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

Public Member Functions

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

Private Attributes

uint8 _phase
 
int8 _currentWP
 
bool _whelpSpam
 
uint8 _whelpCount
 
int32 _whelpSpamTimer
 
bool _manyWhelpsAvailable
 

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 ()
 
- Public Attributes inherited from BossAI
float callForHelpRange
 
InstanceScript *const instance
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
- 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
 
bool _isEngaged
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ boss_onyxia()

boss_onyxia::boss_onyxia ( Creature creature)
inline
129 : BossAI(creature, DATA_ONYXIA)
130 {
131 Initialize();
132 }
Definition ScriptedCreature.h:485
@ DATA_ONYXIA
Definition onyxias_lair.h:29
void Initialize()
Definition boss_onyxia.cpp:134

References Initialize().

Member Function Documentation

◆ CheckInRoom()

bool boss_onyxia::CheckInRoom ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

318 {
319 if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f)
320 {
323 return false;
324 }
325
326 return true;
327 }
@ SAY_EVADE
Definition boss_onyxia.cpp:123
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition ScriptedCreature.h:526
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:349
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1317
Talk
Definition hyjal.cpp:82
Creature * me
Definition ScriptedCreature.h:281

References BossAI::EnterEvadeMode(), WorldObject::GetDistance2d(), Creature::GetHomePosition(), ScriptedAI::me, and SAY_EVADE.

Referenced by UpdateAI().

◆ DamageTaken()

void boss_onyxia::DamageTaken ( Unit ,
uint32 ,
DamageEffectType  ,
SpellSchoolMask   
)
inlineoverridevirtual

Called at any Damage from any attacker (before damage apply)

Note
It use for recalculation damage or special reaction at damage for attack reaction use AttackedBy called for non DOT damage in Unit::DealDamage also

Reimplemented from UnitAI.

207 {
208 if (me->HealthBelowPctDamaged(65, damage) && _phase == PHASE_GROUNDED)
209 {
211 }
212 else if (me->HealthBelowPctDamaged(40, damage) && _phase == PHASE_AIRPHASE)
213 {
216 }
217 }
@ PHASE_AIRPHASE
Definition boss_onyxia.cpp:83
@ PHASE_LANDED
Definition boss_onyxia.cpp:84
@ PHASE_GROUNDED
Definition boss_onyxia.cpp:82
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4312
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:1118
uint8 _phase
Definition boss_onyxia.cpp:563
void SetPhase(uint8 ph)
Definition boss_onyxia.cpp:144

References _phase, Unit::HealthBelowPctDamaged(), Unit::InterruptNonMeleeSpells(), ScriptedAI::me, PHASE_AIRPHASE, PHASE_GROUNDED, PHASE_LANDED, and SetPhase().

◆ DoAction()

void boss_onyxia::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

180 {
181 switch (param)
182 {
185 {
187 }
188 break;
189 default:
190 break;
191 }
192 }
InstanceScript *const instance
Definition ScriptedCreature.h:492
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:52
@ DATA_WHELP_SUMMONED
Definition onyxias_lair.h:31
@ ACTION_WHELP_SUMMONED
Definition onyxias_lair.h:45
bool _manyWhelpsAvailable
Definition boss_onyxia.cpp:569

References _manyWhelpsAvailable, ACTION_WHELP_SUMMONED, DATA_WHELP_SUMMONED, BossAI::instance, and ZoneScript::SetData().

◆ HandleWhelpSpam()

void boss_onyxia::HandleWhelpSpam ( uint32  diff)
inline
295 {
296 if (_whelpSpam)
297 {
298 if (_whelpCount < 40)
299 {
300 _whelpSpamTimer -= diff;
301 if (_whelpSpamTimer <= 0)
302 {
303 SummonWhelps();
304 _whelpCount += 2;
305 _whelpSpamTimer += 600;
306 }
307 }
308 else
309 {
310 _whelpSpam = false;
311 _whelpCount = 0;
312 _whelpSpamTimer = 0;
313 }
314 }
315 }
uint8 _whelpCount
Definition boss_onyxia.cpp:567
void SummonWhelps()
Definition boss_onyxia.cpp:286
bool _whelpSpam
Definition boss_onyxia.cpp:566
int32 _whelpSpamTimer
Definition boss_onyxia.cpp:568

References _whelpCount, _whelpSpam, _whelpSpamTimer, and SummonWhelps().

Referenced by UpdateAI().

◆ Initialize()

void boss_onyxia::Initialize ( )
inline
135 {
137 _currentWP = 0;
138 _whelpSpam = false;
139 _whelpCount = 0;
140 _whelpSpamTimer = 0;
141 _manyWhelpsAvailable = false;
142 }
@ PHASE_NONE
Definition boss_onyxia.cpp:81
int8 _currentWP
Definition boss_onyxia.cpp:564

References _currentWP, _manyWhelpsAvailable, _phase, _whelpCount, _whelpSpam, _whelpSpamTimer, and PHASE_NONE.

Referenced by boss_onyxia(), and Reset().

◆ JustEngagedWith()

void boss_onyxia::JustEngagedWith ( Unit )
inlineoverridevirtual

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

Reimplemented from CreatureAI.

195 {
198
199 instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); // just in case at reset some players already left the instance
202
203 me->SummonCreature(NPC_ONYXIAN_LAIR_GUARD, -167.837936f, -200.549332f, -66.343231f, 5.598287f, TEMPSUMMON_MANUAL_DESPAWN);
204 }
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:110
@ TEMPSUMMON_MANUAL_DESPAWN
Definition Object.h:56
@ SAY_AGGRO
Definition boss_onyxia.cpp:118
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged - this happens after JustEnteredCombat.
Definition ScriptedCreature.h:525
void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition InstanceScript.cpp:683
void DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition InstanceScript.cpp:692
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2448
@ NPC_ONYXIAN_LAIR_GUARD
Definition onyxias_lair.h:40
@ ACHIEV_TIMED_START_EVENT
Definition onyxias_lair.h:60

References ACHIEV_TIMED_START_EVENT, ACHIEVEMENT_TIMED_TYPE_EVENT, InstanceScript::DoStartTimedAchievement(), InstanceScript::DoStopTimedAchievement(), BossAI::instance, BossAI::JustEngagedWith(), ScriptedAI::me, NPC_ONYXIAN_LAIR_GUARD, PHASE_GROUNDED, SAY_AGGRO, SetPhase(), WorldObject::SummonCreature(), and TEMPSUMMON_MANUAL_DESPAWN.

◆ JustSummoned()

void boss_onyxia::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from CreatureAI.

220 {
221 summons.Summon(summon);
222
223 if (summon->GetEntry() != NPC_ONYXIAN_WHELP && summon->GetEntry() != NPC_ONYXIAN_LAIR_GUARD)
224 {
225 return;
226 }
227
229 {
230 return;
231 }
232
233 if (Unit* target = summon->SelectNearestTarget(300.0f))
234 {
235 summon->AI()->AttackStart(target);
236 DoZoneInCombat(summon);
237 }
238 }
SummonList summons
Definition ScriptedCreature.h:539
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition CreatureAI.cpp:117
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Select nearest hostile unit within the given distance (regardless of threat list).
Definition Creature.cpp:2427
CreatureAI * AI() const
Definition Creature.h:144
uint32 GetEntry() const
Definition Object.h:117
void Summon(Creature const *summon)
Definition ScriptedCreature.h:88
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:29
Definition Unit.h:665
@ NPC_ONYXIAN_WHELP
Definition onyxias_lair.h:38

References _phase, Creature::AI(), UnitAI::AttackStart(), CreatureAI::DoZoneInCombat(), Object::GetEntry(), NPC_ONYXIAN_LAIR_GUARD, NPC_ONYXIAN_WHELP, PHASE_AIRPHASE, Creature::SelectNearestTarget(), SummonList::Summon(), and BossAI::summons.

◆ MovementInform()

void boss_onyxia::MovementInform ( uint32  type,
uint32  id 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

241 {
242 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
243 {
244 return;
245 }
246
247 if (id < 9)
248 {
249 if (id > 0 && _phase == PHASE_AIRPHASE)
250 {
252 me->SetSpeed(MOVE_RUN, 1.6f, false);
253 _currentWP = id;
254 events.ScheduleEvent(EVENT_SPELL_FIREBALL_FIRST, 1s);
255 }
256 }
257 else
258 {
259 switch (id)
260 {
263 events.ScheduleEvent(EVENT_LIFTOFF, 0ms);
264 break;
265 case POINT_TAKEOFF:
267 events.ScheduleEvent(EVENT_FLY_S_TO_N, 0ms);
268 break;
269 case POINT_PRE_LAND:
271 events.ScheduleEvent(EVENT_LAND, 0ms);
272 break;
273 case POINT_LAND:
274 me->SetCanFly(false);
275 me->SetDisableGravity(false);
277 events.ScheduleEvent(EVENT_PHASE_3_ATTACK, 0ms);
278 break;
279 default:
280 break;
281 }
282 }
283 }
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ EFFECT_MOTION_TYPE
Definition MotionMaster.h:56
@ MOVE_RUN
Definition UnitDefines.h:357
static OnyxiaMove const OnyxiaMoveData[]
Definition boss_onyxia.cpp:103
@ POINT_TAKEOFF
Definition boss_onyxia.cpp:91
@ POINT_PRE_LAND
Definition boss_onyxia.cpp:92
@ POINT_LAND
Definition boss_onyxia.cpp:93
@ POINT_GROUND_SOUTH
Definition boss_onyxia.cpp:90
@ EVENT_SPELL_FIREBALL_FIRST
Definition boss_onyxia.cpp:57
@ EVENT_FLY_S_TO_N
Definition boss_onyxia.cpp:74
@ EVENT_LIFTOFF
Definition boss_onyxia.cpp:73
@ EVENT_LAND
Definition boss_onyxia.cpp:75
@ EVENT_PHASE_3_ATTACK
Definition boss_onyxia.cpp:64
events
Definition boss_sartura.cpp:43
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:207
void SetFacingTo(float ori)
Definition Unit.cpp:16455
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16566
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:11304
void SetDisableGravity(bool disable)
Definition Unit.cpp:16506
float speed_run
Definition CreatureData.h:202

References _currentWP, _phase, EFFECT_MOTION_TYPE, EVENT_FLY_S_TO_N, EVENT_LAND, EVENT_LIFTOFF, EVENT_PHASE_3_ATTACK, EVENT_SPELL_FIREBALL_FIRST, Creature::GetCreatureTemplate(), ScriptedAI::me, MOVE_RUN, OnyxiaMoveData, PHASE_AIRPHASE, POINT_GROUND_SOUTH, POINT_LAND, POINT_MOTION_TYPE, POINT_PRE_LAND, POINT_TAKEOFF, Unit::SetCanFly(), Unit::SetDisableGravity(), Unit::SetFacingTo(), Unit::SetSpeed(), and CreatureTemplate::speed_run.

◆ Reset()

void boss_onyxia::Reset ( )
inlineoverridevirtual

◆ SetPhase()

void boss_onyxia::SetPhase ( uint8  ph)
inline
145 {
146 events.Reset();
147 _phase = ph;
148 switch (ph)
149 {
150 case PHASE_GROUNDED:
151 events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, 10s, 20s);
152 events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, 10s, 20s);
153 events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, 15s, 20s);
154 events.ScheduleEvent(EVENT_SPELL_CLEAVE, 2s, 5s);
155 break;
156 case PHASE_AIRPHASE:
157 events.ScheduleEvent(EVENT_START_PHASE_2, 0ms);
158 break;
159 case PHASE_LANDED:
160 events.ScheduleEvent(EVENT_START_PHASE_3, 5s);
161 break;
162 default:
163 break;
164 }
165 }
@ EVENT_SPELL_CLEAVE
Definition boss_onyxia.cpp:55
@ EVENT_START_PHASE_3
Definition boss_onyxia.cpp:63
@ EVENT_START_PHASE_2
Definition boss_onyxia.cpp:56
@ EVENT_SPELL_WINGBUFFET
Definition boss_onyxia.cpp:52
@ EVENT_SPELL_TAILSWEEP
Definition boss_onyxia.cpp:54
@ EVENT_SPELL_FLAMEBREATH
Definition boss_onyxia.cpp:53

References _phase, EVENT_SPELL_CLEAVE, EVENT_SPELL_FLAMEBREATH, EVENT_SPELL_TAILSWEEP, EVENT_SPELL_WINGBUFFET, EVENT_START_PHASE_2, EVENT_START_PHASE_3, PHASE_AIRPHASE, PHASE_GROUNDED, and PHASE_LANDED.

Referenced by DamageTaken(), JustEngagedWith(), and Reset().

◆ SpellHitTarget()

void boss_onyxia::SpellHitTarget ( Unit target,
SpellInfo const *  spell 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

551 {
552 // Deep Breath is a chain of dozens of triggered spells with no shared id,
553 // so identify a hit by the shape common to all of them
554 if (target->IsPlayer() && spell->DurationEntry && spell->DurationEntry->ID == 328
555 && spell->Effects[EFFECT_1].TargetA.GetTarget() == TARGET_UNIT_CASTER
556 && (spell->Effects[EFFECT_1].Amplitude == 50 || spell->Effects[EFFECT_1].Amplitude == 215))
557 {
559 }
560 }
@ EFFECT_1
Definition SharedDefines.h:32
@ TARGET_UNIT_CASTER
Definition SharedDefines.h:1414
bool IsPlayer() const
Definition Object.h:201
@ DATA_DEEP_BREATH_FAILED
Definition onyxias_lair.h:32

References DATA_DEEP_BREATH_FAILED, SpellInfo::DurationEntry, EFFECT_1, SpellInfo::Effects, SpellDurationEntry::ID, BossAI::instance, Object::IsPlayer(), ZoneScript::SetData(), and TARGET_UNIT_CASTER.

◆ SummonWhelps()

void boss_onyxia::SummonWhelps ( )
inline
287 {
288 float angle = rand_norm() * 2 * M_PI;
289 float dist = rand_norm() * 4.0f;
290 me->CastSpell(-33.18f + std::cos(angle) * dist, -258.80f + std::sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true);
291 me->CastSpell(-32.535f + std::cos(angle) * dist, -170.190f + std::sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true);
292 }
double rand_norm()
Definition Random.cpp:85
@ SPELL_SUMMON_WHELP
Definition boss_onyxia.cpp:33
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:1361

References Unit::CastSpell(), ScriptedAI::me, rand_norm(), and SPELL_SUMMON_WHELP.

Referenced by HandleWhelpSpam(), and UpdateAI().

◆ UpdateAI()

void boss_onyxia::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

330 {
331 if (!UpdateVictim() || !CheckInRoom())
332 {
333 return;
334 }
335
336 events.Update(diff);
337 HandleWhelpSpam(diff);
338
340 {
341 return;
342 }
343
344 switch (events.ExecuteEvent())
345 {
347 {
349 events.Repeat(15s, 30s);
350 break;
351 }
353 {
355 events.Repeat(10s, 20s);
356 break;
357 }
359 {
361 events.Repeat(15s, 20s);
362 break;
363 }
365 {
367 events.Repeat(2s, 5s);
368 break;
369 }
371 {
372 me->AttackStop();
374 me->StopMoving();
377 break;
378 }
379 case EVENT_LIFTOFF:
380 {
384 me->DisableSpline();
385 me->SetCanFly(true);
386 me->SetDisableGravity(true);
391
392 events.RescheduleEvent(EVENT_END_MANY_WHELPS_TIME, 10s);
393 break;
394 }
396 _manyWhelpsAvailable = false;
397 break;
398 case EVENT_FLY_S_TO_N:
399 {
400 me->SetSpeed(MOVE_RUN, 2.95f, false);
402
403 _whelpSpam = true;
404 events.ScheduleEvent(EVENT_WHELP_SPAM, 90s);
405 events.ScheduleEvent(EVENT_SUMMON_LAIR_GUARD, 30s);
406 break;
407 }
409 {
410 me->CastSpell(-101.654f, -214.491f, -80.70f, SPELL_SUMMON_LAIR_GUARD, true);
411 events.Repeat(30s);
412 break;
413 }
414 case EVENT_WHELP_SPAM:
415 {
416 _whelpSpam = true;
417 events.Repeat(90s);
418 break;
419 }
420 case EVENT_LAND:
421 {
426 break;
427 }
429 {
430 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 200.0f, true))
431 {
432 me->SetFacingToObject(target);
433 DoCast(target, SPELL_FIREBALL);
434 }
435
436 events.ScheduleEvent(EVENT_SPELL_FIREBALL_SECOND, 4s);
437 break;
438 }
440 {
441 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 200.0f, true))
442 {
443 me->SetFacingToObject(target);
444 DoCast(target, SPELL_FIREBALL);
445 }
446
447 switch (urand(0, 2))
448 {
449 case 0:
450 events.ScheduleEvent(EVENT_PHASE_2_STEP_CW, 4s);
451 break;
452 case 1:
453 events.ScheduleEvent(EVENT_PHASE_2_STEP_ACW, 4s);
454 break;
455 default:
456 events.ScheduleEvent(EVENT_PHASE_2_STEP_ACROSS, 4s);
457 break;
458 }
459 break;
460 }
462 {
463 uint8 newWP = _currentWP + 1;
464 if (newWP > 8)
465 {
466 newWP = 1;
467 }
468 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].X, OnyxiaMoveData[newWP].Y, OnyxiaMoveData[newWP].Z);
469 break;
470 }
472 {
473 uint8 newWP = _currentWP - 1;
474 if (newWP < 1)
475 {
476 newWP = 8;
477 }
478 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].X, OnyxiaMoveData[newWP].Y, OnyxiaMoveData[newWP].Z);
479 break;
480 }
482 {
486 events.ScheduleEvent(EVENT_SPELL_BREATH, 8250ms);
487 break;
488 }
490 {
492 me->SetSpeed(MOVE_RUN, 2.95f, false);
493 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].X, OnyxiaMoveData[newWP].Y, OnyxiaMoveData[newWP].Z);
494 break;
495 }
497 {
498 me->SetSpeed(MOVE_RUN, 2.95f, false);
500 break;
501 }
503 {
505
506 if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 0, false))
507 {
508 AttackStart(target);
509 }
510
512
513 events.ScheduleEvent(EVENT_ERUPTION, 0ms);
514 events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, 10s, 20s);
515 events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, 10s, 20s);
516 events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, 15s, 20s);
517 events.ScheduleEvent(EVENT_SPELL_CLEAVE, 2s, 5s);
518 events.ScheduleEvent(EVENT_SPELL_BELLOWINGROAR, 15s);
519 events.ScheduleEvent(EVENT_SUMMON_WHELP, 10s);
520 break;
521 }
523 {
525 events.Repeat(22s);
526 events.ScheduleEvent(EVENT_ERUPTION, 0ms);
527 break;
528 }
529 case EVENT_ERUPTION:
530 {
532 {
533 trigger->CastSpell(trigger, SPELL_ERUPTION, false);
534 }
535 break;
536 }
538 {
539 SummonWhelps();
540 events.Repeat(30s);
541 break;
542 }
543 default:
544 break;
545 }
546
548 }
std::uint8_t uint8
Definition Define.h:109
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:51
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ UNIT_STATE_CASTING
Definition UnitDefines.h:188
@ REACT_PASSIVE
Definition Unit.h:567
@ SAY_PHASE_2_TRANS
Definition boss_onyxia.cpp:120
@ EMOTE_BREATH
Definition boss_onyxia.cpp:122
@ SAY_PHASE_3_TRANS
Definition boss_onyxia.cpp:121
@ SPELL_CLEAVE
Definition boss_onyxia.cpp:28
@ SPELL_BELLOWINGROAR
Definition boss_onyxia.cpp:31
@ SPELL_FLAMEBREATH
Definition boss_onyxia.cpp:27
@ SPELL_FIREBALL
Definition boss_onyxia.cpp:30
@ SPELL_SUMMON_LAIR_GUARD
Definition boss_onyxia.cpp:34
@ SPELL_TAILSWEEP
Definition boss_onyxia.cpp:29
@ SPELL_ERUPTION
Definition boss_onyxia.cpp:35
@ SPELL_WINGBUFFET
Definition boss_onyxia.cpp:26
@ EVENT_WHELP_SPAM
Definition boss_onyxia.cpp:66
@ EVENT_SPELL_BELLOWINGROAR
Definition boss_onyxia.cpp:65
@ EVENT_SPELL_BREATH
Definition boss_onyxia.cpp:62
@ EVENT_PHASE_2_STEP_ACROSS
Definition boss_onyxia.cpp:61
@ EVENT_SPELL_FIREBALL_SECOND
Definition boss_onyxia.cpp:58
@ EVENT_PHASE_2_STEP_ACW
Definition boss_onyxia.cpp:60
@ EVENT_PHASE_2_STEP_CW
Definition boss_onyxia.cpp:59
@ EVENT_SUMMON_WHELP
Definition boss_onyxia.cpp:68
@ EVENT_END_MANY_WHELPS_TIME
Definition boss_onyxia.cpp:76
@ EVENT_SUMMON_LAIR_GUARD
Definition boss_onyxia.cpp:67
@ EVENT_ERUPTION
Definition boss_onyxia.cpp:71
bool UpdateVictim()
Definition CreatureAI.cpp:350
Definition Creature.h:47
void MovePoint(uint32 id, Position const &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:240
void MoveTakeoff(uint32 id, Position const &pos, float speed=0.0f, bool skipAnimation=false)
Use to move the unit from the ground to the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:589
void MoveLand(uint32 id, Position const &pos, float speed=0.0f)
Use to move the unit from the air to the ground. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:554
void MoveIdle()
Definition MotionMaster.cpp:235
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:286
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:41
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:278
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:112
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:179
void SetFacingToObject(WorldObject *object, Milliseconds timed=0ms)
Definition Unit.cpp:16465
MotionMaster * GetMotionMaster()
Definition Unit.h:1758
void StopMoving()
Definition Unit.cpp:13034
void DisableSpline()
Definition Unit.cpp:755
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:13088
Unit * GetVictim() const
Definition Unit.h:904
bool HasUnitState(const uint32 f) const
Definition Unit.h:737
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:7499
void SendMeleeAttackStop(Unit const *victim=nullptr) const
Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or int...
Definition Unit.cpp:3242
@ NPC_ONYXIA_TRIGGER
Definition onyxias_lair.h:39
uint8 DestId
Definition boss_onyxia.cpp:98
void SetOrientation(float orientation)
Definition Position.h:116
void DoResetThreatList()
Definition ScriptedCreature.cpp:473
void AttackStart(Unit *) override
Definition ScriptedCreature.cpp:228
bool CheckInRoom() override
Definition boss_onyxia.cpp:317
void HandleWhelpSpam(uint32 diff)
Definition boss_onyxia.cpp:294

References _currentWP, _manyWhelpsAvailable, _whelpSpam, ScriptedAI::AttackStart(), Unit::AttackStop(), Unit::CastSpell(), CheckInRoom(), OnyxiaMove::DestId, Unit::DisableSpline(), UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoCastVictim(), UnitAI::DoMeleeAttackIfReady(), ScriptedAI::DoResetThreatList(), EMOTE_BREATH, EVENT_END_MANY_WHELPS_TIME, EVENT_ERUPTION, EVENT_FLY_S_TO_N, EVENT_LAND, EVENT_LIFTOFF, EVENT_PHASE_2_STEP_ACROSS, EVENT_PHASE_2_STEP_ACW, EVENT_PHASE_2_STEP_CW, EVENT_PHASE_3_ATTACK, EVENT_SPELL_BELLOWINGROAR, EVENT_SPELL_BREATH, EVENT_SPELL_CLEAVE, EVENT_SPELL_FIREBALL_FIRST, EVENT_SPELL_FIREBALL_SECOND, EVENT_SPELL_FLAMEBREATH, EVENT_SPELL_TAILSWEEP, EVENT_SPELL_WINGBUFFET, EVENT_START_PHASE_2, EVENT_START_PHASE_3, EVENT_SUMMON_LAIR_GUARD, EVENT_SUMMON_WHELP, EVENT_WHELP_SPAM, Unit::GetMotionMaster(), Unit::GetVictim(), HandleWhelpSpam(), Unit::HasUnitState(), MaxThreat, ScriptedAI::me, MOVE_RUN, MotionMaster::MoveIdle(), MotionMaster::MoveLand(), MotionMaster::MovePoint(), MotionMaster::MoveTakeoff(), NPC_ONYXIA_TRIGGER, OnyxiaMoveData, POINT_GROUND_SOUTH, POINT_LAND, POINT_PRE_LAND, POINT_TAKEOFF, Random, REACT_AGGRESSIVE, REACT_PASSIVE, SAY_PHASE_2_TRANS, SAY_PHASE_3_TRANS, UnitAI::SelectTarget(), Unit::SendMeleeAttackStop(), Unit::SendMovementFlagUpdate(), Unit::SetCanFly(), Unit::SetDisableGravity(), Unit::SetFacingTo(), Unit::SetFacingToObject(), Position::SetOrientation(), Creature::SetReactState(), Unit::SetSpeed(), SPELL_BELLOWINGROAR, SPELL_CLEAVE, SPELL_ERUPTION, SPELL_FIREBALL, SPELL_FLAMEBREATH, SPELL_SUMMON_LAIR_GUARD, SPELL_TAILSWEEP, SPELL_WINGBUFFET, Unit::StopMoving(), WorldObject::SummonCreature(), SummonWhelps(), TEMPSUMMON_TIMED_DESPAWN, UNIT_STATE_CASTING, CreatureAI::UpdateVictim(), and urand().

Member Data Documentation

◆ _currentWP

int8 boss_onyxia::_currentWP
private

◆ _manyWhelpsAvailable

bool boss_onyxia::_manyWhelpsAvailable
private

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

◆ _phase

uint8 boss_onyxia::_phase
private

◆ _whelpCount

uint8 boss_onyxia::_whelpCount
private

Referenced by HandleWhelpSpam(), and Initialize().

◆ _whelpSpam

bool boss_onyxia::_whelpSpam
private

◆ _whelpSpamTimer

int32 boss_onyxia::_whelpSpamTimer
private

Referenced by HandleWhelpSpam(), and Initialize().


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