fix(Scripts/Spells): Finger of Frost Shatter Combo. (#13006)

This commit is contained in:
UltraNix
2022-09-19 05:46:17 +02:00
committed by GitHub
parent c8da2b64fe
commit a5ab96c79d
8 changed files with 173 additions and 5 deletions

View File

@@ -55,6 +55,7 @@ enum MageSpells
SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT = 70908,
SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY = 70907,
SPELL_MAGE_GLYPH_OF_BLAST_WAVE = 62126,
SPELL_MAGE_FINGERS_OF_FROST = 44543
};
class spell_mage_arcane_blast : public SpellScript
@@ -932,6 +933,114 @@ class spell_mage_summon_water_elemental : public SpellScript
}
};
#define FingersOfFrostScriptName "spell_mage_fingers_of_frost_proc_aura"
class spell_mage_fingers_of_frost_proc_aura : public AuraScript
{ PrepareAuraScript(spell_mage_fingers_of_frost_proc_aura);
bool CheckProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetSpellPhaseMask() != PROC_SPELL_PHASE_CAST)
{
eventInfo.SetProcChance(_chance);
}
return true;
}
bool CheckAfterProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetSpellPhaseMask() != PROC_SPELL_PHASE_CAST)
{
eventInfo.ResetProcChance();
}
return true;
}
void HandleOnEffectProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
if (eventInfo.GetSpellPhaseMask() == PROC_SPELL_PHASE_CAST)
{
_chance = 100.f;
_spell = eventInfo.GetProcSpell();
if (!_spell || _spell->GetDelayMoment() <= 0)
{
PreventDefaultAction();
}
}
else
{
if (eventInfo.GetSpellPhaseMask() == PROC_SPELL_PHASE_FINISH || ((_spell && _spell->GetDelayMoment() > 0) || !eventInfo.GetDamageInfo()))
{
PreventDefaultAction();
}
_chance = 0.f;
_spell = nullptr;
}
}
void HandleAfterEffectProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
if (eventInfo.GetSpellPhaseMask() == PROC_SPELL_PHASE_HIT)
{
_chance = 100.f;
}
else if (eventInfo.GetSpellPhaseMask() == PROC_SPELL_PHASE_FINISH)
{
_chance = 0.f;
_spell = nullptr;
}
}
void Register()
{
DoCheckProc += AuraCheckProcFn(spell_mage_fingers_of_frost_proc_aura::CheckProc);
DoCheckAfterProc += AuraCheckProcFn(spell_mage_fingers_of_frost_proc_aura::CheckAfterProc);
OnEffectProc += AuraEffectProcFn(spell_mage_fingers_of_frost_proc_aura::HandleOnEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
AfterEffectProc += AuraEffectProcFn(spell_mage_fingers_of_frost_proc_aura::HandleAfterEffectProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
public:
Spell const* GetProcSpell() const { return _spell; }
private:
float _chance = 0.f;
Spell const* _spell = nullptr;
};
typedef spell_mage_fingers_of_frost_proc_aura spell_mage_fingers_of_frost_proc_aura_script;
class spell_mage_fingers_of_frost_proc : public AuraScript
{
PrepareAuraScript(spell_mage_fingers_of_frost_proc);
bool CheckProc(ProcEventInfo& eventInfo)
{
if (Aura* aura = GetCaster()->GetAuraOfRankedSpell(SPELL_MAGE_FINGERS_OF_FROST))
{
if (spell_mage_fingers_of_frost_proc_aura_script* script = dynamic_cast<spell_mage_fingers_of_frost_proc_aura_script*>(aura->GetScriptByName(FingersOfFrostScriptName)))
{
if (Spell const* fofProcSpell = script->GetProcSpell())
{
if (fofProcSpell == eventInfo.GetProcSpell())
{
return false;
}
}
}
}
return true;
}
void Register()
{
DoCheckProc += AuraCheckProcFn(spell_mage_fingers_of_frost_proc::CheckProc);
}
};
void AddSC_mage_spell_scripts()
{
RegisterSpellScript(spell_mage_arcane_blast);
@@ -955,4 +1064,6 @@ void AddSC_mage_spell_scripts()
RegisterSpellScript(spell_mage_master_of_elements);
RegisterSpellScript(spell_mage_polymorph_cast_visual);
RegisterSpellScript(spell_mage_summon_water_elemental);
RegisterSpellScript(spell_mage_fingers_of_frost_proc_aura);
RegisterSpellScript(spell_mage_fingers_of_frost_proc);
}