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. More...
 
void AttackStart (Unit *who) override
 
float GetThreatMod (float dist, float, uint32 health, uint32, Unit *target)
 
void RecalculateThreat ()
 
void EventMapGCD (EventMap &e, uint32 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() More...
 
- 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) More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
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. More...
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
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=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, 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=0s)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table. More...
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon. More...
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged. More...
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed. More...
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
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 ()
 
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)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 Called when unit is charmed. More...
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, 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: More...
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat. More...
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat. More...
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 Called at any Damage to any victim (before damage apply) More...
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage from any attacker (before damage apply) More...
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal. More...
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates. More...
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals. More...
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations. More...
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT) More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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
 
- 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:548
Definition: ScriptedCreature.h:190
Creature * me
Definition: ScriptedCreature.h:280
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:94
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1203
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 ScriptedAI.

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:33
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27

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

◆ EnemiesInRange()

uint32 boss_faction_championsAI::EnemiesInRange ( float  distance)
inline
181 {
183 uint32 count = 0;
184 Unit* target;
185 for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
186 {
187 target = ObjectAccessor::GetUnit((*me), (*iter)->getUnitGuid());
188 if (target && me->GetDistance2d(target) < distance )
189 ++count;
190 }
191 return count;
192 }
std::uint32_t uint32
Definition: Define.h:107
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:199
std::list< HostileReference * > StorageType
Definition: ThreatMgr.h:147
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:273
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1274
Definition: Unit.h:630
ThreatMgr & GetThreatMgr()
Definition: Unit.h:903

References WorldObject::GetDistance2d(), ThreatMgr::GetThreatList(), Unit::GetThreatMgr(), ObjectAccessor::GetUnit(), 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.

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

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:2031

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

Referenced by RecalculateThreat().

◆ IsCCed()

bool boss_faction_championsAI::IsCCed ( )
inline
146 {
147 // check for stun, fear, etc.
148 // for casting, silence, disarm check individually in the ai
150 {
151 if (!IsHeroic())
152 return true;
154 return true;
155 else
156 {
159 }
160 }
161 return false;
162 }
@ SPELL_PVP_TRINKET
Definition: boss_faction_champions.cpp:36
@ UNIT_STATE_CONFUSED
Definition: UnitDefines.h:160
@ UNIT_STATE_STUNNED
Definition: UnitDefines.h:152
bool IsHeroic() const
Definition: ScriptedCreature.h:379
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Creature.cpp:2915
void AddSpellCooldown(uint32 spell_id, uint32, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition: Creature.cpp:2860
bool isFrozen() const
Definition: Unit.cpp:15829
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:1167
bool HasFearAura() const
Definition: Unit.h:1697
bool HasUnitState(const uint32 f) const
Definition: Unit.h:701

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 ScriptedAI.

128 {
129 if (pInstance && mAIType != AI_PET)
131 }
@ TYPE_FACTION_CHAMPIONS
Definition: trial_of_the_crusader.h:41
@ DONE
Definition: InstanceScript.h:60

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.

Reimplemented from ScriptedAI.

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

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

◆ KilledUnit()

void boss_faction_championsAI::KilledUnit ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

134 {
135 if (pInstance)
137 }
@ 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 {
107 for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr )
108 {
109 Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
110 if (pUnit && pUnit->IsPlayer() && me->GetThreatMgr().GetThreat(pUnit))
111 {
112 float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
113 me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);
114 //me->getThreatMgr().DoAddThreat(pUnit, 10000000.0f * threatMod);
116 ref->AddThreat(10000000.0f * threatMod);
117 }
118 }
119 }
Definition: ThreatMgr.h:48
HostileReference * getReferenceByTarget(Unit const *victim) const
Definition: ThreatMgr.cpp:261
float GetThreat(Unit *victim, bool alsoSearchOfflineList=false)
Definition: ThreatMgr.cpp:525
void ModifyThreatByPercent(Unit *victim, int32 percent)
Definition: ThreatMgr.cpp:508
ThreatContainer & GetOnlineContainer()
Definition: ThreatMgr.h:275
bool IsPlayer() const
Definition: Object.h:200
uint32 GetMaxHealth() const
Definition: Unit.h:1030
uint32 GetHealth() const
Definition: Unit.h:1029
uint32 GetArmor() const
Definition: Unit.h:1079
float GetThreatMod(float dist, float, uint32 health, uint32, Unit *target)
Definition: boss_faction_champions.cpp:74

References Unit::GetArmor(), WorldObject::GetDistance2d(), Unit::GetHealth(), Unit::GetMaxHealth(), ThreatMgr::GetOnlineContainer(), ThreatContainer::getReferenceByTarget(), ThreatMgr::GetThreat(), ThreatMgr::GetThreatList(), Unit::GetThreatMgr(), GetThreatMod(), ObjectAccessor::GetUnit(), Object::IsPlayer(), ScriptedAI::me, and ThreatMgr::ModifyThreatByPercent().

Referenced by JustEngagedWith(), and UpdateAI().

◆ SelectEnemyCaster()

Unit * boss_faction_championsAI::SelectEnemyCaster ( bool  casting,
float  range 
)
inline
195 {
197 Unit* target;
198 for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
199 {
200 target = ObjectAccessor::GetUnit((*me), (*iter)->getUnitGuid());
201 if (target && target->getPowerType() == POWER_MANA && (!casting || target->HasUnitState(UNIT_STATE_CASTING)) && me->GetExactDist(target) <= range )
202 return target;
203 }
204 return nullptr;
205 }
@ POWER_MANA
Definition: SharedDefines.h:269
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
float GetExactDist(float x, float y, float z) const
Definition: Position.h:177
Powers getPowerType() const
Definition: Unit.h:1052

References Position::GetExactDist(), Unit::getPowerType(), ThreatMgr::GetThreatList(), Unit::GetThreatMgr(), ObjectAccessor::GetUnit(), Unit::HasUnitState(), 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
165 {
166 std::list<Creature*> lst = DoFindFriendlyMissingBuff(range, spell);
167 if (lst.empty())
168 return nullptr;
169 std::list<Creature*>::const_iterator iter = lst.begin();
170 uint32 lowestHP = (*iter)->GetMaxHealth() - (*iter)->GetHealth();
171 for( std::list<Creature*>::const_iterator itr = lst.begin(); itr != lst.end(); ++itr )
172 if (((*itr)->GetMaxHealth() - (*itr)->GetHealth()) > lowestHP )
173 {
174 iter = itr;
175 lowestHP = (*itr)->GetMaxHealth() - (*itr)->GetHealth();
176 }
177 return (*iter);
178 }
std::list< Creature * > DoFindFriendlyMissingBuff(float range, uint32 spellId)
Definition: ScriptedCreature.cpp:508

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()

Reimplemented from ScriptedAI.

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.

208 {
209 if (!me->IsInCombat())
210 return;
211
212 if (threatTimer <= diff)
213 {
215 threatTimer = urand(8750, 9250);
216 }
217 else
218 threatTimer -= diff;
219
220 if (me->getPowerType() == POWER_MANA )
221 {
222 if (powerTimer <= diff)
223 {
225 powerTimer = 4000;
226 }
227 else
228 powerTimer -= diff;
229 }
230 else if (me->getPowerType() == POWER_ENERGY )
231 {
232 if (powerTimer <= diff)
233 {
235 powerTimer = 1000;
236 }
237 else
238 powerTimer -= diff;
239 }
240 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ POWER_ENERGY
Definition: SharedDefines.h:272
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14149
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1057
bool IsInCombat() const
Definition: Unit.h:884

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