diff options
author | ariel- <ariel-@users.noreply.github.com> | 2016-10-09 01:48:48 -0300 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-09-05 12:04:42 +0200 |
commit | f7263b6d4b155fd1bb6ca4ee31a66e747807eae3 (patch) | |
tree | aa0079b81cabd8ac5535f2dc7ffcd93443a80970 | |
parent | b86150352da0b8111b5c4fd52a0a18165d13b5d8 (diff) |
Core/Auras: moved check for CC auras out of proc handler, and fixed its logic
(cherry picked from commit 86903f701540fab062c4d7772c201507fc031c63)
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 72545e45e72..b45c3cb985a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1185,21 +1185,44 @@ bool AuraEffect::CheckEffectProc(AuraApplication* aurApp, ProcEventInfo& eventIn SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); switch (GetAuraType()) { + case SPELL_AURA_MOD_CONFUSE: + case SPELL_AURA_MOD_FEAR: + case SPELL_AURA_MOD_STUN: + case SPELL_AURA_MOD_ROOT: + case SPELL_AURA_TRANSFORM: + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return false; + + // Spell own damage at apply won't break CC + if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) + { + if (spellInfo == GetSpellInfo()) + { + Aura* aura = GetBase(); + // called from spellcast, should not have ticked yet + if (aura->GetDuration() == aura->GetMaxDuration()) + return false; + } + } + break; + } case SPELL_AURA_MECHANIC_IMMUNITY: case SPELL_AURA_MOD_MECHANIC_RESISTANCE: // compare mechanic if (!spellInfo || !(spellInfo->GetAllEffectsMechanicMask() & (1 << GetMiscValue()))) - result = false; + return false; break; case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK: // skip melee hits and instant cast spells if (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->GetCastTime()) - result = false; + return false; break; case SPELL_AURA_MOD_SPELL_DAMAGE_FROM_CASTER: // Compare casters if (GetCasterGUID() != eventInfo.GetActor()->GetGUID()) - result = false; + return false; break; case SPELL_AURA_MOD_POWER_COST_SCHOOL: case SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT: @@ -1207,22 +1230,19 @@ bool AuraEffect::CheckEffectProc(AuraApplication* aurApp, ProcEventInfo& eventIn // Skip melee hits and spells with wrong school or zero cost if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue()) // School Check || !eventInfo.GetProcSpell()) - { - result = false; - break; - } + return false; // Costs Check std::vector<SpellPowerCost> const& costs = eventInfo.GetProcSpell()->GetPowerCost(); auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Amount > 0; }); if (m == costs.end()) - result = false; + return false; break; } case SPELL_AURA_REFLECT_SPELLS_SCHOOL: // Skip melee hits and spells with wrong school if (!spellInfo || !(spellInfo->GetSchoolMask() & GetMiscValue())) - result = false; + return false; break; case SPELL_AURA_PROC_TRIGGER_SPELL: case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE: @@ -1231,7 +1251,7 @@ bool AuraEffect::CheckEffectProc(AuraApplication* aurApp, ProcEventInfo& eventIn uint32 triggerSpellId = GetSpellEffectInfo()->TriggerSpell; if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId)) if (aurApp->GetTarget()->m_extraAttacks && triggeredSpellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS)) - result = false; + return false; break; } default: @@ -6249,23 +6269,12 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con void AuraEffect::HandleBreakableCCAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) { - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo) - return; - - // aura own damage at apply won't break CC - if (eventInfo.GetSpellPhaseMask() & PROC_SPELL_PHASE_CAST) - { - if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo()) - if (spellInfo == GetSpellInfo()) - return; - } + int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage()); - int32 damageLeft = GetAmount(); - if (damageLeft < int32(damageInfo->GetDamage())) + if (damageLeft <= 0) aurApp->GetTarget()->RemoveAura(aurApp); else - ChangeAmount(damageLeft - damageInfo->GetDamage()); + ChangeAmount(damageLeft); } void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) |