AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
boss_sapphiron::boss_sapphironAI Struct Reference
Inheritance diagram for boss_sapphiron::boss_sapphironAI:
BossAI ScriptedAI CreatureAI UnitAI

Public Member Functions

 boss_sapphironAI (Creature *c)
 
void InitializeAI () override
 
bool IsInRoom ()
 
void Reset () override
 
void EnterCombatSelfFunction ()
 
void JustEngagedWith (Unit *who) override
 Called for reaction when initially engaged.
 
void JustDied (Unit *killer) override
 
void DoAction (int32 param) override
 
void MovementInform (uint32 type, uint32 id) override
 
void SpellHitTarget (Unit *target, SpellInfo const *spellInfo) override
 
bool IsValidExplosionTarget (WorldObject *target)
 
void KilledUnit (Unit *who) override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
 ~BossAI () override
 
bool CanRespawn () override
 
void OnSpellCastFinished (SpellInfo const *spell, SpellFinishReason reason) override
 
void DamageTaken (Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
void SummonedCreatureDespawnAll () override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void ScheduleHealthCheckEvent (uint32 healthPct, std::function< void()> exec, bool allowedWhileCasting=true)
 Executes a function once the creature reaches the defined health point percent.
 
void ScheduleHealthCheckEvent (std::initializer_list< uint8 > healthPct, std::function< void()> exec, bool allowedWhileCasting=true)
 
void ProcessHealthCheck ()
 
void ScheduleEnrageTimer (uint32 spellId, Milliseconds timer, uint8 textId=0)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER) override
 
void JustDied (Unit *) override
 
void JustReachedHome () override
 
- 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.
 
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=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
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
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 ==================
 
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 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 JustEnteredCombat (Unit *)
 Called when the unit enters combat.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
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

EventMap events
 
uint8 iceboltCount {}
 
uint32 spawnTimer {}
 
GuidList blockList
 
ObjectGuid currentTarget
 
- Public Attributes inherited from BossAI
float callForHelpRange
 
InstanceScript *const instance
 
- 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 BossAI
void _Reset ()
 
void _JustEngagedWith ()
 
void _JustDied ()
 
void _JustReachedHome ()
 
void _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
void TeleportCheaters ()
 
- 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 BossAI
SummonList summons
 
- 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_sapphironAI()

boss_sapphiron::boss_sapphironAI::boss_sapphironAI ( Creature c)
inlineexplicit
92 {}
Definition ScriptedCreature.h:482
@ BOSS_SAPPHIRON
Definition naxxramas.h:40

Member Function Documentation

◆ DoAction()

void boss_sapphiron::boss_sapphironAI::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

178 {
179 if (param == ACTION_SAPPHIRON_BIRTH)
180 {
181 spawnTimer = 1;
182 }
183 }
@ ACTION_SAPPHIRON_BIRTH
Definition naxxramas.h:307
uint32 spawnTimer
Definition boss_sapphiron.cpp:96

References ACTION_SAPPHIRON_BIRTH, and spawnTimer.

◆ EnterCombatSelfFunction()

void boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction ( )
inline
135 {
136 Map::PlayerList const& PlList = me->GetMap()->GetPlayers();
137 if (PlList.IsEmpty())
138 return;
139
140 for (auto const& i : PlList)
141 {
142 if (Player* player = i.GetSource())
143 {
144 if (player->IsGameMaster())
145 continue;
146
147 if (player->IsAlive() && me->GetDistance(player) < 80.0f)
148 {
149 me->SetInCombatWith(player);
150 player->SetInCombatWith(me);
151 me->AddThreat(player, 0.0f);
152 }
153 }
154 }
155 }
bool IsEmpty() const
Definition LinkedList.h:97
Definition MapRefMgr.h:26
PlayerList const & GetPlayers() const
Definition Map.h:326
Definition Player.h:1066
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:14771
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition Unit.cpp:13745
Map * GetMap() const
Definition Object.h:620
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1271
Creature * me
Definition ScriptedCreature.h:281

References Unit::AddThreat(), WorldObject::GetDistance(), WorldObject::GetMap(), Map::GetPlayers(), LinkedListHead::IsEmpty(), ScriptedAI::me, and Unit::SetInCombatWith().

Referenced by JustEngagedWith().

◆ InitializeAI()

void boss_sapphiron::boss_sapphironAI::InitializeAI ( )
inlineoverridevirtual

Reimplemented from UnitAI.

101 {
103 me->SetVisible(false);
107 }
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:255
@ REACT_PASSIVE
Definition Unit.h:555
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
virtual void InitializeAI()
Definition UnitAI.h:209
void SetVisible(bool x)
Definition Unit.cpp:14409
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:738
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition Object.cpp:2366
@ GO_SAPPHIRON_BIRTH
Definition naxxramas.h:115
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GO_SAPPHIRON_BIRTH, UnitAI::InitializeAI(), ScriptedAI::me, REACT_PASSIVE, Creature::SetReactState(), Unit::SetUnitFlag(), Unit::SetVisible(), WorldObject::SummonGameObject(), and UNIT_FLAG_NON_ATTACKABLE.

◆ IsInRoom()

bool boss_sapphiron::boss_sapphironAI::IsInRoom ( )
inline
110 {
111 if (me->GetExactDist(3523.5f, -5235.3f, 137.6f) > 100.0f)
112 {
114 return false;
115 }
116 return true;
117 }
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition ScriptedCreature.h:521
float GetExactDist(float x, float y, float z) const
Definition Position.h:182

References BossAI::EnterEvadeMode(), Position::GetExactDist(), and ScriptedAI::me.

Referenced by UpdateAI().

◆ IsValidExplosionTarget()

bool boss_sapphiron::boss_sapphironAI::IsValidExplosionTarget ( WorldObject target)
inline
202 {
203 for (ObjectGuid const& guid : blockList)
204 {
205 if (target->GetGUID() == guid)
206 return false;
207
208 if (Unit* block = ObjectAccessor::GetUnit(*me, guid))
209 {
210 if (block->IsInBetween(me, target, 2.0f) && block->IsWithinDist(target, 10.0f))
211 return false;
212 }
213 }
214 return true;
215 }
Definition ObjectGuid.h:118
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
Definition Unit.h:655
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:199
GuidList blockList
Definition boss_sapphiron.cpp:97

References blockList, Object::GetGUID(), ObjectAccessor::GetUnit(), and ScriptedAI::me.

◆ JustDied()

void boss_sapphiron::boss_sapphironAI::JustDied ( Unit killer)
inlineoverridevirtual

Reimplemented from CreatureAI.

172 {
173 BossAI::JustDied(killer);
175 }
@ SPELL_SAPPHIRON_DIES
Definition boss_sapphiron.cpp:50
void JustDied(Unit *) override
Definition ScriptedCreature.h:522
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:1194

References Unit::CastSpell(), BossAI::JustDied(), ScriptedAI::me, and SPELL_SAPPHIRON_DIES.

◆ JustEngagedWith()

void boss_sapphiron::boss_sapphironAI::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from CreatureAI.

158 {
162 events.ScheduleEvent(EVENT_BERSERK, 15min);
163 events.ScheduleEvent(EVENT_CLEAVE, 5s);
164 events.ScheduleEvent(EVENT_TAIL_SWEEP, 10s);
165 events.ScheduleEvent(EVENT_LIFE_DRAIN, 17s);
166 events.ScheduleEvent(EVENT_BLIZZARD, 17s);
167 events.ScheduleEvent(EVENT_FLIGHT_START, 45s);
168 events.ScheduleEvent(EVENT_HUNDRED_CLUB, 5s);
169 }
@ SPELL_FROST_AURA
Definition boss_sapphiron.cpp:36
@ EVENT_TAIL_SWEEP
Definition boss_sapphiron.cpp:65
@ EVENT_HUNDRED_CLUB
Definition boss_sapphiron.cpp:76
@ EVENT_LIFE_DRAIN
Definition boss_sapphiron.cpp:66
@ EVENT_BERSERK
Definition boss_sapphiron.cpp:63
@ EVENT_FLIGHT_START
Definition boss_sapphiron.cpp:68
@ EVENT_BLIZZARD
Definition boss_sapphiron.cpp:67
@ EVENT_CLEAVE
Definition boss_sapphiron.cpp:64
events
Definition boss_sartura.cpp:43
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition ScriptedCreature.h:520
void EnterCombatSelfFunction()
Definition boss_sapphiron.cpp:134

References Unit::CastSpell(), EnterCombatSelfFunction(), EVENT_BERSERK, EVENT_BLIZZARD, EVENT_CLEAVE, EVENT_FLIGHT_START, EVENT_HUNDRED_CLUB, EVENT_LIFE_DRAIN, EVENT_TAIL_SWEEP, BossAI::JustEngagedWith(), ScriptedAI::me, and SPELL_FROST_AURA.

◆ KilledUnit()

void boss_sapphiron::boss_sapphironAI::KilledUnit ( Unit who)
inlineoverridevirtual

Reimplemented from CreatureAI.

218 {
219 if (who->IsPlayer())
221 }
InstanceScript *const instance
Definition ScriptedCreature.h:489
void StorePersistentData(uint32 index, uint32 data)
Definition InstanceScript.cpp:422
bool IsPlayer() const
Definition Object.h:200
@ PERSISTENT_DATA_IMMORTAL_FAIL
Definition naxxramas.h:87

References BossAI::instance, Object::IsPlayer(), PERSISTENT_DATA_IMMORTAL_FAIL, and InstanceScript::StorePersistentData().

◆ MovementInform()

void boss_sapphiron::boss_sapphironAI::MovementInform ( uint32  type,
uint32  id 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

186 {
187 if (type == POINT_MOTION_TYPE && id == POINT_CENTER)
188 {
189 events.ScheduleEvent(EVENT_FLIGHT_LIFTOFF, 500ms);
190 }
191 }
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ POINT_CENTER
Definition boss_sapphiron.cpp:58
@ EVENT_FLIGHT_LIFTOFF
Definition boss_sapphiron.cpp:69

References EVENT_FLIGHT_LIFTOFF, POINT_CENTER, and POINT_MOTION_TYPE.

◆ Reset()

void boss_sapphiron::boss_sapphironAI::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

120 {
122 if (me->IsVisible())
123 {
125 }
126 events.Reset();
127 iceboltCount = 0;
128 spawnTimer = 0;
130 blockList.clear();
132 }
@ REACT_AGGRESSIVE
Definition Unit.h:557
void Reset() override
Definition ScriptedCreature.h:519
void Clear()
Definition ObjectGuid.h:138
void SetAnimTier(AnimTier animTier)
Definition Unit.cpp:15300
bool IsVisible() const
Definition Unit.h:1992
uint8 iceboltCount
Definition boss_sapphiron.cpp:95
ObjectGuid currentTarget
Definition boss_sapphiron.cpp:98

References blockList, ObjectGuid::Clear(), currentTarget, Fly, iceboltCount, Unit::IsVisible(), ScriptedAI::me, REACT_AGGRESSIVE, BossAI::Reset(), Unit::SetAnimTier(), Creature::SetReactState(), and spawnTimer.

◆ SpellHitTarget()

void boss_sapphiron::boss_sapphironAI::SpellHitTarget ( Unit target,
SpellInfo const *  spellInfo 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

194 {
195 if (spellInfo->Id == SPELL_ICEBOLT_CAST)
196 {
197 me->CastSpell(target, SPELL_ICEBOLT_TRIGGER, true);
198 }
199 }
@ SPELL_ICEBOLT_TRIGGER
Definition boss_sapphiron.cpp:45
@ SPELL_ICEBOLT_CAST
Definition boss_sapphiron.cpp:44

References Unit::CastSpell(), SpellInfo::Id, ScriptedAI::me, SPELL_ICEBOLT_CAST, and SPELL_ICEBOLT_TRIGGER.

◆ UpdateAI()

void boss_sapphiron::boss_sapphironAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

224 {
225 if (spawnTimer)
226 {
227 spawnTimer += diff;
228 if (spawnTimer >= 21500)
229 {
230 me->SetVisible(true);
233 spawnTimer = 0;
234 }
235 return;
236 }
237
238 if (!IsInRoom())
239 return;
240
241 if (!UpdateVictim())
242 return;
243
244 events.Update(diff);
246 return;
247
248 switch (events.ExecuteEvent())
249 {
250 case EVENT_BERSERK:
252 me->CastSpell(me, SPELL_BERSERK, true);
253 return;
254 case EVENT_CLEAVE:
255 me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false);
256 events.Repeat(10s);
257 return;
258 case EVENT_TAIL_SWEEP:
260 events.Repeat(10s);
261 return;
262 case EVENT_LIFE_DRAIN:
264 events.Repeat(24s);
265 return;
266 case EVENT_BLIZZARD:
267 {
268 Creature* cr;
269 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
270 {
272 }
273 else
274 {
276 }
277 if (cr)
278 {
279 cr->GetMotionMaster()->MoveRandom(40);
280 }
281 events.Repeat(RAID_MODE(8000ms, 6500ms));
282 return;
283 }
285 if (me->HealthBelowPct(11))
286 {
287 return;
288 }
289 events.Repeat(45s);
290 events.DelayEvents(35s);
292 me->AttackStop();
293 float x, y, z, o;
294 me->GetHomePosition(x, y, z, o);
296 return;
302 me->SetDisableGravity(true);
304 events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3s);
305 iceboltCount = RAID_MODE(2, 3);
306 return;
308 {
309 if (currentTarget)
310 {
312 {
313 me->SummonGameObject(GO_ICE_BLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0);
314 }
315 }
316
317 std::vector<Unit*> targets;
318 auto i = me->GetThreatMgr().GetThreatList().begin();
319 for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
320 {
321 if ((*i)->getTarget()->IsPlayer())
322 {
323 bool inList = false;
324 if (!blockList.empty())
325 {
326 for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
327 {
328 if ((*i)->getTarget()->GetGUID() == *itr)
329 {
330 inList = true;
331 break;
332 }
333 }
334 }
335 if (!inList)
336 {
337 targets.push_back((*i)->getTarget());
338 }
339 }
340 }
341
342 if (!targets.empty() && iceboltCount)
343 {
344 auto itr = targets.begin();
345 advance(itr, urand(0, targets.size() - 1));
346 me->CastSpell(*itr, SPELL_ICEBOLT_CAST, false);
347 blockList.push_back((*itr)->GetGUID());
348 currentTarget = (*itr)->GetGUID();
349 --iceboltCount;
350 events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, Seconds(uint32(me->GetExactDist(*itr) / 13.0f)));
351 }
352 else
353 {
354 events.ScheduleEvent(EVENT_FLIGHT_BREATH, 1s);
355 }
356 return;
357 }
362 events.ScheduleEvent(EVENT_FLIGHT_SPELL_EXPLOSION, 8500ms);
363 return;
366 events.ScheduleEvent(EVENT_FLIGHT_START_LAND, 3s);
367 return;
369 if (!blockList.empty())
370 {
371 for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
372 {
373 if (Unit* block = ObjectAccessor::GetUnit(*me, *itr))
374 {
375 block->RemoveAurasDueToSpell(SPELL_ICEBOLT_TRIGGER);
376 }
377 }
378 }
379 blockList.clear();
381 events.ScheduleEvent(EVENT_LAND, 1s);
382 return;
383 case EVENT_LAND:
385 me->SetDisableGravity(false);
386 events.ScheduleEvent(EVENT_GROUND, 1500ms);
387 return;
388 case EVENT_GROUND:
392 return;
394 {
395 Map::PlayerList const& pList = me->GetMap()->GetPlayers();
396 for (auto const& itr : pList)
397 {
398 if (itr.GetSource()->GetResistance(SPELL_SCHOOL_FROST) > 100)
399 {
401 return;
402 }
403 }
404 events.Repeat(5s);
405 return;
406 }
407 }
409 }
std::uint32_t uint32
Definition Define.h:107
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:30
@ FORCED_MOVEMENT_NONE
Definition MotionMaster.h:85
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:50
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ EMOTE_ONESHOT_LAND
Definition SharedDefines.h:1975
@ EMOTE_ONESHOT_LIFTOFF
Definition SharedDefines.h:1971
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:298
@ SPELLVALUE_MAX_TARGETS
Definition SpellDefines.h:117
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185
@ GO_ICE_BLOCK
Definition boss_sapphiron.cpp:55
@ NPC_BLIZZARD
Definition boss_sapphiron.cpp:56
@ EMOTE_AIR_PHASE
Definition boss_sapphiron.cpp:27
@ EMOTE_BREATH
Definition boss_sapphiron.cpp:29
@ EMOTE_ENRAGE
Definition boss_sapphiron.cpp:30
@ EMOTE_GROUND_PHASE
Definition boss_sapphiron.cpp:28
@ SPELL_CLEAVE
Definition boss_sapphiron.cpp:37
@ SPELL_LIFE_DRAIN
Definition boss_sapphiron.cpp:40
@ SPELL_FROST_EXPLOSION
Definition boss_sapphiron.cpp:47
@ SPELL_FROST_MISSILE
Definition boss_sapphiron.cpp:46
@ SPELL_BERSERK
Definition boss_sapphiron.cpp:41
@ SPELL_TAIL_SWEEP
Definition boss_sapphiron.cpp:38
@ EVENT_FLIGHT_BREATH
Definition boss_sapphiron.cpp:71
@ EVENT_GROUND
Definition boss_sapphiron.cpp:75
@ EVENT_FLIGHT_ICEBOLT
Definition boss_sapphiron.cpp:70
@ EVENT_FLIGHT_SPELL_EXPLOSION
Definition boss_sapphiron.cpp:72
@ EVENT_FLIGHT_START_LAND
Definition boss_sapphiron.cpp:73
@ EVENT_LAND
Definition boss_sapphiron.cpp:74
bool UpdateVictim()
Definition CreatureAI.cpp:277
Definition Creature.h:47
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition Creature.cpp:2777
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:340
void MoveIdle()
Definition MotionMaster.cpp:233
void MovePoint(uint32 id, const Position &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true, std::optional< AnimTier > animTier=std::nullopt)
Definition MotionMaster.h:238
void MoveRandom(float wanderDistance=0.0f)
Enable a random movement in desired range around the unit. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:243
ThreatContainer::StorageType const & GetThreatList() const
Definition ThreatMgr.h:277
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:39
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:110
void RemoveAllGameObjects()
Definition Unit.cpp:6501
MotionMaster * GetMotionMaster()
Definition Unit.h:1738
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1251
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1101
Unit * GetVictim() const
Definition Unit.h:893
bool HasUnitState(const uint32 f) const
Definition Unit.h:726
void SetDisableGravity(bool disable)
Definition Unit.cpp:20562
void SendMeleeAttackStop(Unit *victim=nullptr)
Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or int...
Definition Unit.cpp:3115
ThreatMgr & GetThreatMgr()
Definition Unit.h:943
void HandleEmoteCommand(uint32 emoteId)
Definition Unit.cpp:2036
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:10618
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:739
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2352
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:52
Talk
Definition hyjal.cpp:82
@ DATA_HUNDRED_CLUB
Definition naxxramas.h:80
const T & RAID_MODE(const T &normal10, const T &normal25) const
Definition ScriptedCreature.h:405
bool IsInRoom()
Definition boss_sapphiron.cpp:109

References Unit::AttackStop(), blockList, Unit::CastCustomSpell(), Unit::CastSpell(), ObjectGuid::Clear(), currentTarget, DATA_HUNDRED_CLUB, UnitAI::DoMeleeAttackIfReady(), EMOTE_AIR_PHASE, EMOTE_BREATH, EMOTE_ENRAGE, EMOTE_GROUND_PHASE, EMOTE_ONESHOT_LAND, EMOTE_ONESHOT_LIFTOFF, EVENT_BERSERK, EVENT_BLIZZARD, EVENT_CLEAVE, EVENT_FLIGHT_BREATH, EVENT_FLIGHT_ICEBOLT, EVENT_FLIGHT_LIFTOFF, EVENT_FLIGHT_SPELL_EXPLOSION, EVENT_FLIGHT_START, EVENT_FLIGHT_START_LAND, EVENT_GROUND, EVENT_HUNDRED_CLUB, EVENT_LAND, EVENT_LIFE_DRAIN, EVENT_TAIL_SWEEP, FORCED_MOVEMENT_NONE, Position::GetExactDist(), Creature::GetHomePosition(), WorldObject::GetMap(), Unit::GetMotionMaster(), Map::GetPlayers(), ThreatMgr::GetThreatList(), Unit::GetThreatMgr(), ObjectAccessor::GetUnit(), Unit::GetVictim(), GO_ICE_BLOCK, Unit::HandleEmoteCommand(), Unit::HasUnitState(), Unit::HealthBelowPct(), iceboltCount, BossAI::instance, IsInRoom(), ScriptedAI::me, MotionMaster::MoveIdle(), MotionMaster::MovePoint(), MotionMaster::MoveRandom(), NPC_BLIZZARD, POINT_CENTER, ScriptedAI::RAID_MODE(), Random, REACT_AGGRESSIVE, REACT_PASSIVE, Unit::RemoveAllGameObjects(), Unit::RemoveUnitFlag(), UnitAI::SelectTarget(), Unit::SendMeleeAttackStop(), ZoneScript::SetData(), Unit::SetDisableGravity(), Creature::SetInCombatWithZone(), Creature::SetReactState(), Unit::SetVisible(), spawnTimer, SPELL_BERSERK, SPELL_CLEAVE, SPELL_FROST_EXPLOSION, SPELL_FROST_MISSILE, SPELL_ICEBOLT_CAST, SPELL_ICEBOLT_TRIGGER, SPELL_LIFE_DRAIN, SPELL_SCHOOL_FROST, SPELL_TAIL_SWEEP, SPELLVALUE_MAX_TARGETS, WorldObject::SummonCreature(), WorldObject::SummonGameObject(), TEMPSUMMON_TIMED_DESPAWN, UNIT_FLAG_NON_ATTACKABLE, UNIT_STATE_CASTING, CreatureAI::UpdateVictim(), and urand().

Member Data Documentation

◆ blockList

GuidList boss_sapphiron::boss_sapphironAI::blockList

◆ currentTarget

ObjectGuid boss_sapphiron::boss_sapphironAI::currentTarget

Referenced by Reset(), and UpdateAI().

◆ events

EventMap boss_sapphiron::boss_sapphironAI::events

◆ iceboltCount

uint8 boss_sapphiron::boss_sapphironAI::iceboltCount {}
95{};

Referenced by Reset(), and UpdateAI().

◆ spawnTimer

uint32 boss_sapphiron::boss_sapphironAI::spawnTimer {}
96{};

Referenced by DoAction(), Reset(), and UpdateAI().


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