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

Public Member Functions

 boss_ragnarosAI (Creature *creature)
 
void Reset () override
 
void DamageTaken (Unit *, uint32 &damage, DamageEffectType, SpellSchoolMask) override
 
void DoAction (int32 action) override
 
void JustSummoned (Creature *summon) override
 
void SetGUID (ObjectGuid guid, int32 index) override
 
void SummonedCreatureDies (Creature *summon, Unit *) override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *victim) override
 
void AttackStart (Unit *target) override
 
void EnterEvadeMode (EvadeReason why) override
 
bool CanAIAttack (Unit const *victim) const override
 
void UpdateAI (uint32 diff) 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
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
void SummonedCreatureDespawnAll () override
 
void UpdateAI (uint32 diff) override
 
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)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
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 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 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)
 
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, 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)
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged.
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void 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 ==================
 
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 ()
 
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 JustEnteredCombat (Unit *)
 Called when the unit enters combat (NOTE: Creature engage logic should NOT be here, but in JustEngagedWith, which happens once threat is established!)
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 
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)
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the max threat target, which may not always 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)
 
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 Member Functions

void HandleEmerge ()
 
void ScheduleCombatEvents ()
 
bool IsVictimWithinMeleeRange () const
 

Private Attributes

EventMap extraEvents
 
bool _isIntroDone
 
bool _hasYelledMagmaBurst
 
bool _processingMagmaBurst
 
bool _hasSubmergedOnce
 
bool _isKnockbackEmoteAllowed
 
GuidSet _lavaBurstGUIDS
 

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 _JustEngagedWith ()
 
void _JustDied ()
 
void _JustReachedHome ()
 
bool _ProccessHealthCheckEvent (uint8 healthPct, uint32 damage, std::function< void()> exec) const
 
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_ragnarosAI()

boss_ragnaros::boss_ragnarosAI::boss_ragnarosAI ( Creature creature)
inline
122 : BossAI(creature, DATA_RAGNAROS),
123 _isIntroDone(false),
126 _hasSubmergedOnce(false),
128 {
129 }
@ DATA_RAGNAROS
Definition: molten_core.h:41
Definition: ScriptedCreature.h:469
bool _hasSubmergedOnce
Definition: boss_ragnaros.cpp:449
bool _hasYelledMagmaBurst
Definition: boss_ragnaros.cpp:447
bool _isKnockbackEmoteAllowed
Definition: boss_ragnaros.cpp:450
bool _isIntroDone
Definition: boss_ragnaros.cpp:446
bool _processingMagmaBurst
Definition: boss_ragnaros.cpp:448

Member Function Documentation

◆ AttackStart()

void boss_ragnaros::boss_ragnarosAI::AttackStart ( Unit target)
inlineoverridevirtual

Reimplemented from ScriptedAI.

231 {
232 if (target && me->Attack(target, true))
233 {
234 DoStartNoMovement(target);
235 }
236 }
void DoStartNoMovement(Unit *target)
Definition: ScriptedCreature.cpp:233
Creature * me
Definition: ScriptedCreature.h:282
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:10280

References Unit::Attack(), ScriptedAI::DoStartNoMovement(), and ScriptedAI::me.

Referenced by HandleEmerge().

◆ CanAIAttack()

bool boss_ragnaros::boss_ragnarosAI::CanAIAttack ( Unit const *  victim) const
inlineoverridevirtual

Reimplemented from UnitAI.

256 {
257 return me->IsWithinMeleeRange(victim);
258 }
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition: Unit.cpp:683

References Unit::IsWithinMeleeRange(), and ScriptedAI::me.

◆ DamageTaken()

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

Reimplemented from BossAI.

157 {
158 if (events.IsInPhase(PHASE_SUBMERGED) && damage >= me->GetHealth())
159 {
160 damage = 0;
161 }
162 }
@ PHASE_SUBMERGED
Definition: boss_ragnaros.cpp:110
events
Definition: boss_sartura.cpp:43
uint32 GetHealth() const
Definition: Unit.h:1454

References Unit::GetHealth(), ScriptedAI::me, and PHASE_SUBMERGED.

◆ DoAction()

void boss_ragnaros::boss_ragnarosAI::DoAction ( int32  action)
inlineoverridevirtual

Reimplemented from UnitAI.

165 {
166 if (action == ACTION_FINISH_RAGNAROS_INTRO)
167 {
170 }
171 }
@ PHASE_INTRO
Definition: boss_ragnaros.cpp:108
@ EVENT_INTRO_SAY
Definition: boss_ragnaros.cpp:90
@ ACTION_FINISH_RAGNAROS_INTRO
Definition: molten_core.h:51
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition: EventMap.cpp:56
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
EventMap extraEvents
Definition: boss_ragnaros.cpp:445

References ACTION_FINISH_RAGNAROS_INTRO, EVENT_INTRO_SAY, extraEvents, PHASE_INTRO, EventMap::ScheduleEvent(), and EventMap::SetPhase().

◆ EnterEvadeMode()

void boss_ragnaros::boss_ragnarosAI::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from CreatureAI.

239 {
240 if (!me->GetThreatMgr().GetThreatList().empty())
241 {
243 {
244 // Boss try to evade, but still got some targets on threat list - it means that none of these targets are in melee range - cast magma blast
247 }
248 }
249 else
250 {
252 }
253 }
@ PHASE_EMERGED
Definition: boss_ragnaros.cpp:109
@ EVENT_MAGMA_BLAST
Definition: boss_ragnaros.cpp:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:196
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:274
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2159

References _processingMagmaBurst, CreatureAI::EnterEvadeMode(), EVENT_MAGMA_BLAST, ThreatMgr::GetThreatList(), Unit::GetThreatMgr(), ScriptedAI::me, and PHASE_EMERGED.

◆ HandleEmerge()

void boss_ragnaros::boss_ragnarosAI::HandleEmerge ( )
inlineprivate
455 {
456 if (events.IsInPhase(PHASE_EMERGED))
457 {
458 return;
459 }
460
461 events.SetPhase(PHASE_EMERGED);
465
470
472
473 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
474 {
475 AttackStart(target);
476 }
477 }
@ UNIT_NPC_EMOTESTATE
Definition: UpdateFields.h:140
@ REACT_AGGRESSIVE
Definition: Unit.h:1037
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
@ UNIT_FLAG_NOT_SELECTABLE
Definition: Unit.h:473
@ SPELL_RAGNA_SUBMERGE_VISUAL
Definition: boss_ragnaros.cpp:47
@ EMOTE_ONESHOT_EMERGE
Definition: SharedDefines.h:2043
void CancelEventGroup(uint32 group)
Definition: EventMap.cpp:209
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:110
void SetReactState(ReactStates st)
Definition: Creature.h:90
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
Definition: Unit.h:1302
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4855
void HandleEmoteCommand(uint32 emoteId)
Definition: Unit.cpp:1980
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:1496
void AttackStart(Unit *target) override
Definition: boss_ragnaros.cpp:230
void ScheduleCombatEvents()
Definition: boss_ragnaros.cpp:479

References AttackStart(), EventMap::CancelEventGroup(), EMOTE_ONESHOT_EMERGE, extraEvents, Unit::HandleEmoteCommand(), ScriptedAI::me, PHASE_EMERGED, PHASE_SUBMERGED, REACT_AGGRESSIVE, Unit::RemoveAurasDueToSpell(), Unit::RemoveUnitFlag(), ScheduleCombatEvents(), UnitAI::SelectTarget(), EventMap::SetPhase(), Creature::SetReactState(), Object::SetUInt32Value(), SPELL_RAGNA_SUBMERGE_VISUAL, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, and UNIT_NPC_EMOTESTATE.

Referenced by SummonedCreatureDies(), and UpdateAI().

◆ IsVictimWithinMeleeRange()

bool boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange ( ) const
inlineprivate
490 {
491 return me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim());
492 }
Unit * GetVictim() const
Definition: Unit.h:1398

References Unit::GetVictim(), Unit::IsWithinMeleeRange(), and ScriptedAI::me.

Referenced by UpdateAI().

◆ JustDied()

void boss_ragnaros::boss_ragnarosAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from BossAI.

216 {
217 _JustDied();
220 }
constexpr float DEATH_ORIENTATION
Definition: boss_ragnaros.cpp:113
void Reset()
Definition: EventMap.cpp:21
void _JustDied()
Definition: ScriptedCreature.cpp:620
void SetFacingTo(float ori)
Definition: Unit.cpp:20884

References BossAI::_JustDied(), DEATH_ORIENTATION, extraEvents, ScriptedAI::me, EventMap::Reset(), and Unit::SetFacingTo().

◆ JustEngagedWith()

void boss_ragnaros::boss_ragnarosAI::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from BossAI.

209 {
211 events.SetPhase(PHASE_EMERGED);
213 }
void _JustEngagedWith()
Definition: ScriptedCreature.cpp:633

References BossAI::_JustEngagedWith(), PHASE_EMERGED, and ScheduleCombatEvents().

◆ JustSummoned()

void boss_ragnaros::boss_ragnarosAI::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from BossAI.

174 {
175 BossAI::JustSummoned(summon);
176 if (summon->GetEntry() == NPC_FLAME_OF_RAGNAROS)
177 {
178 summon->CastSpell((Unit*)nullptr, SPELL_INTENSE_HEAT, true, nullptr, nullptr, me->GetGUID());
179 }
180 else if (summon->GetEntry() == NPC_SON_OF_FLAME)
181 {
182 DoZoneInCombat(summon);
183 }
184 }
@ NPC_SON_OF_FLAME
Definition: boss_ragnaros.cpp:99
@ NPC_FLAME_OF_RAGNAROS
Definition: boss_ragnaros.cpp:100
@ SPELL_INTENSE_HEAT
Definition: boss_ragnaros.cpp:52
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:94
void JustSummoned(Creature *summon) override
Definition: ScriptedCreature.cpp:663
uint32 GetEntry() const
Definition: Object.h:109
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
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:1169

References Unit::CastSpell(), CreatureAI::DoZoneInCombat(), Object::GetEntry(), Object::GetGUID(), BossAI::JustSummoned(), ScriptedAI::me, NPC_FLAME_OF_RAGNAROS, NPC_SON_OF_FLAME, and SPELL_INTENSE_HEAT.

◆ KilledUnit()

void boss_ragnaros::boss_ragnarosAI::KilledUnit ( Unit victim)
inlineoverridevirtual

Reimplemented from ScriptedAI.

223 {
224 if (roll_chance_i(25) && victim->IsPlayer())
225 {
226 Talk(SAY_KILL);
227 }
228 }
bool roll_chance_i(int chance)
Definition: Random.h:59
@ SAY_KILL
Definition: boss_ragnaros.cpp:35
Talk
Definition: boss_fathomlord_karathress.cpp:25
bool IsPlayer() const
Definition: Object.h:194

References Object::IsPlayer(), roll_chance_i(), and SAY_KILL.

◆ Reset()

void boss_ragnaros::boss_ragnarosAI::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

132 {
133 _Reset();
134
135 // Never reset intro events!
136 if (_isIntroDone && !(extraEvents.GetPhaseMask() & (1 << (PHASE_INTRO - 1))))
137 {
142 me->SetImmuneToAll(false);
145 }
146
147 _hasYelledMagmaBurst = false;
148 _processingMagmaBurst = false;
149 _hasSubmergedOnce = false;
153 _lavaBurstGUIDS.clear();
154 }
@ UNIT_STATE_ROOT
Definition: Unit.h:335
uint8 GetPhaseMask() const
Definition: EventMap.h:87
void _Reset()
Definition: ScriptedCreature.cpp:604
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18288
void SetImmuneToAll(bool apply, bool keepCombat=false)
Definition: Unit.h:1692
GuidSet _lavaBurstGUIDS
Definition: boss_ragnaros.cpp:452

References _hasSubmergedOnce, _hasYelledMagmaBurst, _isIntroDone, _isKnockbackEmoteAllowed, _lavaBurstGUIDS, _processingMagmaBurst, BossAI::_Reset(), EMOTE_ONESHOT_EMERGE, extraEvents, EventMap::GetPhaseMask(), Unit::HandleEmoteCommand(), ScriptedAI::me, PHASE_EMERGED, PHASE_INTRO, REACT_AGGRESSIVE, Unit::RemoveUnitFlag(), EventMap::Reset(), Unit::SetControlled(), Unit::SetImmuneToAll(), EventMap::SetPhase(), Creature::SetReactState(), Object::SetUInt32Value(), UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_NPC_EMOTESTATE, and UNIT_STATE_ROOT.

◆ ScheduleCombatEvents()

void boss_ragnaros::boss_ragnarosAI::ScheduleCombatEvents ( )
inlineprivate
480 {
481 events.RescheduleEvent(EVENT_ERUPTION, 15s, PHASE_EMERGED, PHASE_EMERGED);
484 events.RescheduleEvent(EVENT_LAVA_BURST, 10s, PHASE_EMERGED, PHASE_EMERGED);
485 events.RescheduleEvent(EVENT_SUBMERGE, 180s, PHASE_EMERGED, PHASE_EMERGED);
487 }
@ EVENT_WRATH_OF_RAGNAROS
Definition: boss_ragnaros.cpp:78
@ EVENT_MIGHT_OF_RAGNAROS
Definition: boss_ragnaros.cpp:80
@ EVENT_HAND_OF_RAGNAROS
Definition: boss_ragnaros.cpp:79
@ EVENT_SUBMERGE
Definition: boss_ragnaros.cpp:83
@ EVENT_LAVA_BURST
Definition: boss_ragnaros.cpp:81
@ EVENT_ERUPTION
Definition: boss_ragnaros.cpp:77

References EVENT_ERUPTION, EVENT_HAND_OF_RAGNAROS, EVENT_LAVA_BURST, EVENT_MIGHT_OF_RAGNAROS, EVENT_SUBMERGE, EVENT_WRATH_OF_RAGNAROS, and PHASE_EMERGED.

Referenced by HandleEmerge(), and JustEngagedWith().

◆ SetGUID()

void boss_ragnaros::boss_ragnarosAI::SetGUID ( ObjectGuid  guid,
int32  index 
)
inlineoverridevirtual

Reimplemented from UnitAI.

187 {
188 if (index == GO_LAVA_BURST)
189 {
190 if (_lavaBurstGUIDS.empty())
191 {
193 }
194
195 _lavaBurstGUIDS.insert(guid);
196 }
197 }
@ EVENT_LAVA_BURST_TRIGGER
Definition: boss_ragnaros.cpp:84
@ GO_LAVA_BURST
Definition: molten_core.h:114

References _lavaBurstGUIDS, EVENT_LAVA_BURST_TRIGGER, extraEvents, GO_LAVA_BURST, and EventMap::ScheduleEvent().

◆ SummonedCreatureDies()

void boss_ragnaros::boss_ragnarosAI::SummonedCreatureDies ( Creature summon,
Unit  
)
inlineoverridevirtual

Reimplemented from CreatureAI.

200 {
201 summons.Despawn(summon);
203 {
204 HandleEmerge();
205 }
206 }
bool HasEntry(uint32 entry) const
Definition: ScriptedCreature.cpp:93
void Despawn(Creature const *summon)
Definition: ScriptedCreature.h:91
SummonList summons
Definition: ScriptedCreature.h:510
void HandleEmerge()
Definition: boss_ragnaros.cpp:454

References SummonList::Despawn(), HandleEmerge(), SummonList::HasEntry(), NPC_SON_OF_FLAME, PHASE_SUBMERGED, and BossAI::summons.

◆ UpdateAI()

void boss_ragnaros::boss_ragnarosAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from BossAI.

261 {
262 if (!extraEvents.Empty())
263 {
264 extraEvents.Update(diff);
265
266 while (uint32 const eventId = extraEvents.ExecuteEvent())
267 {
268 switch (eventId)
269 {
270 // Intro events
271 case EVENT_INTRO_SAY:
272 {
275 break;
276 }
278 {
279 _isIntroDone = true;
283 me->SetImmuneToAll(false);
286 break;
287 }
288 // Submerge events
289 case EVENT_EMERGE:
290 {
291 HandleEmerge();
292 break;
293 }
295 {
297 break;
298 }
300 {
301 if (!_lavaBurstGUIDS.empty())
302 {
304
305 if (GameObject* go = ObjectAccessor::GetGameObject(*me, lavaBurstGUID))
306 {
307 go->CastSpell(nullptr, SPELL_LAVA_BURST_TRAP);
308 go->SendCustomAnim(0);
309 }
310
311 _lavaBurstGUIDS.erase(lavaBurstGUID);
313 }
314 else
315 {
316 events.RescheduleEvent(EVENT_LAVA_BURST, 10s, PHASE_EMERGED, PHASE_EMERGED);
317 }
318
319 break;
320 }
321 }
322 }
323 }
324
325 if (!UpdateVictim())
326 {
328 {
329 return;
330 }
331 }
332
333 events.Update(diff);
334
336 {
337 return;
338 }
339
340 // Base combat events - (mainly emerge phase)
341 while (uint32 const eventId = events.ExecuteEvent())
342 {
343 switch (eventId)
344 {
346 {
348
349 if (urand(0, 1))
350 {
352 }
353 events.RepeatEvent(25000);
354 break;
355 }
357 {
360 {
364 }
365 events.RepeatEvent(20000);
366 break;
367 }
368 case EVENT_LAVA_BURST:
369 {
371 break;
372 }
374 {
375 _processingMagmaBurst = false;
376
378 {
380
382 {
385 }
386 }
387
388 break;
389 }
391 {
392 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [](Unit const* target)
393 {
394 return target->IsPlayer() && target->getPowerType() == POWER_MANA;
395 }))
396 {
398 {
402 }
403 }
404 events.RepeatEvent(urand(11000, 30000));
405 break;
406 }
407 case EVENT_SUBMERGE:
408 {
409 events.CancelEventGroup(PHASE_EMERGED);
410 events.SetPhase(PHASE_SUBMERGED);
414 me->AttackStop();
419 //me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
420
422
424
426 {
427 _hasSubmergedOnce = true;
428 }
429
431 break;
432 }
433 }
434
436 {
437 return;
438 }
439 }
440
442 }
std::uint32_t uint32
Definition: Define.h:108
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ REACT_PASSIVE
Definition: Unit.h:1035
@ UNIT_STATE_CASTING
Definition: Unit.h:340
@ SPELL_WRATH_OF_RAGNAROS
Definition: boss_ragnaros.cpp:42
@ SPELL_RAGNAROS_SUBMERGE_EFFECT
Definition: boss_ragnaros.cpp:49
@ SPELL_MAGMA_BLAST
Definition: boss_ragnaros.cpp:44
@ SPELL_HAND_OF_RAGNAROS
Definition: boss_ragnaros.cpp:41
@ SPELL_SUMMON_SONS_FLAME
Definition: boss_ragnaros.cpp:53
@ SPELL_LAVA_BURST
Definition: boss_ragnaros.cpp:43
@ SPELL_LAVA_BURST_TRAP
Definition: boss_ragnaros.cpp:63
@ SPELL_MIGHT_OF_RAGNAROS
Definition: boss_ragnaros.cpp:51
@ SAY_ARRIVAL5_RAG
Definition: boss_ragnaros.cpp:30
@ SAY_MAGMABURST
Definition: boss_ragnaros.cpp:36
@ SAY_REINFORCEMENTS1
Definition: boss_ragnaros.cpp:31
@ SAY_KNOCKBACK
Definition: boss_ragnaros.cpp:33
@ SAY_REINFORCEMENTS2
Definition: boss_ragnaros.cpp:32
@ SAY_WRATH
Definition: boss_ragnaros.cpp:34
@ EVENT_EMERGE
Definition: boss_ragnaros.cpp:87
@ EVENT_INTRO_MAKE_ATTACKABLE
Definition: boss_ragnaros.cpp:91
@ EVENT_RESET_KNOCKBACK_EMOTE
Definition: boss_ragnaros.cpp:94
@ EMOTE_STATE_SUBMERGED
Definition: SharedDefines.h:1968
@ POWER_MANA
Definition: SharedDefines.h:269
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:135
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:187
uint32 ExecuteEvent()
Definition: EventMap.cpp:114
void Update(uint32 time)
Definition: EventMap.h:54
bool Empty() const
Definition: EventMap.h:96
void RepeatEvent(uint32 time)
Definition: EventMap.cpp:99
void RescheduleEvent(uint32 eventId, uint32 time, uint32 groupId=0, uint32 phase=0)
Definition: EventMap.cpp:81
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
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition: UnitAI.h:379
SpellCastResult DoCastRandomTarget(uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
Definition: UnitAI.cpp:256
bool UpdateVictim()
Definition: CreatureAI.cpp:268
void DoResetThreatList()
Definition: ScriptedCreature.cpp:438
Definition: GameObject.h:122
Definition: ObjectGuid.h:120
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4081
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1410
Powers getPowerType() const
Definition: Unit.h:1473
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1495
bool AttackStop()
Definition: Unit.cpp:10407
bool IsVictimWithinMeleeRange() const
Definition: boss_ragnaros.cpp:489

References _hasSubmergedOnce, _hasYelledMagmaBurst, _isIntroDone, _isKnockbackEmoteAllowed, _lavaBurstGUIDS, _processingMagmaBurst, Unit::AttackStop(), Unit::CastSpell(), UnitAI::DoCastAOE(), UnitAI::DoCastRandomTarget(), UnitAI::DoCastSelf(), UnitAI::DoCastVictim(), UnitAI::DoMeleeAttackIfReady(), ScriptedAI::DoResetThreatList(), CreatureAI::DoZoneInCombat(), EMOTE_STATE_SUBMERGED, EventMap::Empty(), EVENT_EMERGE, EVENT_HAND_OF_RAGNAROS, EVENT_INTRO_MAKE_ATTACKABLE, EVENT_INTRO_SAY, EVENT_LAVA_BURST, EVENT_LAVA_BURST_TRIGGER, EVENT_MAGMA_BLAST, EVENT_MIGHT_OF_RAGNAROS, EVENT_RESET_KNOCKBACK_EMOTE, EVENT_SUBMERGE, EVENT_WRATH_OF_RAGNAROS, EventMap::ExecuteEvent(), extraEvents, ObjectAccessor::GetGameObject(), Unit::getPowerType(), HandleEmerge(), Unit::HasUnitState(), Unit::InterruptNonMeleeSpells(), Object::IsPlayer(), IsVictimWithinMeleeRange(), ScriptedAI::me, PHASE_EMERGED, PHASE_INTRO, PHASE_SUBMERGED, POWER_MANA, REACT_AGGRESSIVE, REACT_PASSIVE, Unit::RemoveAurasDueToSpell(), Unit::RemoveUnitFlag(), EventMap::RepeatEvent(), EventMap::RescheduleEvent(), SAY_ARRIVAL5_RAG, SAY_KNOCKBACK, SAY_MAGMABURST, SAY_REINFORCEMENTS1, SAY_REINFORCEMENTS2, SAY_WRATH, EventMap::ScheduleEvent(), Acore::Containers::SelectRandomContainerElement(), UnitAI::SelectTarget(), Unit::SetImmuneToAll(), EventMap::SetPhase(), Creature::SetReactState(), Object::SetUInt32Value(), Unit::SetUnitFlag(), SPELL_CAST_OK, SPELL_HAND_OF_RAGNAROS, SPELL_LAVA_BURST, SPELL_LAVA_BURST_TRAP, SPELL_MAGMA_BLAST, SPELL_MIGHT_OF_RAGNAROS, SPELL_RAGNA_SUBMERGE_VISUAL, SPELL_RAGNAROS_SUBMERGE_EFFECT, SPELL_SUMMON_SONS_FLAME, SPELL_WRATH_OF_RAGNAROS, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_NPC_EMOTESTATE, UNIT_STATE_CASTING, EventMap::Update(), CreatureAI::UpdateVictim(), and urand().

Member Data Documentation

◆ _hasSubmergedOnce

bool boss_ragnaros::boss_ragnarosAI::_hasSubmergedOnce
private

Referenced by Reset(), and UpdateAI().

◆ _hasYelledMagmaBurst

bool boss_ragnaros::boss_ragnarosAI::_hasYelledMagmaBurst
private

Referenced by Reset(), and UpdateAI().

◆ _isIntroDone

bool boss_ragnaros::boss_ragnarosAI::_isIntroDone
private

Referenced by Reset(), and UpdateAI().

◆ _isKnockbackEmoteAllowed

bool boss_ragnaros::boss_ragnarosAI::_isKnockbackEmoteAllowed
private

Referenced by Reset(), and UpdateAI().

◆ _lavaBurstGUIDS

GuidSet boss_ragnaros::boss_ragnarosAI::_lavaBurstGUIDS
private

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

◆ _processingMagmaBurst

bool boss_ragnaros::boss_ragnarosAI::_processingMagmaBurst
private

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

◆ extraEvents

EventMap boss_ragnaros::boss_ragnarosAI::extraEvents
private