Scripts/Spells: Migrate Some Scripted Spells to Scripts (#23185)

* Migrate spells to scripts

* Simplify code

* I need to sleep

* Update chapter1.cpp

* Use actual damage

* No need in null check here
This commit is contained in:
Sorikoff
2019-04-16 07:49:39 +00:00
committed by Giacomo Pozzoni
parent 50d32fe493
commit 2cfaeb1400
8 changed files with 283 additions and 168 deletions
@@ -87,6 +87,8 @@ enum ShamanSpells
SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1 = 45297,
SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1 = 26364,
SPELL_SHAMAN_SHAMANISTIC_RAGE_PROC = 30824,
SPELL_SHAMAN_STONECLAW_TOTEM = 55277,
SPELL_SHAMAN_GLYPH_OF_STONECLAW_TOTEM = 63298,
SPELL_SHAMAN_MAELSTROM_POWER = 70831,
SPELL_SHAMAN_T10_ENHANCEMENT_4P_BONUS = 70832,
SPELL_SHAMAN_BLESSING_OF_THE_ETERNALS_R1 = 51554,
@@ -1780,6 +1782,44 @@ class spell_sha_shamanistic_rage : public SpellScriptLoader
}
};
class spell_sha_stoneclaw_totem : public SpellScript
{
PrepareSpellScript(spell_sha_stoneclaw_totem);
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
Unit* target = GetHitUnit();
// Cast Absorb on totems
for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
{
if (!target->m_SummonSlot[slot])
continue;
Creature* totem = target->GetMap()->GetCreature(target->m_SummonSlot[slot]);
if (totem && totem->IsTotem())
{
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.AddSpellMod(SPELLVALUE_BASE_POINT0, GetEffectValue());
GetCaster()->CastSpell(totem, SPELL_SHAMAN_STONECLAW_TOTEM, args);
}
}
// Glyph of Stoneclaw Totem
if (AuraEffect* aur = target->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_STONECLAW_TOTEM, 0))
{
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
args.AddSpellMod(SPELLVALUE_BASE_POINT0, GetEffectValue() * aur->GetAmount());
GetCaster()->CastSpell(target, SPELL_SHAMAN_STONECLAW_TOTEM, args);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_sha_stoneclaw_totem::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 58877 - Spirit Hunt
class spell_sha_spirit_hunt : public SpellScriptLoader
{
@@ -2385,6 +2425,7 @@ void AddSC_shaman_spell_scripts()
new spell_sha_nature_guardian();
new spell_sha_sentry_totem();
new spell_sha_shamanistic_rage();
RegisterSpellScript(spell_sha_stoneclaw_totem);
new spell_sha_spirit_hunt();
new spell_sha_static_shock();
new spell_sha_tidal_force_dummy();