fix(Core): Crashfix. (#11490)

* fix(Core): Crashfix.

* Update.
This commit is contained in:
UltraNix
2022-04-23 16:32:09 +02:00
committed by GitHub
parent d0a4df2869
commit 385176f434
4 changed files with 87 additions and 51 deletions
@@ -661,7 +661,7 @@ enum BG_AV_CreaturePlace
AV_CPLACE_MAX = 321,
AV_CPLACE_A_BOSS = 381,
AV_CPLACE_H_BOSS = 445
AV_CPLACE_H_BOSS = 443
};
//x, y, z, o
@@ -103,6 +103,7 @@ public:
events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
_hasAura = false;
_attacked = false;
}
void JustRespawned() override
@@ -114,6 +115,10 @@ public:
{
ScriptedAI::AttackStart(victim);
if (!_attacked)
{
_attacked = true;
// Boss should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
@@ -129,11 +134,16 @@ public:
}
}
}
}
void EnterEvadeMode(EvadeReason why) override
{
ScriptedAI::EnterEvadeMode(why);
if (_attacked)
{
_attacked = false;
// Evade boss
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
@@ -149,6 +159,7 @@ public:
}
}
}
}
void UpdateAI(uint32 diff) override
{
@@ -214,6 +225,7 @@ public:
private:
EventMap events;
bool _hasAura;
bool _attacked;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -54,6 +54,7 @@ public:
uint32 FrenzyTimer;
uint32 YellTimer;
uint32 ResetTimer;
bool Attacked;
void Reset() override
{
@@ -63,6 +64,7 @@ public:
FrenzyTimer = 6 * IN_MILLISECONDS;
ResetTimer = 5 * IN_MILLISECONDS;
YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); //20 to 30 seconds
Attacked = false;
}
void EnterCombat(Unit* /*who*/) override
@@ -80,6 +82,10 @@ public:
{
ScriptedAI::AttackStart(victim);
if (!Attacked)
{
Attacked = true;
// Mini bosses should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
@@ -98,11 +104,16 @@ public:
}
}
}
}
void EnterEvadeMode(EvadeReason why) override
{
ScriptedAI::EnterEvadeMode(why);
if (Attacked)
{
Attacked = false;
// Evade mini bosses
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
@@ -121,6 +132,7 @@ public:
}
}
}
}
void UpdateAI(uint32 diff) override
{
@@ -50,6 +50,7 @@ public:
uint32 StormboltTimer;
uint32 ResetTimer;
uint32 YellTimer;
bool Attacked;
void Reset() override
{
@@ -58,6 +59,7 @@ public:
StormboltTimer = 6 * IN_MILLISECONDS;
ResetTimer = 5 * IN_MILLISECONDS;
YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS);
Attacked = false;
}
void EnterCombat(Unit* /*who*/) override
@@ -69,6 +71,10 @@ public:
{
ScriptedAI::AttackStart(victim);
if (!Attacked)
{
Attacked = true;
// Mini bosses should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
@@ -87,11 +93,16 @@ public:
}
}
}
}
void EnterEvadeMode(EvadeReason why) override
{
ScriptedAI::EnterEvadeMode(why);
if (Attacked)
{
Attacked = false;
// Evade mini bosses
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
@@ -110,6 +121,7 @@ public:
}
}
}
}
void UpdateAI(uint32 diff) override
{