diff options
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/World/item_scripts.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 2a1ff2d6e14..2510e18edc1 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -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(); } |
