fix(Core): Boss encounter disengage improvement (#4954)

This commit is contained in:
Cláudio Costa
2021-04-06 13:15:56 +01:00
committed by GitHub
parent c0cb2eae38
commit 042cec82f4
2 changed files with 53 additions and 17 deletions

View File

@@ -216,6 +216,10 @@ public:
bool bAchievCoolestFriends{ true };
uint16 addSpawnTimer{ 0 };
// Used to make Hodir disengage whenever he leaves his room
const Position ENTRANCE_DOOR{ 1999.160034f, -297.792999f, 431.960999f, 0 };
const Position EXIT_DOOR{ 1999.709961f, -166.259003f, 432.822998f, 0 };
void Reset() override
{
events.Reset();
@@ -369,22 +373,12 @@ public:
}
}
bool IsInRoom()
{
// Calculate the distance between his home position to the gate
if (me->GetExactDist(me->GetHomePosition().GetPositionX(),
me->GetHomePosition().GetPositionY(),
me->GetHomePosition().GetPositionZ()) > 80.0f)
{
EnterEvadeMode();
return false;
}
return true;
}
void UpdateAI(uint32 diff) override
{
if (!IsInRoom()) { return; }
if (!IsInRoom(&ENTRANCE_DOOR, Axis::AXIS_Y, false) || !IsInRoom(&EXIT_DOOR, Axis::AXIS_Y, true))
{
return;
}
if (!UpdateVictim())
{
@@ -398,9 +392,6 @@ public:
return;
}
if( !berserk && (me->GetPositionX() < 1940.0f || me->GetPositionX() > 2070.0f || me->GetPositionY() < -300.0f || me->GetPositionY() > -155.0f) )
events.RescheduleEvent(EVENT_BERSERK, 1);
events.Update(diff);
if( me->HasUnitState(UNIT_STATE_CASTING) )