refactor(Scripts/Hodir): spellscripts use registry macros (#19126)

This commit is contained in:
Jelle Meeus
2024-06-22 20:22:24 +02:00
committed by GitHub
parent 2555dbd727
commit 9c7cf93cd8
4 changed files with 231 additions and 302 deletions
@@ -0,0 +1,5 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_hodir_storm_power_aura' WHERE `spell_id` IN (63711,65134);
UPDATE `spell_script_names` SET `ScriptName`='spell_hodir_storm_cloud_aura' WHERE `spell_id` IN (65123,65133);
UPDATE `spell_script_names` SET `ScriptName`='spell_hodir_toasty_fire_aura' WHERE `spell_id`=62821;
UPDATE `spell_script_names` SET `ScriptName`='spell_hodir_starlight_aura' WHERE `spell_id`=62807;
@@ -1180,159 +1180,133 @@ public:
}; };
}; };
class spell_hodir_shatter_chest : public SpellScriptLoader class spell_hodir_shatter_chest : public SpellScript
{ {
public: PrepareSpellScript(spell_hodir_shatter_chest);
spell_hodir_shatter_chest() : SpellScriptLoader("spell_hodir_shatter_chest") { }
class spell_hodir_shatter_chestSpellScript : public SpellScript void DestroyWinterCache(SpellEffIndex effIndex)
{ {
PrepareSpellScript(spell_hodir_shatter_chestSpellScript) PreventHitDefaultEffect(effIndex);
void destroyWinterCache(SpellEffIndex effIndex) if (Unit* hodir = GetCaster())
{ hodir->GetAI()->DoAction(EVENT_FAIL_HM);
PreventHitDefaultEffect(effIndex);
if (Unit* hodir = GetCaster())
hodir->GetAI()->DoAction(EVENT_FAIL_HM);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_hodir_shatter_chestSpellScript::destroyWinterCache, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE);
};
};
SpellScript* GetSpellScript() const override
{
return new spell_hodir_shatter_chestSpellScript();
} }
void Register() override
{
OnEffectHit += SpellEffectFn(spell_hodir_shatter_chest::DestroyWinterCache, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE);
};
}; };
class spell_hodir_biting_cold_main_aura : public SpellScriptLoader class spell_hodir_biting_cold_main_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_hodir_biting_cold_main_aura);
spell_hodir_biting_cold_main_aura() : SpellScriptLoader("spell_hodir_biting_cold_main_aura") { }
class spell_hodir_biting_cold_main_aura_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_hodir_biting_cold_main_aura_AuraScript) return ValidateSpellInfo({ SPELL_BITING_COLD_PLAYER_AURA, SPELL_MAGE_TOASTY_FIRE_AURA });
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if ((aurEff->GetTickNumber() % 4) == 0)
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER
&& !target->isMoving()
&& !target->HasAura(SPELL_BITING_COLD_PLAYER_AURA)
&& !target->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA))
target->CastSpell(target, SPELL_BITING_COLD_PLAYER_AURA, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_main_aura_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hodir_biting_cold_main_aura_AuraScript();
} }
};
class spell_hodir_biting_cold_player_aura : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* aurEff)
{
public:
spell_hodir_biting_cold_player_aura() : SpellScriptLoader("spell_hodir_biting_cold_player_aura") { }
class spell_hodir_biting_cold_player_aura_AuraScript : public AuraScript
{ {
PrepareAuraScript(spell_hodir_biting_cold_player_aura_AuraScript) if ((aurEff->GetTickNumber() % 4) == 0)
uint8 counter {0};
bool prev {false};
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* target = GetTarget()) if (Unit* target = GetTarget())
{ if (target->GetTypeId() == TYPEID_PLAYER
if (target->GetMapId() == 603) && !target->isMoving()
SetDuration(GetMaxDuration()); && !target->HasAura(SPELL_BITING_COLD_PLAYER_AURA)
if (target->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) && !target->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA))
return; target->CastSpell(target, SPELL_BITING_COLD_PLAYER_AURA, true);
if (target->isMoving() || target->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA)) }
{
if (prev)
{
ModStackAmount(-1);
prev = false;
}
else
prev = true;
if (counter >= 2) void Register() override
counter -= 2; {
else if (counter) OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_main_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
--counter; }
};
class spell_hodir_biting_cold_player_aura : public AuraScript
{
PrepareAuraScript(spell_hodir_biting_cold_player_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FLASH_FREEZE_TRAPPED_PLAYER, SPELL_MAGE_TOASTY_FIRE_AURA, SPELL_BITING_COLD_DAMAGE });
}
bool Load() override
{
_counter = 0;
_prev = false;
return true;
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
if (Unit* target = GetTarget())
{
if (target->GetMapId() == 603)
SetDuration(GetMaxDuration());
if (target->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER))
return;
if (target->isMoving() || target->HasAura(SPELL_MAGE_TOASTY_FIRE_AURA))
{
if (_prev)
{
ModStackAmount(-1);
_prev = false;
} }
else else
{ _prev = true;
prev = false;
++counter;
if (counter >= 4)
{
if (GetStackAmount() == 2) // increasing from 2 to 3 (not checking >= to improve performance)
if (InstanceScript* pInstance = target->GetInstanceScript())
if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetGuidData(TYPE_HODIR)))
hodir->AI()->SetData(2, 1);
ModStackAmount(1);
counter = 0;
}
}
const int32 dmg = 200 * pow(2.0f, GetStackAmount()); if (_counter >= 2)
target->CastCustomSpell(target, SPELL_BITING_COLD_DAMAGE, &dmg, 0, 0, true); _counter -= 2;
else if (_counter)
--_counter;
}
else
{
_prev = false;
++_counter;
if (_counter >= 4)
{
if (GetStackAmount() == 2) // increasing from 2 to 3 (not checking >= to improve performance)
if (InstanceScript* pInstance = target->GetInstanceScript())
if (Creature* hodir = pInstance->instance->GetCreature(pInstance->GetGuidData(TYPE_HODIR)))
hodir->AI()->SetData(2, 1);
ModStackAmount(1);
_counter = 0;
}
} }
}
void Register() override const int32 dmg = 200 * pow(2.0f, GetStackAmount());
{ target->CastCustomSpell(target, SPELL_BITING_COLD_DAMAGE, &dmg, 0, 0, true);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_player_aura_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
} }
};
AuraScript* GetAuraScript() const override
{
return new spell_hodir_biting_cold_player_aura_AuraScript();
} }
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_biting_cold_player_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
private:
uint8 _counter;
bool _prev;
}; };
class spell_hodir_periodic_icicle : public SpellScriptLoader class spell_hodir_periodic_icicle : public SpellScript
{ {
public: PrepareSpellScript(spell_hodir_periodic_icicle);
spell_hodir_periodic_icicle() : SpellScriptLoader("spell_hodir_periodic_icicle") { }
class spell_hodir_periodic_icicle_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_hodir_periodic_icicle_SpellScript); targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
targets.remove_if(Acore::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER));
Acore::Containers::RandomResize(targets, 1);
}
void FilterTargets(std::list<WorldObject*>& targets) void Register() override
{
targets.remove_if(Acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
targets.remove_if(Acore::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER));
Acore::Containers::RandomResize(targets, 1);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_periodic_icicle_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{ {
return new spell_hodir_periodic_icicle_SpellScript(); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_periodic_icicle::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
} }
}; };
@@ -1349,150 +1323,156 @@ public:
} }
}; };
class spell_hodir_flash_freeze : public SpellScriptLoader class spell_hodir_flash_freeze : public SpellScript
{ {
public: PrepareSpellScript(spell_hodir_flash_freeze);
spell_hodir_flash_freeze() : SpellScriptLoader("spell_hodir_flash_freeze") { }
class spell_hodir_flash_freeze_SpellScript : public SpellScript void FilterTargets(std::list<WorldObject*>& targets)
{ {
PrepareSpellScript(spell_hodir_flash_freeze_SpellScript); targets.remove_if(FlashFreezeCheck());
}
void FilterTargets(std::list<WorldObject*>& targets) void Register() override
{
targets.remove_if(FlashFreezeCheck());
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
class spell_hodir_flash_freeze_AuraScript : public AuraScript
{ {
PrepareAuraScript(spell_hodir_flash_freeze_AuraScript) OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hodir_flash_freeze::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
}
};
void HandleEffectPeriodic(AuraEffect const* aurEff) class spell_hodir_flash_freeze_aura : public AuraScript
{
PrepareAuraScript(spell_hodir_flash_freeze_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FLASH_FREEZE_INSTAKILL, SPELL_FLASH_FREEZE_TRAPPED_PLAYER, SPELL_FLASH_FREEZE_TRAPPED_NPC });
}
void HandleEffectPeriodic(AuraEffect const* aurEff)
{
if (aurEff->GetTotalTicks() > 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()) - 1)
{ {
if (aurEff->GetTotalTicks() > 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()) - 1) Unit* target = GetTarget();
Unit* caster = GetCaster();
if (!target || !caster || caster->GetTypeId() != TYPEID_UNIT)
return;
if (Aura* aur = target->GetAura(target->GetTypeId() == TYPEID_PLAYER ? SPELL_FLASH_FREEZE_TRAPPED_PLAYER : SPELL_FLASH_FREEZE_TRAPPED_NPC))
{ {
Unit* target = GetTarget(); if (Unit* caster2 = aur->GetCaster())
Unit* caster = GetCaster();
if (!target || !caster || caster->GetTypeId() != TYPEID_UNIT)
return;
if (Aura* aur = target->GetAura(target->GetTypeId() == TYPEID_PLAYER ? SPELL_FLASH_FREEZE_TRAPPED_PLAYER : SPELL_FLASH_FREEZE_TRAPPED_NPC))
{ {
if (Unit* caster2 = aur->GetCaster()) if (caster2->GetTypeId() == TYPEID_UNIT)
{ {
if (caster2->GetTypeId() == TYPEID_UNIT) caster2->ToCreature()->DespawnOrUnsummon();
{
caster2->ToCreature()->DespawnOrUnsummon();
}
}
target->CastSpell(target, SPELL_FLASH_FREEZE_INSTAKILL, true);
return;
}
if (target->GetTypeId() == TYPEID_PLAYER)
{
caster->ToCreature()->AI()->SetData(1, 1);
if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_PLR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 5 * 60 * 1000) )
{
c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_PLAYER, true);
caster->ToCreature()->AI()->JustSummoned(c);
} }
} }
else if (target->GetTypeId() == TYPEID_UNIT) target->CastSpell(target, SPELL_FLASH_FREEZE_INSTAKILL, true);
return;
}
if (target->GetTypeId() == TYPEID_PLAYER)
{
caster->ToCreature()->AI()->SetData(1, 1);
if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_PLR, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 5 * 60 * 1000) )
{ {
if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_NPC, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000) ) c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_PLAYER, true);
{ caster->ToCreature()->AI()->JustSummoned(c);
c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_NPC, true); }
caster->ToCreature()->AI()->JustSummoned(c); }
} else if (target->GetTypeId() == TYPEID_UNIT)
{
if( Creature* c = target->SummonCreature(NPC_FLASH_FREEZE_NPC, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000) )
{
c->CastSpell(target, SPELL_FLASH_FREEZE_TRAPPED_NPC, true);
caster->ToCreature()->AI()->JustSummoned(c);
} }
} }
} }
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_flash_freeze_AuraScript::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_hodir_flash_freeze_SpellScript();
} }
AuraScript* GetAuraScript() const override void Register() override
{ {
return new spell_hodir_flash_freeze_AuraScript(); OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_flash_freeze_aura::HandleEffectPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
} }
}; };
class spell_hodir_storm_power : public SpellScriptLoader class spell_hodir_storm_power_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_hodir_storm_power_aura);
spell_hodir_storm_power() : SpellScriptLoader("spell_hodir_storm_power") { }
class spell_hodir_storm_power_AuraScript : public AuraScript void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
PrepareAuraScript(spell_hodir_storm_power_AuraScript) if (Unit* caster = GetCaster())
if (Aura* a = caster->GetAura(GetId() == SPELL_SHAMAN_STORM_POWER_10 ? SPELL_SHAMAN_STORM_CLOUD_10 : SPELL_SHAMAN_STORM_CLOUD_25))
a->ModStackAmount(-1);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
if (Aura* a = caster->GetAura(GetId() == SPELL_SHAMAN_STORM_POWER_10 ? SPELL_SHAMAN_STORM_CLOUD_10 : SPELL_SHAMAN_STORM_CLOUD_25))
a->ModStackAmount(-1);
}
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, GetId(), 0, GetCaster());
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_REAL);
AfterEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_hodir_storm_power_AuraScript(); if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, GetId(), 0, GetCaster());
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_aura::OnApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_REAL);
AfterEffectApply += AuraEffectApplyFn(spell_hodir_storm_power_aura::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK);
} }
}; };
class spell_hodir_storm_cloud : public SpellScriptLoader class spell_hodir_storm_cloud_aura : public AuraScript
{ {
public: PrepareAuraScript(spell_hodir_storm_cloud_aura);
spell_hodir_storm_cloud() : SpellScriptLoader("spell_hodir_storm_cloud") { }
class spell_hodir_storm_cloud_AuraScript : public AuraScript bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
PrepareAuraScript(spell_hodir_storm_cloud_AuraScript) return ValidateSpellInfo({ SPELL_SHAMAN_STORM_CLOUD_10, SPELL_SHAMAN_STORM_POWER_10, SPELL_SHAMAN_STORM_POWER_25 });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (Unit* target = GetTarget())
target->CastSpell((Unit*)nullptr, (GetId() == SPELL_SHAMAN_STORM_CLOUD_10 ? SPELL_SHAMAN_STORM_POWER_10 : SPELL_SHAMAN_STORM_POWER_25), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_storm_cloud_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{ {
return new spell_hodir_storm_cloud_AuraScript(); PreventDefaultAction();
if (Unit* target = GetTarget())
target->CastSpell((Unit*)nullptr, (GetId() == SPELL_SHAMAN_STORM_CLOUD_10 ? SPELL_SHAMAN_STORM_POWER_10 : SPELL_SHAMAN_STORM_POWER_25), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hodir_storm_cloud_aura::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_hodir_toasty_fire_aura : public AuraScript
{
PrepareAuraScript(spell_hodir_toasty_fire_aura);
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_MAGE_TOASTY_FIRE_AURA, 0, GetCaster());
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_hodir_toasty_fire_aura::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK);
}
};
class spell_hodir_starlight_aura : public AuraScript
{
PrepareAuraScript(spell_hodir_starlight_aura);
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_DRUID_STARLIGHT_AREA_AURA, 0, GetCaster());
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_hodir_starlight_aura::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MELEE_SLOW, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK);
} }
}; };
@@ -1562,62 +1542,6 @@ public:
} }
}; };
class spell_hodir_toasty_fire : public SpellScriptLoader
{
public:
spell_hodir_toasty_fire() : SpellScriptLoader("spell_hodir_toasty_fire") { }
class spell_hodir_toasty_fire_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hodir_toasty_fire_AuraScript);
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_MAGE_TOASTY_FIRE_AURA, 0, GetCaster());
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_hodir_toasty_fire_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hodir_toasty_fire_AuraScript();
}
};
class spell_hodir_starlight : public SpellScriptLoader
{
public:
spell_hodir_starlight() : SpellScriptLoader("spell_hodir_starlight") { }
class spell_hodir_starlight_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hodir_starlight_AuraScript);
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, SPELL_DRUID_STARLIGHT_AREA_AURA, 0, GetCaster());
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_hodir_starlight_AuraScript::HandleAfterEffectApply, EFFECT_0, SPELL_AURA_MELEE_SLOW, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hodir_starlight_AuraScript();
}
};
void AddSC_boss_hodir() void AddSC_boss_hodir()
{ {
new boss_hodir(); new boss_hodir();
@@ -1630,13 +1554,15 @@ void AddSC_boss_hodir()
new npc_ulduar_hodir_shaman(); new npc_ulduar_hodir_shaman();
new npc_ulduar_hodir_mage(); new npc_ulduar_hodir_mage();
new spell_hodir_biting_cold_main_aura(); RegisterSpellScript(spell_hodir_shatter_chest);
new spell_hodir_biting_cold_player_aura(); RegisterSpellScript(spell_hodir_biting_cold_main_aura);
new spell_hodir_periodic_icicle(); RegisterSpellScript(spell_hodir_biting_cold_player_aura);
new spell_hodir_flash_freeze(); RegisterSpellScript(spell_hodir_periodic_icicle);
new spell_hodir_storm_power(); RegisterSpellAndAuraScriptPair(spell_hodir_flash_freeze, spell_hodir_flash_freeze_aura);
new spell_hodir_storm_cloud(); RegisterSpellScript(spell_hodir_storm_power_aura);
new spell_hodir_shatter_chest(); RegisterSpellScript(spell_hodir_storm_cloud_aura);
RegisterSpellScript(spell_hodir_toasty_fire_aura);
RegisterSpellScript(spell_hodir_starlight_aura);
new achievement_cheese_the_freeze(); new achievement_cheese_the_freeze();
new achievement_getting_cold_in_here(); new achievement_getting_cold_in_here();
@@ -1644,6 +1570,4 @@ void AddSC_boss_hodir()
new achievement_i_have_the_coolest_friends(); new achievement_i_have_the_coolest_friends();
new achievement_staying_buffed_all_winter_10(); new achievement_staying_buffed_all_winter_10();
new achievement_staying_buffed_all_winter_25(); new achievement_staying_buffed_all_winter_25();
new spell_hodir_toasty_fire();
new spell_hodir_starlight();
} }
@@ -432,7 +432,7 @@ class spell_ignis_scorch_aura : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
return ValidateSpellInfo( { SPELL_SCORCHED_GROUND_10, SPELL_SCORCHED_GROUND_25 }); return ValidateSpellInfo({ SPELL_SCORCHED_GROUND_10, SPELL_SCORCHED_GROUND_25 });
} }
void HandleEffectPeriodic(AuraEffect const* aurEff) void HandleEffectPeriodic(AuraEffect const* aurEff)
@@ -458,7 +458,7 @@ class spell_ignis_grab_initial : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
return ValidateSpellInfo( { SPELL_GRAB_TRIGGERED }); return ValidateSpellInfo({ SPELL_GRAB_TRIGGERED });
} }
void HandleScript(SpellEffIndex /*effIndex*/) void HandleScript(SpellEffIndex /*effIndex*/)
@@ -882,7 +882,7 @@ class spell_xt002_tympanic_tantrum : public SpellScript
// 64234, 63024 - Gravity Bomb // 64234, 63024 - Gravity Bomb
enum GravityBomb enum GravityBomb
{ {
SPELL_GRAVTY_BOMB_10 = 63025 SPELL_GRAVITY_BOMB_TRIGGER_10 = 63025
}; };
class spell_xt002_gravity_bomb : public SpellScript class spell_xt002_gravity_bomb : public SpellScript
@@ -917,7 +917,7 @@ class spell_xt002_gravity_bomb_aura : public AuraScript
if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode if (xt002->HasAura(aurEff->GetAmount())) // Heartbreak aura indicating hard mode
if (Creature* creature = xt002->SummonCreature(NPC_VOID_ZONE, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000)) if (Creature* creature = xt002->SummonCreature(NPC_VOID_ZONE, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000))
{ {
int32 damage = GetSpellInfo()->Id == SPELL_GRAVTY_BOMB_10 ? 5000 : 7500; int32 damage = GetSpellInfo()->Id == SPELL_GRAVITY_BOMB_TRIGGER_10 ? 5000 : 7500;
creature->CastCustomSpell(creature, SPELL_VOID_ZONE_DAMAGE, &damage, 0, 0, true); creature->CastCustomSpell(creature, SPELL_VOID_ZONE_DAMAGE, &damage, 0, 0, true);
} }
} }