Core/Auras: moved check for CC auras out of proc handler, and fixed its logic

(cherry picked from commit 86903f7015)
This commit is contained in:
ariel-
2016-10-09 01:48:48 -03:00
committed by joschiwald
parent b86150352d
commit f7263b6d4b

View File

@@ -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;
int32 const damageLeft = GetAmount() - static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage());
// 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 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)