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. More...
 
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() More...
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
 ~BossAI () override
 
bool CanRespawn () override
 
void DamageTaken (Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
 Called at any Damage from any attacker (before damage apply) More...
 
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() More...
 
void ScheduleHealthCheckEvent (uint32 healthPct, std::function< void()> exec)
 Executes a function once the creature reaches the defined health point percent. More...
 
void ScheduleHealthCheckEvent (std::initializer_list< uint8 > healthPct, std::function< void()> exec)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
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) 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

EventMap events
 
InstanceScriptpInstance
 
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
95 {
97 }
@ BOSS_SAPPHIRON
Definition: naxxramas.h:42
Creature * me
Definition: ScriptedCreature.h:280
Definition: ScriptedCreature.h:467
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1203
InstanceScript * pInstance
Definition: boss_sapphiron.cpp:100

References WorldObject::GetInstanceScript(), ScriptedAI::me, and pInstance.

Member Function Documentation

◆ DoAction()

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

Reimplemented from UnitAI.

183 {
184 if (param == ACTION_SAPPHIRON_BIRTH)
185 {
186 spawnTimer = 1;
187 }
188 }
@ ACTION_SAPPHIRON_BIRTH
Definition: naxxramas.h:178
uint32 spawnTimer
Definition: boss_sapphiron.cpp:102

References ACTION_SAPPHIRON_BIRTH, and spawnTimer.

◆ EnterCombatSelfFunction()

void boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction ( )
inline
140 {
141 Map::PlayerList const& PlList = me->GetMap()->GetPlayers();
142 if (PlList.IsEmpty())
143 return;
144
145 for (auto const& i : PlList)
146 {
147 if (Player* player = i.GetSource())
148 {
149 if (player->IsGameMaster())
150 continue;
151
152 if (player->IsAlive() && me->GetDistance(player) < 80.0f)
153 {
154 me->SetInCombatWith(player);
155 player->SetInCombatWith(me);
156 me->AddThreat(player, 0.0f);
157 }
158 }
159 }
160 }
bool IsEmpty() const
Definition: LinkedList.h:97
Map * GetMap() const
Definition: Object.h:536
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1256
Definition: Player.h:1081
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: Unit.cpp:14653
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition: Unit.cpp:13581
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26

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.

107 {
109 me->SetVisible(false);
113 }
@ GO_SAPPHIRON_BIRTH
Definition: naxxramas.h:106
@ REACT_PASSIVE
Definition: Unit.h:548
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:230
virtual void InitializeAI()
Definition: UnitAI.h:204
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:94
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:2380
float GetPositionZ() const
Definition: Position.h:118
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
void SetVisible(bool x)
Definition: Unit.cpp:14232
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:713

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
116 {
117 if (me->GetExactDist(3523.5f, -5235.3f, 137.6f) > 100.0f)
118 {
120 return false;
121 }
122 return true;
123 }
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition: ScriptedCreature.h:498
float GetExactDist(float x, float y, float z) const
Definition: Position.h:177

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

Referenced by UpdateAI().

◆ IsValidExplosionTarget()

bool boss_sapphiron::boss_sapphironAI::IsValidExplosionTarget ( WorldObject target)
inline
207 {
208 for (ObjectGuid const& guid : blockList)
209 {
210 if (target->GetGUID() == guid)
211 return false;
212
213 if (Unit* block = ObjectAccessor::GetUnit(*me, guid))
214 {
215 if (block->IsInBetween(me, target, 2.0f) && block->IsWithinDist(target, 10.0f))
216 return false;
217 }
218 }
219 return true;
220 }
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:199
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
Definition: ObjectGuid.h:118
Definition: Unit.h:630
GuidList blockList
Definition: boss_sapphiron.cpp:103

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

◆ JustDied()

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

Reimplemented from BossAI.

177 {
178 BossAI::JustDied(killer);
180 }
@ SPELL_SAPPHIRON_DIES
Definition: boss_sapphiron.cpp:53
void JustDied(Unit *) override
Definition: ScriptedCreature.h:499
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

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

163 {
167 events.ScheduleEvent(EVENT_BERSERK, 15min);
168 events.ScheduleEvent(EVENT_CLEAVE, 5s);
169 events.ScheduleEvent(EVENT_TAIL_SWEEP, 10s);
170 events.ScheduleEvent(EVENT_LIFE_DRAIN, 17s);
171 events.ScheduleEvent(EVENT_BLIZZARD, 17s);
172 events.ScheduleEvent(EVENT_FLIGHT_START, 45s);
173 events.ScheduleEvent(EVENT_HUNDRED_CLUB, 5s);
174 }
events
Definition: boss_sartura.cpp:43
@ SPELL_FROST_AURA_10
Definition: boss_sapphiron.cpp:36
@ SPELL_FROST_AURA_25
Definition: boss_sapphiron.cpp:37
@ EVENT_TAIL_SWEEP
Definition: boss_sapphiron.cpp:68
@ EVENT_HUNDRED_CLUB
Definition: boss_sapphiron.cpp:79
@ EVENT_LIFE_DRAIN
Definition: boss_sapphiron.cpp:69
@ EVENT_BERSERK
Definition: boss_sapphiron.cpp:66
@ EVENT_FLIGHT_START
Definition: boss_sapphiron.cpp:71
@ EVENT_BLIZZARD
Definition: boss_sapphiron.cpp:70
@ EVENT_CLEAVE
Definition: boss_sapphiron.cpp:67
const T & RAID_MODE(const T &normal10, const T &normal25) const
Definition: ScriptedCreature.h:404
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition: ScriptedCreature.h:497
void EnterCombatSelfFunction()
Definition: boss_sapphiron.cpp:139

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, ScriptedAI::RAID_MODE(), SPELL_FROST_AURA_10, and SPELL_FROST_AURA_25.

◆ KilledUnit()

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

Reimplemented from ScriptedAI.

223 {
224 if (who->IsPlayer() && pInstance)
225 {
227 }
228 }
@ DATA_IMMORTAL_FAIL
Definition: naxxramas.h:73
bool IsPlayer() const
Definition: Object.h:200
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52

References DATA_IMMORTAL_FAIL, Object::IsPlayer(), pInstance, and ZoneScript::SetData().

◆ MovementInform()

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

Reimplemented from ScriptedAI.

191 {
192 if (type == POINT_MOTION_TYPE && id == POINT_CENTER)
193 {
194 events.ScheduleEvent(EVENT_FLIGHT_LIFTOFF, 500ms);
195 }
196 }
@ POINT_CENTER
Definition: boss_sapphiron.cpp:61
@ EVENT_FLIGHT_LIFTOFF
Definition: boss_sapphiron.cpp:72
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:48

References EVENT_FLIGHT_LIFTOFF, POINT_CENTER, and POINT_MOTION_TYPE.

◆ Reset()

void boss_sapphiron::boss_sapphironAI::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

126 {
128 if (me->IsVisible())
129 {
131 }
132 events.Reset();
133 iceboltCount = 0;
134 spawnTimer = 0;
136 blockList.clear();
137 }
@ REACT_AGGRESSIVE
Definition: Unit.h:550
void Reset() override
Definition: ScriptedCreature.h:496
void Clear()
Definition: ObjectGuid.h:138
bool IsVisible() const
Definition: Unit.h:1876
uint8 iceboltCount
Definition: boss_sapphiron.cpp:101
ObjectGuid currentTarget
Definition: boss_sapphiron.cpp:104

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

199 {
200 if (spellInfo->Id == SPELL_ICEBOLT_CAST)
201 {
202 me->CastSpell(target, SPELL_ICEBOLT_TRIGGER, true);
203 }
204 }
@ SPELL_ICEBOLT_TRIGGER
Definition: boss_sapphiron.cpp:48
@ SPELL_ICEBOLT_CAST
Definition: boss_sapphiron.cpp:47

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

Reimplemented from BossAI.

231 {
232 if (spawnTimer)
233 {
234 spawnTimer += diff;
235 if (spawnTimer >= 21500)
236 {
237 me->SetVisible(true);
240 spawnTimer = 0;
241 }
242 return;
243 }
244
245 if (!IsInRoom())
246 return;
247
248 if (!UpdateVictim())
249 return;
250
251 events.Update(diff);
253 return;
254
255 switch (events.ExecuteEvent())
256 {
257 case EVENT_BERSERK:
259 me->CastSpell(me, SPELL_BERSERK, true);
260 return;
261 case EVENT_CLEAVE:
262 me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false);
263 events.Repeat(10s);
264 return;
265 case EVENT_TAIL_SWEEP:
267 events.Repeat(10s);
268 return;
269 case EVENT_LIFE_DRAIN:
271 events.Repeat(24s);
272 return;
273 case EVENT_BLIZZARD:
274 {
275 Creature* cr;
276 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40.0f, true))
277 {
279 }
280 else
281 {
283 }
284 if (cr)
285 {
286 cr->GetMotionMaster()->MoveRandom(40);
287 }
288 events.RepeatEvent(RAID_MODE(8000, 6500));
289 return;
290 }
292 if (me->HealthBelowPct(11))
293 {
294 return;
295 }
296 events.Repeat(45s);
297 events.DelayEvents(35s);
299 me->AttackStop();
300 float x, y, z, o;
301 me->GetHomePosition(x, y, z, o);
303 return;
309 me->SetDisableGravity(true);
311 events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3s);
312 iceboltCount = RAID_MODE(2, 3);
313 return;
315 {
316 if (currentTarget)
317 {
319 {
320 me->SummonGameObject(GO_ICE_BLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0);
321 }
322 }
323
324 std::vector<Unit*> targets;
325 auto i = me->GetThreatMgr().GetThreatList().begin();
326 for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
327 {
328 if ((*i)->getTarget()->IsPlayer())
329 {
330 bool inList = false;
331 if (!blockList.empty())
332 {
333 for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
334 {
335 if ((*i)->getTarget()->GetGUID() == *itr)
336 {
337 inList = true;
338 break;
339 }
340 }
341 }
342 if (!inList)
343 {
344 targets.push_back((*i)->getTarget());
345 }
346 }
347 }
348
349 if (!targets.empty() && iceboltCount)
350 {
351 auto itr = targets.begin();
352 advance(itr, urand(0, targets.size() - 1));
353 me->CastSpell(*itr, SPELL_ICEBOLT_CAST, false);
354 blockList.push_back((*itr)->GetGUID());
355 currentTarget = (*itr)->GetGUID();
356 --iceboltCount;
357 events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, (me->GetExactDist(*itr) / 13.0f)*IN_MILLISECONDS);
358 }
359 else
360 {
361 events.ScheduleEvent(EVENT_FLIGHT_BREATH, 1s);
362 }
363 return;
364 }
369 events.ScheduleEvent(EVENT_FLIGHT_SPELL_EXPLOSION, 8500ms);
370 return;
373 events.ScheduleEvent(EVENT_FLIGHT_START_LAND, 3s);
374 return;
376 if (!blockList.empty())
377 {
378 for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
379 {
380 if (Unit* block = ObjectAccessor::GetUnit(*me, *itr))
381 {
382 block->RemoveAurasDueToSpell(SPELL_ICEBOLT_TRIGGER);
383 }
384 }
385 }
386 blockList.clear();
388 events.ScheduleEvent(EVENT_LAND, 1s);
389 return;
390 case EVENT_LAND:
392 me->SetDisableGravity(false);
393 events.ScheduleEvent(EVENT_GROUND, 1500ms);
394 return;
395 case EVENT_GROUND:
399 return;
401 {
402 Map::PlayerList const& pList = me->GetMap()->GetPlayers();
403 for (auto const& itr : pList)
404 {
405 if (itr.GetSource()->GetResistance(SPELL_SCHOOL_FROST) > 100 && pInstance)
406 {
408 return;
409 }
410 }
411 events.Repeat(5s);
412 return;
413 }
414 }
416 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:53
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
Talk
Definition: hyjal.cpp:82
@ GO_ICE_BLOCK
Definition: boss_sapphiron.cpp:58
@ NPC_BLIZZARD
Definition: boss_sapphiron.cpp:59
@ 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:38
@ SPELL_TAIL_SWEEP_10
Definition: boss_sapphiron.cpp:39
@ SPELL_FROST_EXPLOSION
Definition: boss_sapphiron.cpp:50
@ SPELL_FROST_MISSILE
Definition: boss_sapphiron.cpp:49
@ SPELL_BERSERK
Definition: boss_sapphiron.cpp:44
@ SPELL_TAIL_SWEEP_25
Definition: boss_sapphiron.cpp:40
@ SPELL_LIFE_DRAIN_10
Definition: boss_sapphiron.cpp:42
@ SPELL_LIFE_DRAIN_25
Definition: boss_sapphiron.cpp:43
@ EVENT_FLIGHT_BREATH
Definition: boss_sapphiron.cpp:74
@ EVENT_GROUND
Definition: boss_sapphiron.cpp:78
@ EVENT_FLIGHT_ICEBOLT
Definition: boss_sapphiron.cpp:73
@ EVENT_FLIGHT_SPELL_EXPLOSION
Definition: boss_sapphiron.cpp:75
@ EVENT_FLIGHT_START_LAND
Definition: boss_sapphiron.cpp:76
@ EVENT_LAND
Definition: boss_sapphiron.cpp:77
@ DATA_HUNDRED_CLUB
Definition: naxxramas.h:71
@ EMOTE_ONESHOT_LAND
Definition: SharedDefines.h:1964
@ EMOTE_ONESHOT_LIFTOFF
Definition: SharedDefines.h:1960
@ SPELL_SCHOOL_FROST
Definition: SharedDefines.h:287
@ SPELLVALUE_MAX_TARGETS
Definition: SpellDefines.h:117
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:48
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
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
bool UpdateVictim()
Definition: CreatureAI.cpp:280
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:273
Definition: Creature.h:43
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition: Creature.cpp:2811
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING....
Definition: Creature.cpp:3205
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:338
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:2366
void RemoveAllGameObjects()
Definition: Unit.cpp:6263
MotionMaster * GetMotionMaster()
Definition: Unit.h:1620
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:1224
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1037
Unit * GetVictim() const
Definition: Unit.h:853
bool HasUnitState(const uint32 f) const
Definition: Unit.h:701
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:3077
ThreatMgr & GetThreatMgr()
Definition: Unit.h:903
void HandleEmoteCommand(uint32 emoteId)
Definition: Unit.cpp:2000
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition: Unit.cpp:10403
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:714
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:213
void MoveIdle()
Definition: MotionMaster.cpp:232
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:242
bool IsInRoom()
Definition: boss_sapphiron.cpp:115

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, IN_MILLISECONDS, IsInRoom(), ScriptedAI::me, MotionMaster::MoveIdle(), MotionMaster::MovePoint(), MotionMaster::MoveRandom(), NPC_BLIZZARD, pInstance, POINT_CENTER, ScriptedAI::RAID_MODE(), REACT_AGGRESSIVE, REACT_PASSIVE, Unit::RemoveAllGameObjects(), Unit::RemoveUnitFlag(), UnitAI::SelectTarget(), Unit::SendMeleeAttackStop(), ZoneScript::SetData(), Creature::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_10, SPELL_LIFE_DRAIN_25, SPELL_SCHOOL_FROST, SPELL_TAIL_SWEEP_10, SPELL_TAIL_SWEEP_25, 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 {}

Referenced by Reset(), and UpdateAI().

◆ pInstance

InstanceScript* boss_sapphiron::boss_sapphironAI::pInstance

◆ spawnTimer

uint32 boss_sapphiron::boss_sapphironAI::spawnTimer {}

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