AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
boss_faction_championsAI Struct Reference
Inheritance diagram for boss_faction_championsAI:
ScriptedAI CreatureAI UnitAI npc_toc_boomkin::npc_toc_boomkinAI npc_toc_dk::npc_toc_dkAI npc_toc_druid::npc_toc_druidAI npc_toc_enh_shaman::npc_toc_enh_shamanAI npc_toc_hunter::npc_toc_hunterAI npc_toc_mage::npc_toc_mageAI npc_toc_paladin::npc_toc_paladinAI npc_toc_pet_hunter::npc_toc_pet_hunterAI npc_toc_pet_warlock::npc_toc_pet_warlockAI npc_toc_priest::npc_toc_priestAI npc_toc_retro_paladin::npc_toc_retro_paladinAI npc_toc_rogue::npc_toc_rogueAI npc_toc_shadow_priest::npc_toc_shadow_priestAI npc_toc_shaman::npc_toc_shamanAI npc_toc_warlock::npc_toc_warlockAI npc_toc_warrior::npc_toc_warriorAI

Public Member Functions

 boss_faction_championsAI (Creature *pCreature, uint32 aitype)
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged - this happens after JustEnteredCombat.
 
void AttackStart (Unit *who) override
 
float GetThreatMod (float dist, float, uint32 health, uint32, Unit *target)
 
void RecalculateThreat ()
 
void EventMapGCD (EventMap &e, Milliseconds delay, uint32 gcd=0)
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void EnterEvadeMode (EvadeReason) override
 
bool IsCCed ()
 
CreatureSelectTarget_MostHPLostFriendlyMissingBuff (uint32 spell, float range)
 
uint32 EnemiesInRange (float distance)
 
UnitSelectEnemyCaster (bool casting, float range)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged - this happens after JustEnteredCombat.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoRewardPlayersInArea ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0ms)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
bool IsEngaged () const
 Check if creature is currently engaged in combat.
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
void JustEnteredCombat (Unit *who) override
 Called when the unit enters combat.
 
virtual void JustStartedThreateningMe (Unit *who)
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
void JustExitedCombat () override
 Called when the unit leaves combat.
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void OnSpellStart (SpellInfo const *)
 
virtual void OnSpellCast (SpellInfo const *)
 
virtual void OnSpellFailed (SpellInfo const *)
 
virtual void OnChannelFinished (SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
virtual void WaypointPathStarted (uint32)
 == Waypoints system =============================
 
virtual void WaypointStarted (uint32, uint32)
 
virtual void WaypointReached (uint32, uint32)
 
virtual void WaypointPathEnded (uint32, uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *attacker)
 
virtual void OwnerAttacked (Unit *target)
 
void OnOwnerCombatInteraction (Unit *target)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
virtual void DistancingStarted ()
 
virtual void DistancingEnded ()
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid const &, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following:
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void EvadeTimerExpired ()
 Called when evade timer expires (target unreachable for too long)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast.
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished.
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Public Attributes

InstanceScriptpInstance
 
uint32 mAIType
 
uint32 threatTimer
 
uint32 powerTimer
 
- Public Attributes inherited from ScriptedAI
Creatureme
 

Additional Inherited Members

- Public Types inherited from ScriptedAI
enum class  Axis {
  AXIS_X ,
  AXIS_Y
}
 
- Public Types inherited from CreatureAI
enum  EvadeReason {
  EVADE_REASON_NO_HOSTILES ,
  EVADE_REASON_BOUNDARY ,
  EVADE_REASON_SEQUENCE_BREAK ,
  EVADE_REASON_NO_PATH ,
  EVADE_REASON_OTHER
}
 
- Static Public Member Functions inherited from CreatureAI
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
TaskScheduler scheduler
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
bool _isEngaged
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ boss_faction_championsAI()

boss_faction_championsAI::boss_faction_championsAI ( Creature pCreature,
uint32  aitype 
)
inline
41 : ScriptedAI(pCreature)
42 {
43 pInstance = pCreature->GetInstanceScript();
45 mAIType = aitype;
46 threatTimer = 2000;
47 powerTimer = 1000;
48 }
@ REACT_PASSIVE
Definition Unit.h:566
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1238
Definition ScriptedCreature.h:191
Creature * me
Definition ScriptedCreature.h:281
uint32 powerTimer
Definition boss_faction_champions.cpp:53
InstanceScript * pInstance
Definition boss_faction_champions.cpp:50
uint32 threatTimer
Definition boss_faction_champions.cpp:52
uint32 mAIType
Definition boss_faction_champions.cpp:51

References WorldObject::GetInstanceScript(), mAIType, ScriptedAI::me, pInstance, powerTimer, REACT_PASSIVE, Creature::SetReactState(), and threatTimer.

Member Function Documentation

◆ AttackStart()

void boss_faction_championsAI::AttackStart ( Unit who)
inlineoverridevirtual

Reimplemented from UnitAI.

64 {
65 if (!who)
66 return;
67
68 if (mAIType == AI_MELEE || mAIType == AI_PET)
70 else
71 UnitAI::AttackStartCaster(who, 18.5f);
72 }
@ AI_MELEE
Definition boss_faction_champions.cpp:27
@ AI_PET
Definition boss_faction_champions.cpp:30
void AttackStartCaster(Unit *victim, float dist)
Definition UnitAI.cpp:34
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:28

References AI_MELEE, AI_PET, UnitAI::AttackStart(), UnitAI::AttackStartCaster(), and mAIType.

◆ EnemiesInRange()

uint32 boss_faction_championsAI::EnemiesInRange ( float  distance)
inline
178 {
179 uint32 count = 0;
180 for (ThreatReference const* ref : me->GetThreatMgr().GetUnsortedThreatList())
181 {
182 if (Unit* target = ref->GetVictim())
183 if (me->GetDistance2d(target) < distance)
184 ++count;
185 }
186 return count;
187 }
std::uint32_t uint32
Definition Define.h:107
Definition ThreatManager.h:267
ThreatManager & GetThreatMgr()
Definition UnitAI.cpp:380
Definition Unit.h:664
Unit * GetVictim() const
Definition Unit.h:903
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1313

References WorldObject::GetDistance2d(), Unit::GetThreatMgr(), ThreatManager::GetUnsortedThreatList(), Unit::GetVictim(), and ScriptedAI::me.

Referenced by npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), and npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI().

◆ EnterEvadeMode()

void boss_faction_championsAI::EnterEvadeMode ( EvadeReason  )
inlineoverridevirtual

Reimplemented from CreatureAI.

Reimplemented in npc_toc_pet_warlock::npc_toc_pet_warlockAI, and npc_toc_pet_hunter::npc_toc_pet_hunterAI.

137 {
138 if (pInstance)
140 }
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:52
@ TYPE_FAILED
Definition trial_of_the_crusader.h:33

References pInstance, ZoneScript::SetData(), and TYPE_FAILED.

◆ EventMapGCD()

◆ GetThreatMod()

float boss_faction_championsAI::GetThreatMod ( float  dist,
float  ,
uint32  health,
uint32  ,
Unit target 
)
inline
75 {
76 /*float mod_health = ((float)health)/maxhealth;
77 if (mod_health < 0.4f) mod_health = 0.4f;
78 float unimportant_dist = (mAIType == AI_MELEE || mAIType == AI_PET ? 5.0f : 20.0f);
79 if (dist > unimportant_dist)
80 dist -= unimportant_dist; // compensate melee range
81 else
82 dist = 0.0f;
83 float mod_dist = 25.0f/(25.0f + dist);
84 float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? armor / 16635.0f : 0.0f;
85 return mod_dist / ((0.15f+mod_armor)*mod_health);*/
86
87 // TC:
88 /*float dist_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? 15.0f / (15.0f + dist) : 1.0f;
89 float armor_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? armor / 16635.0f : 0.0f;
90 float eh = (health + 1) * (1.0f + armor_mod);
91 return dist_mod * 30000.0f / eh;*/
92
93 // third try:
94 float unimportant_dist = (mAIType == AI_MELEE || mAIType == AI_PET ? 5.0f : 35.0f);
95 if (dist > unimportant_dist) dist -= unimportant_dist;
96 else dist = 0.0f;
97 const float dist_factor = (mAIType == AI_MELEE || mAIType == AI_PET ? 15.0f : 25.0f);
98 float mod_dist = dist_factor / (dist_factor + dist); // 0.2 .. 1.0
99 float mod_health = health > 40000 ? 2.0f : (60000 - health) / 10000.0f; // 2.0 .. 6.0
100 float mod_armor = (mAIType == AI_MELEE || mAIType == AI_PET) ? Unit::CalcArmorReducedDamage(me, target, 10000, nullptr) / 10000.0f : 1.0f;
101 return mod_dist * mod_health * mod_armor;
102 }
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
Definition Unit.cpp:2203

References AI_MELEE, AI_PET, Unit::CalcArmorReducedDamage(), mAIType, and ScriptedAI::me.

Referenced by RecalculateThreat().

◆ IsCCed()

bool boss_faction_championsAI::IsCCed ( )
inline
143 {
144 // check for stun, fear, etc.
145 // for casting, silence, disarm check individually in the ai
147 {
148 if (!IsHeroic())
149 return true;
151 return true;
152 else
153 {
156 }
157 }
158 return false;
159 }
@ UNIT_STATE_CONFUSED
Definition UnitDefines.h:184
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:176
@ SPELL_PVP_TRINKET
Definition boss_faction_champions.cpp:36
bool HasSpellCooldown(uint32 spell_id) const override
Definition Creature.cpp:2963
void AddSpellCooldown(uint32 spell_id, uint32, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Creature.cpp:2908
bool isFrozen() const
Definition Unit.cpp:12652
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1350
bool HasFearAura() const
Definition Unit.h:1836
bool HasUnitState(const uint32 f) const
Definition Unit.h:736
bool IsHeroic() const
Definition ScriptedCreature.h:383

References Creature::AddSpellCooldown(), Unit::CastSpell(), Unit::HasFearAura(), Creature::HasSpellCooldown(), Unit::HasUnitState(), Unit::isFrozen(), ScriptedAI::IsHeroic(), ScriptedAI::me, SPELL_PVP_TRINKET, UNIT_STATE_CONFUSED, and UNIT_STATE_STUNNED.

Referenced by npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_hunter::npc_toc_hunterAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_warrior::npc_toc_warriorAI::myCanCast(), npc_toc_dk::npc_toc_dkAI::myCanCast(), npc_toc_rogue::npc_toc_rogueAI::myCanCast(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::myCanCast(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::myCanCast(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::myCanCast(), and npc_toc_pet_hunter::npc_toc_pet_hunterAI::myCanCast().

◆ JustDied()

void boss_faction_championsAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

125 {
126 if (pInstance && mAIType != AI_PET)
128 }
@ DONE
Definition InstanceScript.h:61
@ TYPE_FACTION_CHAMPIONS
Definition trial_of_the_crusader.h:41

References AI_PET, DONE, mAIType, pInstance, ZoneScript::SetData(), and TYPE_FACTION_CHAMPIONS.

◆ JustEngagedWith()

void boss_faction_championsAI::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged - this happens after JustEnteredCombat.

Reimplemented from CreatureAI.

56 {
59 if (pInstance)
61 }
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition Creature.cpp:2789
void RecalculateThreat()
Definition boss_faction_champions.cpp:104
@ TYPE_FACTION_CHAMPIONS_START
Definition trial_of_the_crusader.h:46

References ScriptedAI::me, pInstance, RecalculateThreat(), ZoneScript::SetData(), Creature::SetInCombatWithZone(), and TYPE_FACTION_CHAMPIONS_START.

◆ KilledUnit()

void boss_faction_championsAI::KilledUnit ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

131 {
132 if (pInstance)
134 }
@ TYPE_FACTION_CHAMPIONS_PLAYER_DIED
Definition trial_of_the_crusader.h:42

References pInstance, ZoneScript::SetData(), and TYPE_FACTION_CHAMPIONS_PLAYER_DIED.

◆ RecalculateThreat()

void boss_faction_championsAI::RecalculateThreat ( )
inline
105 {
106 for (ThreatReference const* ref : me->GetThreatMgr().GetUnsortedThreatList())
107 {
108 Unit* pUnit = ref->GetVictim();
109 if (pUnit && pUnit->IsPlayer() && me->GetThreatMgr().GetThreat(pUnit))
110 {
111 float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
112 me->GetThreatMgr().ResetThreat(pUnit);
113 me->GetThreatMgr().AddThreat(pUnit, 10000000.0f * threatMod, nullptr, true, true);
114 }
115 }
116 }
bool IsPlayer() const
Definition Object.h:201
void ResetThreat(Unit *target)
Definition ThreatManager.h:152
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
Definition ThreatManager.cpp:388
float GetThreat(Unit const *who, bool includeOffline=false) const
Definition ThreatManager.cpp:286
uint32 GetMaxHealth() const
Definition Unit.h:1109
uint32 GetHealth() const
Definition Unit.h:1108
uint32 GetArmor() const
Definition Unit.h:1157
ThreatManager & GetThreatMgr()
Definition Unit.h:951
float GetThreatMod(float dist, float, uint32 health, uint32, Unit *target)
Definition boss_faction_champions.cpp:74

References ThreatManager::AddThreat(), Unit::GetArmor(), WorldObject::GetDistance2d(), Unit::GetHealth(), Unit::GetMaxHealth(), ThreatManager::GetThreat(), Unit::GetThreatMgr(), GetThreatMod(), ThreatManager::GetUnsortedThreatList(), Unit::GetVictim(), Object::IsPlayer(), ScriptedAI::me, and ThreatManager::ResetThreat().

Referenced by JustEngagedWith(), and UpdateAI().

◆ SelectEnemyCaster()

Unit * boss_faction_championsAI::SelectEnemyCaster ( bool  casting,
float  range 
)
inline
190 {
191 for (ThreatReference const* ref : me->GetThreatMgr().GetUnsortedThreatList())
192 {
193 if (Unit* target = ref->GetVictim())
194 if (target->getPowerType() == POWER_MANA && (!casting || target->HasUnitState(UNIT_STATE_CASTING)) && me->GetExactDist(target) <= range)
195 return target;
196 }
197 return nullptr;
198 }
@ POWER_MANA
Definition SharedDefines.h:257
@ UNIT_STATE_CASTING
Definition UnitDefines.h:188
float GetExactDist(float x, float y, float z) const
Definition Position.h:182

References Position::GetExactDist(), Unit::GetThreatMgr(), ThreatManager::GetUnsortedThreatList(), Unit::GetVictim(), ScriptedAI::me, POWER_MANA, and UNIT_STATE_CASTING.

Referenced by npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), and npc_toc_dk::npc_toc_dkAI::UpdateAI().

◆ SelectTarget_MostHPLostFriendlyMissingBuff()

Creature * boss_faction_championsAI::SelectTarget_MostHPLostFriendlyMissingBuff ( uint32  spell,
float  range 
)
inline
162 {
163 std::list<Creature*> lst = DoFindFriendlyMissingBuff(range, spell);
164 if (lst.empty())
165 return nullptr;
166 std::list<Creature*>::const_iterator iter = lst.begin();
167 uint32 lowestHP = (*iter)->GetMaxHealth() - (*iter)->GetHealth();
168 for( std::list<Creature*>::const_iterator itr = lst.begin(); itr != lst.end(); ++itr )
169 if (((*itr)->GetMaxHealth() - (*itr)->GetHealth()) > lowestHP )
170 {
171 iter = itr;
172 lowestHP = (*itr)->GetMaxHealth() - (*itr)->GetHealth();
173 }
174 return (*iter);
175 }
std::list< Creature * > DoFindFriendlyMissingBuff(float range, uint32 spellId)
Definition ScriptedCreature.cpp:536

References ScriptedAI::DoFindFriendlyMissingBuff().

Referenced by npc_toc_druid::npc_toc_druidAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_paladin::npc_toc_paladinAI::UpdateAI(), npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), and npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI().

◆ UpdateAI()

void boss_faction_championsAI::UpdateAI ( uint32  )
inlineoverridevirtual

Use to start attacking a target. Called just before JustEngagedWith()

Implements UnitAI.

Reimplemented in npc_toc_druid::npc_toc_druidAI, npc_toc_shaman::npc_toc_shamanAI, npc_toc_paladin::npc_toc_paladinAI, npc_toc_priest::npc_toc_priestAI, npc_toc_shadow_priest::npc_toc_shadow_priestAI, npc_toc_warlock::npc_toc_warlockAI, npc_toc_mage::npc_toc_mageAI, npc_toc_hunter::npc_toc_hunterAI, npc_toc_boomkin::npc_toc_boomkinAI, npc_toc_warrior::npc_toc_warriorAI, npc_toc_dk::npc_toc_dkAI, npc_toc_rogue::npc_toc_rogueAI, npc_toc_enh_shaman::npc_toc_enh_shamanAI, npc_toc_retro_paladin::npc_toc_retro_paladinAI, npc_toc_pet_warlock::npc_toc_pet_warlockAI, and npc_toc_pet_hunter::npc_toc_pet_hunterAI.

201 {
202 if (!me->IsInCombat())
203 return;
204
205 if (threatTimer <= diff)
206 {
208 threatTimer = urand(8750, 9250);
209 }
210 else
211 threatTimer -= diff;
212
213 if (me->getPowerType() == POWER_MANA )
214 {
215 if (powerTimer <= diff)
216 {
218 powerTimer = 4000;
219 }
220 else
221 powerTimer -= diff;
222 }
223 else if (me->getPowerType() == POWER_ENERGY )
224 {
225 if (powerTimer <= diff)
226 {
228 powerTimer = 1000;
229 }
230 else
231 powerTimer -= diff;
232 }
233 }
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ POWER_ENERGY
Definition SharedDefines.h:260
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10998
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1136
Powers getPowerType() const
Definition Unit.h:1131
bool IsInCombat() const
Definition Unit.h:935

References Unit::GetMaxPower(), Unit::getPowerType(), Unit::IsInCombat(), ScriptedAI::me, Unit::ModifyPower(), POWER_ENERGY, POWER_MANA, powerTimer, RecalculateThreat(), threatTimer, and urand().

Referenced by npc_toc_druid::npc_toc_druidAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_paladin::npc_toc_paladinAI::UpdateAI(), npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), and npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI().

Member Data Documentation

◆ mAIType

uint32 boss_faction_championsAI::mAIType

◆ pInstance

InstanceScript* boss_faction_championsAI::pInstance

◆ powerTimer

uint32 boss_faction_championsAI::powerTimer

◆ threatTimer

uint32 boss_faction_championsAI::threatTimer

The documentation for this struct was generated from the following file: