Scripts/Vashjir: Fix crash in spell_vashjir_sea_legs_aura

This commit is contained in:
Shauren
2026-07-21 21:30:17 +02:00
parent 7553aea819
commit 40917c7acd
@@ -35,22 +35,20 @@ class spell_vashjir_sea_legs_aura : public AuraScript
return ValidateSpellInfo({ Spells::SeaLegsAura }); return ValidateSpellInfo({ Spells::SeaLegsAura });
} }
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) const static void CalcPeriodic(AuraScript const&, AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{ {
isPeriodic = true; isPeriodic = true;
amplitude = 500; amplitude = 500;
} }
void OnUpdate(AuraEffect* /*aurEff*/) void OnUpdate(AuraEffect const* /*aurEff*/) const
{ {
Unit* target = GetTarget(); Unit* target = GetTarget();
if (target->IsInWater()) if (target->IsInWater())
target->CastSpell(target, Spells::SeaLegsAura, TRIGGERED_IGNORE_CAST_IN_PROGRESS); target->CastSpell(target, Spells::SeaLegsAura, TRIGGERED_IGNORE_CAST_IN_PROGRESS);
else
target->RemoveAura(Spells::SeaLegsAura);
} }
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const
{ {
GetTarget()->RemoveAura(Spells::SeaLegsAura); GetTarget()->RemoveAura(Spells::SeaLegsAura);
} }
@@ -58,7 +56,7 @@ class spell_vashjir_sea_legs_aura : public AuraScript
void Register() override void Register() override
{ {
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_vashjir_sea_legs_aura::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_vashjir_sea_legs_aura::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_vashjir_sea_legs_aura::OnUpdate, EFFECT_0, SPELL_AURA_DUMMY); OnEffectPeriodic += AuraEffectPeriodicFn(spell_vashjir_sea_legs_aura::OnUpdate, EFFECT_0, SPELL_AURA_DUMMY);
AfterEffectRemove += AuraEffectRemoveFn(spell_vashjir_sea_legs_aura::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_vashjir_sea_legs_aura::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
} }
}; };