78 currentTarget =
nullptr;
85 Unit* selectedTarget =
nullptr;
89 float minDistance = 0.0f;
92 Unit* target = pair.second->GetOther(owner);
99 if (!selectedTarget || dist < minDistance)
101 selectedTarget = target;
109 float maxThreat = 0.0f;
112 Unit* target = pair.second->GetOther(owner);
117 if (threat >= maxThreat)
119 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
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool IsInEvadeMode() const
void MoveFollow(Unit *target, float dist, ChaseAngle angle, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_ACTIVE)
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={})
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
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
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
void UpdateAI(uint32 diff) override
const float CHASE_DISTANCE
bool CanAIAttack(Unit const *who) const override