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:481
@ BOSS_SAPPHIRON
Definition naxxramas.h:40

Member Function Documentation

◆ DoAction()

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

Reimplemented from UnitAI.

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

References ACTION_SAPPHIRON_BIRTH, and spawnTimer.

◆ EnterCombatSelfFunction()

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

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:550
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:14320
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:733
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:2373
@ GO_SAPPHIRON_BIRTH
Definition naxxramas.h:116
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:520
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
201 {
202 for (ObjectGuid const& guid : blockList)
203 {
204 if (target->GetGUID() == guid)
205 return false;
206
207 if (Unit* block = ObjectAccessor::GetUnit(*me, guid))
208 {
209 if (block->IsInBetween(me, target, 2.0f) && block->IsWithinDist(target, 10.0f))
210 return false;
211 }
212 }
213 return true;
214 }
Definition ObjectGuid.h:118
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
Definition Unit.h:650
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.

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

157 {
161 events.ScheduleEvent(EVENT_BERSERK, 15min);
162 events.ScheduleEvent(EVENT_CLEAVE, 5s);
163 events.ScheduleEvent(EVENT_TAIL_SWEEP, 10s);
164 events.ScheduleEvent(EVENT_LIFE_DRAIN, 17s);
165 events.ScheduleEvent(EVENT_BLIZZARD, 17s);
166 events.ScheduleEvent(EVENT_FLIGHT_START, 45s);
167 events.ScheduleEvent(EVENT_HUNDRED_CLUB, 5s);
168 }
@ 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:519
void EnterCombatSelfFunction()
Definition boss_sapphiron.cpp:133

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.

217 {
218 if (who->IsPlayer())
220 }
InstanceScript *const instance
Definition ScriptedCreature.h:488
void StorePersistentData(uint32 index, uint32 data)
Definition InstanceScript.cpp:422
bool IsPlayer() const
Definition Object.h:201
@ PERSISTENT_DATA_IMMORTAL_FAIL
Definition naxxramas.h:88

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.

185 {
186 if (type == POINT_MOTION_TYPE && id == POINT_CENTER)
187 {
188 events.ScheduleEvent(EVENT_FLIGHT_LIFTOFF, 500ms);
189 }
190 }
@ 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();
131 }
@ REACT_AGGRESSIVE
Definition Unit.h:552
void Reset() override
Definition ScriptedCreature.h:518
void Clear()
Definition ObjectGuid.h:138
bool IsVisible() const
Definition Unit.h:1967
uint8 iceboltCount
Definition boss_sapphiron.cpp:95
ObjectGuid currentTarget
Definition boss_sapphiron.cpp:98

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

◆ SpellHitTarget()

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

Reimplemented from CreatureAI.

193 {
194 if (spellInfo->Id == SPELL_ICEBOLT_CAST)
195 {
196 me->CastSpell(target, SPELL_ICEBOLT_TRIGGER, true);
197 }
198 }
@ 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.

223 {
224 if (spawnTimer)
225 {
226 spawnTimer += diff;
227 if (spawnTimer >= 21500)
228 {
229 me->SetVisible(true);
232 spawnTimer = 0;
233 }
234 return;
235 }
236
237 if (!IsInRoom())
238 return;
239
240 if (!UpdateVictim())
241 return;
242
243 events.Update(diff);
245 return;
246
247 switch (events.ExecuteEvent())
248 {
249 case EVENT_BERSERK:
251 me->CastSpell(me, SPELL_BERSERK, true);
252 return;
253 case EVENT_CLEAVE:
254 me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false);
255 events.Repeat(10s);
256 return;
257 case EVENT_TAIL_SWEEP:
259 events.Repeat(10s);
260 return;
261 case EVENT_LIFE_DRAIN:
263 events.Repeat(24s);
264 return;
265 case EVENT_BLIZZARD:
266 {
267 Creature* cr;
268 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
269 {
271 }
272 else
273 {
275 }
276 if (cr)
277 {
278 cr->GetMotionMaster()->MoveRandom(40);
279 }
280 events.Repeat(RAID_MODE(8000ms, 6500ms));
281 return;
282 }
284 if (me->HealthBelowPct(11))
285 {
286 return;
287 }
288 events.Repeat(45s);
289 events.DelayEvents(35s);
291 me->AttackStop();
292 float x, y, z, o;
293 me->GetHomePosition(x, y, z, o);
295 return;
301 me->SetDisableGravity(true);
303 events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3s);
304 iceboltCount = RAID_MODE(2, 3);
305 return;
307 {
308 if (currentTarget)
309 {
311 {
312 me->SummonGameObject(GO_ICE_BLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0);
313 }
314 }
315
316 std::vector<Unit*> targets;
317 auto i = me->GetThreatMgr().GetThreatList().begin();
318 for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
319 {
320 if ((*i)->getTarget()->IsPlayer())
321 {
322 bool inList = false;
323 if (!blockList.empty())
324 {
325 for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
326 {
327 if ((*i)->getTarget()->GetGUID() == *itr)
328 {
329 inList = true;
330 break;
331 }
332 }
333 }
334 if (!inList)
335 {
336 targets.push_back((*i)->getTarget());
337 }
338 }
339 }
340
341 if (!targets.empty() && iceboltCount)
342 {
343 auto itr = targets.begin();
344 advance(itr, urand(0, targets.size() - 1));
345 me->CastSpell(*itr, SPELL_ICEBOLT_CAST, false);
346 blockList.push_back((*itr)->GetGUID());
347 currentTarget = (*itr)->GetGUID();
348 --iceboltCount;
349 events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, Seconds(uint32(me->GetExactDist(*itr) / 13.0f)));
350 }
351 else
352 {
353 events.ScheduleEvent(EVENT_FLIGHT_BREATH, 1s);
354 }
355 return;
356 }
361 events.ScheduleEvent(EVENT_FLIGHT_SPELL_EXPLOSION, 8500ms);
362 return;
365 events.ScheduleEvent(EVENT_FLIGHT_START_LAND, 3s);
366 return;
368 if (!blockList.empty())
369 {
370 for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
371 {
372 if (Unit* block = ObjectAccessor::GetUnit(*me, *itr))
373 {
374 block->RemoveAurasDueToSpell(SPELL_ICEBOLT_TRIGGER);
375 }
376 }
377 }
378 blockList.clear();
380 events.ScheduleEvent(EVENT_LAND, 1s);
381 return;
382 case EVENT_LAND:
384 me->SetDisableGravity(false);
385 events.ScheduleEvent(EVENT_GROUND, 1500ms);
386 return;
387 case EVENT_GROUND:
391 return;
393 {
394 Map::PlayerList const& pList = me->GetMap()->GetPlayers();
395 for (auto const& itr : pList)
396 {
397 if (itr.GetSource()->GetResistance(SPELL_SCHOOL_FROST) > 100)
398 {
400 return;
401 }
402 }
403 events.Repeat(5s);
404 return;
405 }
406 }
408 }
std::uint32_t uint32
Definition Define.h:107
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:30
@ 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:287
Definition Creature.h:47
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition Creature.cpp:2829
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:341
void MovePoint(uint32 id, const Position &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true)
Definition MotionMaster.h:228
void MoveIdle()
Definition MotionMaster.cpp:233
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:273
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:6362
MotionMaster * GetMotionMaster()
Definition Unit.h:1713
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:1078
Unit * GetVictim() const
Definition Unit.h:886
bool HasUnitState(const uint32 f) const
Definition Unit.h:721
void SetDisableGravity(bool disable)
Definition Unit.cpp:20331
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:3114
ThreatMgr & GetThreatMgr()
Definition Unit.h:936
void HandleEmoteCommand(uint32 emoteId)
Definition Unit.cpp:2035
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:10479
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:734
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:2359
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:404
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, 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: