Scripts/Spells: Fix chain lightning energize (elemental) (#27468)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
aquadeus
2021-12-25 22:15:11 +01:00
committed by GitHub
parent c95b1784df
commit 47d8b17e9f
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_sha_chain_lightning';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(188443, 'spell_sha_chain_lightning');

View File

@@ -38,6 +38,7 @@ enum ShamanSpells
{
SPELL_SHAMAN_ANCESTRAL_GUIDANCE = 108281,
SPELL_SHAMAN_ANCESTRAL_GUIDANCE_HEAL = 114911,
SPELL_SHAMAN_CHAIN_LIGHTNING_ENERGIZE = 195897,
SPELL_SHAMAN_CHAINED_HEAL = 70809,
SPELL_SHAMAN_CRASH_LIGHTNING_CLEAVE = 187878,
SPELL_SHAMAN_EARTH_SHIELD_HEAL = 204290,
@@ -186,6 +187,30 @@ class spell_sha_bloodlust : public SpellScript
}
};
// 188443 - Chain lightning
class spell_sha_chain_lightning : public SpellScript
{
PrepareSpellScript(spell_sha_chain_lightning);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SHAMAN_CHAIN_LIGHTNING_ENERGIZE, SPELL_SHAMAN_MAELSTROM_CONTROLLER })
&& sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_MAELSTROM_CONTROLLER, DIFFICULTY_NONE)->GetEffects().size() > EFFECT_4;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (AuraEffect const* energizeAmount = GetCaster()->GetAuraEffect(SPELL_SHAMAN_MAELSTROM_CONTROLLER, EFFECT_4))
GetCaster()->CastSpell(GetCaster(), SPELL_SHAMAN_CHAIN_LIGHTNING_ENERGIZE, CastSpellExtraArgs(energizeAmount)
.AddSpellMod(SPELLVALUE_BASE_POINT0, energizeAmount->GetAmount() * GetUnitTargetCountForEffect(EFFECT_0)));
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_sha_chain_lightning::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
// 187874 - Crash Lightning
class spell_sha_crash_lightning : public SpellScript
{
@@ -1194,6 +1219,7 @@ void AddSC_shaman_spell_scripts()
RegisterAuraScript(spell_sha_ancestral_guidance);
RegisterSpellScript(spell_sha_ancestral_guidance_heal);
RegisterSpellScript(spell_sha_bloodlust);
RegisterSpellScript(spell_sha_chain_lightning);
RegisterSpellScript(spell_sha_crash_lightning);
RegisterAuraScript(spell_sha_earth_shield);
RegisterAuraScript(spell_sha_earthen_rage_passive);