Core/Scripts: fix Nightfall proc chance and reduce it for victims with level above 60

Closes #15734

(cherrypicked from eac9c1f0b9)
This commit is contained in:
ariel-
2017-02-21 22:37:53 -03:00
committed by Shauren
parent 8e4f5e1627
commit 5f70be050f
5 changed files with 45 additions and 1 deletions

View File

@@ -414,6 +414,30 @@ public:
}
};
// Only used currently for
// 19169: Nightfall
class item_generic_limit_chance_above_60 : public ItemScript
{
public:
item_generic_limit_chance_above_60() : ItemScript("item_generic_limit_chance_above_60") { }
bool OnCastItemCombatSpell(Player* player, Unit* victim, SpellInfo const* /*spellInfo*/, Item* /*item*/) override
{
// spell proc chance gets severely reduced on victims > 60 (formula unknown)
if (victim->getLevel() > 60)
{
// gives ~0.1% proc chance at lvl 70
float const lvlPenaltyFactor = 9.93f;
float const failureChance = (victim->GetLevelForTarget(player) - 60) * lvlPenaltyFactor;
// base ppm chance was already rolled, only roll success chance
return !roll_chance_f(failureChance);
}
return true;
}
};
void AddSC_item_scripts()
{
new item_only_for_flight();
@@ -427,4 +451,5 @@ void AddSC_item_scripts()
new item_dehta_trap_smasher();
new item_trident_of_nazjan();
new item_captured_frog();
new item_generic_limit_chance_above_60();
}