diff options
author | Andrew <47818697+Nyeriah@users.noreply.github.com> | 2024-11-16 12:20:56 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-16 12:20:56 -0300 |
commit | 4948197014f0636761c12d153a34ad4776a1cb64 (patch) | |
tree | 826108d8cc84e9bf5a109e8d0e294e263b8c58f6 /src | |
parent | 829624bee8b72b529f1e087b9063375a99997e05 (diff) |
refactor(Scripts/ZulAman): Move Amani Hatchling to SAI (#20589)
Diffstat (limited to 'src')
3 files changed, 24 insertions, 42 deletions
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index ae7651914e..7a192f0c2c 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -65,7 +65,6 @@ enum Spells enum Creatures { NPC_AMANI_HATCHER = 23818, - NPC_HATCHLING = 23598, // 42493 NPC_EGG = 23817, NPC_FIRE_BOMB = 23920 }; @@ -153,6 +152,19 @@ struct boss_janalai : public BossAI BossAI::JustDied(killer); } + void JustSummoned(Creature* summon) override + { + if (summon->GetEntry() == NPC_AMANI_HATCHLING) + { + if (summon->GetPositionY() > 1150) + summon->GetMotionMaster()->MovePoint(0, hatcherway[0][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[0][3].GetPositionY()); + else + summon->GetMotionMaster()->MovePoint(0, hatcherway[1][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[1][3].GetPositionY()); + } + + BossAI::JustSummoned(summon); + } + void DamageDealt(Unit* target, uint32& damage, DamageEffectType /*damagetype*/) override { if (_isFlameBreathing) @@ -211,11 +223,7 @@ struct boss_janalai : public BossAI for (Creature* egg : eggList) egg->Respawn(); - std::list<Creature* > hatchlingList; - me->GetCreaturesWithEntryInRange(hatchlingList, 100.0f, NPC_HATCHLING); - for (Creature* hatchling : hatchlingList) - hatchling->DespawnOrUnsummon(); - hatchlingList.clear(); + summons.DespawnEntry(NPC_AMANI_HATCHLING); } else if (hatchAction == HATCH_ALL) DoCastSelf(SPELL_HATCH_EGG_ALL); @@ -390,43 +398,8 @@ private: bool _isHatching; }; -struct npc_janalai_hatchling : public ScriptedAI -{ - npc_janalai_hatchling(Creature* creature) : ScriptedAI(creature) { } - - void Reset() override - { - scheduler.CancelAll(); - if (me->GetPositionY() > 1150) - me->GetMotionMaster()->MovePoint(0, hatcherway[0][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[0][3].GetPositionY()); - else - me->GetMotionMaster()->MovePoint(0, hatcherway[1][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[1][3].GetPositionY()); - - me->SetInCombatWithZone(); - } - - void JustEngagedWith(Unit* who) override - { - ScriptedAI::JustEngagedWith(who); - ScheduleTimedEvent(7s, [&]{ - DoCastVictim(SPELL_FLAMEBUFFET); - }, 10s); - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } -}; - void AddSC_boss_janalai() { RegisterZulAmanCreatureAI(boss_janalai); RegisterZulAmanCreatureAI(npc_janalai_hatcher); - RegisterZulAmanCreatureAI(npc_janalai_hatchling); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index bc2bbbde75..e402fb189a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -58,6 +58,7 @@ DoorData const doorData[] = ObjectData const creatureData[] = { + { NPC_JANALAI, DATA_JANALAI }, { NPC_SPIRIT_LYNX, DATA_SPIRIT_LYNX }, { NPC_HARRISON_JONES, DATA_HARRISON_JONES }, { 0, 0 } @@ -71,6 +72,12 @@ ObjectData const gameObjectData[] = { 0, 0 } }; +ObjectData const summonData[] = +{ + { NPC_AMANI_HATCHLING, DATA_JANALAI }, + { 0, 0 } +}; + BossBoundaryData const boundaries = { { DATA_HEXLORD, new RectangleBoundary(80.50557f, 920.9858f, 155.88986f, 1015.27563f)} @@ -93,6 +100,7 @@ public: LoadObjectData(creatureData, gameObjectData); LoadBossBoundaries(boundaries); LoadDoorData(doorData); + LoadSummonData(summonData); for (uint8 i = 0; i < RAND_VENDOR; ++i) RandVendor[i] = NOT_STARTED; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h index 4da0ed8cd4..843198c065 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h @@ -53,7 +53,8 @@ enum CreatureIds NPC_AMANISHI_WARBRINGER = 23580, NPC_AMANISHI_TRIBESMAN = 23582, NPC_AMANISHI_MEDICINE_MAN = 23581, - NPC_AMANISHI_AXE_THROWER = 23542 + NPC_AMANISHI_AXE_THROWER = 23542, + NPC_AMANI_HATCHLING = 23598 // 42493 }; enum GameobjectIds |