refactor(Scripts/ZulAman): Move Amani Hatchling to SAI (#20589)

This commit is contained in:
Andrew
2024-11-16 12:20:56 -03:00
committed by GitHub
parent 829624bee8
commit 4948197014
4 changed files with 30 additions and 42 deletions

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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