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

Public Member Functions

 boss_alar (Creature *creature)
 
void Reset () override
 
void JustReachedHome () override
 
void JustEngagedWith (Unit *who) override
 Called for reaction when initially engaged.
 
bool CanAIAttack (Unit const *victim) const override
 
void EnterEvadeMode (EvadeReason why) override
 
void JustDied (Unit *killer) override
 
void MoveInLineOfSight (Unit *) override
 
void DamageTaken (Unit *, uint32 &damage, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void PretendToDie (Creature *creature)
 
void ScheduleAbilities ()
 
void SpawnPhoenixes (uint8 count, Unit *targetToSpawnAt)
 
void DoDiveBomb ()
 
void MovementInform (uint32 type, uint32 id) override
 
void ScheduleMainSpellAttack (std::chrono::seconds timer)
 
void ConstructWaypointsAndMove ()
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
Position DeterminePhoenixPosition (Position playerPosition)
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
 ~BossAI () override
 
bool CanRespawn () override
 
void OnSpellCastFinished (SpellInfo const *spell, SpellFinishReason reason) override
 
void DamageTaken (Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
void SummonedCreatureDespawnAll () override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void ScheduleHealthCheckEvent (uint32 healthPct, std::function< void()> exec, bool allowedWhileCasting=true)
 Executes a function once the creature reaches the defined health point percent.
 
void ScheduleHealthCheckEvent (std::initializer_list< uint8 > healthPct, std::function< void()> exec, bool allowedWhileCasting=true)
 
void ProcessHealthCheck ()
 
void ScheduleEnrageTimer (uint32 spellId, Milliseconds timer, uint8 textId=0)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
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=0ms, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
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=0ms)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
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 ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
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)
 
virtual void DistancingStarted ()
 
virtual void DistancingEnded ()
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual void InitializeAI ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid const &, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following:
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void 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

bool _hasPretendedToDie
 
bool _canAttackCooldown
 
bool _baseAttackOverride
 
bool _spawnPhoenixes
 
bool _noMelee
 
uint8 _platform
 
uint8 _platformRoll
 
uint8 _noQuillTimes
 
std::chrono::seconds _platformMoveRepeatTimer
 
TaskScheduler _transitionScheduler
 

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

boss_alar::boss_alar ( Creature creature)
inline
98 : BossAI(creature, DATA_ALAR)
99 {
100 me->SetCombatMovement(false);
102 {
104 });
105 }
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185
Definition ScriptedCreature.h:481
TaskScheduler scheduler
Definition CreatureAI.h:76
void SetCombatMovement(bool allowMovement)
Definition Creature.cpp:3777
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
Definition TaskScheduler.h:197
bool HasUnitState(const uint32 f) const
Definition Unit.h:721
Creature * me
Definition ScriptedCreature.h:280
@ DATA_ALAR
Definition the_eye.h:29

References Unit::HasUnitState(), ScriptedAI::me, CreatureAI::scheduler, Creature::SetCombatMovement(), TaskScheduler::SetValidator(), and UNIT_STATE_CASTING.

Member Function Documentation

◆ CanAIAttack()

bool boss_alar::CanAIAttack ( Unit const *  victim) const
inlineoverridevirtual

Reimplemented from UnitAI.

164 {
165 if (me->isMoving())
166 return true;
167
168 return _hasPretendedToDie || me->IsWithinMeleeRange(victim);
169 }
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition Unit.cpp:665
bool isMoving() const
Definition Unit.h:1663
bool _hasPretendedToDie
Definition boss_alar.cpp:408

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

◆ ConstructWaypointsAndMove()

void boss_alar::ConstructWaypointsAndMove ( )
inline
356 {
357 me->StopMoving();
359 }
@ FORCED_MOVEMENT_NONE
Definition MotionMaster.h:85
uint32 GetWaypointPath() const
Definition Creature.h:349
void MovePath(uint32 path_id, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, PathSource pathSource=PathSource::WAYPOINT_MGR)
Definition MotionMaster.cpp:507
MotionMaster * GetMotionMaster()
Definition Unit.h:1713
void StopMoving()
Definition Unit.cpp:16660

References FORCED_MOVEMENT_NONE, Unit::GetMotionMaster(), Creature::GetWaypointPath(), ScriptedAI::me, MotionMaster::MovePath(), Unit::StopMoving(), and WAYPOINT_MGR.

Referenced by JustReachedHome(), MovementInform(), and Reset().

◆ DamageTaken()

void boss_alar::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.

194 {
195 if (damage >= me->GetHealth() && _platform < POINT_MIDDLE)
196 {
197 damage = 0;
199 {
200 _hasPretendedToDie = true;
204 {
205 me->SetVisible(false);
206 }).Schedule(8s, [this](TaskContext)
207 {
209 }).Schedule(12s, [this](TaskContext)
210 {
212 me->SetVisible(true);
215 }).Schedule(16001ms, [this](TaskContext)
216 {
219 _noMelee = false;
224 });
225 }
226 }
227 }
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:32
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:279
@ REACT_AGGRESSIVE
Definition Unit.h:552
const Position alarPoints[9]
Definition boss_alar.cpp:49
@ POINT_MIDDLE
Definition boss_alar.cpp:70
@ SPELL_CLEAR_ALL_DEBUFFS
Definition boss_alar.cpp:35
@ SPELL_REBIRTH_PHASE2
Definition boss_alar.cpp:38
@ SPELL_EMBER_BLAST
Definition boss_alar.cpp:37
void SetPosition(float x, float y, float z, float o)
Definition Creature.cpp:3172
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
void ResumeChasingVictim()
Helper to resume chasing current victim.
Definition Creature.h:418
Definition TaskScheduler.h:421
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition TaskScheduler.h:232
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition UnitAI.h:391
void SetVisible(bool x)
Definition Unit.cpp:14320
uint32 GetMaxHealth() const
Definition Unit.h:1071
void SetHealth(uint32 val)
Definition Unit.cpp:15507
uint32 GetHealth() const
Definition Unit.h:1070
void SetStandState(uint8 state)
Definition Unit.cpp:16752
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:734
bool _noMelee
Definition boss_alar.cpp:412
TaskScheduler _transitionScheduler
Definition boss_alar.cpp:417
uint8 _platform
Definition boss_alar.cpp:413
void ScheduleAbilities()
Definition boss_alar.cpp:242
void PretendToDie(Creature *creature)
Definition boss_alar.cpp:229

References _hasPretendedToDie, _noMelee, _platform, _transitionScheduler, alarPoints, UnitAI::DoCastSelf(), Unit::GetHealth(), Unit::GetMaxHealth(), ScriptedAI::me, POINT_MIDDLE, PretendToDie(), REACT_AGGRESSIVE, Unit::RemoveUnitFlag(), Creature::ResumeChasingVictim(), TaskScheduler::Schedule(), ScheduleAbilities(), Unit::SetHealth(), Creature::SetPosition(), Creature::SetReactState(), Unit::SetStandState(), Unit::SetVisible(), SPELL_CLEAR_ALL_DEBUFFS, SPELL_EMBER_BLAST, SPELL_REBIRTH_PHASE2, UNIT_FLAG_NOT_SELECTABLE, and UNIT_STAND_STATE_STAND.

◆ DeterminePhoenixPosition()

Position boss_alar::DeterminePhoenixPosition ( Position  playerPosition)
inline
378 {
379 // set finalPosition to playerPosition in case the fraction fails
380 Position finalPosition = playerPosition;
381 float playerXPosition = playerPosition.GetPositionX();
382 float playerYPosition = playerPosition.GetPositionY();
383 float centreXPosition = alarPoints[POINT_MIDDLE].GetPositionX();
384 float centreYPosition = alarPoints[POINT_MIDDLE].GetPositionY();
385 float deltaX = std::abs(playerXPosition-centreXPosition);
386 float deltaY = std::abs(playerYPosition-centreYPosition);
387 int8 signMultiplier[2] = {1, 1};
388 // if fraction has x position 0.0f we get nan as a result
389 if (float playerFraction = deltaX/deltaY)
390 {
391 // player angle based on delta X and delta Y
392 float playerAngle = std::atan(playerFraction);
393 float phoenixDeltaYPosition = std::cos(playerAngle)*INNER_CIRCLE_RADIUS;
394 float phoenixDeltaXPosition = std::sin(playerAngle)*INNER_CIRCLE_RADIUS;
395 // as calculations are absolute values we have to multiply in the end
396 // should be negative if player position was further down than centre
397 if (playerXPosition < centreXPosition)
398 signMultiplier[0] = -1;
399 if (playerYPosition < centreYPosition)
400 signMultiplier[1] = -1;
401 // phoenix position based on set distance
402 finalPosition = {centreXPosition+signMultiplier[0]*phoenixDeltaXPosition, centreYPosition+signMultiplier[1]*phoenixDeltaYPosition, 0.0f, 0.0f};
403 }
404 return finalPosition;
405 }
std::int8_t int8
Definition Define.h:105
const float INNER_CIRCLE_RADIUS
Definition boss_alar.cpp:93
Definition Position.h:27
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References alarPoints, Position::GetPositionX(), Position::GetPositionY(), INNER_CIRCLE_RADIUS, and POINT_MIDDLE.

Referenced by SpawnPhoenixes().

◆ DoDiveBomb()

void boss_alar::DoDiveBomb ( )
inline
285 {
286 _noMelee = true;
287 scheduler.Schedule(2s, [this](TaskContext)
288 {
289 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 110.0f, true))
290 SpawnPhoenixes(2, target);
291 }).Schedule(6s, [this](TaskContext)
292 {
293 me->SetModelVisible(true);
295 }).Schedule(10s, [this](TaskContext)
296 {
298 _noMelee = false;
299 });
300 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 90.0f, true))
301 {
302 DoCast(target, SPELL_DIVE_BOMB);
303 me->SetPosition(*target);
305 }
307
308 }
@ SPELL_DIVE_BOMB
Definition boss_alar.cpp:43
@ SPELL_DIVE_BOMB_VISUAL
Definition boss_alar.cpp:42
@ SPELL_REBIRTH_DIVE
Definition boss_alar.cpp:41
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
Definition Unit.h:650
void SetModelVisible(bool on)
Definition Unit.cpp:14330
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4977
void StopMovingOnCurrentPos()
Definition Unit.cpp:16699
void SpawnPhoenixes(uint8 count, Unit *targetToSpawnAt)
Definition boss_alar.cpp:272

References _noMelee, UnitAI::DoCast(), UnitAI::DoCastSelf(), ScriptedAI::me, Random, Unit::RemoveAurasDueToSpell(), Creature::ResumeChasingVictim(), TaskScheduler::Schedule(), CreatureAI::scheduler, UnitAI::SelectTarget(), Unit::SetModelVisible(), Creature::SetPosition(), SpawnPhoenixes(), SPELL_DIVE_BOMB, SPELL_DIVE_BOMB_VISUAL, SPELL_REBIRTH_DIVE, and Unit::StopMovingOnCurrentPos().

Referenced by MovementInform().

◆ EnterEvadeMode()

void boss_alar::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from CreatureAI.

172 {
173 if (why == EVADE_REASON_BOUNDARY)
175 else if (me->GetThreatMgr().GetThreatList().empty())
177 }
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition ScriptedCreature.h:520
@ EVADE_REASON_BOUNDARY
Definition CreatureAI.h:91
ThreatContainer::StorageType const & GetThreatList() const
Definition ThreatMgr.h:273
ThreatMgr & GetThreatMgr()
Definition Unit.h:936

References BossAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_BOUNDARY, ThreatMgr::GetThreatList(), Unit::GetThreatMgr(), and ScriptedAI::me.

◆ JustDied()

void boss_alar::JustDied ( Unit killer)
inlineoverridevirtual

Reimplemented from CreatureAI.

180 {
181 BossAI::JustDied(killer);
182 me->SetModelVisible(true);
183
184 me->GetMap()->DoForAllPlayers([&](Player* player)
185 {
188 });
189 }
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:103
@ QUEST_RUSE_OF_THE_ASHTONGUE
Definition boss_alar.cpp:90
@ SPELL_ASHTONGUE_RUSE
Definition boss_alar.cpp:89
void JustDied(Unit *) override
Definition ScriptedCreature.h:521
void DoForAllPlayers(std::function< void(Player *)> exec)
Definition Map.cpp:2911
Definition Player.h:1071
void AreaExploredOrEventHappens(uint32 questId)
Definition PlayerQuest.cpp:1791
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition PlayerQuest.cpp:1430
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5789
Map * GetMap() const
Definition Object.h:621

References Player::AreaExploredOrEventHappens(), Map::DoForAllPlayers(), WorldObject::GetMap(), Player::GetQuestStatus(), Unit::HasAura(), BossAI::JustDied(), ScriptedAI::me, QUEST_RUSE_OF_THE_ASHTONGUE, QUEST_STATUS_INCOMPLETE, Unit::SetModelVisible(), and SPELL_ASHTONGUE_RUSE.

◆ JustEngagedWith()

void boss_alar::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from CreatureAI.

134 {
136 scheduler.Schedule(0s, [this](TaskContext context)
137 {
139 {
140 _noQuillTimes = 0;
141 _platformRoll = RAND(0, 1);
142 _platform = _platformRoll ? 0 : 3;
145 }
146 else
147 {
148 if (_noQuillTimes++ > 0)
149 {
150 me->SetOrientation(alarPoints[_platform].GetOrientation());
151 SpawnPhoenixes(1, me);
152 }
154 _platform = (_platform+1)%4;
156 }
158 });
159
161 }
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition CreatureAIImpl.h:25
bool roll_chance_i(int chance)
Definition Random.h:63
@ POINT_PLATFORM
Definition boss_alar.cpp:68
@ POINT_QUILL
Definition boss_alar.cpp:69
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition ScriptedCreature.h:519
void MovePoint(uint32 id, const Position &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true)
Definition MotionMaster.h:228
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition TaskScheduler.h:493
void SetOrientation(float orientation)
Definition Position.h:116
void ScheduleMainSpellAttack(std::chrono::seconds timer)
Definition boss_alar.cpp:344
uint8 _noQuillTimes
Definition boss_alar.cpp:415
uint8 _platformRoll
Definition boss_alar.cpp:414
std::chrono::seconds _platformMoveRepeatTimer
Definition boss_alar.cpp:416

References _noQuillTimes, _platform, _platformMoveRepeatTimer, _platformRoll, alarPoints, FORCED_MOVEMENT_NONE, Unit::GetMotionMaster(), BossAI::JustEngagedWith(), ScriptedAI::me, MotionMaster::MovePoint(), POINT_PLATFORM, POINT_QUILL, RAND(), TaskContext::Repeat(), roll_chance_i(), TaskScheduler::Schedule(), ScheduleMainSpellAttack(), CreatureAI::scheduler, Position::SetOrientation(), and SpawnPhoenixes().

◆ JustReachedHome()

void boss_alar::JustReachedHome ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

127 {
129 if (me->IsEngaged())
131 }
void JustReachedHome() override
Definition ScriptedCreature.h:522
bool IsEngaged() const
Definition Unit.h:914
void ConstructWaypointsAndMove()
Definition boss_alar.cpp:355

References ConstructWaypointsAndMove(), Unit::IsEngaged(), BossAI::JustReachedHome(), and ScriptedAI::me.

◆ MoveInLineOfSight()

void boss_alar::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

191{ }

◆ MovementInform()

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

Reimplemented from CreatureAI.

311 {
312 if (type != POINT_MOTION_TYPE)
313 {
314 if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat())
316
317 return;
318 }
319
320 switch (id)
321 {
322 case POINT_QUILL:
324 scheduler.Schedule(1s, [this](TaskContext)
325 {
327 });
329 break;
330 case POINT_DIVE:
331 scheduler.Schedule(1s, [this](TaskContext)
332 {
334 }).Schedule(5s, [this](TaskContext)
335 {
336 DoDiveBomb();
337 });
338 break;
339 default:
340 return;
341 }
342 }
@ ESCORT_MOTION_TYPE
Definition MotionMaster.h:57
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ POINT_DIVE
Definition boss_alar.cpp:71
@ SPELL_FLAME_QUILLS
Definition boss_alar.cpp:32
@ GROUP_FLAME_BUFFET
Definition boss_alar.cpp:83
bool Finalized() const
Definition MoveSpline.h:116
TaskScheduler & CancelGroup(group_t const group)
Definition TaskScheduler.cpp:53
Movement::MoveSpline * movespline
Definition Unit.h:2071
bool IsInCombat() const
Definition Unit.h:917
void DoDiveBomb()
Definition boss_alar.cpp:284

References TaskScheduler::CancelGroup(), ConstructWaypointsAndMove(), UnitAI::DoCastSelf(), DoDiveBomb(), ESCORT_MOTION_TYPE, Movement::MoveSpline::Finalized(), GROUP_FLAME_BUFFET, Unit::IsInCombat(), ScriptedAI::me, Unit::movespline, POINT_DIVE, POINT_MOTION_TYPE, POINT_QUILL, TaskScheduler::Schedule(), ScheduleMainSpellAttack(), CreatureAI::scheduler, SPELL_DIVE_BOMB_VISUAL, and SPELL_FLAME_QUILLS.

◆ PretendToDie()

void boss_alar::PretendToDie ( Creature creature)
inline
230 {
231 _noMelee = true;
233 creature->InterruptNonMeleeSpells(true);
234 creature->RemoveAllAuras();
236 creature->SetReactState(REACT_PASSIVE);
237 creature->GetMotionMaster()->MovementExpired(false);
238 creature->GetMotionMaster()->MoveIdle();
240 }
@ UNIT_STAND_STATE_DEAD
Definition UnitDefines.h:39
@ REACT_PASSIVE
Definition Unit.h:550
void MovementExpired(bool reset=true)
Definition MotionMaster.h:195
void MoveIdle()
Definition MotionMaster.cpp:233
TaskScheduler & CancelAll()
Definition TaskScheduler.cpp:45
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4188
void RemoveAllAuras()
Definition Unit.cpp:5387
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:733

References _noMelee, TaskScheduler::CancelAll(), Unit::GetMotionMaster(), Unit::InterruptNonMeleeSpells(), MotionMaster::MoveIdle(), MotionMaster::MovementExpired(), REACT_PASSIVE, Unit::RemoveAllAuras(), CreatureAI::scheduler, Creature::SetReactState(), Unit::SetStandState(), Unit::SetUnitFlag(), UNIT_FLAG_NOT_SELECTABLE, and UNIT_STAND_STATE_DEAD.

Referenced by DamageTaken().

◆ Reset()

void boss_alar::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

108 {
110 _canAttackCooldown = true;
111 _baseAttackOverride = false;
112 _spawnPhoenixes = false;
113 _hasPretendedToDie = false;
115 _platform = 0;
116 _noMelee = false;
117 _platformRoll = 0;
118 _noQuillTimes = 0;
120 me->SetModelVisible(true);
123 me->m_Events.KillAllEvents(false);
124 }
void Reset() override
Definition ScriptedCreature.h:518
void KillAllEvents(bool force)
Definition EventProcessor.cpp:82
EventProcessor m_Events
Definition Object.h:731
bool _canAttackCooldown
Definition boss_alar.cpp:409
bool _baseAttackOverride
Definition boss_alar.cpp:410
bool _spawnPhoenixes
Definition boss_alar.cpp:411

References _baseAttackOverride, _canAttackCooldown, _hasPretendedToDie, _noMelee, _noQuillTimes, _platform, _platformMoveRepeatTimer, _platformRoll, _spawnPhoenixes, _transitionScheduler, TaskScheduler::CancelAll(), ConstructWaypointsAndMove(), EventProcessor::KillAllEvents(), WorldObject::m_Events, ScriptedAI::me, REACT_AGGRESSIVE, BossAI::Reset(), Unit::SetModelVisible(), and Creature::SetReactState().

◆ ScheduleAbilities()

void boss_alar::ScheduleAbilities ( )
inline
243 {
245 ScheduleTimedEvent(57s, [&]
246 {
248 }, 60s);
249 ScheduleTimedEvent(10s, [&]
250 {
252 }, 30s);
253 ScheduleTimedEvent(20s, [&]
254 {
255 // find spell from sniffs?
256 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
258 }, 30s);
259 ScheduleTimedEvent(34s, [&]
260 {
261 me->GetMotionMaster()->MovePoint(POINT_DIVE, alarPoints[POINT_DIVE], FORCED_MOVEMENT_NONE, 0.f, false, true);
262 scheduler.DelayAll(15s);
263 }, 57s);
264
267 }, 10min);
268
270 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:50
@ NPC_FLAME_PATCH
Definition boss_alar.cpp:66
@ SPELL_CHARGE
Definition boss_alar.cpp:40
@ SPELL_BERSERK
Definition boss_alar.cpp:31
@ SPELL_MELT_ARMOR
Definition boss_alar.cpp:39
void AddEventAtOffset(BasicEvent *event, Milliseconds offset, uint8 eventGroup=0)
Definition EventProcessor.h:108
TaskScheduler & DelayAll(std::chrono::duration< _Rep, _Period > const &duration)
Delays all tasks with the given duration.
Definition TaskScheduler.h:283
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.
Definition UnitAI.cpp:295
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:276
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:2359
void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
Definition ScriptedCreature.cpp:321

References _transitionScheduler, EventProcessor::AddEventAtOffset(), alarPoints, TaskScheduler::CancelAll(), TaskScheduler::DelayAll(), UnitAI::DoCastRandomTarget(), UnitAI::DoCastSelf(), UnitAI::DoCastVictim(), FORCED_MOVEMENT_NONE, Unit::GetMotionMaster(), IN_MILLISECONDS, WorldObject::m_Events, ScriptedAI::me, MINUTE, NPC_FLAME_PATCH, POINT_DIVE, Random, ScheduleMainSpellAttack(), CreatureAI::scheduler, ScriptedAI::ScheduleTimedEvent(), UnitAI::SelectTarget(), SPELL_BERSERK, SPELL_CHARGE, SPELL_MELT_ARMOR, WorldObject::SummonCreature(), and TEMPSUMMON_TIMED_DESPAWN.

Referenced by DamageTaken().

◆ ScheduleMainSpellAttack()

void boss_alar::ScheduleMainSpellAttack ( std::chrono::seconds  timer)
inline
345 {
346 scheduler.Schedule(timer, GROUP_FLAME_BUFFET, [this](TaskContext context)
347 {
350
351 context.Repeat(2s);
352 });
353 }
@ SPELL_FLAME_BUFFET
Definition boss_alar.cpp:36
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Select nearest hostile unit within the given distance (regardless of threat list).
Definition Creature.cpp:2392
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:284
float GetCombatReach() const override
Definition Unit.h:860

References UnitAI::DoCastAOE(), Unit::GetCombatReach(), GROUP_FLAME_BUFFET, Unit::isMoving(), ScriptedAI::me, TaskContext::Repeat(), TaskScheduler::Schedule(), CreatureAI::scheduler, Creature::SelectNearestTarget(), and SPELL_FLAME_BUFFET.

Referenced by JustEngagedWith(), MovementInform(), and ScheduleAbilities().

◆ SpawnPhoenixes()

void boss_alar::SpawnPhoenixes ( uint8  count,
Unit targetToSpawnAt 
)
inline
273 {
274 if (targetToSpawnAt)
275 {
276 Position spawnPosition = DeterminePhoenixPosition(targetToSpawnAt->GetPosition());
277 for (uint8 i = 0; i < count; ++i)
278 {
280 }
281 }
282 }
std::uint8_t uint8
Definition Define.h:109
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition Object.h:53
@ NPC_EMBER_OF_ALAR
Definition boss_alar.cpp:65
void GetPosition(float &x, float &y) const
Definition Position.h:126
Position DeterminePhoenixPosition(Position playerPosition)
Definition boss_alar.cpp:377

References DeterminePhoenixPosition(), Position::GetPosition(), ScriptedAI::me, NPC_EMBER_OF_ALAR, WorldObject::SummonCreature(), and TEMPSUMMON_CORPSE_TIMED_DESPAWN.

Referenced by DoDiveBomb(), and JustEngagedWith().

◆ UpdateAI()

void boss_alar::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

362 {
364
365 scheduler.Update(diff);
366
367 if (!UpdateVictim())
368 return;
369
371 return;
372
373 if (!_noMelee)
375 }
bool UpdateVictim()
Definition CreatureAI.cpp:287
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:39

References _noMelee, _transitionScheduler, UnitAI::DoMeleeAttackIfReady(), Unit::HasUnitState(), ScriptedAI::me, CreatureAI::scheduler, UNIT_STATE_CASTING, TaskScheduler::Update(), and CreatureAI::UpdateVictim().

Member Data Documentation

◆ _baseAttackOverride

bool boss_alar::_baseAttackOverride
private

Referenced by Reset().

◆ _canAttackCooldown

bool boss_alar::_canAttackCooldown
private

Referenced by Reset().

◆ _hasPretendedToDie

bool boss_alar::_hasPretendedToDie
private

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

◆ _noMelee

bool boss_alar::_noMelee
private

◆ _noQuillTimes

uint8 boss_alar::_noQuillTimes
private

Referenced by JustEngagedWith(), and Reset().

◆ _platform

uint8 boss_alar::_platform
private

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

◆ _platformMoveRepeatTimer

std::chrono::seconds boss_alar::_platformMoveRepeatTimer
private

Referenced by JustEngagedWith(), and Reset().

◆ _platformRoll

uint8 boss_alar::_platformRoll
private

Referenced by JustEngagedWith(), and Reset().

◆ _spawnPhoenixes

bool boss_alar::_spawnPhoenixes
private

Referenced by Reset().

◆ _transitionScheduler

TaskScheduler boss_alar::_transitionScheduler
private

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