19 #ifndef SCRIPTEDCREATURE_H_
20 #define SCRIPTEDCREATURE_H_
28 #define CAST_AI(a, b) (dynamic_cast<a*>(b))
29 #define ENSURE_AI(a,b) (EnsureAI<a>(b))
31 template<
class T,
class U>
34 T* cast_ai =
dynamic_cast<T*
>(ai);
59 return storage_.begin();
64 return storage_.begin();
69 return storage_.end();
72 const_iterator
end()
const
74 return storage_.end();
79 return storage_.erase(i);
84 return storage_.empty();
89 return storage_.size();
94 void DespawnEntry(
uint32 entry);
100 storage_.remove_if(predicate);
103 template <
class Predicate>
107 StorageType listCopy = storage_;
108 Trinity::Containers::RandomResizeList<ObjectGuid, Predicate>(listCopy, predicate,
max);
109 for (StorageType::iterator i = listCopy.begin(); i != listCopy.end(); )
117 void DoZoneInCombat(
uint32 entry = 0);
118 void RemoveNotExisting();
119 bool HasEntry(
uint32 entry)
const;
151 void AttackStartNoMove(
Unit* target);
205 void DoStartMovement(
Unit* target,
float distance = 0.0f,
float angle = 0.0f);
208 void DoStartNoMovement(
Unit* target);
214 void DoCastSpell(
Unit* target,
SpellInfo const* spellInfo,
bool triggered =
false);
220 void DoResetThreat();
222 float DoGetThreat(
Unit* unit);
223 void DoModifyThreatPercent(
Unit* unit,
int32 pct);
225 void DoTeleportTo(
float x,
float y,
float z,
uint32 time = 0);
226 void DoTeleportTo(
float const pos[4]);
229 void DoTeleportPlayer(
Unit* unit,
float x,
float y,
float z,
float o);
230 void DoTeleportAll(
float x,
float y,
float z,
float o);
233 Unit* DoSelectLowestHpFriendly(
float range,
uint32 minHPDiff = 1);
236 std::list<Creature*> DoFindFriendlyCC(
float range);
239 std::list<Creature*> DoFindFriendlyMissingBuff(
float range,
uint32 spellId);
242 Player* GetPlayerAtMinimumRange(
float minRange);
245 Creature* DoSpawnCreature(
uint32 entry,
float offsetX,
float offsetY,
float offsetZ,
float angle,
uint32 type,
uint32 despawntime);
260 void SetCombatMovement(
bool allowMovement);
276 template<
class T>
inline
292 template<
class T>
inline
293 const T&
RAID_MODE(
const T& normal10,
const T& normal25)
const
308 template<
class T>
inline
309 const T&
RAID_MODE(
const T& normal10,
const T& normal25,
const T& heroic10,
const T& heroic25)
const
367 void _DespawnAtEvade();
369 void TeleportCheaters();
416 #endif // SCRIPTEDCREATURE_H_
Definition: ScriptedCreature.h:379
Definition: DBCEnums.h:406
void JustReachedHome() override
Definition: ScriptedCreature.h:358
Difficulty
Definition: DBCEnums.h:402
uint32 const _bossId
Definition: ScriptedCreature.h:376
Definition: TaskScheduler.h:49
Definition: DBCEnums.h:407
bool _isHeroic
Definition: ScriptedCreature.h:331
void DamageTaken(Unit *, uint32 &) override
Definition: ScriptedCreature.h:154
void SpellHit(Unit *, SpellInfo const *) override
Definition: ScriptedCreature.h:172
Definition: SpellInfo.h:326
iterator begin()
Definition: ScriptedCreature.h:57
bool HealthBelowPct(uint32 pct) const
Definition: ScriptedCreature.h:247
Definition: ScriptedCreature.h:136
Creature * me
Definition: ScriptedCreature.h:122
StorageType storage_
Definition: ScriptedCreature.h:123
void DoAction(int32 info, Predicate &predicate, uint16 max=0)
Definition: ScriptedCreature.h:104
bool HealthAbovePct(uint32 pct) const
Definition: ScriptedCreature.h:248
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:92
virtual void UpdateAI(uint32 diff) override
Definition: ScriptedCreature.cpp:125
bool IsFleeing
Definition: ScriptedCreature.h:185
virtual void ScheduleTasks()
Definition: ScriptedCreature.h:353
bool IsHeroic() const
Definition: ScriptedCreature.h:268
virtual void UpdateAI(uint32 diff)=0
void JustDied(Unit *) override
Definition: ScriptedCreature.h:160
Definition: Creature.h:467
TC_GAME_API void GetCreatureListWithEntryInGrid(std::list< Creature * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
Definition: ScriptedCreature.cpp:621
bool IsCombatMovementAllowed() const
Definition: ScriptedCreature.h:261
void EnterCombat(Unit *) override
Definition: ScriptedCreature.h:356
TaskScheduler scheduler
Definition: ScriptedCreature.h:373
bool IsAIEnabled
Definition: Unit.h:2161
virtual void ExecuteEvent(uint32)
Definition: ScriptedCreature.h:394
uint32 _entry
Definition: ScriptedCreature.h:133
GuidList StorageType
Definition: ScriptedCreature.h:44
double distance(double x, double y)
Definition: g3dmath.h:731
const T & RAID_MODE(const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
Definition: ScriptedCreature.h:309
std::list< ObjectGuid > GuidList
Definition: ObjectGuid.h:333
T max(const T &x, const T &y)
Definition: g3dmath.h:320
void Despawn(Creature const *summon)
Definition: ScriptedCreature.h:93
Definition: CreatureAI.h:63
Difficulty GetDifficulty() const
Definition: ScriptedCreature.h:271
bool operator()(ObjectGuid)
Definition: ScriptedCreature.h:139
TC_GAME_API GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange)
Definition: ScriptedCreature.cpp:616
void JustSummoned(Creature *) override
Definition: ScriptedCreature.h:166
void EnterCombat(Unit *) override
Definition: ScriptedCreature.h:195
TC_GAME_API void GetGameObjectListWithEntryInGrid(std::list< GameObject * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
Definition: ScriptedCreature.cpp:626
const_iterator end() const
Definition: ScriptedCreature.h:72
Definition: ScriptedCreature.h:142
G3D::int16 z
Definition: Vector3int16.h:46
void _JustReachedHome()
Definition: ScriptedCreature.h:366
Difficulty _difficulty
Definition: ScriptedCreature.h:329
bool CanAIAttack(Unit const *target) const override
Definition: ScriptedCreature.h:360
CreatureAI * AI() const
Definition: Creature.h:525
Definition: EventMap.h:25
int32_t int32
Definition: Define.h:146
Definition: CreatureAI.h:68
uint32_t uint32
Definition: Define.h:150
void SummonedCreatureDespawn(Creature *) override
Definition: ScriptedCreature.h:169
G3D::int16 y
Definition: Vector2int16.h:38
uint16_t uint16
Definition: Define.h:151
void Reset() override
Definition: ScriptedCreature.h:355
Definition: DBCEnums.h:409
Definition: DBCEnums.h:408
Definition: GameObject.h:880
virtual void DoAction(int32)
Definition: UnitAI.h:138
SummonList(Creature *creature)
Definition: ScriptedCreature.h:50
Definition: DBCEnums.h:410
TC_GAME_API void GetPlayerListInGrid(std::list< Player * > &list, WorldObject *source, float maxSearchRange)
Definition: ScriptedCreature.cpp:631
void OnPossess(bool)
Definition: ScriptedCreature.h:178
iterator erase(iterator i)
Definition: ScriptedCreature.h:77
virtual ~WorldBossAI()
Definition: ScriptedCreature.h:383
uint32 GetEntry() const
Definition: ObjectGuid.h:220
SummonList summons
Definition: ScriptedCreature.h:372
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
void Reset() override
Definition: ScriptedCreature.h:192
void EnterCombat(Unit *) override
Definition: ScriptedCreature.h:397
const T & RAID_MODE(const T &normal10, const T &normal25) const
Definition: ScriptedCreature.h:293
Definition: ScriptedCreature.h:126
T * EnsureAI(U *ai)
Definition: ScriptedCreature.h:32
void JustDied(Unit *) override
Definition: ScriptedCreature.h:398
const_iterator begin() const
Definition: ScriptedCreature.h:62
ObjectGuid const & GetGUID() const
Definition: Object.h:105
TC_GAME_API Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive=true)
Definition: ScriptedCreature.cpp:611
const T & DUNGEON_MODE(const T &normal5, const T &heroic10) const
Definition: ScriptedCreature.h:277
EntryCheckPredicate(uint32 entry)
Definition: ScriptedCreature.h:129
virtual ~ScriptedAI()
Definition: ScriptedCreature.h:145
void KilledUnit(Unit *) override
Definition: ScriptedCreature.h:163
#define TC_GAME_API
Definition: Define.h:134
void Reset() override
Definition: ScriptedCreature.h:396
SelectEffect
Definition: CreatureAI.h:53
Definition: InstanceScript.h:141
bool _isCombatMovementAllowed
Definition: ScriptedCreature.h:330
StorageType::value_type value_type
Definition: ScriptedCreature.h:48
#define ASSERT
Definition: Errors.h:55
StorageType::const_iterator const_iterator
Definition: ScriptedCreature.h:46
EventMap events
Definition: ScriptedCreature.h:371
Definition: ScriptedCreature.h:41
Definition: ObjectGuid.h:189
G3D::int16 x
Definition: Vector2int16.h:37
Definition: ScriptedCreature.h:334
void SpellHitTarget(Unit *, SpellInfo const *) override
Definition: ScriptedCreature.h:175
void DespawnIf(T const &predicate)
Definition: ScriptedCreature.h:98
StorageType::iterator iterator
Definition: ScriptedCreature.h:45
bool empty() const
Definition: ScriptedCreature.h:82
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29
bool CheckBoundary(Position const *who=nullptr) const
Definition: CreatureAI.cpp:353
void JustDied(Unit *) override
Definition: ScriptedCreature.h:357
virtual void ExecuteEvent(uint32)
Definition: ScriptedCreature.h:351
SummonList summons
Definition: ScriptedCreature.h:406
StorageType::size_type size_type
Definition: ScriptedCreature.h:47
InstanceScript *const instance
Definition: ScriptedCreature.h:340
size_type size() const
Definition: ScriptedCreature.h:87
Definition: DBCEnums.h:405
SelectTargetType
Definition: CreatureAI.h:37
iterator end()
Definition: ScriptedCreature.h:67
virtual ~BossAI()
Definition: ScriptedCreature.h:338
bool operator()(ObjectGuid guid)
Definition: ScriptedCreature.h:130
EventMap events
Definition: ScriptedCreature.h:405
bool Is25ManRaid() const
Definition: ScriptedCreature.h:274