136 typedef std::vector<std::pair<Unit*, Spell*> > TargetSpellList;
137 TargetSpellList targetSpellStore;
166 bool spellUsed =
false;
171 if (!target && owner)
178 targetSpellStore.push_back(std::make_pair(target, spell));
203 targetSpellStore.push_back(std::make_pair(ally, spell));
218 targetSpellStore.push_back(std::make_pair(
me->
GetVictim(), spell));
225 if (!targetSpellStore.empty())
227 uint32 index =
urand(0, targetSpellStore.size() - 1);
229 Spell* spell = targetSpellStore[index].second;
230 Unit* target = targetSpellStore[index].first;
232 targetSpellStore.erase(targetSpellStore.begin() + index);
247 spell->prepare(&targets);
251 for (TargetSpellList::const_iterator itr = targetSpellStore.begin(); itr != targetSpellStore.end(); ++itr)
Definition: DBCEnums.h:404
Unit * EnsureVictim() const
Definition: Unit.h:1381
uint32 m_updateAlliesTimer
Definition: PetAI.h:61
virtual uint8 GetPetAutoSpellSize() const
Definition: Creature.h:664
bool CanBeUsedInCombat() const
Definition: SpellInfo.cpp:1490
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
#define M_PI
Definition: Common.h:163
Definition: SpellInfo.h:326
Unit * SelectNextTarget(bool allowAutoSelect) const
Definition: PetAI.cpp:377
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:10378
bool IsInCombat() const
Definition: Unit.h:1584
bool HasReactState(ReactStates state) const
Definition: Creature.h:504
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
bool IsAtStay()
Definition: Unit.cpp:15746
CharmInfo * GetCharmInfo()
Definition: Unit.h:1748
Player * ToPlayer()
Definition: Object.h:191
void HandleReturnMovement()
Definition: PetAI.cpp:421
void _stopAttack(void)
Definition: PetAI.cpp:54
Creature *const me
Definition: CreatureAI.h:71
TypeID GetTypeId() const
Definition: Object.h:113
SpellHistory * GetSpellHistory()
Definition: Unit.h:1926
bool IsCommandAttack()
Definition: Unit.cpp:15705
GuidSet m_AllySet
Definition: PetAI.h:60
Unit * GetCharmerOrOwner() const
Definition: Unit.cpp:7627
bool IsPositive() const
Definition: SpellInfo.cpp:1495
bool IsAlive() const
Definition: Unit.h:1692
Unit * GetVictim() const
Definition: Unit.h:1379
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
void SetUnitTarget(Unit *target)
Definition: Spell.cpp:230
#define sSpellMgr
Definition: SpellMgr.h:756
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1920
uint32_t uint32
Definition: Define.h:150
bool IsWithinMeleeRange(const Unit *obj, float dist=MELEE_RANGE) const
Definition: Unit.cpp:508
bool HasEffect(uint32 difficulty, SpellEffectName effect) const
Definition: SpellInfo.cpp:1169
void UpdateAllies()
Definition: PetAI.cpp:262
bool HasInArc(float arcangle, Position const *pos, float border=2.0f) const
Definition: Position.cpp:129
bool HasBreakableByDamageCrowdControlAura(Unit *excludeCasterChannel=NULL) const
Definition: Unit.cpp:590
bool IsReady(SpellInfo const *spellInfo, uint32 itemId=0, bool ignoreCategoryCooldown=false) const
Definition: SpellHistory.cpp:262
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
bool HasCommandState(CommandStates state) const
Definition: Unit.h:1212
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:2916
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:49
Unit * getAttackerForHelper() const
Definition: Unit.cpp:7211
Definition: SharedDefines.h:1052
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
uint8_t uint8
Definition: Define.h:152
bool HasGlobalCooldown(SpellInfo const *spellInfo) const
Definition: SpellHistory.cpp:821
bool CanAttack(Unit *target)
Definition: PetAI.cpp:519
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
Definition: Creature.cpp:2529
void AttackStart(Unit *target) override
Definition: PetAI.cpp:324
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:15771
bool CanAutoCast(Unit *target)
Definition: Spell.cpp:5810
bool _needToStop(void)
Definition: PetAI.cpp:45
void SendUpdateToPlayer(Player *player)
Definition: Object.cpp:251
std::string ToString() const
Definition: ObjectGuid.cpp:99