aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/CreatureAI.h
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2016-01-13 15:33:17 +0100
committerShauren <shauren.trinity@gmail.com>2016-03-22 22:56:43 +0100
commite2f2c70ba4ee0205dbe7f6ebb81e79dd0872d9e8 (patch)
tree462105f4bd862b5b2d0a761aa6c5912151bda68a /src/server/game/AI/CreatureAI.h
parent78885769cbc52940993064b34f347e50c018dd52 (diff)
Merge branch '3.3.5-bossboundary' into 3.3.5-base (PR #16089)
(cherry picked from commit 5b8b8c653039ec2add0b3a66468abb85e6f35054)
Diffstat (limited to 'src/server/game/AI/CreatureAI.h')
-rw-r--r--src/server/game/AI/CreatureAI.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 0a2cce723dc..3b7c489e018 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -21,6 +21,7 @@
#include "Creature.h"
#include "UnitAI.h"
+#include "AreaBoundary.h"
#include "Common.h"
class WorldObject;
@@ -63,6 +64,7 @@ enum SCEquip
EQUIP_UNEQUIP = 0
};
+typedef std::set<AreaBoundary const*> CreatureBoundary;
class CreatureAI : public UnitAI
{
protected:
@@ -77,10 +79,20 @@ class CreatureAI : public UnitAI
Creature* DoSummon(uint32 entry, WorldObject* obj, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
+ bool CheckBoundary(Position* who = nullptr) const;
+ void SetBoundary(CreatureBoundary const* boundary) { _boundary = boundary; CheckInRoom(); }
public:
+ enum EvadeReason
+ {
+ EVADE_REASON_NO_HOSTILES, // the creature's threat list is empty
+ EVADE_REASON_BOUNDARY, // the creature has moved outside its evade boundary
+ EVADE_REASON_SEQUENCE_BREAK, // this is a boss and the pre-requisite encounters for engaging it are not defeated yet
+ EVADE_REASON_OTHER
+ };
+
void Talk(uint8 id, WorldObject const* whisperTarget = nullptr);
- explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) { }
+ explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), _boundary(nullptr), m_MoveInLineOfSight_locked(false) { }
virtual ~CreatureAI() { }
@@ -96,7 +108,7 @@ class CreatureAI : public UnitAI
virtual bool CanRespawn() { return true; }
// Called for reaction at stopping attack at no attackers or targets
- virtual void EnterEvadeMode();
+ virtual void EnterEvadeMode(EvadeReason why = EVADE_REASON_OTHER);
// Called for reaction at enter to combat if not in combat yet (enemy can be NULL)
virtual void EnterCombat(Unit* /*victim*/) { }
@@ -174,10 +186,17 @@ class CreatureAI : public UnitAI
virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; }
+ // intended for encounter design/debugging. do not use for other purposes. expensive.
+ int32 VisualizeBoundary(uint32 duration, Unit* owner=nullptr, bool fill=false) const;
+ virtual bool CheckInRoom();
+ CreatureBoundary const* GetBoundary() const { return _boundary; }
+
protected:
virtual void MoveInLineOfSight(Unit* /*who*/);
- bool _EnterEvadeMode();
+ bool _EnterEvadeMode(EvadeReason why = EVADE_REASON_OTHER);
+
+ CreatureBoundary const* _boundary;
private:
bool m_MoveInLineOfSight_locked;