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 *pCreature)
 
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.
 
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 HandleWhelpSpam (const 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 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)
 Executes a function once the creature reaches the defined health point percent.
 
void ScheduleHealthCheckEvent (std::initializer_list< uint8 > healthPct, std::function< void()> exec)
 
void ScheduleEnrageTimer (uint32 spellId, Milliseconds timer, uint8 textId=0)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER) override
 
void JustDied (Unit *) override
 
void JustReachedHome () override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=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.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
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 InitializeAI ()
 
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:
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast.
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished.
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

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
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
 
- 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 }
Definition ScriptedCreature.h:467
@ DATA_ONYXIA
Definition onyxias_lair.h:29
void Initialize()
Definition boss_onyxia.cpp:125

References Initialize().

Member Function Documentation

◆ CheckInRoom()

bool boss_onyxia::CheckInRoom ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

296 {
297 if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f)
298 {
301 return false;
302 }
303
304 return true;
305 }
@ SAY_EVADE
Definition boss_onyxia.cpp:114
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition ScriptedCreature.h:504
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition Creature.h:342
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1274
Talk
Definition hyjal.cpp:82
Creature * me
Definition ScriptedCreature.h:280

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.

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_AIRPHASE
Definition boss_onyxia.cpp:83
@ PHASE_LANDED
Definition boss_onyxia.cpp:84
@ PHASE_GROUNDED
Definition boss_onyxia.cpp:82
Phase
Definition boss_zuljin.cpp:82
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4161
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:1047
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 }
InstanceScript *const instance
Definition ScriptedCreature.h:474
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:52
@ DATA_WHELP_SUMMONED
Definition onyxias_lair.h:31
bool bManyWhelpsAvailable
Definition boss_onyxia.cpp:545

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

◆ HandleWhelpSpam()

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

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:540

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

Referenced by boss_onyxia(), and Reset().

◆ JustEngagedWith()

void boss_onyxia::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from CreatureAI.

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 }
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition DBCEnums.h:110
@ TEMPSUMMON_MANUAL_DESPAWN
Definition Object.h:53
@ SAY_AGGRO
Definition boss_onyxia.cpp:109
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition ScriptedCreature.h:503
void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition InstanceScript.cpp:665
void DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition InstanceScript.cpp:674
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:2368
@ NPC_ONYXIAN_LAIR_GUARD
Definition onyxias_lair.h:39
@ ACHIEV_TIMED_START_EVENT
Definition onyxias_lair.h:54

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.

206 {
207 summons.Summon(summon);
208
209 if (summon->GetEntry() != NPC_ONYXIAN_WHELP && summon->GetEntry() != NPC_ONYXIAN_LAIR_GUARD)
210 {
211 return;
212 }
213
215 {
216 return;
217 }
218
219 if (Unit* target = summon->SelectNearestTarget(300.0f))
220 {
221 summon->AI()->AttackStart(target);
222 DoZoneInCombat(summon);
223 }
224 }
SummonList summons
Definition ScriptedCreature.h:517
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition CreatureAI.cpp:106
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Select nearest hostile unit within the given distance (regardless of threat list).
Definition Creature.cpp:2393
CreatureAI * AI() const
Definition Creature.h:141
uint32 GetEntry() const
Definition Object.h:115
void Summon(Creature const *summon)
Definition ScriptedCreature.h:88
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:27
Definition Unit.h:636
@ NPC_ONYXIAN_WHELP
Definition onyxias_lair.h:38

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

227 {
228 if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
229 {
230 return;
231 }
232
233 if (id < 9)
234 {
235 if (id > 0 && Phase == PHASE_AIRPHASE)
236 {
238 me->SetSpeed(MOVE_RUN, 1.6f, false);
239 CurrentWP = id;
240 events.ScheduleEvent(EVENT_SPELL_FIREBALL_FIRST, 1000);
241 }
242 }
243 else
244 {
245 switch (id)
246 {
247 case 10:
249 events.ScheduleEvent(EVENT_LIFTOFF, 0);
250 break;
251 case 11:
253 events.ScheduleEvent(EVENT_FLY_S_TO_N, 0);
254 break;
255 case 12:
257 events.ScheduleEvent(EVENT_LAND, 0);
258 break;
259 case 13:
260 me->SetCanFly(false);
261 me->SetDisableGravity(false);
263 events.ScheduleEvent(EVENT_PHASE_3_ATTACK, 0);
264 break;
265 }
266 }
267 }
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ EFFECT_MOTION_TYPE
Definition MotionMaster.h:56
@ MOVE_RUN
Definition UnitDefines.h:350
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
Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING....
Definition Creature.cpp:3222
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:209
bool SetCanFly(bool enable, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Creature.cpp:3307
void SetFacingTo(float ori)
Definition Unit.cpp:20581
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:14481
float speed_run
Definition CreatureData.h:201

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

Reimplemented from UnitAI.

156 {
157 Initialize();
160 me->SetCanFly(false);
161 me->SetDisableGravity(false);
165 }
@ REACT_AGGRESSIVE
Definition Unit.h:550
@ PHASE_NONE
Definition boss_onyxia.cpp:81
void Reset() override
Definition ScriptedCreature.h:502
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:95

References ACHIEV_TIMED_START_EVENT, ACHIEVEMENT_TIMED_TYPE_EVENT, InstanceScript::DoStopTimedAchievement(), Creature::GetCreatureTemplate(), Initialize(), BossAI::instance, ScriptedAI::me, MOVE_RUN, PHASE_NONE, REACT_AGGRESSIVE, BossAI::Reset(), Creature::SetCanFly(), Creature::SetDisableGravity(), SetPhase(), Creature::SetReactState(), Unit::SetSpeed(), and CreatureTemplate::speed_run.

◆ 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(), JustEngagedWith(), and Reset().

◆ SpellHitTarget()

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

Reimplemented from CreatureAI.

531 {
532 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
533 {
535 }
536 }
@ EFFECT_1
Definition SharedDefines.h:32
bool IsPlayer() const
Definition Object.h:200
@ 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(), and ZoneScript::SetData().

◆ UpdateAI()

void boss_onyxia::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

308 {
309 if (!UpdateVictim() || !CheckInRoom())
310 {
311 return;
312 }
313
314 events.Update(diff);
315 HandleWhelpSpam(diff);
316
318 {
319 return;
320 }
321
323
324 switch (events.ExecuteEvent())
325 {
327 {
329 events.RepeatEvent(urand(15000, 30000));
330 break;
331 }
333 {
335 events.RepeatEvent(urand(10000, 20000));
336 break;
337 }
339 {
341 events.RepeatEvent(urand(15000, 20000));
342 break;
343 }
345 {
347 events.RepeatEvent(urand(2000, 5000));
348 break;
349 }
351 {
352 me->AttackStop();
354 me->StopMoving();
357 break;
358 }
359 case EVENT_LIFTOFF:
360 {
364 me->DisableSpline();
365 me->SetCanFly(true);
366 me->SetDisableGravity(true);
369 me->GetMotionMaster()->MoveTakeoff(11, OnyxiaMoveData[1].x + 1.0f, OnyxiaMoveData[1].y, OnyxiaMoveData[1].z, 12.0f);
371
372 events.RescheduleEvent(EVENT_END_MANY_WHELPS_TIME, 10000);
373 break;
374 }
376 bManyWhelpsAvailable = false;
377 break;
378 case EVENT_FLY_S_TO_N:
379 {
380 me->SetSpeed(MOVE_RUN, 2.95f, false);
382
383 whelpSpam = true;
384 events.ScheduleEvent(EVENT_WHELP_SPAM, 90000);
385 events.ScheduleEvent(EVENT_SUMMON_LAIR_GUARD, 30000);
386 break;
387 }
389 {
390 me->CastSpell(-101.654f, -214.491f, -80.70f, SPELL_SUMMON_LAIR_GUARD, true);
391 events.RepeatEvent(30000);
392 break;
393 }
394 case EVENT_WHELP_SPAM:
395 {
396 whelpSpam = true;
397 events.RepeatEvent(90000);
398 break;
399 }
400 case EVENT_LAND:
401 {
404 me->GetMotionMaster()->MoveLand(13, OnyxiaMoveData[0].x + 1.0f, OnyxiaMoveData[0].y, OnyxiaMoveData[0].z, 12.0f);
406 break;
407 }
409 {
410 if (Unit* v = SelectTarget(SelectTargetMethod::Random, 0, 200.0f, true))
411 {
414 }
415
416 events.ScheduleEvent(EVENT_SPELL_FIREBALL_SECOND, 4000);
417 break;
418 }
420 {
421 if (Unit* v = SelectTarget(SelectTargetMethod::Random, 0, 200.0f, true))
422 {
425 }
426
427 uint8 rand = urand(0, 99);
428 if (rand < 33)
429 {
430 events.ScheduleEvent(EVENT_PHASE_2_STEP_CW, 4000);
431 }
432 else if (rand < 66)
433 {
434 events.ScheduleEvent(EVENT_PHASE_2_STEP_ACW, 4000);
435 }
436 else
437 {
438 events.ScheduleEvent(EVENT_PHASE_2_STEP_ACROSS, 4000);
439 }
440 break;
441 }
443 {
444 uint8 newWP = CurrentWP + 1;
445 if (newWP > 8)
446 {
447 newWP = 1;
448 }
449 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z);
450 break;
451 }
453 {
454 uint8 newWP = CurrentWP - 1;
455 if (newWP < 1)
456 {
457 newWP = 8;
458 }
459 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z);
460 break;
461 }
463 {
467 events.ScheduleEvent(EVENT_SPELL_BREATH, 8250);
468 break;
469 }
471 {
473 me->SetSpeed(MOVE_RUN, 2.95f, false);
474 me->GetMotionMaster()->MovePoint(newWP, OnyxiaMoveData[newWP].x, OnyxiaMoveData[newWP].y, OnyxiaMoveData[newWP].z);
475 break;
476 }
478 {
479 me->SetSpeed(MOVE_RUN, 2.95f, false);
481 break;
482 }
484 {
486
487 if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 0, false))
488 {
489 AttackStart(target);
490 }
491
493
494 events.ScheduleEvent(EVENT_ERUPTION, 0);
495 events.ScheduleEvent(EVENT_SPELL_WINGBUFFET, urand(10000, 20000));
496 events.ScheduleEvent(EVENT_SPELL_FLAMEBREATH, urand(10000, 20000));
497 events.ScheduleEvent(EVENT_SPELL_TAILSWEEP, urand(15000, 20000));
498 events.ScheduleEvent(EVENT_SPELL_CLEAVE, urand(2000, 5000));
499 events.ScheduleEvent(EVENT_SPELL_BELLOWINGROAR, 15000);
500 events.ScheduleEvent(EVENT_SUMMON_WHELP, 10000);
501 break;
502 }
504 {
506 events.RepeatEvent(22000);
507 events.ScheduleEvent(EVENT_ERUPTION, 0);
508 break;
509 }
510 case EVENT_ERUPTION:
511 {
512 if (Creature* trigger = me->SummonCreature(12758, *me, TEMPSUMMON_TIMED_DESPAWN, 1000))
513 {
514 trigger->CastSpell(trigger, 17731, false);
515 }
516 break;
517 }
519 {
520 float angle = rand_norm() * 2 * M_PI;
521 float dist = rand_norm() * 4.0f;
522 me->CastSpell(-33.18f + cos(angle) * dist, -258.80f + std::sin(angle) * dist, -89.0f, 17646, true);
523 me->CastSpell(-32.535f + cos(angle) * dist, -170.190f + std::sin(angle) * dist, -89.0f, 17646, true);
524 events.RepeatEvent(30000);
525 break;
526 }
527 }
528 }
std::uint8_t uint8
Definition Define.h:109
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:48
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185
@ REACT_PASSIVE
Definition Unit.h:548
@ 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
bool UpdateVictim()
Definition CreatureAI.cpp:280
Definition Creature.h:43
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition MotionMaster.h:213
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:523
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:488
void MoveIdle()
Definition MotionMaster.cpp:232
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:248
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:39
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:240
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:110
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:177
MotionMaster * GetMotionMaster()
Definition Unit.h:1673
void SetFacingToObject(WorldObject *object)
Definition Unit.cpp:20591
void StopMoving()
Definition Unit.cpp:16702
void DisableSpline()
Definition Unit.cpp:636
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:16756
Unit * GetVictim() const
Definition Unit.h:862
bool HasUnitState(const uint32 f) const
Definition Unit.h:707
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:3090
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:10448
void SetOrientation(float orientation)
Definition Position.h:116
void DoResetThreatList()
Definition ScriptedCreature.cpp:445
void AttackStart(Unit *) override
Definition ScriptedCreature.cpp:210
bool CheckInRoom() override
Definition boss_onyxia.cpp:295
void HandleWhelpSpam(const uint32 diff)
Definition boss_onyxia.cpp:269
uint8 DestId
Definition boss_onyxia.cpp:89

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(), MaxThreat, ScriptedAI::me, MOVE_RUN, MotionMaster::MoveIdle(), MotionMaster::MoveLand(), MotionMaster::MovePoint(), MotionMaster::MoveTakeoff(), OnyxiaMoveData, rand_norm(), Random, 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().


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