AzeorthCore 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 *pCreature)
 
void Initialize ()
 
void SetPhase (uint8 ph)
 
void Reset () override
 
void DoAction (int32 param) override
 
void EnterCombat (Unit *who) override
 
void DamageTaken (Unit *, uint32 &damage, DamageEffectType, SpellSchoolMask) override
 
void JustSummoned (Creature *summon) override
 
void MovementInform (uint32 type, uint32 id) override
 
void HandleWhelpSpam (const uint32 diff)
 
bool CheckInRoom () override
 
void UpdateAI (uint32 diff) override
 
void SpellHitTarget (Unit *target, SpellInfo const *spell) override
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
 ~BossAI () override
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
void SummonedCreatureDespawnAll () override
 
void UpdateAI (uint32 diff) override
 
virtual void ExecuteEvent (uint32)
 
void Reset () override
 
void EnterCombat (Unit *) 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
 
void UpdateAI (uint32 diff) override
 
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 EnterCombat (Unit *) override
 
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 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 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)
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
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
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 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 EnterCombat (Unit *)
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
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
 
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 *)
 
- 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
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 
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)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
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)
 
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)
 
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)
 
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 bManyWhelpsAvailable
 

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
InstanceScript *const instance
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
bool IsFleeing
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from BossAI
void _Reset ()
 
void _EnterCombat ()
 
void _JustDied ()
 
void _JustReachedHome ()
 
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
EventMap events
 
SummonList summons
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ boss_onyxia()

boss_onyxia::boss_onyxia ( Creature pCreature)
inline
120 : BossAI(pCreature, DATA_ONYXIA)
121 {
122 Initialize();
123 }
@ DATA_ONYXIA
Definition: onyxias_lair.h:27
Definition: ScriptedCreature.h:433
void Initialize()
Definition: boss_onyxia.cpp:125

References Initialize().

Member Function Documentation

◆ CheckInRoom()

bool boss_onyxia::CheckInRoom ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

298 {
299 if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f)
300 {
303 return false;
304 }
305
306 return true;
307 }
@ SAY_EVADE
Definition: boss_onyxia.cpp:114
Talk
Definition: boss_fathomlord_karathress.cpp:23
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:195
Creature * me
Definition: ScriptedCreature.h:267
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:322
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1263

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

Referenced by UpdateAI().

◆ DamageTaken()

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

Reimplemented from ScriptedAI.

193 {
194 if (me->HealthBelowPctDamaged(65, damage) && Phase == PHASE_GROUNDED)
195 {
197 }
198 else if (me->HealthBelowPctDamaged(40, damage) && Phase == PHASE_AIRPHASE)
199 {
202 }
203 }
Phase
Definition: boss_zuljin.cpp:84
@ 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:4057
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:1444
void SetPhase(uint8 ph)
Definition: boss_onyxia.cpp:134

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

168 {
169 switch (param)
170 {
171 case -1:
173 {
175 }
176 break;
177 }
178 }
@ DATA_WHELP_SUMMONED
Definition: onyxias_lair.h:29
InstanceScript *const instance
Definition: ScriptedCreature.h:438
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:53
bool bManyWhelpsAvailable
Definition: boss_onyxia.cpp:547

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

◆ EnterCombat()

void boss_onyxia::EnterCombat ( Unit who)
inlineoverridevirtual

Reimplemented from BossAI.

181 {
184
185 instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); // just in case at reset some players already left the instance
188
189 me->SummonCreature(NPC_ONYXIAN_LAIR_GUARD, -167.837936f, -200.549332f, -66.343231f, 5.598287f, TEMPSUMMON_MANUAL_DESPAWN);
190 }
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: Object.h:49
@ SAY_AGGRO
Definition: boss_onyxia.cpp:109
@ NPC_ONYXIAN_LAIR_GUARD
Definition: onyxias_lair.h:37
@ ACHIEV_TIMED_START_EVENT
Definition: onyxias_lair.h:52
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition: DBCEnums.h:116
void EnterCombat(Unit *) override
Definition: ScriptedCreature.h:453
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr) const
Definition: Object.cpp:2304
void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: InstanceScript.cpp:464
void DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: InstanceScript.cpp:475

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

◆ HandleWhelpSpam()

void boss_onyxia::HandleWhelpSpam ( const uint32  diff)
inline
272 {
273 if (whelpSpam)
274 {
275 if (whelpCount < 40)
276 {
277 whelpSpamTimer -= diff;
278 if (whelpSpamTimer <= 0)
279 {
280 float angle = rand_norm() * 2 * M_PI;
281 float dist = rand_norm() * 4.0f;
282 me->CastSpell(-33.18f + cos(angle) * dist, -258.80f + std::sin(angle) * dist, -89.0f, 17646, true);
283 me->CastSpell(-32.535f + cos(angle) * dist, -170.190f + std::sin(angle) * dist, -89.0f, 17646, true);
284 whelpCount += 2;
285 whelpSpamTimer += 600;
286 }
287 }
288 else
289 {
290 whelpSpam = false;
291 whelpCount = 0;
292 whelpSpamTimer = 0;
293 }
294 }
295 }
double rand_norm()
Definition: Random.cpp:77
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:1168
int32 whelpSpamTimer
Definition: boss_onyxia.cpp:546
uint8 whelpCount
Definition: boss_onyxia.cpp:545
bool whelpSpam
Definition: boss_onyxia.cpp:544

References Unit::CastSpell(), ScriptedAI::me, rand_norm(), whelpCount, whelpSpam, and whelpSpamTimer.

Referenced by UpdateAI().

◆ Initialize()

void boss_onyxia::Initialize ( )
inline
126 {
127 CurrentWP = 0;
128 whelpSpam = false;
129 whelpCount = 0;
130 whelpSpamTimer = 0;
131 bManyWhelpsAvailable = false;
132 }
int8 CurrentWP
Definition: boss_onyxia.cpp:542

References bManyWhelpsAvailable, CurrentWP, whelpCount, whelpSpam, and whelpSpamTimer.

Referenced by boss_onyxia(), and Reset().

◆ JustSummoned()

void boss_onyxia::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from BossAI.

206 {
207 summons.Summon(summon);
208
209 if (summon->GetEntry() != NPC_ONYXIAN_WHELP && summon->GetEntry() != NPC_ONYXIAN_LAIR_GUARD)
210 {
211 return;
212 }
213
214 if (summon->GetEntry() == NPC_ONYXIAN_LAIR_GUARD && Phase != PHASE_LANDED)
215 {
216 return;
217 }
218
219 if (Unit* target = summon->SelectNearestTarget(300.0f))
220 {
221 summon->AI()->AttackStart(target);
222 DoZoneInCombat(summon);
223 }
224
225 summons.Summon(summon);
226 }
@ NPC_ONYXIAN_WHELP
Definition: onyxias_lair.h:36
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:28
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:93
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:89
SummonList summons
Definition: ScriptedCreature.h:466
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Definition: Creature.cpp:2296
CreatureAI * AI() const
Definition: Creature.h:134
uint32 GetEntry() const
Definition: Object.h:109
Definition: Unit.h:1290

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

◆ MovementInform()

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

Reimplemented from ScriptedAI.

229 {
230 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
231 {
232 return;
233 }
234
235 if (id < 9)
236 {
237 if (id > 0 && Phase == PHASE_AIRPHASE)
238 {
240 me->SetSpeed(MOVE_RUN, 1.6f, false);
241 CurrentWP = id;
242 events.ScheduleEvent(EVENT_SPELL_FIREBALL_FIRST, 1000);
243 }
244 }
245 else
246 {
247 switch (id)
248 {
249 case 10:
251 events.ScheduleEvent(EVENT_LIFTOFF, 0);
252 break;
253 case 11:
255 events.ScheduleEvent(EVENT_FLY_S_TO_N, 0);
256 break;
257 case 12:
259 events.ScheduleEvent(EVENT_LAND, 0);
260 break;
261 case 13:
262 me->SetCanFly(false);
263 me->SetDisableGravity(false);
265 events.ScheduleEvent(EVENT_PHASE_3_ATTACK, 0);
266 break;
267 }
268 }
269 }
@ MOVE_RUN
Definition: Unit.h:379
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:46
@ EFFECT_MOTION_TYPE
Definition: MotionMaster.h:54
static sOnyxMove OnyxiaMoveData[]
Definition: boss_onyxia.cpp:94
@ 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
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Definition: Creature.cpp:3064
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:196
bool SetCanFly(bool enable, bool packetOnly=false) override
Definition: Creature.cpp:3149
float speed_run
Definition: CreatureData.h:194
void SetFacingTo(float ori)
Definition: Unit.cpp:20643
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14301

References CurrentWP, 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_MOTION_TYPE, Creature::SetCanFly(), Creature::SetDisableGravity(), Unit::SetFacingTo(), Unit::SetSpeed(), and CreatureTemplate::speed_run.

◆ Reset()

void boss_onyxia::Reset ( )
inlineoverridevirtual

◆ SetPhase()

void boss_onyxia::SetPhase ( uint8  ph)
inline
135 {
136 events.Reset();
137 Phase = ph;
138 switch (ph)
139 {
140 case PHASE_GROUNDED:
141 events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, urand(10000, 20000));
142 events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, urand(10000, 20000));
143 events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, urand(15000, 20000));
144 events.ScheduleEvent(EVENT_SPELL_CLEAVE, urand(2000, 5000));
145 break;
146 case PHASE_AIRPHASE:
147 events.ScheduleEvent(EVENT_START_PHASE_2, 0);
148 break;
149 case PHASE_LANDED:
150 events.ScheduleEvent(EVENT_START_PHASE_3, 5000);
151 break;
152 }
153 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ 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 EVENT_SPELL_CLEAVE, EVENT_SPELL_FLAMEBREATH, EVENT_SPELL_TAILSWEEP, EVENT_SPELL_WINGBUFFET, EVENT_START_PHASE_2, EVENT_START_PHASE_3, PHASE_AIRPHASE, PHASE_GROUNDED, PHASE_LANDED, and urand().

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

◆ SpellHitTarget()

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

Reimplemented from ScriptedAI.

533 {
534 if (target->IsPlayer() && spell->DurationEntry && spell->DurationEntry->ID == 328 && spell->Effects[EFFECT_1].TargetA.GetTarget() == 1 && (spell->Effects[EFFECT_1].Amplitude == 50 || spell->Effects[EFFECT_1].Amplitude == 215)) // Deep Breath
535 {
537 }
538 }
@ DATA_DEEP_BREATH_FAILED
Definition: onyxias_lair.h:30
@ EFFECT_1
Definition: SharedDefines.h:31
bool IsPlayer() const
Definition: Object.h:194

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

◆ UpdateAI()

void boss_onyxia::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from BossAI.

310 {
311 if (!UpdateVictim() || !CheckInRoom())
312 {
313 return;
314 }
315
316 events.Update(diff);
317 HandleWhelpSpam(diff);
318
320 {
321 return;
322 }
323
325
326 switch (events.ExecuteEvent())
327 {
329 {
331 events.RepeatEvent(urand(15000, 30000));
332 break;
333 }
335 {
337 events.RepeatEvent(urand(10000, 20000));
338 break;
339 }
341 {
343 events.RepeatEvent(urand(15000, 20000));
344 break;
345 }
347 {
349 events.RepeatEvent(urand(2000, 5000));
350 break;
351 }
353 {
354 me->AttackStop();
356 me->StopMoving();
359 break;
360 }
361 case EVENT_LIFTOFF:
362 {
366 me->DisableSpline();
367 me->SetCanFly(true);
368 me->SetDisableGravity(true);
371 me->GetMotionMaster()->MoveTakeoff(11, OnyxiaMoveData[1].x + 1.0f, OnyxiaMoveData[1].y, OnyxiaMoveData[1].z, 12.0f);
373
374 events.RescheduleEvent(EVENT_END_MANY_WHELPS_TIME, 10000);
375 break;
376 }
378 bManyWhelpsAvailable = false;
379 break;
380 case EVENT_FLY_S_TO_N:
381 {
382 me->SetSpeed(MOVE_RUN, 2.95f, false);
384
385 whelpSpam = true;
386 events.ScheduleEvent(EVENT_WHELP_SPAM, 90000);
387 events.ScheduleEvent(EVENT_SUMMON_LAIR_GUARD, 30000);
388 break;
389 }
391 {
392 me->CastSpell(-101.654f, -214.491f, -80.70f, SPELL_SUMMON_LAIR_GUARD, true);
393 events.RepeatEvent(30000);
394 break;
395 }
396 case EVENT_WHELP_SPAM:
397 {
398 whelpSpam = true;
399 events.RepeatEvent(90000);
400 break;
401 }
402 case EVENT_LAND:
403 {
406 me->GetMotionMaster()->MoveLand(13, OnyxiaMoveData[0].x + 1.0f, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z, 12.0f);
408 break;
409 }
411 {
412 if (Unit* v = SelectTarget(SelectTargetMethod::Random, 0, 200.0f, true))
413 {
416 }
417
418 events.ScheduleEvent(EVENT_SPELL_FIREBALL_SECOND, 4000);
419 break;
420 }
422 {
423 if (Unit* v = SelectTarget(SelectTargetMethod::Random, 0, 200.0f, true))
424 {
427 }
428
429 uint8 rand = urand(0, 99);
430 if (rand < 33)
431 {
432 events.ScheduleEvent(EVENT_PHASE_2_STEP_CW, 4000);
433 }
434 else if (rand < 66)
435 {
436 events.ScheduleEvent(EVENT_PHASE_2_STEP_ACW, 4000);
437 }
438 else
439 {
440 events.ScheduleEvent(EVENT_PHASE_2_STEP_ACROSS, 4000);
441 }
442 break;
443 }
445 {
446 uint8 newWP = CurrentWP + 1;
447 if (newWP > 8)
448 {
449 newWP = 1;
450 }
451 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z);
452 break;
453 }
455 {
456 uint8 newWP = CurrentWP - 1;
457 if (newWP < 1)
458 {
459 newWP = 8;
460 }
461 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z);
462 break;
463 }
465 {
469 events.ScheduleEvent(EVENT_SPELL_BREATH, 8250);
470 break;
471 }
473 {
475 me->SetSpeed(MOVE_RUN, 2.95f, false);
476 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z);
477 break;
478 }
480 {
481 me->SetSpeed(MOVE_RUN, 2.95f, false);
483 break;
484 }
486 {
488
489 if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 0, false))
490 {
491 AttackStart(target);
492 }
493
495
496 events.ScheduleEvent(EVENT_ERUPTION, 0);
497 events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, urand(10000, 20000));
498 events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, urand(10000, 20000));
499 events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, urand(15000, 20000));
500 events.ScheduleEvent(EVENT_SPELL_CLEAVE, urand(2000, 5000));
501 events.ScheduleEvent(EVENT_SPELL_BELLOWINGROAR, 15000);
502 events.ScheduleEvent(EVENT_SUMMON_WHELP, 10000);
503 break;
504 }
506 {
508 events.RepeatEvent(22000);
509 events.ScheduleEvent(EVENT_ERUPTION, 0);
510 break;
511 }
512 case EVENT_ERUPTION:
513 {
514 if (Creature* trigger = me->SummonCreature(12758, *me, TEMPSUMMON_TIMED_DESPAWN, 1000))
515 {
516 trigger->CastSpell(trigger, 17731, false);
517 }
518 break;
519 }
521 {
522 float angle = rand_norm() * 2 * M_PI;
523 float dist = rand_norm() * 4.0f;
524 me->CastSpell(-33.18f + cos(angle) * dist, -258.80f + std::sin(angle) * dist, -89.0f, 17646, true);
525 me->CastSpell(-32.535f + cos(angle) * dist, -170.190f + std::sin(angle) * dist, -89.0f, 17646, true);
526 events.RepeatEvent(30000);
527 break;
528 }
529 }
530 }
std::uint8_t uint8
Definition: Define.h:110
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:44
@ REACT_PASSIVE
Definition: Unit.h:1023
@ UNIT_STATE_CASTING
Definition: Unit.h:340
@ SAY_PHASE_2_TRANS
Definition: boss_onyxia.cpp:111
@ EMOTE_BREATH
Definition: boss_onyxia.cpp:113
@ SAY_PHASE_3_TRANS
Definition: boss_onyxia.cpp:112
@ 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_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
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:249
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:40
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:111
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:178
bool UpdateVictim()
Definition: CreatureAI.cpp:268
void DoResetThreatList()
Definition: ScriptedCreature.cpp:411
void AttackStart(Unit *) override
Definition: ScriptedCreature.cpp:206
Definition: Creature.h:46
void SetOrientation(float orientation)
Definition: Position.h:112
MotionMaster * GetMotionMaster()
Definition: Unit.h:2258
void SetFacingToObject(WorldObject *object)
Definition: Unit.cpp:20653
void StopMoving()
Definition: Unit.cpp:16754
void DisableSpline()
Definition: Unit.cpp:654
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16808
Unit * GetVictim() const
Definition: Unit.h:1386
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398
void SendMeleeAttackStop(Unit *victim=nullptr)
Definition: Unit.cpp:3023
bool AttackStop()
Definition: Unit.cpp:10356
void MoveTakeoff(uint32 id, Position const &pos, float speed=0.0f)
Definition: MotionMaster.cpp:455
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:210
void MoveLand(uint32 id, Position const &pos, float speed=0.0f)
Definition: MotionMaster.cpp:425
void MoveIdle()
Definition: MotionMaster.cpp:231
uint8 DestId
Definition: boss_onyxia.cpp:89
bool CheckInRoom() override
Definition: boss_onyxia.cpp:297
void HandleWhelpSpam(const uint32 diff)
Definition: boss_onyxia.cpp:271

References ScriptedAI::AttackStart(), Unit::AttackStop(), bManyWhelpsAvailable, Unit::CastSpell(), CheckInRoom(), CurrentWP, sOnyxMove::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(), ScriptedAI::me, MOVE_RUN, MotionMaster::MoveIdle(), MotionMaster::MoveLand(), MotionMaster::MovePoint(), MotionMaster::MoveTakeoff(), OnyxiaMoveData, rand_norm(), REACT_AGGRESSIVE, REACT_PASSIVE, SAY_PHASE_2_TRANS, SAY_PHASE_3_TRANS, UnitAI::SelectTarget(), Unit::SendMeleeAttackStop(), Unit::SendMovementFlagUpdate(), Creature::SetCanFly(), Creature::SetDisableGravity(), Unit::SetFacingTo(), Unit::SetFacingToObject(), Position::SetOrientation(), Creature::SetReactState(), Unit::SetSpeed(), SPELL_BELLOWINGROAR, SPELL_CLEAVE, SPELL_FIREBALL, SPELL_FLAMEBREATH, SPELL_SUMMON_LAIR_GUARD, SPELL_TAILSWEEP, SPELL_WINGBUFFET, Unit::StopMoving(), WorldObject::SummonCreature(), TEMPSUMMON_TIMED_DESPAWN, UNIT_STATE_CASTING, CreatureAI::UpdateVictim(), urand(), and whelpSpam.

Member Data Documentation

◆ bManyWhelpsAvailable

bool boss_onyxia::bManyWhelpsAvailable
private

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

◆ CurrentWP

int8 boss_onyxia::CurrentWP
private

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