[3.3.5] CastSpell unclusterfucking (that's a word now) (#21123)
Core/Spell: The giant CastSpell unclusterfucking (that's a word now) of this generation. - CastSpell now always takes three arguments - target, spellId, and a struct containing extra arguments - This struct (CastSpellExtraArgs, see SpellDefines.h) serves as a conglomerate of every previous combination of the 20 billion different CastSpell overloads, all merged into one - It has some great utility constructors - check them out! All of these can be used to implicitly construct the ExtraArgs object. - A gajillion refactors to make everything behave the way it always has (cherry picked from commit d507a7e3388382960108b24143da48e5f912b4a7)
This commit is contained in:
@@ -138,7 +138,7 @@ class spell_gen_adaptive_warding : public AuraScript
|
||||
default:
|
||||
return;
|
||||
}
|
||||
GetTarget()->CastSpell(GetTarget(), spellId, true, nullptr, aurEff);
|
||||
GetTarget()->CastSpell(GetTarget(), spellId, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -492,7 +492,9 @@ class spell_gen_blood_reserve : public AuraScript
|
||||
PreventDefaultAction();
|
||||
|
||||
Unit* caster = eventInfo.GetActionTarget();
|
||||
caster->CastCustomSpell(SPELL_GEN_BLOOD_RESERVE_HEAL, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), caster, TRIGGERED_FULL_MASK, nullptr, aurEff);
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.SpellValueOverrides.AddBP0(aurEff->GetAmount());
|
||||
caster->CastSpell(caster, SPELL_GEN_BLOOD_RESERVE_HEAL, args);
|
||||
caster->RemoveAura(SPELL_GEN_BLOOD_RESERVE_AURA);
|
||||
}
|
||||
|
||||
@@ -778,7 +780,11 @@ class spell_gen_chaos_blast : public SpellScript
|
||||
int32 basepoints0 = 100;
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, nullptr, nullptr, true);
|
||||
{
|
||||
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
|
||||
args.SpellValueOverrides.AddBP0(basepoints0);
|
||||
caster->CastSpell(target, SPELL_CHAOS_BLAST, args);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1164,7 +1170,7 @@ class spell_gen_defend : public AuraScript
|
||||
for (uint8 i = 0; i < GetSpellInfo()->StackAmount; ++i)
|
||||
target->RemoveAurasDueToSpell(SPELL_VISUAL_SHIELD_1 + i);
|
||||
|
||||
target->CastSpell(target, SPELL_VISUAL_SHIELD_1 + GetAura()->GetStackAmount() - 1, true, nullptr, aurEff);
|
||||
target->CastSpell(target, SPELL_VISUAL_SHIELD_1 + GetAura()->GetStackAmount() - 1, aurEff);
|
||||
}
|
||||
else
|
||||
GetTarget()->RemoveAurasDueToSpell(GetId());
|
||||
@@ -1373,7 +1379,7 @@ class spell_gen_elune_candle : public SpellScript
|
||||
else
|
||||
spellId = SPELL_ELUNE_CANDLE_NORMAL;
|
||||
|
||||
GetCaster()->CastSpell(GetHitUnit(), spellId, true, nullptr);
|
||||
GetCaster()->CastSpell(GetHitUnit(), spellId, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1542,7 +1548,7 @@ class spell_gen_interrupt : public AuraScript
|
||||
void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_GEN_THROW_INTERRUPT, true, nullptr, aurEff);
|
||||
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_GEN_THROW_INTERRUPT, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1614,7 +1620,7 @@ class spell_gen_lifebloom : public SpellScriptLoader
|
||||
return;
|
||||
|
||||
// final heal
|
||||
GetTarget()->CastSpell(GetTarget(), _spellId, true, nullptr, aurEff, GetCasterGUID());
|
||||
GetTarget()->CastSpell(GetTarget(), _spellId, { aurEff, GetCasterGUID() });
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1809,7 +1815,7 @@ class spell_gen_moss_covered_feet : public AuraScript
|
||||
void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_FALL_DOWN, true, nullptr, aurEff);
|
||||
eventInfo.GetActionTarget()->CastSpell(nullptr, SPELL_FALL_DOWN, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1832,7 +1838,9 @@ class spell_gen_negative_energy_periodic : public AuraScript
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
GetTarget()->CastCustomSpell(GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1, nullptr, true, nullptr, aurEff);
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.SpellValueOverrides.AddMod(SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1);
|
||||
GetTarget()->CastSpell(nullptr, GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, args);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -2010,7 +2018,7 @@ class spell_gen_obsidian_armor : public AuraScript
|
||||
default:
|
||||
return;
|
||||
}
|
||||
GetTarget()->CastSpell(GetTarget(), spellId, true, nullptr, aurEff);
|
||||
GetTarget()->CastSpell(GetTarget(), spellId, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -2113,7 +2121,7 @@ class spell_gen_paralytic_poison : public AuraScript
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
return;
|
||||
|
||||
GetTarget()->CastSpell(nullptr, SPELL_PARALYSIS, true, nullptr, aurEff);
|
||||
GetTarget()->CastSpell(nullptr, SPELL_PARALYSIS, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -2626,7 +2634,7 @@ class spell_gen_two_forms : public SpellScript
|
||||
if (target->HasAuraType(SPELL_AURA_WORGEN_ALTERED_FORM))
|
||||
target->RemoveAurasByType(SPELL_AURA_WORGEN_ALTERED_FORM);
|
||||
else // Basepoints 1 for this aura control whether to trigger transform transition animation or not.
|
||||
target->CastCustomSpell(SPELL_ALTERED_FORM, SPELLVALUE_BASE_POINT0, 1, target, TRIGGERED_FULL_MASK);
|
||||
target->CastSpell(target, SPELL_ALTERED_FORM, CastSpellExtraArgs(TRIGGERED_FULL_MASK).AddSpellMod(SPELLVALUE_BASE_POINT0, 1));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -3028,7 +3036,7 @@ class spell_gen_turkey_marker : public AuraScript
|
||||
|
||||
// on stack 15 cast the achievement crediting spell
|
||||
if (GetStackAmount() >= 15)
|
||||
target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, nullptr, aurEff, GetCasterGUID());
|
||||
target->CastSpell(target, SPELL_TURKEY_VENGEANCE, { aurEff, GetCasterGUID() });
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
@@ -3109,8 +3117,9 @@ class spell_gen_vampiric_touch : public AuraScript
|
||||
return;
|
||||
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
int32 bp = damageInfo->GetDamage() / 2;
|
||||
caster->CastCustomSpell(SPELL_VAMPIRIC_TOUCH_HEAL, SPELLVALUE_BASE_POINT0, bp, caster, true, nullptr, aurEff);
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.SpellValueOverrides.AddBP0(damageInfo->GetDamage() / 2);
|
||||
caster->CastSpell(caster, SPELL_VAMPIRIC_TOUCH_HEAL, args);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -3811,7 +3820,7 @@ class spell_gen_mark_of_kazrogal_hellfire_aura : public AuraScript
|
||||
|
||||
if (target->GetPower(POWER_MANA) == 0)
|
||||
{
|
||||
target->CastSpell(target, SPELL_MARK_OF_KAZROGAL_DAMAGE_HELLFIRE, true, nullptr, aurEff);
|
||||
target->CastSpell(target, SPELL_MARK_OF_KAZROGAL_DAMAGE_HELLFIRE, aurEff);
|
||||
// Remove aura
|
||||
SetDuration(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user