Fixed onyxia whelp spawns

Whelps will now spawn at mouth cave entrances on spam. Will also auto attack nearest player.
This commit is contained in:
Dinkledork
2023-08-21 00:57:06 -06:00
committed by GitHub
parent 6bef854580
commit f02a6f5bdd

View File

@@ -116,6 +116,7 @@ enum Yells
SAY_EVADE = 5
};
class boss_onyxia_40 : public CreatureScript
{
public:
@@ -209,11 +210,8 @@ public:
void JustSummoned(Creature* summon) override
{
if (summon->GetEntry() != NPC_ONYXIAN_WHELP && summon->GetEntry() != NPC_ONYXIAN_LAIR_GUARD)
if (summon->GetEntry() == NPC_ONYXIAN_WHELP || summon->GetEntry() == NPC_ONYXIAN_LAIR_GUARD)
{
return;
}
if (Unit* target = summon->SelectNearestTarget(300.0f))
{
summon->AI()->AttackStart(target);
@@ -222,6 +220,7 @@ public:
summons.Summon(summon);
}
}
void MovementInform(uint32 type, uint32 id) override
{
@@ -275,11 +274,29 @@ public:
whelpSpamTimer -= diff;
if (whelpSpamTimer <= 0)
{
float angle = rand_norm() * 2 * M_PI;
float dist = rand_norm() * 4.0f;
me->CastSpell(-33.18f + cos(angle) * dist, -258.80f + sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true);
me->CastSpell(-32.535f + cos(angle) * dist, -170.190f + sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true);
whelpCount += 2;
// Coordinates for the cave mouths
float caveMouths[2][3] = {
{-31.71, -170.55, -89.72},
{-32.086, -258.55, -89.72},
};
// Randomly select one of the cave mouths for spawning
uint8 selectedCave = urand(0, 1);
// Summon a whelp at the selected cave mouth
Creature* whelp = me->SummonCreature(NPC_ONYXIAN_WHELP, caveMouths[selectedCave][0], caveMouths[selectedCave][1], caveMouths[selectedCave][2], 0);
if (whelp)
{
// Find the nearest player and attack
if (Unit* target = whelp->SelectNearestTarget(300.0f))
{
whelp->AI()->AttackStart(target);
}
}
// Increment the whelp count and reset the timer
whelpCount += 1;
whelpSpamTimer += 600;
}
}
@@ -292,6 +309,7 @@ public:
}
}
bool CheckInRoom() override
{
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f)