Scripts/Spells: Fix mage Comet Storm (#27710)

This commit is contained in:
Aqua Deus
2022-02-07 16:49:18 +01:00
committed by GitHub
parent db8280a0fb
commit 7192da410d
2 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_mage_comet_storm', 'spell_mage_comet_storm_damage');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(153595, 'spell_mage_comet_storm'),
(228601, 'spell_mage_comet_storm_damage');

View File

@@ -45,6 +45,8 @@ enum MageSpells
SPELL_MAGE_BLINK = 1953,
SPELL_MAGE_CAUTERIZE_DOT = 87023,
SPELL_MAGE_CAUTERIZED = 87024,
SPELL_MAGE_COMET_STORM_DAMAGE = 153596,
SPELL_MAGE_COMET_STORM_VISUAL = 228601,
SPELL_MAGE_CONE_OF_COLD = 120,
SPELL_MAGE_CONE_OF_COLD_SLOW = 212792,
SPELL_MAGE_CONJURE_REFRESHMENT = 116136,
@@ -430,6 +432,75 @@ class spell_mage_cold_snap : public SpellScript
}
};
class CometStormEvent : public BasicEvent
{
public:
CometStormEvent(Unit* caster, ObjectGuid originalCastId, Position const& dest) : _caster(caster), _originalCastId(originalCastId), _dest(dest), _count(0) { }
bool Execute(uint64 time, uint32 /*diff*/) override
{
Position destPosition = {_dest.GetPositionX() + frand(-3.0f, 3.0f), _dest.GetPositionY() + frand(-3.0f, 3.0f), _dest.GetPositionZ()};
_caster->CastSpell(destPosition, SPELL_MAGE_COMET_STORM_VISUAL,
CastSpellExtraArgs(TRIGGERED_IGNORE_CAST_IN_PROGRESS).SetOriginalCastId(_originalCastId));
++_count;
if (_count >= 7)
return true;
_caster->m_Events.AddEvent(this, Milliseconds(time) + randtime(100ms, 275ms));
return false;
}
private:
Unit* _caster;
ObjectGuid _originalCastId;
Position _dest;
uint8 _count;
};
// 153595 - Comet Storm (launch)
class spell_mage_comet_storm : public SpellScript
{
PrepareSpellScript(spell_mage_comet_storm);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MAGE_COMET_STORM_VISUAL });
}
void EffectHit(SpellEffIndex /*effIndex*/)
{
GetCaster()->m_Events.AddEventAtOffset(new CometStormEvent(GetCaster(), GetSpell()->m_castId, *GetHitDest()), randtime(100ms, 275ms));
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_mage_comet_storm::EffectHit, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// 228601 - Comet Storm (damage)
class spell_mage_comet_storm_damage : public SpellScript
{
PrepareSpellScript(spell_mage_comet_storm_damage);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MAGE_COMET_STORM_DAMAGE });
}
void HandleEffectHitTarget(SpellEffIndex /*effIndex*/)
{
GetCaster()->CastSpell(*GetHitDest(), SPELL_MAGE_COMET_STORM_DAMAGE,
CastSpellExtraArgs(TRIGGERED_IGNORE_CAST_IN_PROGRESS).SetOriginalCastId(GetSpell()->m_originalCastId));
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_mage_comet_storm_damage::HandleEffectHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
// 120 - Cone of Cold
class spell_mage_cone_of_cold : public SpellScript
{
@@ -1226,6 +1297,8 @@ void AddSC_mage_spell_scripts()
RegisterSpellScript(spell_mage_burning_determination);
RegisterSpellAndAuraScriptPair(spell_mage_cauterize, spell_mage_cauterize_AuraScript);
RegisterSpellScript(spell_mage_cold_snap);
RegisterSpellScript(spell_mage_comet_storm);
RegisterSpellScript(spell_mage_comet_storm_damage);
RegisterSpellScript(spell_mage_cone_of_cold);
RegisterSpellScript(spell_mage_conjure_refreshment);
RegisterSpellScript(spell_mage_fingers_of_frost);