aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-12-30 15:38:33 -0300
committerariel- <ariel-@users.noreply.github.com>2016-12-30 15:38:33 -0300
commit07fb65a6f2ae490bd74a53c945b4eb166c2ec953 (patch)
treece808e56f12461f937691b72a05f3b927071b7a6 /src
parenta20fda9b2d63e777a49d15976d7a51cc932b40f0 (diff)
Core/Player: fix some PCT_MOD charge consumption
By xinef1 Closes #18516
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp8
-rw-r--r--src/server/game/Entities/Player/Player.h19
2 files changed, 22 insertions, 5 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index a827ed46edf..32b026da160 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -20901,6 +20901,14 @@ void Player::RestoreAllSpellMods(uint32 ownerAuraId /*= 0*/, Aura* aura /*= null
RestoreSpellMods(spell, ownerAuraId, aura);
}
+bool Player::HasSpellModApplied(SpellModifier* mod, Spell* spell)
+{
+ if (!spell)
+ return false;
+
+ return spell->m_appliedMods.count(mod->ownerAura) != 0;
+}
+
void Player::ApplyModToSpell(SpellModifier* mod, Spell* spell)
{
if (!spell)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index dcaa2199496..51bfb112b93 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1610,6 +1610,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = nullptr);
void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = nullptr);
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);
@@ -2634,7 +2635,7 @@ void Player::ApplySpellMod(uint32 spellId, T& basevalue, Spell* spell /*= nullpt
case SPELLMOD_CASTING_TIME:
{
SpellModifier* modInstantSpell = nullptr;
- for (SpellModifier* mod : m_spellMods[SPELLMOD_CASTING_TIME])
+ for (SpellModifier* mod : m_spellMods[op])
{
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
continue;
@@ -2658,7 +2659,7 @@ void Player::ApplySpellMod(uint32 spellId, T& basevalue, Spell* spell /*= nullpt
case SPELLMOD_CRITICAL_CHANCE:
{
SpellModifier* modCritical = nullptr;
- for (SpellModifier* mod : m_spellMods[SPELLMOD_CRITICAL_CHANCE])
+ for (SpellModifier* mod : m_spellMods[op])
{
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
continue;
@@ -2694,14 +2695,22 @@ void Player::ApplySpellMod(uint32 spellId, T& basevalue, Spell* spell /*= nullpt
break;
case SPELLMOD_PCT:
{
- // skip percent mods for null basevalue (most important for spell mods with charges)
+ // skip percent mods with null basevalue (most important for spell mods with charges)
if (basevalue == T(0))
continue;
// special case (skip > 10sec spell casts for instant cast setting)
- if (op == SPELLMOD_CASTING_TIME)
+ if (op == SPELLMOD_CASTING_TIME && mod->value <= -100 && basevalue >= T(10000))
+ continue;
+ else if (!Player::HasSpellModApplied(mod, spell))
{
- if (mod->value <= -100 && basevalue >= T(10000))
+ // special case for Surge of Light, don't apply critical chance reduction if other mods not applied (ie procs while casting another spell)
+ // (Surge of Light is the only PCT_MOD on critical chance)
+ if (op == SPELLMOD_CRITICAL_CHANCE)
+ continue;
+ // special case for Backdraft, dont' apply GCD reduction if cast time reduction wasn't applied (ie when Backlash is consumed first)
+ // (Backdraft is the only PCT_MOD on global cooldown)
+ else if (op == SPELLMOD_GLOBAL_COOLDOWN)
continue;
}