diff options
Diffstat (limited to 'src')
21 files changed, 294 insertions, 255 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 123c3403ec0..af4fcb052d6 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -253,12 +253,12 @@ uint32 HealInfo::GetHitMask() const return _hitMask; } -ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, +ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo) : - _actor(actor), _actionTarget(actionTarget), _procTarget(procTarget), + _actor(actor), _actionTarget(actionTarget), _typeMask(typeMask), _spellTypeMask(spellTypeMask), _spellPhaseMask(spellPhaseMask), _hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo) @@ -10179,7 +10179,7 @@ void Unit::GetProcAurasTriggeredOnEvent(AuraApplicationProcContainer& aurasTrigg void Unit::TriggerAurasProcOnEvent(Unit* actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo) { // prepare data for self trigger - ProcEventInfo myProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); + ProcEventInfo myProcEventInfo(this, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); if (typeMaskActor) { AuraApplicationProcContainer myAurasTriggeringProc; @@ -10203,7 +10203,7 @@ void Unit::TriggerAurasProcOnEvent(Unit* actionTarget, uint32 typeMaskActor, uin } // prepare data for target trigger - ProcEventInfo targetProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); + ProcEventInfo targetProcEventInfo(this, actionTarget, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo); if (typeMaskActionTarget && actionTarget) { AuraApplicationProcContainer targetAurasTriggeringProc; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index a0b232460d9..8bd1618ada0 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -501,13 +501,12 @@ class TC_GAME_API HealInfo class TC_GAME_API ProcEventInfo { public: - ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask, + ProcEventInfo(Unit* actor, Unit* actionTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo); Unit* GetActor() { return _actor; } Unit* GetActionTarget() const { return _actionTarget; } - Unit* GetProcTarget() const { return _procTarget; } uint32 GetTypeMask() const { return _typeMask; } uint32 GetSpellTypeMask() const { return _spellTypeMask; } @@ -525,7 +524,6 @@ class TC_GAME_API ProcEventInfo private: Unit* const _actor; Unit* const _actionTarget; - Unit* const _procTarget; uint32 _typeMask; uint32 _spellTypeMask; uint32 _spellPhaseMask; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1346f8682ae..bc6d3677094 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5615,7 +5615,7 @@ void AuraEffect::HandleBreakableCCAuraProc(AuraApplication* aurApp, ProcEventInf void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) { Unit* triggerCaster = aurApp->GetTarget(); - Unit* triggerTarget = eventInfo.GetProcTarget(); + Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor(); uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell; if (triggerSpellId == 0) @@ -5636,7 +5636,7 @@ void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEve void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) { Unit* triggerCaster = aurApp->GetTarget(); - Unit* triggerTarget = eventInfo.GetProcTarget(); + Unit* triggerTarget = triggerCaster == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor(); uint32 triggerSpellId = GetSpellEffectInfo().TriggerSpell; if (triggerSpellId == 0) @@ -5662,7 +5662,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv return; Unit* target = aurApp->GetTarget(); - Unit* triggerTarget = eventInfo.GetProcTarget(); + Unit* triggerTarget = target == eventInfo.GetActor() ? eventInfo.GetActionTarget() : eventInfo.GetActor(); if (triggerTarget->HasUnitState(UNIT_STATE_ISOLATED) || triggerTarget->IsImmunedToDamage(GetSpellInfo())) { SendTickImmune(triggerTarget, target); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 209dd71150b..04ddea79fe6 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1101,7 +1101,7 @@ class spell_deathbringer_blood_beast_blood_link : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetProcTarget()->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(aurEff).AddSpellBP0(3)); + eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_BLOOD_LINK_DUMMY, CastSpellExtraArgs(aurEff).AddSpellBP0(3)); } void Register() override diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp index daba4bfc3db..258736a4aa4 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp @@ -112,7 +112,7 @@ class spell_koralon_meteor_fists : public AuraScript void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_METEOR_FISTS_DAMAGE, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_METEOR_FISTS_DAMAGE, aurEff); } void Register() override @@ -168,7 +168,7 @@ class spell_flame_warder_meteor_fists : public AuraScript void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_FW_METEOR_FISTS_DAMAGE, aurEff); } void Register() override diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 952fa800a05..60812545908 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -1952,8 +1952,8 @@ class spell_illidan_parasitic_shadowfiend_proc : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - Unit* target = eventInfo.GetProcTarget(); - return target && !target->HasAura(SPELL_PARASITIC_SHADOWFIEND) && !target->HasAura(SPELL_PARASITIC_SHADOWFIEND_2); + Unit* target = eventInfo.GetActionTarget(); + return !target->HasAura(SPELL_PARASITIC_SHADOWFIEND) && !target->HasAura(SPELL_PARASITIC_SHADOWFIEND_2); } void Register() override diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp index 3cd67e7970d..3cfdb5853a5 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp @@ -839,7 +839,7 @@ class spell_ahune_spanky_hands : public AuraScript void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_COLD_SLAP, true); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_COLD_SLAP, true); } void Register() override diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index b8bb69fe226..e0d66e3629f 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -202,7 +202,7 @@ class spell_pet_gen_lich_pet_aura : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return (eventInfo.GetProcTarget()->GetTypeId() == TYPEID_PLAYER); + return eventInfo.GetActionTarget()->IsPlayer(); } void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp index 9894e948252..51a9a14f3b0 100644 --- a/src/server/scripts/Pet/pet_hunter.cpp +++ b/src/server/scripts/Pet/pet_hunter.cpp @@ -205,7 +205,7 @@ class spell_pet_guard_dog : public AuraScript Unit* caster = eventInfo.GetActor(); caster->CastSpell(nullptr, SPELL_PET_GUARD_DOG_HAPPINESS, aurEff); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); if (!target->CanHaveThreatList()) return; float addThreat = CalculatePct(ASSERT_NOTNULL(eventInfo.GetSpellInfo())->GetEffect(EFFECT_0).CalcValue(caster), aurEff->GetAmount()); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 71eb6b58fe1..a3f06959d5b 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -981,7 +981,7 @@ class spell_dk_glyph_of_scourge_strike : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DK_GLYPH_OF_SCOURGE_STRIKE_SCRIPT, aurEff); } void Register() override @@ -1344,7 +1344,7 @@ class spell_dk_mark_of_blood : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_MARK_OF_BLOOD_HEAL, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DK_MARK_OF_BLOOD_HEAL, aurEff); } void Register() override @@ -1363,21 +1363,24 @@ class spell_dk_necrosis : public AuraScript return ValidateSpellInfo({ SPELL_DK_NECROSIS_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(damageInfo->GetDamage(), aurEff->GetAmount())); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DK_NECROSIS_DAMAGE, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DK_NECROSIS_DAMAGE, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dk_necrosis::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dk_necrosis::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1889,7 +1892,7 @@ class spell_dk_sudden_doom : public AuraScript if (!spellId) return; - caster->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + caster->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -1956,7 +1959,7 @@ class spell_dk_threat_of_thassarian : public AuraScript return; spellId = sSpellMgr->GetSpellWithRank(spellId, spellInfo->GetRank()); - caster->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + caster->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -1979,19 +1982,21 @@ class spell_dk_unholy_blight : public AuraScript }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DK_UNHOLY_BLIGHT_DAMAGE); - int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); if (AuraEffect const* glyph = caster->GetAuraEffect(SPELL_DK_GLYPH_OF_UNHOLY_BLIGHT, EFFECT_0, caster->GetGUID())) AddPct(amount, glyph->GetAmount()); @@ -2005,6 +2010,7 @@ class spell_dk_unholy_blight : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dk_unholy_blight::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dk_unholy_blight::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -2060,19 +2066,22 @@ class spell_dk_wandering_plague : public AuraScript return ValidateSpellInfo({ SPELL_DK_WANDERING_PLAGUE_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + if (!roll_chance_f(eventInfo.GetActor()->GetUnitCriticalChanceAgainst(BASE_ATTACK, eventInfo.GetActionTarget()))) + return false; + + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); - if (!roll_chance_f(caster->GetUnitCriticalChanceAgainst(BASE_ATTACK, target))) - return; - - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; + Unit* target = eventInfo.GetActionTarget(); - int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); caster->CastSpell(target, SPELL_DK_WANDERING_PLAGUE_DAMAGE, args); @@ -2080,6 +2089,7 @@ class spell_dk_wandering_plague : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dk_wandering_plague::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dk_wandering_plague::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 9efa58725a9..f10de91b481 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -536,13 +536,13 @@ class spell_dru_glyph_of_rake : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget()->GetTypeId() == TYPEID_UNIT; + return eventInfo.GetActionTarget()->IsCreature(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_GLYPH_OF_RAKE_TRIGGERED, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_GLYPH_OF_RAKE_TRIGGERED, aurEff); } void Register() override @@ -564,19 +564,20 @@ class spell_dru_glyph_of_rejuvenation : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget()->HealthBelowPct(50); + if (!eventInfo.GetActionTarget()->HealthBelowPct(50)) + return false; + + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount())); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_GLYPH_OF_REJUVENATION_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_GLYPH_OF_REJUVENATION_HEAL, args); } void Register() override @@ -606,7 +607,7 @@ class spell_dru_glyph_of_shred : public AuraScript Unit* caster = eventInfo.GetActor(); // try to find spell Rip on the target - if (AuraEffect const* rip = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, caster->GetGUID())) + if (AuraEffect const* rip = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, caster->GetGUID())) { // Rip's max duration, note: spells which modifies Rip's duration also counted like Glyph of Rip uint32 countMin = rip->GetBase()->GetMaxDuration(); @@ -689,7 +690,7 @@ class spell_dru_glyph_of_starfire_dummy : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_GLYPH_OF_STARFIRE_SCRIPT, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_GLYPH_OF_STARFIRE_SCRIPT, aurEff); } void Register() override @@ -886,21 +887,24 @@ class spell_dru_living_seed : public AuraScript return ValidateSpellInfo({ SPELL_DRUID_LIVING_SEED_PROC }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount())); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_LIVING_SEED_PROC, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount())); + GetTarget()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_LIVING_SEED_PROC, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_dru_living_seed::CheckProc); OnEffectProc += AuraEffectProcFn(spell_dru_living_seed::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1157,7 +1161,7 @@ class spell_dru_revitalize : public AuraScript if (!roll_chance_i(aurEff->GetAmount())) return; - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); uint32 spellId; switch (target->GetPowerType()) @@ -1483,7 +1487,7 @@ class spell_dru_t3_2p_bonus : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); uint32 spellId; switch (target->GetPowerType()) @@ -1524,7 +1528,7 @@ class spell_dru_t3_6p_bonus : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_DRUID_BLESSING_OF_THE_CLAW, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_DRUID_BLESSING_OF_THE_CLAW, aurEff); } void Register() override @@ -1721,7 +1725,7 @@ class spell_dru_t10_balance_4p_bonus : public AuraScript return; Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_DRUID_LANGUISH); int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); @@ -1807,7 +1811,7 @@ class spell_dru_t10_restoration_4p_bonus_dummy : public AuraScript if (!caster) return false; - return caster->GetGroup() || caster != eventInfo.GetProcTarget(); + return caster->GetGroup() || caster != eventInfo.GetActionTarget(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index f9a30113a37..8edb09cc60a 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1509,7 +1509,7 @@ class spell_ethereal_pet_aura : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - uint32 levelDiff = std::abs(GetTarget()->GetLevel() - eventInfo.GetProcTarget()->GetLevel()); + uint32 levelDiff = std::abs(eventInfo.GetActor()->GetLevel() - eventInfo.GetActionTarget()->GetLevel()); return levelDiff <= 9; } @@ -1524,7 +1524,7 @@ class spell_ethereal_pet_aura : public AuraScript if (minion->IsAIEnabled()) { minion->AI()->Talk(SAY_STEAL_ESSENCE); - minion->CastSpell(eventInfo.GetProcTarget(), SPELL_STEAL_ESSENCE_VISUAL); + minion->CastSpell(eventInfo.GetActionTarget(), SPELL_STEAL_ESSENCE_VISUAL); } } } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 09b314d7ffd..623822f112c 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -357,7 +357,7 @@ class spell_hun_glyph_of_arcane_shot : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - if (Unit* procTarget = eventInfo.GetProcTarget()) + if (Unit* procTarget = eventInfo.GetActionTarget()) { Unit::AuraApplicationMap const& auras = procTarget->GetAppliedAuras(); for (Unit::AuraApplicationMap::const_iterator i = auras.begin(); i != auras.end(); ++i) @@ -381,13 +381,13 @@ class spell_hun_glyph_of_arcane_shot : public AuraScript if (!procSpell) return; - int32 mana = procSpell->CalcPowerCost(GetTarget(), procSpell->GetSchoolMask()); + int32 mana = procSpell->CalcPowerCost(eventInfo.GetActor(), procSpell->GetSchoolMask()); ApplyPct(mana, aurEff->GetAmount()); // castspell refactor note: this is not triggered - is this intended? CastSpellExtraArgs args; args.AddSpellBP0(mana); - GetTarget()->CastSpell(GetTarget(), SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_HUNTER_GLYPH_OF_ARCANE_SHOT, args); } void Register() override @@ -410,7 +410,7 @@ class spell_hun_glyph_of_mend_pet : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetProcTarget()->CastSpell(nullptr, SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS, aurEff); + eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS, aurEff); } void Register() override @@ -1240,7 +1240,7 @@ class spell_hun_thrill_of_the_hunt : public AuraScript // Explosive Shot if (spellInfo->SpellFamilyFlags[2] & 0x200) { - if (AuraEffect const* explosiveShot = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x00000000, 0x80000000, 0x00000000, caster->GetGUID())) + if (AuraEffect const* explosiveShot = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x00000000, 0x80000000, 0x00000000, caster->GetGUID())) { // due to Lock and Load SpellInfo::CalcPowerCost might return 0, so just calculate it manually amount = CalculatePct(static_cast<int32>(CalculatePct(caster->GetCreateMana(), explosiveShot->GetSpellInfo()->ManaCostPercentage)), aurEff->GetAmount()); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 1bdeed4655f..b57a3f4b262 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -249,7 +249,7 @@ class spell_item_anger_capacitor : public SpellScriptLoader { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); caster->CastSpell(nullptr, SPELL_MOTE_OF_ANGER, true); Aura const* motes = caster->GetAura(SPELL_MOTE_OF_ANGER); @@ -450,19 +450,16 @@ class spell_item_blessing_of_ancient_kings : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget() != nullptr; + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - - int32 absorb = int32(CalculatePct(healInfo->GetHeal(), 15.0f)); - if (AuraEffect* protEff = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, 0, eventInfo.GetActor()->GetGUID())) + int32 absorb = int32(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15.0f)); + if (AuraEffect* protEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_PROTECTION_OF_ANCIENT_KINGS, 0, eventInfo.GetActor()->GetGUID())) { // The shield can grow to a maximum size of 20,000 damage absorbtion protEff->SetAmount(std::min<int32>(protEff->GetAmount() + absorb, 20000)); @@ -474,7 +471,7 @@ class spell_item_blessing_of_ancient_kings : public AuraScript { CastSpellExtraArgs args(aurEff); args.AddSpellBP0(absorb); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PROTECTION_OF_ANCIENT_KINGS, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PROTECTION_OF_ANCIENT_KINGS, args); } } @@ -1596,19 +1593,20 @@ class spell_item_necrotic_touch : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + if (!eventInfo.GetActionTarget()->IsAlive()) + return false; + + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(damageInfo->GetDamage(), aurEff->GetAmount())); - GetTarget()->CastSpell(nullptr, SPELL_ITEM_NECROTIC_TOUCH_PROC, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_ITEM_NECROTIC_TOUCH_PROC, args); } void Register() override @@ -1751,7 +1749,7 @@ class spell_item_persistent_shield : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); int32 bp0 = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 15); // Scarab Brooch does not replace stronger shields @@ -2235,22 +2233,21 @@ class spell_item_shadowmourne : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - if (GetTarget()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) // cant collect shards while under effect of Chaos Bane buff - return false; - return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + // cant collect shards while under effect of Chaos Bane buff + return !eventInfo.GetActor()->HasAura(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF) && eventInfo.GetActionTarget()->IsAlive(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_SHADOWMOURNE_SOUL_FRAGMENT, aurEff); // this can't be handled in AuraScript of SoulFragments because we need to know victim if (Aura* soulFragments = GetTarget()->GetAura(SPELL_SHADOWMOURNE_SOUL_FRAGMENT)) { if (soulFragments->GetStackAmount() >= 10) { - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_SHADOWMOURNE_CHAOS_BANE_DAMAGE, aurEff); soulFragments->Remove(); } } @@ -3439,7 +3436,7 @@ class spell_item_shard_of_the_scale : public SpellScriptLoader { PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) caster->CastSpell(target, HealProc, aurEff); @@ -3563,16 +3560,14 @@ class spell_item_sunwell_neck : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - if (eventInfo.GetActor()->GetTypeId() != TYPEID_PLAYER) - return false; - return true; + return eventInfo.GetActor()->GetTypeId() == TYPEID_PLAYER; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); Player* player = eventInfo.GetActor()->ToPlayer(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); // Aggression checks are in the spell system... just cast and forget if (player->GetReputationRank(FACTION_ALDOR) == REP_EXALTED) diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 545dc8d08d1..3e75600ac92 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -393,7 +393,7 @@ class spell_mage_imp_blizzard : public AuraScript { PreventDefaultAction(); uint32 triggerSpellId = sSpellMgr->GetSpellWithRank(SPELL_MAGE_CHILLED, GetSpellInfo()->GetRank()); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), triggerSpellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), triggerSpellId, aurEff); } void Register() override @@ -627,7 +627,7 @@ class spell_mage_gen_extra_effects : public AuraScript { Unit* caster = eventInfo.GetActor(); // Prevent double proc for Arcane missiles - if (caster == eventInfo.GetProcTarget()) + if (caster == eventInfo.GetActionTarget()) return false; // Proc chance is unknown, we'll just use dummy aura amount @@ -661,7 +661,7 @@ class spell_mage_glyph_of_polymorph : public AuraScript void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed. target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH); @@ -841,7 +841,8 @@ class spell_mage_ignite : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetDamageInfo() && eventInfo.GetProcTarget(); + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -856,7 +857,7 @@ class spell_mage_ignite : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_MAGE_IGNITE, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_MAGE_IGNITE, args); } void Register() override @@ -1061,7 +1062,7 @@ class spell_mage_missile_barrage_proc : public AuraScript { Unit* caster = eventInfo.GetActor(); // Prevent double proc for Arcane missiles - if (caster == eventInfo.GetProcTarget()) + if (caster == eventInfo.GetActionTarget()) return false; // Proc chance is unknown, we'll just use dummy aura amount diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 5f7f1303ca2..d4ca85d086a 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -431,17 +431,20 @@ class spell_pal_divine_purpose : public AuraScript { PrepareAuraScript(spell_pal_divine_purpose); - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { - PreventDefaultAction(); - if (!roll_chance_i(aurEff->GetAmount())) - return; + return roll_chance_i(aurEff->GetAmount()); + } - eventInfo.GetProcTarget()->RemoveAurasWithMechanic(1 << MECHANIC_STUN, AURA_REMOVE_BY_ENEMY_SPELL); + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + eventInfo.GetActionTarget()->RemoveAurasWithMechanic(1 << MECHANIC_STUN, AURA_REMOVE_BY_ENEMY_SPELL); } void Register() override { + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pal_divine_purpose::CheckProc, EFFECT_2, SPELL_AURA_DUMMY); OnEffectProc += AuraEffectProcFn(spell_pal_divine_purpose::HandleProc, EFFECT_2, SPELL_AURA_DUMMY); } }; @@ -599,22 +602,26 @@ class spell_pal_eye_for_an_eye : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; // return damage % to attacker but < 50% own total health - int32 damage = std::min(CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()), static_cast<int32>(GetTarget()->GetMaxHealth()) / 2); + int32 damage = std::min(CalculatePct(static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()), static_cast<int32>(eventInfo.GetActionTarget()->GetMaxHealth()) / 2); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(damage); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE, args); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_PALADIN_EYE_FOR_AN_EYE_DAMAGE, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_eye_for_an_eye::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_eye_for_an_eye::OnProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -637,7 +644,7 @@ class spell_pal_glyph_of_divinity : public AuraScript return; Unit* caster = eventInfo.GetActor(); - if (caster == eventInfo.GetProcTarget()) + if (caster == eventInfo.GetActionTarget()) return; CastSpellExtraArgs args(aurEff); @@ -684,12 +691,17 @@ class spell_pal_glyph_of_holy_light_dummy : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); + HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; uint32 basePoints = healInfo->GetSpellInfo()->GetEffect(EFFECT_0).BasePoints + healInfo->GetSpellInfo()->GetEffect(EFFECT_0).DieSides; uint32 healAmount; @@ -700,11 +712,12 @@ class spell_pal_glyph_of_holy_light_dummy : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(CalculatePct(healAmount, aurEff->GetAmount())); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PALADIN_GLYPH_OF_HOLY_LIGHT_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_glyph_of_holy_light_dummy::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_glyph_of_holy_light_dummy::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -803,7 +816,7 @@ class spell_pal_heart_of_the_crusader : public AuraScript PreventDefaultAction(); uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_PALADIN_HEART_OF_THE_CRUSADER_EFF_R1, GetSpellInfo()->GetRank()); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -1140,39 +1153,47 @@ class spell_pal_item_t6_trinket : public AuraScript }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); if (!spellInfo) - return; - - uint32 spellId; - int32 chance; + return false; // Holy Light & Flash of Light if (spellInfo->SpellFamilyFlags[0] & 0xC0000000) { - spellId = SPELL_PALADIN_ENDURING_LIGHT; - chance = 15; + if (!roll_chance_i(15)) + return false; + + _triggeredSpellId = SPELL_PALADIN_ENDURING_LIGHT; + return true; } // Judgements else if (spellInfo->SpellFamilyFlags[0] & 0x00800000) { - spellId = SPELL_PALADIN_ENDURING_JUDGEMENT; - chance = 50; + if (!roll_chance_i(50)) + return false; + + _triggeredSpellId = SPELL_PALADIN_ENDURING_JUDGEMENT; + return true; } - else - return; - if (roll_chance_i(chance)) - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + return false; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), _triggeredSpellId, aurEff); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_item_t6_trinket::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_item_t6_trinket::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } + + uint32 _triggeredSpellId = 0; }; // 53407 - Judgement of Justice @@ -1256,7 +1277,7 @@ class spell_pal_judgement_of_light_heal : public AuraScript { PreventDefaultAction(); - Unit* caster = eventInfo.GetProcTarget(); + Unit* caster = eventInfo.GetActor(); CastSpellExtraArgs args(aurEff); args.OriginalCaster = GetCasterGUID(); @@ -1282,7 +1303,7 @@ class spell_pal_judgement_of_wisdom_mana : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget()->GetPowerType() == POWER_MANA; + return eventInfo.GetActor()->GetPowerType() == POWER_MANA; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -1291,7 +1312,7 @@ class spell_pal_judgement_of_wisdom_mana : public AuraScript SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA); - Unit* caster = eventInfo.GetProcTarget(); + Unit* caster = eventInfo.GetActor(); int32 const amount = CalculatePct(static_cast<int32>(caster->GetCreateMana()), spellInfo->GetEffect(EFFECT_0).CalcValue()); CastSpellExtraArgs args(aurEff); args.OriginalCaster = GetCasterGUID(); @@ -1517,19 +1538,21 @@ class spell_pal_righteous_vengeance : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + return damageInfo && damageInfo->GetDamage(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - DamageInfo* damageInfo = eventInfo.GetDamageInfo(); - if (!damageInfo || !damageInfo->GetDamage()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_RIGHTEOUS_VENGEANCE_DAMAGE); - int32 amount = CalculatePct(static_cast<int32>(damageInfo->GetDamage()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast<int32>(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); @@ -1541,6 +1564,7 @@ class spell_pal_righteous_vengeance : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_righteous_vengeance::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_righteous_vengeance::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1637,16 +1661,11 @@ class spell_pal_seal_of_righteousness : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS }); } - bool CheckProc(ProcEventInfo& eventInfo) - { - return eventInfo.GetProcTarget() != nullptr; - } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - Unit* victim = eventInfo.GetProcTarget(); + Unit* victim = eventInfo.GetActionTarget(); float ap = GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK); ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS); @@ -1660,12 +1679,11 @@ class spell_pal_seal_of_righteousness : public AuraScript int32 bp = std::lroundf(mws * (0.022f * ap + 0.044f * sph)); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp); - GetTarget()->CastSpell(victim, SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args); + eventInfo.GetActor()->CastSpell(victim, SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, args); } void Register() override { - DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_righteousness::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_righteousness::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1722,7 +1740,7 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader } // don't cast triggered, spell already has SPELL_ATTR4_CAN_CAST_WHILE_CASTING attr - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), DoTSpell, CastSpellExtraArgs(TRIGGERED_DONT_RESET_PERIODIC_TIMER).SetTriggeringAura(aurEff)); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), DoTSpell, CastSpellExtraArgs(TRIGGERED_DONT_RESET_PERIODIC_TIMER).SetTriggeringAura(aurEff)); } void HandleSeal(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -1730,7 +1748,7 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); // get current aura on target, if any AuraEffect const* sealDot = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PALADIN, 0x00000000, 0x00000800, 0x00000000, caster->GetGUID()); @@ -1804,7 +1822,7 @@ class spell_pal_spiritual_attunement : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { // "when healed by other friendly targets' spells" - if (eventInfo.GetProcTarget() == eventInfo.GetActionTarget()) + if (eventInfo.GetActor() == eventInfo.GetActionTarget()) return false; return eventInfo.GetHealInfo() && eventInfo.GetHealInfo()->GetEffectiveHeal(); @@ -1838,19 +1856,21 @@ class spell_pal_sheath_of_light : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetEffectiveHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetEffectiveHeal()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_SHEATH_OF_LIGHT_HEAL); - int32 amount = CalculatePct(static_cast<int32>(healInfo->GetEffectiveHeal()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast<int32>(eventInfo.GetHealInfo()->GetEffectiveHeal()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); @@ -1862,6 +1882,7 @@ class spell_pal_sheath_of_light : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_sheath_of_light::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_sheath_of_light::HandleProc, EFFECT_1, SPELL_AURA_DUMMY); } }; @@ -1888,7 +1909,7 @@ class spell_pal_t3_6p_bonus : public AuraScript uint32 spellId; Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); switch (target->GetClass()) { @@ -1932,19 +1953,21 @@ class spell_pal_t8_2p_bonus : public AuraScript return ValidateSpellInfo({ SPELL_PALADIN_HOLY_MENDING }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_HOLY_MENDING); - int32 amount = CalculatePct(static_cast<int32>(healInfo->GetHeal()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast<int32>(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); @@ -1956,6 +1979,7 @@ class spell_pal_t8_2p_bonus : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pal_t8_2p_bonus::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pal_t8_2p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index ba55c1cbc7a..781bbe1cda7 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -154,24 +154,27 @@ class spell_pri_aq_3p_bonus : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_ORACULAR_HEAL }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - if (caster == eventInfo.GetProcTarget()) - return; + if (eventInfo.GetActor() == eventInfo.GetActionTarget()) + return false; HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + return healInfo && healInfo->GetHeal(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), 10)); - caster->CastSpell(caster, SPELL_PRIEST_ORACULAR_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), 10)); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_PRIEST_ORACULAR_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_aq_3p_bonus::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_aq_3p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -227,37 +230,35 @@ class spell_pri_body_and_soul : public AuraScript }); } - void HandleProcTriggerSpell(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + bool CheckProcTriggerSpell(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { // Proc only on Power Word: Shield SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo || !(spellInfo->SpellFamilyFlags[0] & 0x00000001)) - { - PreventDefaultAction(); - return; - } + return spellInfo && (spellInfo->SpellFamilyFlags[0] & 0x00000001) != 0; } - void HandleProcDummy(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProcDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) { - PreventDefaultAction(); - // Proc only on self casted abolish disease + if (eventInfo.GetActor() != eventInfo.GetActionTarget()) + return false; + SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo) - return; + return spellInfo && spellInfo->Id == SPELL_PRIEST_ABOLISH_DISEASE; + } - Unit* caster = eventInfo.GetActor(); - if (spellInfo->Id != SPELL_PRIEST_ABOLISH_DISEASE || caster != eventInfo.GetProcTarget()) - return; + void HandleProcDummy(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); if (roll_chance_i(aurEff->GetAmount())) - caster->CastSpell(caster, SPELL_PRIEST_BODY_AND_SOUL_POISON_TRIGGER, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_PRIEST_BODY_AND_SOUL_POISON_TRIGGER, aurEff); } void Register() override { - OnEffectProc += AuraEffectProcFn(spell_pri_body_and_soul::HandleProcTriggerSpell, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pri_body_and_soul::CheckProcTriggerSpell, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + DoCheckEffectProc += AuraCheckEffectProcFn(spell_pri_body_and_soul::CheckProcDummy, EFFECT_1, SPELL_AURA_DUMMY); OnEffectProc += AuraEffectProcFn(spell_pri_body_and_soul::HandleProcDummy, EFFECT_1, SPELL_AURA_DUMMY); } }; @@ -303,28 +304,25 @@ class spell_pri_divine_aegis : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetProcTarget() != nullptr; + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - - int32 absorb = CalculatePct(healInfo->GetHeal(), aurEff->GetAmount()); + int32 absorb = CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount()); // Multiple effects stack, so let's try to find this aura. - if (AuraEffect const* aegis = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_PRIEST_DIVINE_AEGIS, EFFECT_0)) + if (AuraEffect const* aegis = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_PRIEST_DIVINE_AEGIS, EFFECT_0)) absorb += aegis->GetAmount(); - absorb = std::min(absorb, eventInfo.GetProcTarget()->GetLevel() * 125); + absorb = std::min(absorb, eventInfo.GetActionTarget()->GetLevel() * 125); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(absorb); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_DIVINE_AEGIS, args); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PRIEST_DIVINE_AEGIS, args); } void Register() override @@ -368,15 +366,18 @@ class spell_pri_glyph_of_dispel_magic : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_DISPEL_MAGIC_HEAL }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); // Dispel Magic shares spellfamilyflag with abolish disease SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo || spellInfo->SpellIconID != 74) - return; + return spellInfo && spellInfo->SpellIconID == 74; + } - Unit* target = eventInfo.GetProcTarget(); + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(target->CountPctFromMaxHealth(aurEff->GetAmount())); @@ -385,6 +386,7 @@ class spell_pri_glyph_of_dispel_magic : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_glyph_of_dispel_magic::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_glyph_of_dispel_magic::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -399,24 +401,27 @@ class spell_pri_glyph_of_prayer_of_healing : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - SpellInfo const* triggeredSpellInfo = sSpellMgr->AssertSpellInfo(SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL); ASSERT(triggeredSpellInfo->GetMaxTicks() > 0); CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks()); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount()) / triggeredSpellInfo->GetMaxTicks()); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_glyph_of_prayer_of_healing::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_glyph_of_prayer_of_healing::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -1193,7 +1198,7 @@ class spell_pri_t3_4p_bonus : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_PRIEST_ARMOR_OF_FAITH, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_PRIEST_ARMOR_OF_FAITH, aurEff); } void Register() override @@ -1246,22 +1251,24 @@ class spell_pri_t10_heal_2p_bonus : public AuraScript return ValidateSpellInfo({ SPELL_PRIEST_BLESSED_HEALING }); } + bool CheckProc(ProcEventInfo& eventInfo) + { + HealInfo* healInfo = eventInfo.GetHealInfo(); + return healInfo && healInfo->GetHeal(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PRIEST_BLESSED_HEALING); - int32 amount = CalculatePct(static_cast<int32>(healInfo->GetHeal()), aurEff->GetAmount()); + int32 amount = CalculatePct(static_cast<int32>(eventInfo.GetHealInfo()->GetHeal()), aurEff->GetAmount()); ASSERT(spellInfo->GetMaxTicks() > 0); amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1270,6 +1277,7 @@ class spell_pri_t10_heal_2p_bonus : public AuraScript void Register() override { + DoCheckProc += AuraCheckProcFn(spell_pri_t10_heal_2p_bonus::CheckProc); OnEffectProc += AuraEffectProcFn(spell_pri_t10_heal_2p_bonus::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 9a60d1816f1..b0b6f4681f5 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -71,7 +71,7 @@ class spell_rog_blade_flurry : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetProcTarget()); + _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetActionTarget()); return _procTarget != nullptr; } @@ -186,7 +186,7 @@ class spell_rog_deadly_brew : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_ROGUE_CRIPPLING_POISON, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_ROGUE_CRIPPLING_POISON, aurEff); } void Register() override @@ -637,7 +637,7 @@ class spell_rog_glyph_of_backstab : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_ROGUE_GLYPH_OF_BACKSTAB_TRIGGER, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_ROGUE_GLYPH_OF_BACKSTAB_TRIGGER, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 74bed44d1d0..16af2ab74b1 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -483,7 +483,7 @@ class spell_sha_earthliving_weapon : public AuraScript int32 chance = 20; Unit* caster = eventInfo.GetActor(); if (AuraEffect const* aurEff = caster->GetAuraEffectOfRankedSpell(SPELL_SHAMAN_BLESSING_OF_THE_ETERNALS_R1, EFFECT_1, caster->GetGUID())) - if (eventInfo.GetProcTarget()->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) + if (eventInfo.GetActionTarget()->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT)) chance += aurEff->GetAmount(); return roll_chance_i(chance); @@ -614,7 +614,7 @@ class spell_sha_flametongue_weapon : public AuraScript PreventDefaultAction(); Player* player = eventInfo.GetActor()->ToPlayer(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); WeaponAttackType attType = BASE_ATTACK; if (eventInfo.GetTypeMask() & PROC_FLAG_DONE_OFFHAND_ATTACK) attType = OFF_ATTACK; @@ -678,7 +678,7 @@ class spell_sha_frozen_power : public AuraScript SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_FREEZE); float minDistance(spellInfo->GetEffect(EFFECT_0).CalcValue(caster)); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); if (caster->GetDistance(target) < minDistance) return; @@ -704,7 +704,7 @@ class spell_sha_glyph_of_earth_shield : public AuraScript if (!earthShield) return; - AuraEffect* earthShieldEffect = eventInfo.GetProcTarget()->GetAuraEffect(earthShield->Id, EFFECT_0, eventInfo.GetActor()->GetGUID()); + AuraEffect* earthShieldEffect = eventInfo.GetActionTarget()->GetAuraEffect(earthShield->Id, EFFECT_0, eventInfo.GetActor()->GetGUID()); if (!earthShieldEffect) return; @@ -729,24 +729,27 @@ class spell_sha_glyph_of_healing_wave : public AuraScript return ValidateSpellInfo({ SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL }); } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + bool CheckProc(ProcEventInfo& eventInfo) { - PreventDefaultAction(); - Unit* caster = eventInfo.GetActor(); - if (caster == eventInfo.GetProcTarget()) - return; + if (eventInfo.GetActor() == eventInfo.GetActionTarget()) + return false; HealInfo* healInfo = eventInfo.GetHealInfo(); - if (!healInfo || !healInfo->GetHeal()) - return; + return healInfo && healInfo->GetHeal(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(healInfo->GetHeal(), aurEff->GetAmount())); - caster->CastSpell(nullptr, SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL, args); + args.AddSpellBP0(CalculatePct(eventInfo.GetHealInfo()->GetHeal(), aurEff->GetAmount())); + eventInfo.GetActor()->CastSpell(nullptr, SPELL_SHAMAN_GLYPH_OF_HEALING_WAVE_HEAL, args); } void Register() override { + DoCheckProc += AuraCheckProcFn(spell_sha_glyph_of_healing_wave::CheckProc); OnEffectProc += AuraEffectProcFn(spell_sha_glyph_of_healing_wave::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -963,7 +966,7 @@ class spell_sha_lightning_overload : public AuraScript spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1, spellInfo->GetRank()); } - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); } void Register() override @@ -985,7 +988,7 @@ class spell_sha_item_lightning_shield : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD, aurEff); } void Register() override @@ -1516,7 +1519,7 @@ class spell_sha_static_shock : public AuraScript return; uint32 spellId = sSpellMgr->GetSpellWithRank(SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1, lightningShield->GetSpellInfo()->GetRank()); - eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), spellId, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), spellId, aurEff); lightningShield->GetBase()->DropCharge(); } @@ -1615,7 +1618,7 @@ class spell_sha_t3_6p_bonus : public AuraScript uint32 spellId; Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); switch (target->GetClass()) { @@ -1694,7 +1697,7 @@ class spell_sha_t8_elemental_4p_bonus : public AuraScript amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1732,7 +1735,7 @@ class spell_sha_t9_elemental_4p_bonus : public AuraScript amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1755,7 +1758,7 @@ class spell_sha_t10_elemental_4p_bonus : public AuraScript PreventDefaultAction(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); // try to find spell Flame Shock on the target AuraEffect* flameShock = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x00000000, 0x00000000, caster->GetGUID()); @@ -1804,7 +1807,7 @@ class spell_sha_t10_restoration_4p_bonus : public AuraScript amount /= spellInfo->GetMaxTicks(); Unit* caster = eventInfo.GetActor(); - Unit* target = eventInfo.GetProcTarget(); + Unit* target = eventInfo.GetActionTarget(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); @@ -1895,7 +1898,7 @@ class spell_sha_windfury_weapon : public AuraScript args.AddSpellBP0(amount); // Attack twice for (uint8 i = 0; i < 2; ++i) - player->CastSpell(eventInfo.GetProcTarget(), spellId, args); + player->CastSpell(eventInfo.GetActionTarget(), spellId, args); } void Register() override diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index e1de6fd68d5..bac0337f9c0 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -449,13 +449,9 @@ class spell_warl_drain_soul : public AuraScript // Drain Soul's proc tries to happen each time the warlock lands a killing blow on a unit while channeling. // Make sure that dying unit is afflicted by the caster's Drain Soul debuff in order to avoid a false positive. - Unit* caster = GetCaster(); - Unit* victim = eventInfo.GetProcTarget(); - - if (caster && victim) - return victim->GetAuraApplicationOfRankedSpell(SPELL_WARLOCK_DRAIN_SOUL_R1, caster->GetGUID()) != 0; - - return false; + Unit* caster = eventInfo.GetActor(); + Unit* victim = eventInfo.GetActionTarget(); + return victim->GetAuraApplicationOfRankedSpell(SPELL_WARLOCK_DRAIN_SOUL_R1, caster->GetGUID()) != 0; } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -621,7 +617,7 @@ class spell_warl_glyph_of_shadowflame : public AuraScript void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME, aurEff); + eventInfo.GetActor()->CastSpell(eventInfo.GetActionTarget(), SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 1ea3ca5206d..d9b4014a7ae 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -196,10 +196,10 @@ class spell_warr_damage_shield : public AuraScript PreventDefaultAction(); // % of amount blocked - int32 damage = CalculatePct(int32(GetTarget()->GetShieldBlockValue()), aurEff->GetAmount()); + int32 damage = CalculatePct(int32(eventInfo.GetActionTarget()->GetShieldBlockValue()), aurEff->GetAmount()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(damage); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE, args); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_WARRIOR_DAMAGE_SHIELD_DAMAGE, args); } void Register() override @@ -282,7 +282,7 @@ class spell_warr_deep_wounds_aura : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(damage); - actor->CastSpell(eventInfo.GetProcTarget(), GetEffectInfo(EFFECT_0).TriggerSpell, args); + actor->CastSpell(eventInfo.GetActionTarget(), GetEffectInfo(EFFECT_0).TriggerSpell, args); } void Register() override @@ -622,13 +622,13 @@ class spell_warr_retaliation : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { // check attack comes not from behind and warrior is not stunned - return GetTarget()->isInFront(eventInfo.GetActor(), float(M_PI)) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED); + return eventInfo.GetActionTarget()->isInFront(eventInfo.GetActor(), float(M_PI)) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED); } void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_RETALIATION_DAMAGE, aurEff); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActor(), SPELL_WARRIOR_RETALIATION_DAMAGE, aurEff); } void Register() override @@ -735,7 +735,7 @@ class spell_warr_sweeping_strikes : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetProcTarget()); + _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetActionTarget()); return _procTarget != nullptr; } |
