142 currentTarget =
nullptr;
149 Unit* selectedTarget =
nullptr;
154 float minDistance = 0.f;
157 Unit* target = pair.second->GetOther(owner);
164 if (!selectedTarget || dist < minDistance)
166 selectedTarget = target;
175 float maxThreat = 0.f;
178 Unit* target = pair.second->GetOther(owner);
183 if (threat >= maxThreat)
185 selectedTarget = target;
#define RegisterCreatureAI(ai_name)
std::unordered_map< ObjectGuid, PvPCombatReference * > const & GetPvPCombatRefs() const
std::unordered_map< ObjectGuid, CombatReference * > const & GetPvECombatRefs() const
bool HasPvPCombat() const
@ EVADE_REASON_NO_HOSTILES
void SetLootRecipient(Unit *unit, bool withGroup=true)
void SetLastDamagedTime(time_t val)
void DoNotReacquireSpellFocusTarget()
bool IsEngaged() const override
void ResetPlayerDamageReq()
void SetCannotReachTarget(bool cannotReach)
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetTarget(ObjectGuid guid) override
void MoveFollow(Unit *target, float dist, ChaseAngle angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
static ObjectGuid const Empty
float GetThreat(Unit const *who, bool includeOffline=false) const
void AttackStartCaster(Unit *victim, float dist)
virtual bool CanAIAttack(Unit const *) const
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
ThreatManager & GetThreatManager()
bool HasBreakableByDamageCrowdControlAura(Unit *excludeCasterChannel=nullptr) const
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
MotionMaster * GetMotionMaster()
bool IsInCombatWith(Unit const *who) const
Unit * GetCharmerOrOwner() const
virtual float GetFollowAngle() const
bool HasUnitState(const uint32 f) const
void CombatStop(bool includingCast=false, bool mutualPvP=true)
CombatManager & GetCombatManager()
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
float GetDistance(WorldObject const *obj) const
@ TIMER_MIRROR_IMAGE_FIRE_BLAST
void AddSC_mage_pet_scripts()
@ SPELL_MAGE_MASTERS_THREAT_LIST
npc_pet_mage_mirror_image(Creature *creature)
void InitializeAI() override
void EnterEvadeMode(EvadeReason) override
TimeTracker _fireBlastTimer
void UpdateAI(uint32 diff) override
const float CHASE_DISTANCE
bool CanAIAttack(Unit const *who) const override