Core/Spells: Implemented evoker empower spell mechanic

This commit is contained in:
Shauren
2024-05-01 22:26:53 +02:00
parent cdc6719b83
commit a39d0db9ec
27 changed files with 733 additions and 94 deletions

View File

@@ -32,7 +32,9 @@
enum EvokerSpells
{
SPELL_EVOKER_BLAST_FURNACE = 375510,
SPELL_EVOKER_ENERGIZING_FLAME = 400006,
SPELL_EVOKER_FIRE_BREATH_DAMAGE = 357209,
SPELL_EVOKER_GLIDE_KNOCKBACK = 358736,
SPELL_EVOKER_HOVER = 358267,
SPELL_EVOKER_LIVING_FLAME = 361469,
@@ -40,6 +42,7 @@ enum EvokerSpells
SPELL_EVOKER_LIVING_FLAME_HEAL = 361509,
SPELL_EVOKER_PERMEATING_CHILL_TALENT = 370897,
SPELL_EVOKER_PYRE_DAMAGE = 357212,
SPELL_EVOKER_SCOURING_FLAME = 378438,
SPELL_EVOKER_SOAR_RACIAL = 369536
};
@@ -78,6 +81,72 @@ class spell_evo_charged_blast : public AuraScript
}
};
// 357208 Fire Breath (Red)
// 382266 Fire Breath (Red)
class spell_evo_fire_breath : public SpellScript
{
public:
struct data
{
int32 EmpowerLevel;
};
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_EVOKER_FIRE_BREATH_DAMAGE, SPELL_EVOKER_BLAST_FURNACE });
}
void OnComplete(int32 completedStageCount) const
{
int32 dotTicks = 10 - (completedStageCount - 1) * 3;
if (AuraEffect const* blastFurnace = GetCaster()->GetAuraEffect(SPELL_EVOKER_BLAST_FURNACE, EFFECT_0))
dotTicks += blastFurnace->GetAmount() / 2;
GetCaster()->CastSpell(GetCaster(), SPELL_EVOKER_FIRE_BREATH_DAMAGE, CastSpellExtraArgs()
.SetTriggeringSpell(GetSpell())
.SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR)
.AddSpellMod(SPELLVALUE_DURATION_PCT, 100 * dotTicks)
.SetCustomArg(data{ .EmpowerLevel = completedStageCount }));
}
void Register() override
{
OnEmpowerCompleted += SpellOnEmpowerStageCompletedFn(spell_evo_fire_breath::OnComplete);
}
};
// 357209 Fire Breath (Red)
class spell_evo_fire_breath_damage : public SpellScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 } })
&& spellInfo->GetEffect(EFFECT_2).IsAura(SPELL_AURA_MOD_SILENCE); // validate we are removing the correct effect
}
void AddBonusUpfrontDamage(Unit const* victim, int32& /*damage*/, int32& flatMod, float& /*pctMod*/) const
{
spell_evo_fire_breath::data const* params = std::any_cast<spell_evo_fire_breath::data>(&GetSpell()->m_customArg);
if (!params)
return;
// damage is done after aura is applied, grab periodic amount
if (AuraEffect const* fireBreath = victim->GetAuraEffect(GetSpellInfo()->Id, EFFECT_1, GetCaster()->GetGUID()))
flatMod += fireBreath->GetEstimatedAmount().value_or(fireBreath->GetAmount()) * (params->EmpowerLevel - 1) * 3;
}
void RemoveUnusedEffect(std::list<WorldObject*>& targets) const
{
targets.clear();
}
void Register() override
{
CalcDamage += SpellCalcDamageFn(spell_evo_fire_breath_damage::AddBonusUpfrontDamage);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_evo_fire_breath_damage::RemoveUnusedEffect, EFFECT_2, TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY);
}
};
// 358733 - Glide (Racial)
class spell_evo_glide : public SpellScript
{
@@ -203,12 +272,42 @@ class spell_evo_pyre : public SpellScript
}
};
// 357209 Fire Breath (Red)
class spell_evo_scouring_flame : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_EVOKER_SCOURING_FLAME });
}
void HandleScouringFlame(std::list<WorldObject*>& targets) const
{
if (!GetCaster()->HasAura(SPELL_EVOKER_SCOURING_FLAME))
targets.clear();
}
void CalcDispelCount(SpellEffIndex /*effIndex*/)
{
if (spell_evo_fire_breath::data const* params = std::any_cast<spell_evo_fire_breath::data>(&GetSpell()->m_customArg))
SetEffectValue(params->EmpowerLevel);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_evo_scouring_flame::HandleScouringFlame, EFFECT_3, TARGET_UNIT_CONE_CASTER_TO_DEST_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_evo_scouring_flame::CalcDispelCount, EFFECT_3, SPELL_EFFECT_DISPEL);
}
};
void AddSC_evoker_spell_scripts()
{
RegisterSpellScript(spell_evo_azure_strike);
RegisterSpellScript(spell_evo_charged_blast);
RegisterSpellScript(spell_evo_fire_breath);
RegisterSpellScript(spell_evo_fire_breath_damage);
RegisterSpellScript(spell_evo_glide);
RegisterSpellScript(spell_evo_living_flame);
RegisterSpellScript(spell_evo_permeating_chill);
RegisterSpellScript(spell_evo_pyre);
RegisterSpellScript(spell_evo_scouring_flame);
}