Skip to content

Commit

Permalink
fix(Scripts/OnyxiasLair): Force Onyxia to enter evade mode if pulled …
Browse files Browse the repository at this point in the history
…out of her room (#10890)
  • Loading branch information
Nyeriah committed Mar 7, 2022
1 parent fd2a18a commit d835832
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
5 changes: 5 additions & 0 deletions data/sql/updates/pending_db_world/rev_1646326494303486400.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1646326494303486400');

DELETE FROM `creature_text` WHERE `CreatureID` = 10184 AND `GroupID` = 5;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(10184, 5, 0, 'You seek to lure me from my clutch? You shall pay for your insolence!', 14, 0, 100, 0, 0, 0, 8570, 0, 'Onyxia - Boundary Evade');
29 changes: 24 additions & 5 deletions src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,12 @@ static sOnyxMove OnyxiaMoveData[] =

enum Yells
{
// Say
SAY_AGGRO = 0,
SAY_KILL = 1,
SAY_PHASE_2_TRANS = 2,
SAY_PHASE_3_TRANS = 3,

// Emote
EMOTE_BREATH = 4
EMOTE_BREATH = 4,
SAY_EVADE = 5
};

struct boss_onyxia : public BossAI
Expand Down Expand Up @@ -187,6 +185,8 @@ struct boss_onyxia : public BossAI
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); // just in case at reset some players already left the instance
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
BossAI::EnterCombat(who);

me->SummonCreature(NPC_ONYXIAN_LAIR_GUARD, -167.837936f, -200.549332f, -66.343231f, 5.598287f, TEMPSUMMON_MANUAL_DESPAWN);
}

void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override
Expand All @@ -204,11 +204,18 @@ struct boss_onyxia : public BossAI

void JustSummoned(Creature* summon) override
{
summons.Summon(summon);

if (summon->GetEntry() != NPC_ONYXIAN_WHELP && summon->GetEntry() != NPC_ONYXIAN_LAIR_GUARD)
{
return;
}

if (summon->GetEntry() == NPC_ONYXIAN_LAIR_GUARD && Phase != PHASE_LANDED)
{
return;
}

if (Unit* target = summon->SelectNearestTarget(300.0f))
{
summon->AI()->AttackStart(target);
Expand Down Expand Up @@ -287,9 +294,21 @@ struct boss_onyxia : public BossAI
}
}

bool CheckInRoom()
{
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f)
{
Talk(SAY_EVADE);
EnterEvadeMode();
return false;
}

return true;
}

void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
if (!UpdateVictim() || !CheckInRoom())
{
return;
}
Expand Down

0 comments on commit d835832

Please sign in to comment.