aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2016-01-13 15:33:17 +0100
committertreeston <treeston.mmoc@gmail.com>2016-01-13 15:33:17 +0100
commit5b8b8c653039ec2add0b3a66468abb85e6f35054 (patch)
tree0fcfd3ec94cf65ed004d2f1025f8954b7421455a /src/server/game/AI/ScriptedAI
parentcc3a4e0948ab28bf1aebc0a6eaa0b2ab96c815bd (diff)
parent2da458c56d024aac04468ce2af454a83ad790bf6 (diff)
Merge branch '3.3.5-bossboundary' into 3.3.5-base (PR #16089)
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp60
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h15
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h2
6 files changed, 10 insertions, 73 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index f6022adf6b5..8a1be33cc2b 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -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();
@@ -405,7 +405,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;
@@ -449,15 +449,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);
@@ -494,7 +495,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);
@@ -518,55 +519,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);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index fec1dcb43c9..448ddc7dc73 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -263,8 +263,6 @@ struct ScriptedAI : public CreatureAI
void SetCombatMovement(bool allowMovement);
bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; }
- bool EnterEvadeIfOutOfCombatArea(uint32 const diff);
-
// return true for heroic mode. i.e.
// - for dungeon in mode 10-heroic,
// - for raid in mode 10-Heroic
@@ -332,7 +330,6 @@ struct ScriptedAI : public CreatureAI
private:
Difficulty _difficulty;
- uint32 _evadeCheckCooldown;
bool _isCombatMovementAllowed;
bool _isHeroic;
};
@@ -344,7 +341,6 @@ class BossAI : public ScriptedAI
virtual ~BossAI() { }
InstanceScript* const instance;
- BossBoundaryMap const* GetBoundary() const { return _boundary; }
void JustSummoned(Creature* summon) override;
void SummonedCreatureDespawn(Creature* summon) override;
@@ -370,16 +366,6 @@ class BossAI : public ScriptedAI
void _JustDied();
void _JustReachedHome() { me->setActive(false); }
- virtual bool CheckInRoom()
- {
- if (CheckBoundary(me))
- return true;
-
- EnterEvadeMode();
- return false;
- }
-
- bool CheckBoundary(Unit* who);
void TeleportCheaters();
EventMap events;
@@ -387,7 +373,6 @@ class BossAI : public ScriptedAI
TaskScheduler scheduler;
private:
- BossBoundaryMap const* const _boundary;
uint32 const _bossId;
};
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 70c44f6fe90..68cb8d346d0 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -184,7 +184,7 @@ void npc_escortAI::ReturnToLastPoint()
me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z);
}
-void npc_escortAI::EnterEvadeMode()
+void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->RemoveAllAuras();
me->DeleteThreatList();
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 3b7428e2b9e..673f3e671a0 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -66,7 +66,7 @@ struct npc_escortAI : public ScriptedAI
void ReturnToLastPoint();
- void EnterEvadeMode() override;
+ void EnterEvadeMode(EvadeReason /*why*/ = EVADE_REASON_OTHER) override;
void UpdateAI(uint32 diff) override; // the "internal" update, calls UpdateEscortAI()
virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc)
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 40c404933a2..dc9f6d2681e 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -176,7 +176,7 @@ void FollowerAI::JustRespawned()
Reset();
}
-void FollowerAI::EnterEvadeMode()
+void FollowerAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->RemoveAllAuras();
me->DeleteThreatList();
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
index f3919ea63bc..d1c976b45c8 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
@@ -46,7 +46,7 @@ class FollowerAI : public ScriptedAI
void MoveInLineOfSight(Unit*) override;
- void EnterEvadeMode() override;
+ void EnterEvadeMode(EvadeReason /*why*/ = EVADE_REASON_OTHER) override;
void JustDied(Unit*) override;