Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core/Spells: Remove the unnecessary method ProcEventInfo::GetProcTarget to avoid confusion. #30435

Open
wants to merge 3 commits into
base: 3.3.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,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)
Expand Down Expand Up @@ -10169,7 +10169,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;
Expand All @@ -10193,7 +10193,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;
Expand Down
4 changes: 1 addition & 3 deletions src/server/game/Entities/Unit/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,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; }
Expand All @@ -524,7 +523,6 @@ class TC_GAME_API ProcEventInfo
private:
Unit* const _actor;
Unit* const _actionTarget;
Unit* const _procTarget;
uint32 _typeMask;
uint32 _spellTypeMask;
uint32 _spellPhaseMask;
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Spells/Auras/SpellAuraEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/server/scripts/Pet/pet_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*/)
Expand Down
2 changes: 1 addition & 1 deletion src/server/scripts/Pet/pet_hunter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
58 changes: 34 additions & 24 deletions src/server/scripts/Spells/spell_dk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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());

Expand All @@ -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);
}
};
Expand Down Expand Up @@ -2060,26 +2066,30 @@ 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);
}

void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_dk_wandering_plague::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_dk_wandering_plague::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
Expand Down
Loading