18 if (victim &&
me->Attack(victim,
true))
19 me->GetMotionMaster()->MoveChase(victim);
24 if (victim &&
me->Attack(victim,
false))
25 me->GetMotionMaster()->MoveChase(victim, dist);
33 Unit* victim =
me->GetVictim();
35 if (
me->isAttackReady() &&
me->IsWithinMeleeRange(victim))
37 me->AttackerStateUpdate(victim);
38 me->resetAttackTimer();
55 if (
me->IsWithinCombatRange(
me->GetVictim(), spellInfo->GetMaxRange(
false)))
57 me->CastSpell(
me->GetVictim(), spell,
false);
58 me->resetAttackTimer();
79 return spellInfo ? spellInfo->
GetMaxRange(positive) : 0;
87 for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
91 me->AddAura(spellid, unit);
101 for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
105 me->CastSpell(unit, spellid, triggered);
121 target =
me->GetVictim();
143 float range = spellInfo->GetMaxRange(
false);
147 && targetSelector(
me->GetVictim()))
148 target =
me->GetVictim();
157 me->CastSpell(target, spellId,
false);
165 me->CastSpell(victim, spellId, triggered);
173 me->CastSpell(
me->GetVictim(), spellId, triggered);
181 me->CastSpell((
Unit*)NULL, spellId, triggered);
184#define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;}
193 for (
uint32 i = 0; i <
sSpellMgr->GetSpellInfoStoreSize(); ++i, ++AIInfo)
243 me->IsAIEnabled = apply;
248 Creature* charmer =
me->GetCharmer()->ToCreature();
254 for (Unit::AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
255 if ((*iter)->GetCasterGUID() == charmer->
GetGUID() && (*iter)->GetBase()->IsPermanent())
265 Unit* target =
me->GetVictim();
290 if (target && target !=
_caster)
295 if (!
_caster->IsWithinMeleeRange(target, max_range))
298 else if (!
_caster->IsWithinCombatRange(target, max_range))
303 if (
_caster->IsWithinMeleeRange(target))
306 else if (min_range &&
_caster->IsWithinCombatRange(target, min_range))
321 return target !=
_source->GetVictim();
#define MAX_SPELL_EFFECTS
@ SPELL_ATTR0_CASTABLE_WHILE_DEAD
@ SPELL_EFFECT_APPLY_AURA
@ TARGET_UNIT_DEST_AREA_ENEMY
@ TARGET_DEST_TARGET_ENEMY
@ TARGET_UNIT_TARGET_ENEMY
@ SPELL_ATTR3_ONLY_TARGET_PLAYERS
@ AURA_INTERRUPT_FLAG_NOT_VICTIM
Unit * SelectNearestTargetInAttackDistance(float dist=0) const
bool IsInEvadeMode() const
void OnCharmed(bool apply) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
SpellImplicitTargetInfo TargetA
Targets GetTarget() const
SpellEffectInfo Effects[MAX_SPELL_EFFECTS]
float GetMaxRange(bool positive=false, Unit *caster=NULL, Spell *spell=NULL) const
int32 GetDuration() const
std::list< HostileReference * > StorageType
void AttackStartCaster(Unit *victim, float dist)
static void FillAISpellInfo()
void SelectTargetList(std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
void DoMeleeAttackIfReady()
void DoCast(uint32 spellId)
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
void DoCastToAllHostilePlayers(uint32 spellid, bool triggered=false)
float DoGetSpellMaxRange(uint32 spellId, bool positive=false)
void DoAddAuraToAllHostilePlayers(uint32 spellid)
bool DoSpellAttackIfReady(uint32 spell)
void DoCastVictim(uint32 spellId, bool triggered=false)
void DoCastAOE(uint32 spellId, bool triggered=false)
static AISpellInfoType * AISpellInfo
virtual void AttackStart(Unit *)
void Kill(Unit *victim, bool durabilityLoss=true)
bool IsValidAttackTarget(Unit const *target) const
static Unit * GetUnit(WorldObject &object, uint64 guid)
std::list< AuraEffect * > AuraEffectList
bool operator()(Unit const *target) const
SpellInfo const * _spellInfo
bool operator()(Unit const *target) const
SpellTargetSelector(Unit *caster, uint32 spellId)