Merge branch '3.3.5-bossboundary' into 3.3.5-base (PR #16089)
(cherry picked from commit 5b8b8c653039ec2add0b3a66468abb85e6f35054)
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "AreaBoundary.h"
|
||||
|
||||
// Spell summary for ScriptedAI::SelectSpell
|
||||
struct TSpellSummary
|
||||
@@ -98,7 +99,6 @@ bool SummonList::HasEntry(uint32 entry) const
|
||||
|
||||
ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature),
|
||||
IsFleeing(false),
|
||||
_evadeCheckCooldown(2500),
|
||||
_isCombatMovementAllowed(true)
|
||||
{
|
||||
_isHeroic = me->GetMap()->IsHeroic();
|
||||
@@ -394,7 +394,7 @@ enum NPCs
|
||||
|
||||
// Hacklike storage used for misc creatures that are expected to evade of outside of a certain area.
|
||||
// It is assumed the information is found elswehere and can be handled by the core. So far no luck finding such information/way to extract it.
|
||||
bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
|
||||
/*bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
|
||||
{
|
||||
if (_evadeCheckCooldown <= diff)
|
||||
_evadeCheckCooldown = 2500;
|
||||
@@ -438,15 +438,16 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
|
||||
|
||||
EnterEvadeMode();
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
// BossAI - for instanced bosses
|
||||
BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature),
|
||||
instance(creature->GetInstanceScript()),
|
||||
summons(creature),
|
||||
_boundary(instance ? instance->GetBossBoundary(bossId) : NULL),
|
||||
_bossId(bossId)
|
||||
{
|
||||
if (instance)
|
||||
SetBoundary(instance->GetBossBoundary(bossId));
|
||||
scheduler.SetValidator([this]
|
||||
{
|
||||
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||
@@ -483,7 +484,7 @@ void BossAI::_EnterCombat()
|
||||
// bosses do not respawn, check only on enter combat
|
||||
if (!instance->CheckRequiredBosses(_bossId))
|
||||
{
|
||||
EnterEvadeMode();
|
||||
EnterEvadeMode(EVADE_REASON_SEQUENCE_BREAK);
|
||||
return;
|
||||
}
|
||||
instance->SetBossState(_bossId, IN_PROGRESS);
|
||||
@@ -507,55 +508,6 @@ void BossAI::TeleportCheaters()
|
||||
target->NearTeleportTo(x, y, z, 0);
|
||||
}
|
||||
|
||||
bool BossAI::CheckBoundary(Unit* who)
|
||||
{
|
||||
if (!GetBoundary() || !who)
|
||||
return true;
|
||||
|
||||
for (BossBoundaryMap::const_iterator itr = GetBoundary()->begin(); itr != GetBoundary()->end(); ++itr)
|
||||
{
|
||||
switch (itr->first)
|
||||
{
|
||||
case BOUNDARY_N:
|
||||
if (who->GetPositionX() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_S:
|
||||
if (who->GetPositionX() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_E:
|
||||
if (who->GetPositionY() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_W:
|
||||
if (who->GetPositionY() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_NW:
|
||||
if (who->GetPositionX() + who->GetPositionY() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_SE:
|
||||
if (who->GetPositionX() + who->GetPositionY() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_NE:
|
||||
if (who->GetPositionX() - who->GetPositionY() > itr->second)
|
||||
return false;
|
||||
break;
|
||||
case BOUNDARY_SW:
|
||||
if (who->GetPositionX() - who->GetPositionY() < itr->second)
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BossAI::JustSummoned(Creature* summon)
|
||||
{
|
||||
summons.Summon(summon);
|
||||
|
||||
Reference in New Issue
Block a user