aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-02-21 22:37:53 -0300
committerShauren <shauren.trinity@gmail.com>2019-08-17 20:04:14 +0200
commit5f70be050f971ee70da8953c4f094cb2adc233f8 (patch)
treeadd905ef542727f3cd2255e3a68a4e5ea8387f5d /src/server/scripts
parent8e4f5e162707164c7b4ac12f4e2d9267e226e91b (diff)
Core/Scripts: fix Nightfall proc chance and reduce it for victims with level above 60
Closes #15734 (cherrypicked from eac9c1f0b992fd3622fd7dd864b2acc2781ec778)
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/World/item_scripts.cpp25
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();
}