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

Port From (https://github.com/TrinityCore/TrinityCore/commit/5f70be050f971ee70da8953c4f094cb2adc233f8)
This commit is contained in:
hondacrx
2019-08-31 11:12:07 -04:00
parent f7f2930ac8
commit 9ef63a86cf
4 changed files with 46 additions and 1 deletions
+23
View File
@@ -360,4 +360,27 @@ namespace Scripts.World
return true;
}
}
// Only used currently for
[Script]// 19169: Nightfall
class item_generic_limit_chance_above_60 : ItemScript
{
public item_generic_limit_chance_above_60() : base("item_generic_limit_chance_above_60") { }
public override bool OnCastItemCombatSpell(Player player, Unit victim, SpellInfo spellInfo, Item item)
{
// spell proc chance gets severely reduced on victims > 60 (formula unknown)
if (victim.getLevel() > 60)
{
// gives ~0.1% proc chance at lvl 70
float lvlPenaltyFactor = 9.93f;
float failureChance = (victim.GetLevelForTarget(player) - 60) * lvlPenaltyFactor;
// base ppm chance was already rolled, only roll success chance
return !RandomHelper.randChance(failureChance);
}
return true;
}
}
}