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

Public Member Functions

 boss_sartharionAI (Creature *pCreature)
 
void Reset () override
 
void DoAction (int32 param) override
 
void JustEngagedWith (Unit *pWho) override
 Called for reaction when initially engaged. More...
 
void JustDied (Unit *) override
 
void SetData (uint32 type, uint32 data) override
 
uint32 GetData (uint32 dataOrGuid) const override
 
void KilledUnit (Unit *pVictim) override
 
void JustSummoned (Creature *summon) override
 
void DamageTaken (Unit *, uint32 &damage, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply) More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
 ~BossAI () override
 
bool CanRespawn () override
 
void DamageTaken (Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
 Called at any Damage from any attacker (before damage apply) More...
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
void SummonedCreatureDespawnAll () override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
void ScheduleHealthCheckEvent (uint32 healthPct, std::function< void()> exec)
 Executes a function once the creature reaches the defined health point percent. More...
 
void ScheduleHealthCheckEvent (std::initializer_list< uint8 > healthPct, std::function< void()> exec)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER) override
 
void JustDied (Unit *) override
 
void JustReachedHome () override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply) More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table. More...
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon. More...
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged. More...
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed. More...
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 Called when unit is charmed. More...
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following: More...
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat. More...
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat. More...
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 Called at any Damage to any victim (before damage apply) More...
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage from any attacker (before damage apply) More...
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal. More...
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates. More...
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals. More...
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations. More...
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT) More...
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast. More...
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list. More...
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim. More...
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished. More...
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Private Member Functions

void SummonStartingTriggers ()
 
void SummonLavaWaves ()
 
void SendLavaWaves (bool start)
 
void RespawnDragons (bool checkCombat)
 
bool IsTargetInBounds (Unit const *victim) const
 

Private Attributes

EventMap extraEvents
 
std::list< uint32volcanoBlows
 
uint8 dragonsCount
 
uint8 lastLavaSide
 
bool usedBerserk
 
bool below11PctReached
 

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

boss_sartharion::boss_sartharionAI::boss_sartharionAI ( Creature pCreature)
inline
255 : BossAI(pCreature, DATA_SARTHARION),
256 dragonsCount(0),
258 usedBerserk(false),
259 below11PctReached(false)
260 {
261 }
@ DATA_SARTHARION
Definition: obsidian_sanctum.h:30
@ LAVA_RIGHT_SIDE
Definition: boss_sartharion.cpp:139
Definition: ScriptedCreature.h:467
uint8 dragonsCount
Definition: boss_sartharion.cpp:716
bool usedBerserk
Definition: boss_sartharion.cpp:718
uint8 lastLavaSide
Definition: boss_sartharion.cpp:717
bool below11PctReached
Definition: boss_sartharion.cpp:719

Member Function Documentation

◆ DamageTaken()

void boss_sartharion::boss_sartharionAI::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 BossAI.

418 {
419 // Temporal hack, by some case some melee spells can bypass this aura damage reduction
421 {
422 damage = 0;
423 return;
424 }
425
426 if (!usedBerserk && me->HealthBelowPctDamaged(30, damage))
427 {
429 usedBerserk = true;
430 return;
431 }
432
433 // Soft enrage
434 if (!below11PctReached && me->HealthBelowPctDamaged(10, damage))
435 {
437 if (!summons.empty())
438 {
439 for (ObjectGuid const& summonGuid : summons)
440 {
441 Creature* summon = ObjectAccessor::GetCreature(*me, summonGuid);
442 if (summon && summon->GetEntry() == NPC_FIRE_CYCLONE)
443 {
444 summon->CastSpell(summon, SPELL_CYCLONE_AURA_PERIODIC, true);
445 }
446 }
447 }
449 below11PctReached = true;
450 }
451 }
Talk
Definition: hyjal.cpp:82
@ NPC_FIRE_CYCLONE
Definition: obsidian_sanctum.h:45
@ SAY_SARTHARION_BERSERK
Definition: boss_sartharion.cpp:29
@ SPELL_SARTHARION_BERSERK
Definition: boss_sartharion.cpp:89
@ SPELL_GIFT_OF_TWILIGHT_FIRE
Definition: boss_sartharion.cpp:97
@ SPELL_CYCLONE_AURA_PERIODIC
Definition: boss_sartharion.cpp:84
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:210
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition: UnitAI.h:392
bool empty() const
Definition: ScriptedCreature.h:73
void RemoveNotExisting()
Definition: ScriptedCreature.cpp:82
Creature * me
Definition: ScriptedCreature.h:280
SummonList summons
Definition: ScriptedCreature.h:511
Definition: Creature.h:43
uint32 GetEntry() const
Definition: Object.h:115
Definition: ObjectGuid.h:118
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5698
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1167
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:1038

References below11PctReached, Unit::CastSpell(), UnitAI::DoCastSelf(), SummonList::empty(), ObjectAccessor::GetCreature(), Object::GetEntry(), Unit::HasAura(), Unit::HealthBelowPctDamaged(), ScriptedAI::me, NPC_FIRE_CYCLONE, SummonList::RemoveNotExisting(), SAY_SARTHARION_BERSERK, SPELL_CYCLONE_AURA_PERIODIC, SPELL_GIFT_OF_TWILIGHT_FIRE, SPELL_SARTHARION_BERSERK, BossAI::summons, and usedBerserk.

◆ DoAction()

void boss_sartharion::boss_sartharionAI::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

277 {
278 if (param == ACTION_DRAKE_DIED)
279 {
281 }
282 }
@ ACTION_DRAKE_DIED
Definition: boss_sartharion.cpp:130
@ SPELL_SARTHARION_TWILIGHT_REVENGE
Definition: boss_sartharion.cpp:90

References ACTION_DRAKE_DIED, UnitAI::DoCastSelf(), and SPELL_SARTHARION_TWILIGHT_REVENGE.

◆ GetData()

uint32 boss_sartharion::boss_sartharionAI::GetData ( uint32  dataOrGuid) const
inlineoverridevirtual

Reimplemented from UnitAI.

374 {
375 // it means we want dragons count
376 if (dataOrGuid == DATA_ACHIEVEMENT_DRAGONS_COUNT)
377 {
378 return dragonsCount;
379 }
380
381 // otherwise it is guid to check if player was hit by lava strike :)
382 if (!volcanoBlows.empty() && std::find(volcanoBlows.begin(), volcanoBlows.end(), dataOrGuid) != volcanoBlows.end())
383 {
384 return 1;
385 }
386
387 return 0;
388 }
@ DATA_ACHIEVEMENT_DRAGONS_COUNT
Definition: obsidian_sanctum.h:37
std::list< uint32 > volcanoBlows
Definition: boss_sartharion.cpp:715

References DATA_ACHIEVEMENT_DRAGONS_COUNT, dragonsCount, and volcanoBlows.

◆ IsTargetInBounds()

bool boss_sartharion::boss_sartharionAI::IsTargetInBounds ( Unit const *  victim) const
inlineprivate
699 {
700 if (!victim || victim->GetPositionX() < SartharionBoundary[0] || victim->GetPositionX() > SartharionBoundary[1] || victim->GetPositionY() > SartharionBoundary[3])
701 {
702 return false;
703 }
704
705 // Big island handling
706 if (victim->GetPositionY() < SartharionBoundary[2])
707 {
708 return victim->GetDistance(bigIslandMiddlePos) <= 6.0f;
709 }
710
711 return true;
712 }
const float SartharionBoundary[MAX_BOUNDARY_POSITIONS]
Definition: boss_sartharion.cpp:227
const Position bigIslandMiddlePos
Definition: boss_sartharion.cpp:235

References bigIslandMiddlePos, WorldObject::GetDistance(), Position::GetPositionX(), Position::GetPositionY(), and SartharionBoundary.

Referenced by JustEngagedWith(), and UpdateAI().

◆ JustDied()

void boss_sartharion::boss_sartharionAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from BossAI.

354 {
355 RespawnDragons(true);
356 _JustDied();
358 }
@ SAY_SARTHARION_DEATH
Definition: boss_sartharion.cpp:34
void _JustDied()
Definition: ScriptedCreature.cpp:643
void RespawnDragons(bool checkCombat)
Definition: boss_sartharion.cpp:674

References BossAI::_JustDied(), RespawnDragons(), and SAY_SARTHARION_DEATH.

◆ JustEngagedWith()

void boss_sartharion::boss_sartharionAI::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from BossAI.

285 {
286 if (pWho && !IsTargetInBounds(pWho))
287 {
289 return;
290 }
291
295
296 // Combat events
297 events.ScheduleEvent(EVENT_SARTHARION_CAST_CLEAVE, 7s);
298 events.ScheduleEvent(EVENT_SARTHARION_CAST_FLAME_BREATH, 15s);
299 events.ScheduleEvent(EVENT_SARTHARION_CAST_TAIL_LASH, 11s);
300
301 // Extra events
306
307 // Store dragons
308 for (uint8 i = 0; i < MAX_DRAGONS; ++i)
309 {
311 if (!dragon || !dragon->IsAlive() || instance->GetBossState(dragons[i]) == DONE)
312 {
313 continue;
314 }
315
316 dragon->SetImmuneToNPC(true);
317 dragon->SetFullHealth();
318
319 ++dragonsCount;
321
322 switch (dragons[i])
323 {
324 case DATA_TENEBRON:
325 {
326 dragon->CastSpell(dragon, SPELL_POWER_OF_TENEBRON, true);
328 break;
329 }
330 case DATA_SHADRON:
331 {
332 dragon->CastSpell(dragon, SPELL_POWER_OF_SHADRON, true);
334 break;
335 }
336 case DATA_VESPERON:
337 {
338 dragon->CastSpell(dragon, SPELL_POWER_OF_VESPERON, true);
340 break;
341 }
342 }
343 }
344
345 if (dragonsCount)
346 {
348 }
349
350 me->CallForHelp(500.0f);
351 }
std::uint8_t uint8
Definition: Define.h:109
events
Definition: boss_sartura.cpp:43
@ DATA_VESPERON
Definition: obsidian_sanctum.h:32
@ DATA_TENEBRON
Definition: obsidian_sanctum.h:31
@ DATA_SHADRON
Definition: obsidian_sanctum.h:33
@ SAY_SARTHARION_AGGRO
Definition: boss_sartharion.cpp:28
const uint32 dragons[MAX_DRAGONS]
Definition: boss_sartharion.cpp:237
@ MAX_DRAGONS
Definition: boss_sartharion.cpp:144
@ SPELL_POWER_OF_VESPERON
Definition: boss_sartharion.cpp:95
@ SPELL_POWER_OF_SHADRON
Definition: boss_sartharion.cpp:96
@ SPELL_POWER_OF_TENEBRON
Definition: boss_sartharion.cpp:94
@ SPELL_WILL_OF_SARTHARION
Definition: boss_sartharion.cpp:93
@ SPELL_SARTHARION_PYROBUFFET
Definition: boss_sartharion.cpp:88
@ EVENT_SARTHARION_LAVA_STRIKE
Definition: boss_sartharion.cpp:168
@ EVENT_SARTHARION_CALL_TENEBRON
Definition: boss_sartharion.cpp:172
@ EVENT_SARTHARION_CAST_TAIL_LASH
Definition: boss_sartharion.cpp:164
@ EVENT_SARTHARION_CALL_SHADRON
Definition: boss_sartharion.cpp:173
@ EVENT_SARTHARION_CAST_CLEAVE
Definition: boss_sartharion.cpp:162
@ EVENT_SARTHARION_SUMMON_LAVA
Definition: boss_sartharion.cpp:165
@ EVENT_SARTHARION_CAST_FLAME_BREATH
Definition: boss_sartharion.cpp:163
@ EVENT_SARTHARION_BOUNDARY
Definition: boss_sartharion.cpp:176
@ EVENT_SARTHARION_CALL_VESPERON
Definition: boss_sartharion.cpp:174
@ EVENT_SARTHARION_BERSERK
Definition: boss_sartharion.cpp:169
@ DONE
Definition: InstanceScript.h:60
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition: EventMap.cpp:56
InstanceScript *const instance
Definition: ScriptedCreature.h:474
void _JustEngagedWith()
Definition: ScriptedCreature.cpp:656
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition: ScriptedCreature.h:498
void AddLootMode(uint16 lootMode)
Definition: Creature.h:243
void CallForHelp(float fRadius, Unit *target=nullptr)
Definition: Creature.cpp:2469
void SetFullHealth()
Definition: Unit.h:1047
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13620
bool IsAlive() const
Definition: Unit.h:1654
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:98
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:235
EventMap extraEvents
Definition: boss_sartharion.cpp:714
bool IsTargetInBounds(Unit const *victim) const
Definition: boss_sartharion.cpp:698

References BossAI::_JustEngagedWith(), Creature::AddLootMode(), Creature::CallForHelp(), Unit::CastSpell(), DATA_SHADRON, DATA_TENEBRON, DATA_VESPERON, UnitAI::DoCastSelf(), DONE, dragons, dragonsCount, BossAI::EnterEvadeMode(), EVENT_SARTHARION_BERSERK, EVENT_SARTHARION_BOUNDARY, EVENT_SARTHARION_CALL_SHADRON, EVENT_SARTHARION_CALL_TENEBRON, EVENT_SARTHARION_CALL_VESPERON, EVENT_SARTHARION_CAST_CLEAVE, EVENT_SARTHARION_CAST_FLAME_BREATH, EVENT_SARTHARION_CAST_TAIL_LASH, EVENT_SARTHARION_LAVA_STRIKE, EVENT_SARTHARION_SUMMON_LAVA, extraEvents, InstanceScript::GetBossState(), ObjectAccessor::GetCreature(), InstanceScript::GetGuidData(), BossAI::instance, Unit::IsAlive(), IsTargetInBounds(), MAX_DRAGONS, ScriptedAI::me, SAY_SARTHARION_AGGRO, EventMap::ScheduleEvent(), Unit::SetFullHealth(), Unit::SetImmuneToNPC(), SPELL_POWER_OF_SHADRON, SPELL_POWER_OF_TENEBRON, SPELL_POWER_OF_VESPERON, SPELL_SARTHARION_PYROBUFFET, and SPELL_WILL_OF_SARTHARION.

◆ JustSummoned()

void boss_sartharion::boss_sartharionAI::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from BossAI.

399 {
400 switch (summon->GetEntry())
401 {
403 {
404 summon->SetSpeed(MOVE_FLIGHT, 1.5f);
405 break;
406 }
407 case NPC_FIRE_CYCLONE:
408 {
409 summon->GetMotionMaster()->MoveRandom(5.0f);
410 break;
411 }
412 }
413
414 summons.Summon(summon);
415 }
@ NPC_FLAME_TSUNAMI
Definition: boss_sartharion.cpp:121
@ MOVE_FLIGHT
Definition: UnitDefines.h:334
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:88
MotionMaster * GetMotionMaster()
Definition: Unit.h:1620
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14429
void MoveRandom(float wanderDistance=0.0f)
Enable a random movement in desired range around the unit. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:242

References Object::GetEntry(), Unit::GetMotionMaster(), MOVE_FLIGHT, MotionMaster::MoveRandom(), NPC_FIRE_CYCLONE, NPC_FLAME_TSUNAMI, Unit::SetSpeed(), SummonList::Summon(), and BossAI::summons.

◆ KilledUnit()

void boss_sartharion::boss_sartharionAI::KilledUnit ( Unit pVictim)
inlineoverridevirtual

Reimplemented from ScriptedAI.

391 {
392 if (!urand(0, 2) && pVictim->IsPlayer())
393 {
395 }
396 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ SAY_SARTHARION_SLAY
Definition: boss_sartharion.cpp:36
bool IsPlayer() const
Definition: Object.h:200

References Object::IsPlayer(), SAY_SARTHARION_SLAY, and urand().

◆ Reset()

void boss_sartharion::boss_sartharionAI::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

264 {
265 _Reset();
267 RespawnDragons(false);
269 usedBerserk = false;
270 below11PctReached = false;
271 dragonsCount = 0;
272 volcanoBlows.clear();
274 }
@ SPELL_TWILIGHT_SHIFT
Definition: obsidian_sanctum.h:52
void Reset()
Definition: EventMap.cpp:21
void _Reset()
Definition: ScriptedCreature.cpp:624
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:665
void SummonStartingTriggers()
Definition: boss_sartharion.cpp:606

References BossAI::_Reset(), below11PctReached, InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), dragonsCount, extraEvents, BossAI::instance, EventMap::Reset(), RespawnDragons(), SPELL_TWILIGHT_SHIFT, SummonStartingTriggers(), usedBerserk, and volcanoBlows.

◆ RespawnDragons()

void boss_sartharion::boss_sartharionAI::RespawnDragons ( bool  checkCombat)
inlineprivate
675 {
676 for (uint8 i = 0; i < MAX_DRAGONS; ++i)
677 {
678 if (instance->GetBossState(dragons[i]) == DONE)
679 {
680 continue;
681 }
682
684 {
685 if (checkCombat && dragon->IsInCombat())
686 {
687 continue;
688 }
689
690 dragon->DespawnOrUnsummon();
691 dragon->SetRespawnTime(5);
692 }
693 }
694
695 dragonsCount = 0;
696 }

References DONE, dragons, dragonsCount, InstanceScript::GetBossState(), ObjectAccessor::GetCreature(), InstanceScript::GetGuidData(), BossAI::instance, MAX_DRAGONS, and ScriptedAI::me.

Referenced by JustDied(), and Reset().

◆ SendLavaWaves()

void boss_sartharion::boss_sartharionAI::SendLavaWaves ( bool  start)
inlineprivate
649 {
650 if (summons.empty())
651 {
652 return;
653 }
654
655 for (ObjectGuid const& guid : summons)
656 {
657 Creature* tsunami = ObjectAccessor::GetCreature(*me, guid);
658 if (!tsunami || tsunami->GetEntry() != NPC_FLAME_TSUNAMI)
659 {
660 continue;
661 }
662
663 if (start)
664 {
665 tsunami->GetMotionMaster()->MovePoint(0, ((tsunami->GetPositionX() < 3250.0f) ? 3283.44f : 3208.44f), tsunami->GetPositionY(), tsunami->GetPositionZ());
666 }
667 else
668 {
669 tsunami->SetObjectScale(0.1f);
670 }
671 }
672 }
void SetObjectScale(float scale) override
Definition: Creature.cpp:3499
float GetPositionZ() const
Definition: Position.h:118
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:213

References SummonList::empty(), ObjectAccessor::GetCreature(), Object::GetEntry(), Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), ScriptedAI::me, MotionMaster::MovePoint(), NPC_FLAME_TSUNAMI, Creature::SetObjectScale(), and BossAI::summons.

Referenced by UpdateAI().

◆ SetData()

void boss_sartharion::boss_sartharionAI::SetData ( uint32  type,
uint32  data 
)
inlineoverridevirtual

Reimplemented from UnitAI.

361 {
362 if (type == DATA_VOLCANO_BLOWS && data)
363 {
364 if (!volcanoBlows.empty() && std::find(volcanoBlows.begin(), volcanoBlows.end(), data) != volcanoBlows.end())
365 {
366 return;
367 }
368
369 volcanoBlows.push_back(data);
370 }
371 }
@ DATA_VOLCANO_BLOWS
Definition: obsidian_sanctum.h:38

References DATA_VOLCANO_BLOWS, and volcanoBlows.

◆ SummonLavaWaves()

void boss_sartharion::boss_sartharionAI::SummonLavaWaves ( )
inlineprivate
620 {
625
626 // Send wave from left
628 {
629 for (uint8 i = 0; i < MAX_LEFT_LAVA_TSUNAMIS; ++i)
630 {
631 me->SummonCreature(NPC_FLAME_TSUNAMI, 3208.44f, 580.0f - (i * 50.0f), 55.8f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 12000);
632 }
633
635 }
636 // from right
637 else
638 {
639 for (uint8 i = 0; i < MAX_RIGHT_LAVA_TSUNAMIS; ++i)
640 {
641 me->SummonCreature(NPC_FLAME_TSUNAMI, 3283.44f, 555.0f - (i * 50.0f), 55.8f, 3.14f, TEMPSUMMON_TIMED_DESPAWN, 12000);
642 }
643
645 }
646 }
@ WHISPER_LAVA_CHURN
Definition: boss_sartharion.cpp:64
@ MAX_RIGHT_LAVA_TSUNAMIS
Definition: boss_sartharion.cpp:143
@ MAX_LEFT_LAVA_TSUNAMIS
Definition: boss_sartharion.cpp:142
@ LAVA_LEFT_SIDE
Definition: boss_sartharion.cpp:138
@ EVENT_SARTHARION_FINISH_LAVA
Definition: boss_sartharion.cpp:167
@ EVENT_SARTHARION_START_LAVA
Definition: boss_sartharion.cpp:166
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:48
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition: Object.cpp:2366

References EVENT_SARTHARION_FINISH_LAVA, EVENT_SARTHARION_START_LAVA, extraEvents, lastLavaSide, LAVA_LEFT_SIDE, LAVA_RIGHT_SIDE, MAX_LEFT_LAVA_TSUNAMIS, MAX_RIGHT_LAVA_TSUNAMIS, ScriptedAI::me, NPC_FLAME_TSUNAMI, SummonList::RemoveNotExisting(), EventMap::ScheduleEvent(), WorldObject::SummonCreature(), BossAI::summons, TEMPSUMMON_TIMED_DESPAWN, and WHISPER_LAVA_CHURN.

Referenced by UpdateAI().

◆ SummonStartingTriggers()

void boss_sartharion::boss_sartharionAI::SummonStartingTriggers ( )
inlineprivate
607 {
608 for (uint8 i = 0; i < MAX_CYCLONE_COUNT; ++i)
609 {
611 }
612
613 for (uint8 i = 0; i < MAX_AREA_TRIGGER_COUNT; ++i)
614 {
616 }
617 }
@ MAX_CYCLONE_COUNT
Definition: boss_sartharion.cpp:146
@ MAX_AREA_TRIGGER_COUNT
Definition: boss_sartharion.cpp:145
@ NPC_SAFE_AREA_TRIGGER
Definition: boss_sartharion.cpp:122
const Position CycloneSummonPos[MAX_CYCLONE_COUNT]
Definition: boss_sartharion.cpp:212
const Position AreaTriggerSummonPos[MAX_AREA_TRIGGER_COUNT]
Definition: boss_sartharion.cpp:221

References AreaTriggerSummonPos, CycloneSummonPos, MAX_AREA_TRIGGER_COUNT, MAX_CYCLONE_COUNT, ScriptedAI::me, NPC_FIRE_CYCLONE, NPC_SAFE_AREA_TRIGGER, and WorldObject::SummonCreature().

Referenced by Reset().

◆ UpdateAI()

void boss_sartharion::boss_sartharionAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Reimplemented from BossAI.

454 {
455 if (!UpdateVictim())
456 {
457 return;
458 }
459
460 extraEvents.Update(diff);
461
462 // Special events which needs to be fired immidiately
463 while (uint32 const eventId = extraEvents.ExecuteEvent())
464 {
465 switch (eventId)
466 {
468 {
470 {
472 }
473 else
474 {
475 extraEvents.Repeat(250ms);
476 }
477 break;
478 }
480 {
481 if (!urand(0, 3))
482 {
484 }
485
487 extraEvents.Repeat(25s);
488 return;
489 }
491 {
492 SendLavaWaves(true);
493 return;
494 }
496 {
497 SendLavaWaves(false);
498 return;
499 }
500 // Handling of Drakes Events
501 // Dragon Calls
503 {
506 {
507 tenebron->AI()->DoAction(ACTION_CALL_DRAGON);
508 }
509 break;
510 }
512 {
515 {
516 shadron->AI()->DoAction(ACTION_CALL_DRAGON);
517 }
518 break;
519 }
521 {
524 {
525 vesperon->AI()->DoAction(ACTION_CALL_DRAGON);
526 }
527
528 break;
529 }
530 }
531 }
532
533 // Handle Sartharion combat abbilities
534 events.Update(diff);
535
537 {
538 return;
539 }
540
541 while (uint32 const eventId = events.ExecuteEvent())
542 {
543 switch (eventId)
544 {
546 {
548 events.Repeat(10s);
549 break;
550 }
552 {
554 events.Repeat(20s);
555 break;
556 }
558 {
560 events.Repeat(18s);
561 break;
562 }
564 {
565 if (!urand(0, 2))
566 {
568 }
569
571 uint8 rand = urand(0, MAX_CYCLONE_COUNT - 1); // 5 - numer of cyclones
572 uint8 iter = 0;
573 if (!summons.empty())
574 {
575 for (ObjectGuid const& summonGuid : summons)
576 {
577 Creature* summon = ObjectAccessor::GetCreature(*me, summonGuid);
578 if (summon && summon->GetEntry() == NPC_FIRE_CYCLONE && iter == rand)
579 {
580 summon->CastSpell(summon, SPELL_CYCLONE_AURA_PERIODIC, true);
581 ++iter;
582 }
583 }
584 }
585
586 events.RepeatEvent((below11PctReached ? urand(1400, 2000) : urand(5000, 20000)));
587 break;
588 }
590 {
592 break;
593 }
594 }
595
597 {
598 return;
599 }
600 }
601
603 }
std::uint32_t uint32
Definition: Define.h:107
@ SAY_SARTHARION_SPECIAL_4
Definition: boss_sartharion.cpp:37
@ SAY_SARTHARION_CALL_TENEBRON
Definition: boss_sartharion.cpp:32
@ SAY_SARTHARION_CALL_VESPERON
Definition: boss_sartharion.cpp:33
@ SAY_SARTHARION_CALL_SHADRON
Definition: boss_sartharion.cpp:31
@ SAY_SARTHARION_SPECIAL
Definition: boss_sartharion.cpp:35
@ ACTION_CALL_DRAGON
Definition: boss_sartharion.cpp:129
@ SPELL_SARTHARION_FLAME_BREATH
Definition: boss_sartharion.cpp:82
@ SPELL_SARTHARION_TAIL_LASH
Definition: boss_sartharion.cpp:83
@ SPELL_SARTHARION_CLEAVE
Definition: boss_sartharion.cpp:81
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
uint32 ExecuteEvent()
Definition: EventMap.cpp:114
void Update(uint32 time)
Definition: EventMap.h:54
void Repeat(Milliseconds time)
Definition: EventMap.cpp:104
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:240
bool UpdateVictim()
Definition: CreatureAI.cpp:280
void DespawnEntry(uint32 entry)
Definition: ScriptedCreature.cpp:54
Unit * GetVictim() const
Definition: Unit.h:853
bool HasUnitState(const uint32 f) const
Definition: Unit.h:701
void SendLavaWaves(bool start)
Definition: boss_sartharion.cpp:648
void SummonLavaWaves()
Definition: boss_sartharion.cpp:619

References ACTION_CALL_DRAGON, below11PctReached, Unit::CastSpell(), DATA_SHADRON, DATA_TENEBRON, DATA_VESPERON, SummonList::DespawnEntry(), UnitAI::DoCastSelf(), UnitAI::DoCastVictim(), UnitAI::DoMeleeAttackIfReady(), SummonList::empty(), BossAI::EnterEvadeMode(), EVENT_SARTHARION_BERSERK, EVENT_SARTHARION_BOUNDARY, EVENT_SARTHARION_CALL_SHADRON, EVENT_SARTHARION_CALL_TENEBRON, EVENT_SARTHARION_CALL_VESPERON, EVENT_SARTHARION_CAST_CLEAVE, EVENT_SARTHARION_CAST_FLAME_BREATH, EVENT_SARTHARION_CAST_TAIL_LASH, EVENT_SARTHARION_FINISH_LAVA, EVENT_SARTHARION_LAVA_STRIKE, EVENT_SARTHARION_START_LAVA, EVENT_SARTHARION_SUMMON_LAVA, EventMap::ExecuteEvent(), extraEvents, ObjectAccessor::GetCreature(), Object::GetEntry(), InstanceScript::GetGuidData(), Unit::GetVictim(), Unit::HasUnitState(), BossAI::instance, IsTargetInBounds(), MAX_CYCLONE_COUNT, ScriptedAI::me, NPC_FIRE_CYCLONE, NPC_SAFE_AREA_TRIGGER, SummonList::RemoveNotExisting(), EventMap::Repeat(), SAY_SARTHARION_CALL_SHADRON, SAY_SARTHARION_CALL_TENEBRON, SAY_SARTHARION_CALL_VESPERON, SAY_SARTHARION_SPECIAL, SAY_SARTHARION_SPECIAL_4, SendLavaWaves(), SPELL_CYCLONE_AURA_PERIODIC, SPELL_SARTHARION_CLEAVE, SPELL_SARTHARION_FLAME_BREATH, SPELL_SARTHARION_TAIL_LASH, SummonLavaWaves(), BossAI::summons, UNIT_STATE_CASTING, EventMap::Update(), CreatureAI::UpdateVictim(), and urand().

Member Data Documentation

◆ below11PctReached

bool boss_sartharion::boss_sartharionAI::below11PctReached
private

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

◆ dragonsCount

uint8 boss_sartharion::boss_sartharionAI::dragonsCount
private

◆ extraEvents

EventMap boss_sartharion::boss_sartharionAI::extraEvents
private

◆ lastLavaSide

uint8 boss_sartharion::boss_sartharionAI::lastLavaSide
private

Referenced by SummonLavaWaves().

◆ usedBerserk

bool boss_sartharion::boss_sartharionAI::usedBerserk
private

Referenced by DamageTaken(), and Reset().

◆ volcanoBlows

std::list<uint32> boss_sartharion::boss_sartharionAI::volcanoBlows
private

Referenced by GetData(), Reset(), and SetData().