aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeader <keader.android@gmail.com>2020-10-19 11:27:02 -0300
committerGitHub <noreply@github.com>2020-10-19 11:27:02 -0300
commit5e9a856ad797087e24eb13999f39016dcd3f770c (patch)
treefb2af33112fd9c56320926d43a045059a66bd8fe /src
parente3af6c04a46965c294007c5633e1aa6ae4ac772f (diff)
Game/Player: Fixed Backlash/Backdraft priority (#25564)
Update #18516
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp19
-rw-r--r--src/server/game/Entities/Player/Player.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 75a671feff6..8f40f044fcc 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -21121,6 +21121,17 @@ void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* s
// special case (skip > 10sec spell casts for instant cast setting)
if (op == SPELLMOD_CASTING_TIME && mod->value <= -100 && basevalue >= T(10000))
return;
+ else if (!Player::HasSpellModApplied(mod, spell))
+ {
+ // Special case for Surge of Light, do not apply critical chance reduction if others mods was not applied (i.e. procs while casting another spell)
+ // (Surge of Light is the only PCT_MOD on critical chance)
+ if (op == SPELLMOD_CRITICAL_CHANCE)
+ return;
+ // Special case for Backdraft: do not apply GCD reduction if cast time reduction was not applied (i.e. when Backlash is consumed first).
+ // (Backdraft is the only PCT_MOD on global cooldown)
+ else if (op == SPELLMOD_GLOBAL_COOLDOWN)
+ return;
+ }
totalmul += CalculatePct(1.0f, mod->value);
break;
@@ -21209,6 +21220,14 @@ void Player::ApplyModToSpell(SpellModifier* mod, Spell* spell)
spell->m_appliedMods.insert(mod->ownerAura);
}
+bool Player::HasSpellModApplied(SpellModifier* mod, Spell* spell)
+{
+ if (!spell)
+ return false;
+
+ return spell->m_appliedMods.count(mod->ownerAura) != 0;
+}
+
void Player::SetSpellModTakingSpell(Spell* spell, bool apply)
{
if (apply && m_spellModTakingSpell != nullptr)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index a802f6ca271..27299679346 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1478,6 +1478,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
template <class T>
void ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell = nullptr) const;
static void ApplyModToSpell(SpellModifier* mod, Spell* spell);
+ static bool HasSpellModApplied(SpellModifier* mod, Spell* spell);
void SetSpellModTakingSpell(Spell* spell, bool apply);
void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false);