refactor(Scripts/AhnKahet): new script system (#9040)

This commit is contained in:
Kitzunu
2021-11-28 08:23:19 +01:00
committed by GitHub
parent 801a20fce2
commit 05a2d5baa8
7 changed files with 1619 additions and 1819 deletions
@@ -71,4 +71,7 @@ inline AI* GetAhnKahetAI(T* obj)
return GetInstanceAI<AI>(obj, AhnKahetScriptName); return GetInstanceAI<AI>(obj, AhnKahetScriptName);
} }
#define RegisterAhnKahetCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetAhnKahetAI)
#define RegisterAhnKahetGameObjectAI(ai_name) RegisterGameObjectAIWithFactory(ai_name, GetAhnKahetAI)
#endif // DEF_AHNKAHET_H #endif // DEF_AHNKAHET_H
@@ -99,16 +99,9 @@ Position const MushroomPositions[MAX_MUSHROOMS_COUNT] =
{ 398.2797f, -851.8694f, -68.84419f, 0.5759587f } { 398.2797f, -851.8694f, -68.84419f, 0.5759587f }
}; };
class boss_amanitar : public CreatureScript struct boss_amanitar : public BossAI
{ {
public: boss_amanitar(Creature* creature) : BossAI(creature, DATA_AMANITAR), mushroomsSummoned(false)
boss_amanitar() : CreatureScript("boss_amanitar")
{
}
struct boss_amanitarAI : public BossAI
{
boss_amanitarAI(Creature* creature) : BossAI(creature, DATA_AMANITAR), mushroomsSummoned(false)
{ {
creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
creature->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); creature->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE);
@@ -227,7 +220,7 @@ public:
} }
} }
private: private:
std::deque<Position> _mushroomsDeque; std::deque<Position> _mushroomsDeque;
bool mushroomsSummoned; bool mushroomsSummoned;
@@ -235,22 +228,11 @@ public:
{ {
me->SummonCreature(roll_chance_i(40) ? NPC_HEALTHY_MUSHROOM : NPC_POISONOUS_MUSHROOM, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 4000); me->SummonCreature(roll_chance_i(40) ? NPC_HEALTHY_MUSHROOM : NPC_POISONOUS_MUSHROOM, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 4000);
} }
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetAhnKahetAI<boss_amanitarAI>(creature);
}
}; };
class npc_amanitar_mushrooms : public CreatureScript struct npc_amanitar_mushrooms : public ScriptedAI
{ {
public: npc_amanitar_mushrooms(Creature* pCreature) : ScriptedAI(pCreature)
npc_amanitar_mushrooms() : CreatureScript("npc_amanitar_mushrooms") { }
struct npc_amanitar_mushroomsAI : public ScriptedAI
{
npc_amanitar_mushroomsAI(Creature* pCreature) : ScriptedAI(pCreature)
{ {
SetCombatMovement(false); SetCombatMovement(false);
@@ -336,25 +318,14 @@ public:
} }
} }
private: private:
EventMap events; EventMap events;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetAhnKahetAI<npc_amanitar_mushroomsAI>(creature);
}
}; };
// 57283 Remove Mushroom Power // 57283 Remove Mushroom Power
class spell_amanitar_remove_mushroom_power : public SpellScriptLoader class spell_amanitar_remove_mushroom_power : public AuraScript
{ {
public: PrepareAuraScript(spell_amanitar_remove_mushroom_power);
spell_amanitar_remove_mushroom_power() : SpellScriptLoader("spell_amanitar_remove_mushroom_power") { }
class spell_amanitar_remove_mushroom_power_AuraScript : public AuraScript
{
PrepareAuraScript(spell_amanitar_remove_mushroom_power_AuraScript);
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{ {
@@ -366,21 +337,15 @@ public:
void Register() override void Register() override
{ {
OnEffectApply += AuraEffectApplyFn(spell_amanitar_remove_mushroom_power_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); OnEffectApply += AuraEffectApplyFn(spell_amanitar_remove_mushroom_power::HandleApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_amanitar_remove_mushroom_power_AuraScript();
} }
}; };
void AddSC_boss_amanitar() void AddSC_boss_amanitar()
{ {
new boss_amanitar(); RegisterAhnKahetCreatureAI(boss_amanitar);
new npc_amanitar_mushrooms(); RegisterAhnKahetCreatureAI(npc_amanitar_mushrooms);
// Spells // Spells
new spell_amanitar_remove_mushroom_power(); RegisterSpellScript(spell_amanitar_remove_mushroom_power);
} }
@@ -69,14 +69,9 @@ enum Yells
EMOTE_HATCHES = 4 EMOTE_HATCHES = 4
}; };
class boss_elder_nadox : public CreatureScript struct boss_elder_nadox : public BossAI
{ {
public: boss_elder_nadox(Creature* creature) : BossAI(creature, DATA_PRINCE_TALDARAM),
boss_elder_nadox() : CreatureScript("boss_elder_nadox") { }
struct boss_elder_nadoxAI : public BossAI
{
boss_elder_nadoxAI(Creature* creature) : BossAI(creature, DATA_PRINCE_TALDARAM),
guardianSummoned(false), guardianSummoned(false),
respectYourElders(true) respectYourElders(true)
{ {
@@ -232,7 +227,7 @@ public:
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
private: private:
GuidList swarmEggs; GuidList swarmEggs;
GuidList guardianEggs; GuidList guardianEggs;
ObjectGuid previousSwarmEgg_GUID; // This will prevent casting summoning spells on same egg twice ObjectGuid previousSwarmEgg_GUID; // This will prevent casting summoning spells on same egg twice
@@ -299,22 +294,11 @@ public:
} }
} }
} }
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetAhnKahetAI<boss_elder_nadoxAI>(creature);
}
}; };
class npc_ahnkahar_nerubian : public CreatureScript struct npc_ahnkahar_nerubian : public ScriptedAI
{ {
public: npc_ahnkahar_nerubian(Creature* c) : ScriptedAI(c) { }
npc_ahnkahar_nerubian() : CreatureScript("npc_ahnkahar_nerubian") { }
struct npc_ahnkahar_nerubianAI : public ScriptedAI
{
npc_ahnkahar_nerubianAI(Creature* c) : ScriptedAI(c) { }
void Reset() override void Reset() override
{ {
@@ -338,24 +322,13 @@ public:
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
private: private:
uint32 uiSprintTimer; uint32 uiSprintTimer;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetAhnKahetAI<npc_ahnkahar_nerubianAI>(creature);
}
}; };
class spell_ahn_kahet_swarmer_aura : public SpellScriptLoader class spell_ahn_kahet_swarmer_aura : public SpellScript
{ {
public: PrepareSpellScript(spell_ahn_kahet_swarmer_aura)
spell_ahn_kahet_swarmer_aura() : SpellScriptLoader("spell_ahn_kahet_swarmer_aura") { }
class spell_ahn_kahet_swarmer_aura_SpellScript : public SpellScript
{
PrepareSpellScript(spell_ahn_kahet_swarmer_aura_SpellScript)
void CountTargets(std::list<WorldObject*>& targets) void CountTargets(std::list<WorldObject*>& targets)
{ {
@@ -391,14 +364,8 @@ public:
void Register() override void Register() override
{ {
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ahn_kahet_swarmer_aura_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ahn_kahet_swarmer_aura::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
OnEffectHitTarget += SpellEffectFn(spell_ahn_kahet_swarmer_aura_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); OnEffectHitTarget += SpellEffectFn(spell_ahn_kahet_swarmer_aura::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_ahn_kahet_swarmer_aura_SpellScript();
} }
}; };
@@ -417,11 +384,11 @@ class achievement_respect_your_elders : public AchievementCriteriaScript
void AddSC_boss_elder_nadox() void AddSC_boss_elder_nadox()
{ {
// Creatures // Creatures
new boss_elder_nadox(); RegisterAhnKahetCreatureAI(boss_elder_nadox);
new npc_ahnkahar_nerubian(); RegisterAhnKahetCreatureAI(npc_ahnkahar_nerubian);
// Spells // Spells
new spell_ahn_kahet_swarmer_aura(); RegisterSpellScript(spell_ahn_kahet_swarmer_aura);
// Achievements // Achievements
new achievement_respect_your_elders(); new achievement_respect_your_elders();
@@ -86,18 +86,12 @@ enum Events
const std::array<uint32, MAX_INSANITY_TARGETS> InsanitySpells = { SPELL_INSANITY_PHASING_1, SPELL_INSANITY_PHASING_2, SPELL_INSANITY_PHASING_3, SPELL_INSANITY_PHASING_4, SPELL_INSANITY_PHASING_5 }; const std::array<uint32, MAX_INSANITY_TARGETS> InsanitySpells = { SPELL_INSANITY_PHASING_1, SPELL_INSANITY_PHASING_2, SPELL_INSANITY_PHASING_3, SPELL_INSANITY_PHASING_4, SPELL_INSANITY_PHASING_5 };
class boss_volazj : public CreatureScript struct boss_volazj : public BossAI
{ {
public: boss_volazj(Creature* pCreature) : BossAI(pCreature, DATA_HERALD_VOLAZJ),
boss_volazj() : CreatureScript("boss_volazj") { }
struct boss_volazjAI : public BossAI
{
boss_volazjAI(Creature* pCreature) : BossAI(pCreature, DATA_HERALD_VOLAZJ),
insanityTimes(0), insanityTimes(0),
insanityPhase(false) insanityPhase(false)
{ { }
}
void InitializeAI() override void InitializeAI() override
{ {
@@ -277,7 +271,7 @@ public:
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
private: private:
uint8 insanityTimes; uint8 insanityTimes;
bool insanityPhase; // Indicates if boss enter to insanity phase bool insanityPhase; // Indicates if boss enter to insanity phase
@@ -345,23 +339,12 @@ public:
return false; return false;
} }
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetAhnKahetAI<boss_volazjAI>(creature);
}
}; };
// 57496 Insanity // 57496 Insanity
class spell_herald_volzaj_insanity : public SpellScriptLoader class spell_herald_volzaj_insanity : public SpellScript
{ {
public: PrepareSpellScript(spell_herald_volzaj_insanity);
spell_herald_volzaj_insanity() : SpellScriptLoader("spell_herald_volzaj_insanity") { }
class spell_herald_volzaj_insanity_SpellScript : public SpellScript
{
PrepareSpellScript(spell_herald_volzaj_insanity_SpellScript);
bool Load() override { return GetCaster()->GetTypeId() == TYPEID_UNIT; } bool Load() override { return GetCaster()->GetTypeId() == TYPEID_UNIT; }
@@ -452,14 +435,8 @@ public:
void Register() override void Register() override
{ {
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_herald_volzaj_insanity_SpellScript::HandleDummyEffect, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_herald_volzaj_insanity::HandleDummyEffect, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
AfterCast += SpellCastFn(spell_herald_volzaj_insanity_SpellScript::HandleAfterCast); AfterCast += SpellCastFn(spell_herald_volzaj_insanity::HandleAfterCast);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_herald_volzaj_insanity_SpellScript();
} }
}; };
@@ -470,14 +447,9 @@ public:
// 60295 Volazj Whisper: Slay 03 // 60295 Volazj Whisper: Slay 03
// 60296 Volazj Whisper: Death 01 // 60296 Volazj Whisper: Death 01
// 60297 Volazj Whisper: Death 02 // 60297 Volazj Whisper: Death 02
class spell_volazj_whisper : public SpellScriptLoader class spell_volazj_whisper : public SpellScript
{ {
public: PrepareSpellScript(spell_volazj_whisper);
spell_volazj_whisper() : SpellScriptLoader("spell_volazj_whisper") { }
class spell_volazj_whisper_SpellScript : public SpellScript
{
PrepareSpellScript(spell_volazj_whisper_SpellScript);
bool Validate(SpellInfo const* /*spell*/) override bool Validate(SpellInfo const* /*spell*/) override
{ {
@@ -521,19 +493,13 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_volazj_whisper_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); OnEffectHitTarget += SpellEffectFn(spell_volazj_whisper::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_volazj_whisper_SpellScript();
} }
}; };
void AddSC_boss_volazj() void AddSC_boss_volazj()
{ {
new boss_volazj(); RegisterAhnKahetCreatureAI(boss_volazj);
new spell_herald_volzaj_insanity(); RegisterSpellScript(spell_herald_volzaj_insanity);
new spell_volazj_whisper(); RegisterSpellScript(spell_volazj_whisper);
} }
@@ -150,20 +150,14 @@ const Position VolunteerSpotPositions[MAX_COMBAT_INITIATES][2] =
{ { 404.0797f, -783.829f, -31.59497f }, { 367.8631f, -722.5212f, -16.17974f } } { { 404.0797f, -783.829f, -31.59497f }, { 367.8631f, -722.5212f, -16.17974f } }
}; };
class boss_jedoga_shadowseeker : public CreatureScript struct boss_jedoga_shadowseeker : public BossAI
{ {
public: boss_jedoga_shadowseeker(Creature* pCreature) : BossAI(pCreature, DATA_JEDOGA_SHADOWSEEKER),
boss_jedoga_shadowseeker() : CreatureScript("boss_jedoga_shadowseeker") { }
struct boss_jedoga_shadowseekerAI : public BossAI
{
boss_jedoga_shadowseekerAI(Creature* pCreature) : BossAI(pCreature, DATA_JEDOGA_SHADOWSEEKER),
sayPreachTimer(120000), sayPreachTimer(120000),
combatSummonsSummoned(false), combatSummonsSummoned(false),
ritualTriggered(false), ritualTriggered(false),
volunteerWork(true) volunteerWork(true)
{ { }
}
// Disabled events // Disabled events
void MoveInLineOfSight(Unit* /*who*/) override {} void MoveInLineOfSight(Unit* /*who*/) override {}
@@ -525,7 +519,7 @@ public:
return 0; return 0;
} }
private: private:
GuidList oocSummons; GuidList oocSummons;
GuidList oocTriggers; GuidList oocTriggers;
ObjectGuid sacraficeTarget_GUID; ObjectGuid sacraficeTarget_GUID;
@@ -568,22 +562,11 @@ public:
oocSummons.clear(); oocSummons.clear();
} }
} }
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetAhnKahetAI<boss_jedoga_shadowseekerAI>(creature);
}
}; };
class npc_twilight_volunteer : public CreatureScript struct npc_twilight_volunteer : public ScriptedAI
{ {
public: npc_twilight_volunteer(Creature* pCreature) : ScriptedAI(pCreature),
npc_twilight_volunteer() : CreatureScript("npc_twilight_volunteer") { }
struct npc_twilight_volunteerAI : public ScriptedAI
{
npc_twilight_volunteerAI(Creature* pCreature) : ScriptedAI(pCreature),
pInstance(pCreature->GetInstanceScript()), pInstance(pCreature->GetInstanceScript()),
isSacraficeTarget(false) isSacraficeTarget(false)
{ {
@@ -678,27 +661,16 @@ public:
} }
} }
private: private:
InstanceScript* pInstance; InstanceScript* pInstance;
EventMap events; EventMap events;
bool isSacraficeTarget; bool isSacraficeTarget;
};
CreatureAI *GetAI(Creature *creature) const override
{
return GetAhnKahetAI<npc_twilight_volunteerAI>(creature);
}
}; };
// 56328 - Random Lightning Visual Effect // 56328 - Random Lightning Visual Effect
class spell_random_lightning_visual_effect : public SpellScriptLoader class spell_random_lightning_visual_effect : public SpellScript
{ {
public: PrepareSpellScript(spell_random_lightning_visual_effect);
spell_random_lightning_visual_effect() : SpellScriptLoader("spell_random_lightning_visual_effect") { }
class spell_random_lightning_visual_effect_SpellScript : public SpellScript
{
PrepareSpellScript(spell_random_lightning_visual_effect_SpellScript);
void ModDestHeight(SpellDestination& dest) void ModDestHeight(SpellDestination& dest)
{ {
@@ -708,25 +680,14 @@ class spell_random_lightning_visual_effect : public SpellScriptLoader
void Register() override void Register() override
{ {
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_random_lightning_visual_effect_SpellScript::ModDestHeight, EFFECT_0, TARGET_DEST_CASTER_RANDOM); OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_random_lightning_visual_effect::ModDestHeight, EFFECT_0, TARGET_DEST_CASTER_RANDOM);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_random_lightning_visual_effect_SpellScript();
} }
}; };
// 56150 - Sacrifice Beam // 56150 - Sacrifice Beam
class spell_jedoga_sacrafice_beam : public SpellScriptLoader class spell_jedoga_sacrafice_beam : public AuraScript
{ {
public: PrepareAuraScript(spell_jedoga_sacrafice_beam);
spell_jedoga_sacrafice_beam() : SpellScriptLoader("spell_jedoga_sacrafice_beam") { }
class spell_jedoga_sacrafice_beam_AuraScript : public AuraScript
{
PrepareAuraScript(spell_jedoga_sacrafice_beam_AuraScript);
bool Load() override bool Load() override
{ {
@@ -744,13 +705,7 @@ class spell_jedoga_sacrafice_beam : public SpellScriptLoader
void Register() override void Register() override
{ {
AfterEffectRemove += AuraEffectRemoveFn(spell_jedoga_sacrafice_beam_AuraScript::HandleRemoval, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_jedoga_sacrafice_beam::HandleRemoval, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_jedoga_sacrafice_beam_AuraScript();
} }
}; };
@@ -776,12 +731,12 @@ class achievement_volunteer_work : public AchievementCriteriaScript
void AddSC_boss_jedoga_shadowseeker() void AddSC_boss_jedoga_shadowseeker()
{ {
// Creatures // Creatures
new boss_jedoga_shadowseeker(); RegisterAhnKahetCreatureAI(boss_jedoga_shadowseeker);
new npc_twilight_volunteer(); RegisterAhnKahetCreatureAI(npc_twilight_volunteer);
// Spells // Spells
new spell_random_lightning_visual_effect(); RegisterSpellScript(spell_random_lightning_visual_effect);
new spell_jedoga_sacrafice_beam(); RegisterSpellScript(spell_jedoga_sacrafice_beam);
// Achievements // Achievements
new achievement_volunteer_work(); new achievement_volunteer_work();
@@ -93,14 +93,9 @@ constexpr float DATA_GROUND_POSITION_Z = 11.308135f;
constexpr float DATA_SPHERE_DISTANCE = 25.0f; constexpr float DATA_SPHERE_DISTANCE = 25.0f;
#define DATA_SPHERE_ANGLE_OFFSET float(M_PI) / 2.0f #define DATA_SPHERE_ANGLE_OFFSET float(M_PI) / 2.0f
class npc_taldaram_flamesphere : public CreatureScript struct npc_taldaram_flamesphere : public NullCreatureAI
{ {
public: npc_taldaram_flamesphere(Creature *pCreature) : NullCreatureAI(pCreature),
npc_taldaram_flamesphere() : CreatureScript("npc_taldaram_flamesphere") { }
struct npc_taldaram_flamesphereAI : public NullCreatureAI
{
npc_taldaram_flamesphereAI(Creature *pCreature) : NullCreatureAI(pCreature),
instance(pCreature->GetInstanceScript()), instance(pCreature->GetInstanceScript()),
uiDespawnTimer(13000), uiDespawnTimer(13000),
moveTimer(0) moveTimer(0)
@@ -198,29 +193,16 @@ public:
victimPos.Relocate(pos); victimPos.Relocate(pos);
} }
private: private:
Position victimPos; Position victimPos;
InstanceScript* instance; InstanceScript* instance;
uint32 uiDespawnTimer; uint32 uiDespawnTimer;
uint32 moveTimer; uint32 moveTimer;
};
CreatureAI *GetAI(Creature *creature) const override
{
return GetAhnKahetAI<npc_taldaram_flamesphereAI>(creature);
}
}; };
class boss_taldaram : public CreatureScript struct boss_taldaram : public BossAI
{ {
public: boss_taldaram(Creature* pCreature) : BossAI(pCreature, DATA_PRINCE_TALDARAM),
boss_taldaram() : CreatureScript("boss_taldaram")
{
}
struct boss_taldaramAI : public BossAI
{
boss_taldaramAI(Creature* pCreature) : BossAI(pCreature, DATA_PRINCE_TALDARAM),
vanishDamage(0) vanishDamage(0)
{ {
} }
@@ -363,7 +345,7 @@ public:
case NPC_FLAME_SPHERE_2: case NPC_FLAME_SPHERE_2:
case NPC_FLAME_SPHERE_3: case NPC_FLAME_SPHERE_3:
{ {
if (npc_taldaram_flamesphere::npc_taldaram_flamesphereAI* summonAI = dynamic_cast<npc_taldaram_flamesphere::npc_taldaram_flamesphereAI*>(summon->AI())) if (npc_taldaram_flamesphere* summonAI = dynamic_cast<npc_taldaram_flamesphere*>(summon->AI()))
{ {
summonAI->SetVictimPos(victimSperePos); summonAI->SetVictimPos(victimSperePos);
} }
@@ -491,7 +473,7 @@ public:
} }
} }
private: private:
Position victimSperePos; Position victimSperePos;
ObjectGuid vanishTarget_GUID; ObjectGuid vanishTarget_GUID;
uint32 vanishDamage; uint32 vanishDamage;
@@ -504,27 +486,22 @@ public:
vanishTarget_GUID.Clear(); vanishTarget_GUID.Clear();
vanishDamage = 0; vanishDamage = 0;
} }
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetAhnKahetAI<boss_taldaramAI>(creature);
}
}; };
// TODO: Turn into new script type when Gossips have been updated
class go_prince_taldaram_sphere : public GameObjectScript class go_prince_taldaram_sphere : public GameObjectScript
{ {
public: public:
go_prince_taldaram_sphere() : GameObjectScript("go_prince_taldaram_sphere") { } go_prince_taldaram_sphere() : GameObjectScript("go_prince_taldaram_sphere") {}
bool OnGossipHello(Player* pPlayer, GameObject *go) override bool OnGossipHello(Player* pPlayer, GameObject* go) override
{ {
if (pPlayer && pPlayer->IsInCombat()) if (pPlayer && pPlayer->IsInCombat())
{ {
return true; return true;
} }
InstanceScript *pInstance = go->GetInstanceScript(); InstanceScript* pInstance = go->GetInstanceScript();
if (!pInstance) if (!pInstance)
{ {
return true; return true;
@@ -550,14 +527,9 @@ public:
}; };
// 55931 - Conjure Flame Sphere // 55931 - Conjure Flame Sphere
class spell_prince_taldaram_conjure_flame_sphere : public SpellScriptLoader class spell_prince_taldaram_conjure_flame_sphere : public SpellScript
{ {
public: PrepareSpellScript(spell_prince_taldaram_conjure_flame_sphere);
spell_prince_taldaram_conjure_flame_sphere() : SpellScriptLoader("spell_prince_taldaram_conjure_flame_sphere") { }
class spell_prince_taldaram_conjure_flame_sphere_SpellScript : public SpellScript
{
PrepareSpellScript(spell_prince_taldaram_conjure_flame_sphere_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override bool Validate(SpellInfo const* /*spellInfo*/) override
{ {
@@ -583,25 +555,14 @@ public:
void Register() override void Register() override
{ {
OnEffectHitTarget += SpellEffectFn(spell_prince_taldaram_conjure_flame_sphere_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); OnEffectHitTarget += SpellEffectFn(spell_prince_taldaram_conjure_flame_sphere::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_prince_taldaram_conjure_flame_sphere_SpellScript();
} }
}; };
// 55895, 59511, 59512 - Flame Sphere Summon // 55895, 59511, 59512 - Flame Sphere Summon
class spell_prince_taldaram_flame_sphere_summon : public SpellScriptLoader class spell_prince_taldaram_flame_sphere_summon : public SpellScript
{ {
public: PrepareSpellScript(spell_prince_taldaram_flame_sphere_summon);
spell_prince_taldaram_flame_sphere_summon() : SpellScriptLoader("spell_prince_taldaram_flame_sphere_summon") { }
class spell_prince_taldaram_flame_sphere_summon_SpellScript : public SpellScript
{
PrepareSpellScript(spell_prince_taldaram_flame_sphere_summon_SpellScript);
void SetDest(SpellDestination& dest) void SetDest(SpellDestination& dest)
{ {
@@ -610,23 +571,17 @@ class spell_prince_taldaram_flame_sphere_summon : public SpellScriptLoader
void Register() override void Register() override
{ {
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_prince_taldaram_flame_sphere_summon_SpellScript::SetDest, EFFECT_0, TARGET_DEST_CASTER); OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_prince_taldaram_flame_sphere_summon::SetDest, EFFECT_0, TARGET_DEST_CASTER);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_prince_taldaram_flame_sphere_summon_SpellScript();
} }
}; };
void AddSC_boss_taldaram() void AddSC_boss_taldaram()
{ {
new npc_taldaram_flamesphere(); RegisterAhnKahetCreatureAI(npc_taldaram_flamesphere);
new boss_taldaram(); RegisterAhnKahetCreatureAI(boss_taldaram);
new go_prince_taldaram_sphere(); new go_prince_taldaram_sphere();
// Spells // Spells
new spell_prince_taldaram_conjure_flame_sphere(); RegisterSpellScript(spell_prince_taldaram_conjure_flame_sphere);
new spell_prince_taldaram_flame_sphere_summon(); RegisterSpellScript(spell_prince_taldaram_flame_sphere_summon);
} }
@@ -257,14 +257,9 @@ public:
// 56702 Shadow Sickle // 56702 Shadow Sickle
// 59103 Shadow Sickle // 59103 Shadow Sickle
class spell_shadow_sickle_periodic_damage : public SpellScriptLoader class spell_shadow_sickle_periodic_damage : public AuraScript
{ {
public: PrepareAuraScript(spell_shadow_sickle_periodic_damage);
spell_shadow_sickle_periodic_damage() : SpellScriptLoader("spell_shadow_sickle_periodic_damage") { }
class spell_shadow_sickle_periodic_damage_AuraScript : public AuraScript
{
PrepareAuraScript(spell_shadow_sickle_periodic_damage_AuraScript);
void HandlePeriodic(AuraEffect const* /*aurEff*/) void HandlePeriodic(AuraEffect const* /*aurEff*/)
{ {
@@ -273,18 +268,12 @@ public:
void Register() override void Register() override
{ {
OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadow_sickle_periodic_damage_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); OnEffectPeriodic += AuraEffectPeriodicFn(spell_shadow_sickle_periodic_damage::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_shadow_sickle_periodic_damage_AuraScript();
} }
}; };
void AddSC_instance_ahnkahet() void AddSC_instance_ahnkahet()
{ {
new instance_ahnkahet; new instance_ahnkahet;
new spell_shadow_sickle_periodic_damage(); RegisterSpellScript(spell_shadow_sickle_periodic_damage);
} }