19 #ifndef TRINITY_UNITAI_H
20 #define TRINITY_UNITAI_H
70 if (m_dist < 0.0f && me->IsWithinCombatRange(target, -m_dist))
97 bool operator()(
Unit const* target)
const;
111 bool operator()(
Unit const* target)
const;
127 virtual void AttackStart(
Unit* );
128 virtual void UpdateAI(
uint32 diff) = 0;
135 virtual void OnCharmed(
bool apply) = 0;
150 if (position >= threatlist.size())
153 std::list<Unit*> targetList;
154 for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
155 if (predicate((*itr)->getTarget()))
156 targetList.push_back((*itr)->getTarget());
158 if (position >= targetList.size())
169 std::list<Unit*>::iterator itr = targetList.begin();
176 std::list<Unit*>::reverse_iterator ritr = targetList.rbegin();
182 std::list<Unit*>::iterator itr = targetList.begin();
193 void SelectTargetList(std::list<Unit*>& targetList,
uint32 num,
SelectAggroTarget targetType,
float dist = 0.0f,
bool playerOnly =
false,
int32 aura = 0);
200 if (threatlist.empty())
203 for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
204 if (predicate((*itr)->getTarget()))
205 targetList.push_back((*itr)->getTarget());
207 if (targetList.size() < maxTargets)
214 targetList.reverse();
219 targetList.resize(maxTargets);
240 void AttackStartCaster(
Unit* victim,
float dist);
242 void DoCast(
uint32 spellId);
243 void DoCast(
Unit* victim,
uint32 spellId,
bool triggered =
false);
244 void DoCastVictim(
uint32 spellId,
bool triggered =
false);
245 void DoCastAOE(
uint32 spellId,
bool triggered =
false);
247 void DoMeleeAttackIfReady();
248 bool DoSpellAttackIfReady(
uint32 spellId);
251 static void FillAISpellInfo();
virtual void SetData(uint32, uint32)
Definition: UnitAI.h:140
bool IsWithinCombatRange(const Unit *obj, float dist2compare) const
Definition: Unit.cpp:492
static AISpellInfoType * AISpellInfo
Definition: UnitAI.h:250
virtual void sGossipSelect(Player *, uint32, uint32)
Definition: UnitAI.h:254
virtual ObjectGuid GetGUID(int32=0) const
Definition: UnitAI.h:142
virtual void sQuestReward(Player *, Quest const *, uint32)
Definition: UnitAI.h:258
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
DefaultTargetSelector(Unit const *unit, float dist, bool playerOnly, int32 aura)
Definition: UnitAI.h:54
SimpleCharmedAI(Player *player)
Definition: UnitAI.h:281
virtual ~UnitAI()
Definition: UnitAI.h:124
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
virtual void HealDone(Unit *, uint32 &)
Definition: UnitAI.h:234
virtual void sOnGameEvent(bool, uint16)
Definition: UnitAI.h:260
Player *const me
Definition: UnitAI.h:270
Definition: QuestDef.h:279
bool operator()(Unit const *target) const
Definition: UnitAI.h:56
Definition: SpellInfo.h:326
NonTankTargetSelector(Creature *source, bool playerOnly=true)
Definition: UnitAI.h:110
const Unit * me
Definition: UnitAI.h:45
Unit const * _caster
Definition: UnitAI.h:100
void RandomResizeList(std::list< T > &list, uint32 size)
Definition: Containers.h:34
arena_t NULL
Definition: jemalloc_internal.h:624
ThreatContainer::StorageType const & getThreatList() const
Definition: ThreatManager.h:263
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const &predicate)
Definition: UnitAI.h:147
virtual void UpdateAI(uint32 diff)=0
Definition: Creature.h:467
Unit *const me
Definition: UnitAI.h:121
void apply(T *val)
Definition: ByteConverter.h:41
bool _playerOnly
Definition: UnitAI.h:115
virtual void SetGUID(ObjectGuid, int32=0)
Definition: UnitAI.h:141
virtual void DamageTaken(Unit *, uint32 &)
Definition: UnitAI.h:228
virtual bool CanAIAttack(Unit const *) const
Definition: UnitAI.h:126
virtual void sGossipSelectCode(Player *, uint32, uint32, char const *)
Definition: UnitAI.h:255
void advance(octet_iterator &it, distance_type n, octet_iterator end)
Definition: checked.h:190
UnitAI(Unit *unit)
Definition: UnitAI.h:123
virtual void InitializeAI()
Definition: UnitAI.h:130
TypeID GetTypeId() const
Definition: Object.h:113
float m_dist
Definition: UnitAI.h:46
virtual bool sOnDummyEffect(Unit *, uint32, SpellEffIndex)
Definition: UnitAI.h:259
int32 m_aura
Definition: UnitAI.h:48
SelectAggroTarget
Definition: UnitAI.h:33
virtual void sQuestAccept(Player *, Quest const *)
Definition: UnitAI.h:256
DamageEffectType
Definition: Unit.h:660
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
SpellEffIndex
Definition: SharedDefines.h:26
Vector2int16 & operator=(const Any &a)
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
virtual void DoAction(int32)
Definition: UnitAI.h:138
bool isDead() const
Definition: Unit.h:1694
Definition: ObjectGuid.h:33
std::list< HostileReference * > StorageType
Definition: ThreatManager.h:149
#define TC_GAME_API
Definition: Define.h:134
virtual void DamageDealt(Unit *, uint32 &, DamageEffectType)
Definition: UnitAI.h:223
ThreatManager & getThreatManager()
Definition: Unit.h:1998
SpellInfo const * _spellInfo
Definition: UnitAI.h:101
Definition: ObjectGuid.h:189
uint32_t uint32
Definition: g3dmath.h:168
virtual void HealReceived(Unit *, uint32 &)
Definition: UnitAI.h:231
virtual uint32 GetData(uint32) const
Definition: UnitAI.h:139
virtual void OnCharmed(bool apply)=0
bool m_playerOnly
Definition: UnitAI.h:47
virtual void Reset()
Definition: UnitAI.h:132
Creature const * _source
Definition: UnitAI.h:114
void SelectTargetList(std::list< Unit * > &targetList, PREDICATE const &predicate, uint32 maxTargets, SelectAggroTarget targetType)
Definition: UnitAI.h:197
PlayerAI(Player *player)
Definition: UnitAI.h:272
virtual void SpellInterrupted(uint32, uint32)
Definition: UnitAI.h:238
virtual void sQuestSelect(Player *, Quest const *)
Definition: UnitAI.h:257
Definition: CreatureAIImpl.h:55
virtual void sGossipHello(Player *)
Definition: UnitAI.h:253