refactor(Scripts/Outland): spell scripts use registry macros (#19132)

* zone_terokkar_forest pair:spell_q10930_big_bone_worm

* zone_terokkar_forest spell:spell_q10036_torgos

* zone_terokkar_forest spell:spell_q10923_evil_draws_near_summon

* zone_terokkar_forest aura:spell_q10923_evil_draws_near_periodic_aura

* zone_terokkar_forest spell:spell_q10923_evil_draws_near_visual

* zone_terokkar_forest spell:spell_q10898_skywing

* zone_hellfire_peninsula spell:spell_q10935_the_exorcism_of_colonel_jules

* boss_doomlord_kazzak aura:spell_mark_of_kazzak_aura

* zone_blades_edge_mountains aura:spell_npc22275_crystal_prison_aura

* zone_blades_edge_mountains spell:spell_oscillating_field

* zone_shadowmoon_valley spell:spell_q10612_10613_the_fel_and_the_furious

* zone_shadowmoon_valley aura:spell_q10563_q10596_to_legion_hold_aura

* fixup! zone_hellfire_peninsula spell:spell_q10935_the_exorcism_of_colonel_jules

fixup! zone_hellfire_peninsula spell:spell_q10935_the_exorcism_of_colonel_jules

* fixup! zone_blades_edge_mountains aura:spell_npc22275_crystal_prison_aura

* fixup! zone_shadowmoon_valley spell:spell_q10612_10613_the_fel_and_the_furious

* fixup! zone_blades_edge_mountains spell:spell_oscillating_field

* zone_terokkar_forest pair:spell_q10929_fumping
This commit is contained in:
Jelle Meeus
2024-06-25 21:37:51 +02:00
committed by GitHub
parent 24c8f3c4c6
commit 7a77a3e4f9
6 changed files with 267 additions and 361 deletions

View File

@@ -0,0 +1,5 @@
--
UPDATE `spell_script_names` SET `ScriptName`='spell_q10923_evil_draws_near_periodic_aura' WHERE `spell_id`=39259;
UPDATE `spell_script_names` SET `ScriptName`='spell_mark_of_kazzak_aura' WHERE `spell_id`=32960;
UPDATE `spell_script_names` SET `ScriptName`='spell_npc22275_crystal_prison_aura' WHERE `spell_id`=40846;
UPDATE `spell_script_names` SET `ScriptName`='spell_q10563_q10596_to_legion_hold_aura' WHERE `spell_id`=37097;

View File

@@ -150,54 +150,43 @@ public:
}
};
class spell_mark_of_kazzak : public SpellScriptLoader
class spell_mark_of_kazzak_aura : public AuraScript
{
public:
spell_mark_of_kazzak() : SpellScriptLoader("spell_mark_of_kazzak") { }
PrepareAuraScript(spell_mark_of_kazzak_aura);
class spell_mark_of_kazzak_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spell*/) override
{
PrepareAuraScript(spell_mark_of_kazzak_AuraScript);
return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE });
}
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_MARK_OF_KAZZAK_DAMAGE });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
{
amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
}
}
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* target = GetTarget();
if (target->GetPower(POWER_MANA) == 0)
{
target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff);
SetDuration(0); // Remove aura
}
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
}
};
AuraScript* GetAuraScript() const override
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
return new spell_mark_of_kazzak_AuraScript();
if (Unit* owner = GetUnitOwner())
{
amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
}
}
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* target = GetTarget();
if (target->GetPower(POWER_MANA) == 0)
{
target->CastSpell(target, SPELL_MARK_OF_KAZZAK_DAMAGE, true, nullptr, aurEff);
SetDuration(0); // Remove aura
}
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mark_of_kazzak_aura::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mark_of_kazzak_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_MANA_LEECH);
}
};
void AddSC_boss_doomlordkazzak()
{
new boss_doomlord_kazzak();
new spell_mark_of_kazzak();
RegisterSpellScript(spell_mark_of_kazzak_aura);
}

View File

@@ -223,31 +223,30 @@ public:
}
};
class spell_npc22275_crystal_prison : public SpellScriptLoader
enum CrystalPrison
{
public:
spell_npc22275_crystal_prison() : SpellScriptLoader("spell_npc22275_crystal_prison") { }
SPELL_CRYSTAL_SHATTER = 40898
};
class spell_npc22275_crystal_prison_AuraScript : public AuraScript
class spell_npc22275_crystal_prison_aura : public AuraScript
{
PrepareAuraScript(spell_npc22275_crystal_prison_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_npc22275_crystal_prison_AuraScript);
return ValidateSpellInfo({ SPELL_CRYSTAL_SHATTER });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
SetDuration(0);
GetTarget()->CastSpell(GetTarget(), 40898, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
void OnPeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_npc22275_crystal_prison_AuraScript();
PreventDefaultAction();
SetDuration(0);
GetTarget()->CastSpell(GetTarget(), SPELL_CRYSTAL_SHATTER, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_npc22275_crystal_prison_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
@@ -1139,31 +1138,25 @@ public:
}
};
class spell_oscillating_field : public SpellScriptLoader
class spell_oscillating_field : public SpellScript
{
public:
spell_oscillating_field() : SpellScriptLoader("spell_oscillating_field") { }
PrepareSpellScript(spell_oscillating_field);
class spell_oscillating_field_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_oscillating_field_SpellScript);
return ValidateSpellInfo({ SPELL_OSCILLATION_FIELD });
}
void HandleEffect(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetHitPlayer())
if (player->GetAuraCount(SPELL_OSCILLATION_FIELD) == 5 && player->GetQuestStatus(QUEST_GAUGING_THE_RESONANT_FREQUENCY) == QUEST_STATUS_INCOMPLETE)
player->CompleteQuest(QUEST_GAUGING_THE_RESONANT_FREQUENCY);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_oscillating_field_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const override
void HandleEffect(SpellEffIndex /*effIndex*/)
{
return new spell_oscillating_field_SpellScript();
if (Player* player = GetHitPlayer())
if (player->GetAuraCount(SPELL_OSCILLATION_FIELD) == 5 && player->GetQuestStatus(QUEST_GAUGING_THE_RESONANT_FREQUENCY) == QUEST_STATUS_INCOMPLETE)
player->CompleteQuest(QUEST_GAUGING_THE_RESONANT_FREQUENCY);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_oscillating_field::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
@@ -1172,7 +1165,7 @@ void AddSC_blades_edge_mountains()
// Ours
new npc_deaths_door_fell_cannon_target_bunny();
new npc_deaths_fel_cannon();
new spell_npc22275_crystal_prison();
RegisterSpellScript(spell_npc22275_crystal_prison_aura);
// Theirs
new npc_nether_drake();
new npc_daranelle();
@@ -1180,5 +1173,5 @@ void AddSC_blades_edge_mountains()
new go_simon_cluster();
new go_apexis_relic();
new npc_oscillating_frequency_scanner_master_bunny();
new spell_oscillating_field();
RegisterSpellScript(spell_oscillating_field);
}

View File

@@ -25,39 +25,37 @@
#include "SpellScript.h"
#include "SpellScriptLoader.h"
// Ours
class spell_q10935_the_exorcism_of_colonel_jules : public SpellScriptLoader
enum q10935Exorcism
{
public:
spell_q10935_the_exorcism_of_colonel_jules() : SpellScriptLoader("spell_q10935_the_exorcism_of_colonel_jules") { }
SPELL_HOLY_FIRE = 39323,
SPELL_HEAL_BARADA = 39322
};
class spell_q10935_the_exorcism_of_colonel_jules_SpellScript : public SpellScript
class spell_q10935_the_exorcism_of_colonel_jules : public SpellScript
{
PrepareSpellScript(spell_q10935_the_exorcism_of_colonel_jules);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10935_the_exorcism_of_colonel_jules_SpellScript);
return ValidateSpellInfo({ SPELL_HOLY_FIRE, SPELL_HEAL_BARADA });
}
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Creature* target = GetHitCreature();
if (!target)
return;
if (GetCaster()->IsHostileTo(target))
GetCaster()->CastSpell(target, 39323 /*SPELL_HOLY_FIRE*/, true);
else
GetCaster()->CastSpell(target, 39322 /*SPELL_HEAL_BARADA*/, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
void HandleDummy(SpellEffIndex effIndex)
{
return new spell_q10935_the_exorcism_of_colonel_jules_SpellScript();
PreventHitDefaultEffect(effIndex);
Creature* target = GetHitCreature();
if (!target)
return;
if (GetCaster()->IsHostileTo(target))
GetCaster()->CastSpell(target, SPELL_HOLY_FIRE, true);
else
GetCaster()->CastSpell(target, SPELL_HEAL_BARADA, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q10935_the_exorcism_of_colonel_jules::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -607,7 +605,7 @@ public:
void AddSC_hellfire_peninsula()
{
// Ours
new spell_q10935_the_exorcism_of_colonel_jules();
RegisterSpellScript(spell_q10935_the_exorcism_of_colonel_jules);
// Theirs
new npc_aeranas();

View File

@@ -45,93 +45,81 @@ npc_enraged_spirit
EndContentData */
// Ours
class spell_q10612_10613_the_fel_and_the_furious : public SpellScriptLoader
enum TheFelAndTheFurious
{
public:
spell_q10612_10613_the_fel_and_the_furious() : SpellScriptLoader("spell_q10612_10613_the_fel_and_the_furious") { }
SPELL_ROCKET_LAUNCHER = 38083
};
class spell_q10612_10613_the_fel_and_the_furious_SpellScript : public SpellScript
class spell_q10612_10613_the_fel_and_the_furious : public SpellScript
{
PrepareSpellScript(spell_q10612_10613_the_fel_and_the_furious);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10612_10613_the_fel_and_the_furious_SpellScript);
return ValidateSpellInfo({ SPELL_ROCKET_LAUNCHER });
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!charmer)
return;
std::list<GameObject*> gList;
GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f);
uint8 counter = 0;
for (std::list<GameObject*>::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter)
{
Player* charmer = GetCaster()->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!charmer)
return;
std::list<GameObject*> gList;
GetCaster()->GetGameObjectListWithEntryInGrid(gList, 184979, 30.0f);
uint8 counter = 0;
for (std::list<GameObject*>::const_iterator itr = gList.begin(); itr != gList.end(); ++itr, ++counter)
if (counter >= 10)
break;
GameObject* go = *itr;
if (!go->isSpawned())
continue;
Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 2.0f, 0.0f, 100);
if (cr2)
{
if (counter >= 10)
break;
GameObject* go = *itr;
if (!go->isSpawned())
continue;
Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 2.0f, 0.0f, 100);
if (cr2)
{
cr2->SetFaction(FACTION_MONSTER);
cr2->ReplaceAllUnitFlags(UNIT_FLAG_NONE);
GetCaster()->CastSpell(cr2, 38083, true);
}
go->SetLootState(GO_JUST_DEACTIVATED);
charmer->KilledMonsterCredit(21959);
cr2->SetFaction(FACTION_MONSTER);
cr2->ReplaceAllUnitFlags(UNIT_FLAG_NONE);
GetCaster()->CastSpell(cr2, SPELL_ROCKET_LAUNCHER, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
go->SetLootState(GO_JUST_DEACTIVATED);
charmer->KilledMonsterCredit(21959);
}
};
}
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10612_10613_the_fel_and_the_furious_SpellScript();
OnEffectHitTarget += SpellEffectFn(spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
class spell_q10563_q10596_to_legion_hold : public SpellScriptLoader
class spell_q10563_q10596_to_legion_hold_aura : public AuraScript
{
public:
spell_q10563_q10596_to_legion_hold() : SpellScriptLoader("spell_q10563_q10596_to_legion_hold") { }
PrepareAuraScript(spell_q10563_q10596_to_legion_hold_aura);
class spell_q10563_q10596_to_legion_hold_AuraScript : public AuraScript
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_q10563_q10596_to_legion_hold_AuraScript)
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
if (Player* player = GetTarget()->ToPlayer())
{
if (Player* player = GetTarget()->ToPlayer())
{
player->KilledMonsterCredit(21502);
player->SetControlled(false, UNIT_STATE_STUNNED);
}
player->KilledMonsterCredit(21502);
player->SetControlled(false, UNIT_STATE_STUNNED);
}
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
{
player->SetControlled(true, UNIT_STATE_STUNNED);
player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_q10563_q10596_to_legion_hold_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
return new spell_q10563_q10596_to_legion_hold_AuraScript();
if (Player* player = GetTarget()->ToPlayer())
{
player->SetControlled(true, UNIT_STATE_STUNNED);
player->SummonCreature(21633, -3311.13f, 2946.15f, 171.1f, 4.86f, TEMPSUMMON_TIMED_DESPAWN, 64000);
}
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_q10563_q10596_to_legion_hold_aura::HandleEffectApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_q10563_q10596_to_legion_hold_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -1833,8 +1821,8 @@ public:
void AddSC_shadowmoon_valley()
{
// Ours
new spell_q10612_10613_the_fel_and_the_furious();
new spell_q10563_q10596_to_legion_hold();
RegisterSpellScript(spell_q10612_10613_the_fel_and_the_furious);
RegisterSpellScript(spell_q10563_q10596_to_legion_hold_aura);
// Theirs
new npc_invis_infernal_caster();

View File

@@ -36,103 +36,81 @@ enum fumping
SPELL_SUMMON_HAISHULUD = 39248,
};
class spell_q10930_big_bone_worm : public SpellScriptLoader
class spell_q10930_big_bone_worm : public SpellScript
{
public:
spell_q10930_big_bone_worm() : SpellScriptLoader("spell_q10930_big_bone_worm") { }
PrepareSpellScript(spell_q10930_big_bone_worm);
class spell_q10930_big_bone_worm_SpellScript : public SpellScript
void SetDest(SpellDestination& dest)
{
PrepareSpellScript(spell_q10930_big_bone_worm_SpellScript);
void SetDest(SpellDestination& dest)
{
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10930_big_bone_worm_SpellScript::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_q10930_big_bone_worm_SpellScript();
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
class spell_q10930_big_bone_worm_AuraScript : public AuraScript
void Register() override
{
PrepareAuraScript(spell_q10930_big_bone_worm_AuraScript);
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_q10930_big_bone_worm_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_q10930_big_bone_worm_AuraScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10930_big_bone_worm::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
class spell_q10929_fumping : SpellScriptLoader
class spell_q10930_big_bone_worm_aura : public AuraScript
{
public:
spell_q10929_fumping() : SpellScriptLoader("spell_q10929_fumping") { }
PrepareAuraScript(spell_q10930_big_bone_worm_aura);
class spell_q10929_fumping_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10929_fumping_SpellScript);
void SetDest(SpellDestination& dest)
{
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10929_fumping_SpellScript::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_q10929_fumping_SpellScript();
return ValidateSpellInfo({ SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3 });
}
class spell_q10929_fumping_AuraScript : public AuraScript
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PrepareAuraScript(spell_q10929_fumping_AuraScript);
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_HAISHULUD, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_q10929_fumping_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
void Register() override
{
return new spell_q10929_fumping_AuraScript();
OnEffectRemove += AuraEffectRemoveFn(spell_q10930_big_bone_worm_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_q10929_fumping : public SpellScript
{
PrepareSpellScript(spell_q10929_fumping);
void SetDest(SpellDestination& dest)
{
Position const offset = { 0.5f, 0.5f, 5.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10929_fumping::SetDest, EFFECT_1, TARGET_DEST_CASTER);
}
};
class spell_q10929_fumping_aura : public AuraScript
{
PrepareAuraScript(spell_q10929_fumping_aura);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3 });
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_SUMMON_SAND_GNOME1, SPELL_SUMMON_SAND_GNOME3, SPELL_SUMMON_MATURE_BONE_SIFTER1, SPELL_SUMMON_MATURE_BONE_SIFTER3), true);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_q10929_fumping_aura::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -162,30 +140,19 @@ enum q10036Torgos
NPC_TORGOS = 18707
};
class spell_q10036_torgos : public SpellScriptLoader
class spell_q10036_torgos : public SpellScript
{
public:
spell_q10036_torgos() : SpellScriptLoader("spell_q10036_torgos") { }
PrepareSpellScript(spell_q10036_torgos);
class spell_q10036_torgos_SpellScript : public SpellScript
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
PrepareSpellScript(spell_q10036_torgos_SpellScript);
if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true))
torgos->GetAI()->AttackStart(GetCaster());
}
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
if (Creature* torgos = GetCaster()->FindNearestCreature(NPC_TORGOS, 100.0f, true))
torgos->GetAI()->AttackStart(GetCaster());
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_q10036_torgos_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10036_torgos_SpellScript();
OnEffectLaunch += SpellEffectFn(spell_q10036_torgos::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
@@ -198,114 +165,80 @@ enum eQ10923EvilDrawsNear
NPC_AUCHENAI_DEATH_SPIRIT = 21967
};
class spell_q10923_evil_draws_near_summon : public SpellScriptLoader
class spell_q10923_evil_draws_near_summon : public SpellScript
{
public:
spell_q10923_evil_draws_near_summon() : SpellScriptLoader("spell_q10923_evil_draws_near_summon") { }
PrepareSpellScript(spell_q10923_evil_draws_near_summon);
class spell_q10923_evil_draws_near_summon_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareSpellScript(spell_q10923_evil_draws_near_summon_SpellScript);
return ValidateSpellInfo({ SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA });
}
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true))
auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true);
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
SpellScript* GetSpellScript() const override
void HandleSendEvent(SpellEffIndex /*effIndex*/)
{
return new spell_q10923_evil_draws_near_summon_SpellScript();
if (Creature* auchenai = GetCaster()->FindNearestCreature(NPC_AUCHENAI_DEATH_SPIRIT, 10.0f, true))
auchenai->CastSpell(auchenai, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL_AURA, true);
}
void Register() override
{
OnEffectLaunch += SpellEffectFn(spell_q10923_evil_draws_near_summon::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT);
}
};
class spell_q10923_evil_draws_near_periodic : public SpellScriptLoader
class spell_q10923_evil_draws_near_periodic_aura : public AuraScript
{
public:
spell_q10923_evil_draws_near_periodic() : SpellScriptLoader("spell_q10923_evil_draws_near_periodic") { }
PrepareAuraScript(spell_q10923_evil_draws_near_periodic_aura);
class spell_q10923_evil_draws_near_periodic_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
PrepareAuraScript(spell_q10923_evil_draws_near_periodic_AuraScript);
return ValidateSpellInfo({ SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2 });
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_q10923_evil_draws_near_periodic_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
return new spell_q10923_evil_draws_near_periodic_AuraScript();
PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), RAND(SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL1, SPELL_DUSTIN_UNDEAD_DRAGON_VISUAL2), true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_q10923_evil_draws_near_periodic_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
class spell_q10923_evil_draws_near_visual : public SpellScriptLoader
class spell_q10923_evil_draws_near_visual : public SpellScript
{
public:
spell_q10923_evil_draws_near_visual() : SpellScriptLoader("spell_q10923_evil_draws_near_visual") { }
PrepareSpellScript(spell_q10923_evil_draws_near_visual);
class spell_q10923_evil_draws_near_visual_SpellScript : public SpellScript
void SetDest(SpellDestination& dest)
{
PrepareSpellScript(spell_q10923_evil_draws_near_visual_SpellScript);
// Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f };
dest.RelocateOffset(offset);
}
void SetDest(SpellDestination& dest)
{
// Adjust effect summon position
Position const offset = { 0.0f, 0.0f, 20.0f, 0.0f };
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10923_evil_draws_near_visual_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10923_evil_draws_near_visual_SpellScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10923_evil_draws_near_visual::SetDest, EFFECT_0, TARGET_DEST_CASTER_RADIUS);
}
};
class spell_q10898_skywing : public SpellScriptLoader
class spell_q10898_skywing : public SpellScript
{
public:
spell_q10898_skywing() : SpellScriptLoader("spell_q10898_skywing") { }
PrepareSpellScript(spell_q10898_skywing);
class spell_q10898_skywing_SpellScript : public SpellScript
void SetDest(SpellDestination& dest)
{
PrepareSpellScript(spell_q10898_skywing_SpellScript);
// Adjust effect summon position
Position const offset = { frand(-7.0f, 7.0f), frand(-7.0f, 7.0f), 11.0f, 0.0f };
dest.Relocate(*GetCaster());
dest.RelocateOffset(offset);
}
void SetDest(SpellDestination& dest)
{
// Adjust effect summon position
Position const offset = { frand(-7.0f, 7.0f), frand(-7.0f, 7.0f), 11.0f, 0.0f };
dest.Relocate(*GetCaster());
dest.RelocateOffset(offset);
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10898_skywing_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
SpellScript* GetSpellScript() const override
void Register() override
{
return new spell_q10898_skywing_SpellScript();
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_q10898_skywing::SetDest, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
@@ -701,14 +634,14 @@ public:
void AddSC_terokkar_forest()
{
// Ours
new spell_q10930_big_bone_worm();
new spell_q10929_fumping();
RegisterSpellAndAuraScriptPair(spell_q10930_big_bone_worm, spell_q10930_big_bone_worm_aura);
RegisterSpellAndAuraScriptPair(spell_q10929_fumping, spell_q10929_fumping_aura);
new npc_greatfather_aldrimus();
new spell_q10036_torgos();
new spell_q10923_evil_draws_near_summon();
new spell_q10923_evil_draws_near_periodic();
new spell_q10923_evil_draws_near_visual();
new spell_q10898_skywing();
RegisterSpellScript(spell_q10036_torgos);
RegisterSpellScript(spell_q10923_evil_draws_near_summon);
RegisterSpellScript(spell_q10923_evil_draws_near_periodic_aura);
RegisterSpellScript(spell_q10923_evil_draws_near_visual);
RegisterSpellScript(spell_q10898_skywing);
// Theirs
new npc_unkor_the_ruthless();