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 - this happens after JustEnteredCombat.
 
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 OnSpellCast (SpellInfo const *spell) override
 
void OnChannelFinished (SpellInfo const *spell) override
 
void OnSpellFailed (SpellInfo const *spell) 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 - this happens after JustEnteredCombat.
 
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 - this happens after JustEnteredCombat.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoRewardPlayersInArea ()
 
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
 
bool IsEngaged () const
 Check if creature is currently engaged in combat.
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
void JustEnteredCombat (Unit *who) override
 Called when the unit enters combat.
 
virtual void JustStartedThreateningMe (Unit *who)
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
void JustExitedCombat () override
 Called when the unit leaves combat.
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void OnSpellStart (SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
virtual void WaypointPathStarted (uint32)
 == Waypoints system =============================
 
virtual void WaypointStarted (uint32, uint32)
 
virtual void WaypointReached (uint32, uint32)
 
virtual void WaypointPathEnded (uint32, 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 *attacker)
 
virtual void OwnerAttacked (Unit *target)
 
void OnOwnerCombatInteraction (Unit *target)
 
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 EvadeTimerExpired ()
 Called when evade timer expires (target unreachable for too long)
 
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
 
bool _isEngaged
 
- 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);
101 }
Definition ScriptedCreature.h:485
void SetCombatMovement(bool allowMovement)
Definition Creature.cpp:3801
Creature * me
Definition ScriptedCreature.h:281
@ DATA_ALAR
Definition the_eye.h:29

References ScriptedAI::me, and Creature::SetCombatMovement().

Member Function Documentation

◆ CanAIAttack()

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

Reimplemented from UnitAI.

160 {
161 if (me->isMoving())
162 return true;
163
164 return _hasPretendedToDie || me->IsWithinMeleeRange(victim);
165 }
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition Unit.cpp:782
bool isMoving() const
Definition Unit.h:1708
bool _hasPretendedToDie
Definition boss_alar.cpp:404

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

◆ ConstructWaypointsAndMove()

void boss_alar::ConstructWaypointsAndMove ( )
inline
352 {
353 me->StopMoving();
355 }
@ FORCED_MOVEMENT_NONE
Definition MotionMaster.h:86
uint32 GetWaypointPath() const
Definition Creature.h:355
void MovePath(uint32 path_id, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, PathSource pathSource=PathSource::WAYPOINT_MGR)
Definition MotionMaster.cpp:519
MotionMaster * GetMotionMaster()
Definition Unit.h:1758
void StopMoving()
Definition Unit.cpp:12997

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.

190 {
191 if (damage >= me->GetHealth() && _platform < POINT_MIDDLE)
192 {
193 damage = 0;
195 {
196 _hasPretendedToDie = true;
200 {
201 me->SetVisible(false);
202 }).Schedule(8s, [this](TaskContext)
203 {
205 }).Schedule(12s, [this](TaskContext)
206 {
208 me->SetVisible(true);
211 }).Schedule(16001ms, [this](TaskContext)
212 {
215 _noMelee = false;
220 });
221 }
222 }
223 }
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:35
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:282
@ REACT_AGGRESSIVE
Definition Unit.h:568
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:3197
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:432
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:394
void SetVisible(bool x)
Definition Unit.cpp:11072
uint32 GetMaxHealth() const
Definition Unit.h:1109
void SetHealth(uint32 val)
Definition Unit.cpp:12315
uint32 GetHealth() const
Definition Unit.h:1108
void SetStandState(uint8 state)
Definition Unit.cpp:13089
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:749
bool _noMelee
Definition boss_alar.cpp:408
TaskScheduler _transitionScheduler
Definition boss_alar.cpp:413
uint8 _platform
Definition boss_alar.cpp:409
void ScheduleAbilities()
Definition boss_alar.cpp:238
void PretendToDie(Creature *creature)
Definition boss_alar.cpp:225

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
374 {
375 // set finalPosition to playerPosition in case the fraction fails
376 Position finalPosition = playerPosition;
377 float playerXPosition = playerPosition.GetPositionX();
378 float playerYPosition = playerPosition.GetPositionY();
379 float centreXPosition = alarPoints[POINT_MIDDLE].GetPositionX();
380 float centreYPosition = alarPoints[POINT_MIDDLE].GetPositionY();
381 float deltaX = std::abs(playerXPosition-centreXPosition);
382 float deltaY = std::abs(playerYPosition-centreYPosition);
383 int8 signMultiplier[2] = {1, 1};
384 // if fraction has x position 0.0f we get nan as a result
385 if (float playerFraction = deltaX/deltaY)
386 {
387 // player angle based on delta X and delta Y
388 float playerAngle = std::atan(playerFraction);
389 float phoenixDeltaYPosition = std::cos(playerAngle)*INNER_CIRCLE_RADIUS;
390 float phoenixDeltaXPosition = std::sin(playerAngle)*INNER_CIRCLE_RADIUS;
391 // as calculations are absolute values we have to multiply in the end
392 // should be negative if player position was further down than centre
393 if (playerXPosition < centreXPosition)
394 signMultiplier[0] = -1;
395 if (playerYPosition < centreYPosition)
396 signMultiplier[1] = -1;
397 // phoenix position based on set distance
398 finalPosition = {centreXPosition+signMultiplier[0]*phoenixDeltaXPosition, centreYPosition+signMultiplier[1]*phoenixDeltaYPosition, 0.0f, 0.0f};
399 }
400 return finalPosition;
401 }
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
281 {
282 _noMelee = true;
283 scheduler.Schedule(2s, [this](TaskContext)
284 {
285 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 110.0f, true))
286 SpawnPhoenixes(2, target);
287 }).Schedule(6s, [this](TaskContext)
288 {
289 me->SetModelVisible(true);
291 }).Schedule(10s, [this](TaskContext)
292 {
294 _noMelee = false;
295 });
296 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 90.0f, true))
297 {
298 DoCast(target, SPELL_DIVE_BOMB);
299 me->SetPosition(*target);
301 }
303
304 }
@ 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
TaskScheduler scheduler
Definition CreatureAI.h:74
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:111
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:178
Definition Unit.h:664
void SetModelVisible(bool on)
Definition Unit.cpp:11082
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5157
void StopMovingOnCurrentPos()
Definition Unit.cpp:13036
void SpawnPhoenixes(uint8 count, Unit *targetToSpawnAt)
Definition boss_alar.cpp:268

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.

168 {
169 if (why == EVADE_REASON_BOUNDARY)
171 else if (me->GetThreatMgr().IsThreatListEmpty())
173 }
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition ScriptedCreature.h:526
@ EVADE_REASON_BOUNDARY
Definition CreatureAI.h:89
bool IsThreatListEmpty(bool includeOffline=false) const
Definition ThreatManager.cpp:267
ThreatManager & GetThreatMgr()
Definition Unit.h:951

References BossAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_BOUNDARY, Unit::GetThreatMgr(), ThreatManager::IsThreatListEmpty(), and ScriptedAI::me.

◆ JustDied()

void boss_alar::JustDied ( Unit killer)
inlineoverridevirtual

Reimplemented from CreatureAI.

176 {
177 BossAI::JustDied(killer);
178 me->SetModelVisible(true);
179
180 me->GetMap()->DoForAllPlayers([&](Player* player)
181 {
184 });
185 }
@ 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:527
void DoForAllPlayers(std::function< void(Player *)> exec)
Definition Map.cpp:2890
Definition Player.h:1084
void AreaExploredOrEventHappens(uint32 questId)
Definition PlayerQuest.cpp:1823
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition PlayerQuest.cpp:1462
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5982
Map * GetMap() const
Definition Object.h:625

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 - this happens after JustEnteredCombat.

Reimplemented from CreatureAI.

130 {
132 scheduler.Schedule(0s, [this](TaskContext context)
133 {
135 {
136 _noQuillTimes = 0;
137 _platformRoll = RAND(0, 1);
138 _platform = _platformRoll ? 0 : 3;
141 }
142 else
143 {
144 if (_noQuillTimes++ > 0)
145 {
146 me->SetOrientation(alarPoints[_platform].GetOrientation());
147 SpawnPhoenixes(1, me);
148 }
150 _platform = (_platform+1)%4;
152 }
154 });
155
157 }
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 - this happens after JustEnteredCombat.
Definition ScriptedCreature.h:525
void MovePoint(uint32 id, const Position &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true, std::optional< AnimTier > animTier=std::nullopt)
Definition MotionMaster.h:240
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:340
uint8 _noQuillTimes
Definition boss_alar.cpp:411
uint8 _platformRoll
Definition boss_alar.cpp:410
std::chrono::seconds _platformMoveRepeatTimer
Definition boss_alar.cpp:412

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.

123 {
125 if (me->IsEngaged())
127 }
void JustReachedHome() override
Definition ScriptedCreature.h:528
bool IsEngaged() const override
Definition Creature.cpp:2858
void ConstructWaypointsAndMove()
Definition boss_alar.cpp:351

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

◆ MoveInLineOfSight()

void boss_alar::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

187{ }

◆ MovementInform()

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

Reimplemented from CreatureAI.

307 {
308 if (type != POINT_MOTION_TYPE)
309 {
310 if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat())
312
313 return;
314 }
315
316 switch (id)
317 {
318 case POINT_QUILL:
320 scheduler.Schedule(1s, [this](TaskContext)
321 {
323 });
325 break;
326 case POINT_DIVE:
327 scheduler.Schedule(1s, [this](TaskContext)
328 {
330 }).Schedule(5s, [this](TaskContext)
331 {
332 DoDiveBomb();
333 });
334 break;
335 default:
336 return;
337 }
338 }
@ 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:118
TaskScheduler & CancelGroup(group_t const group)
Definition TaskScheduler.cpp:53
Movement::MoveSpline * movespline
Definition Unit.h:2114
bool IsInCombat() const
Definition Unit.h:935
void DoDiveBomb()
Definition boss_alar.cpp:280

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
226 {
227 _noMelee = true;
229 creature->InterruptNonMeleeSpells(true);
230 creature->RemoveAllAuras();
232 creature->SetReactState(REACT_PASSIVE);
233 creature->GetMotionMaster()->MovementExpired(false);
234 creature->GetMotionMaster()->MoveIdle();
236 }
@ UNIT_STAND_STATE_DEAD
Definition UnitDefines.h:42
@ REACT_PASSIVE
Definition Unit.h:566
void MovementExpired(bool reset=true)
Definition MotionMaster.h:206
void MoveIdle()
Definition MotionMaster.cpp:234
TaskScheduler & CancelAll()
Definition TaskScheduler.cpp:45
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4302
void RemoveAllAuras()
Definition Unit.cpp:5580
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:748

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.

104 {
106 _canAttackCooldown = true;
107 _baseAttackOverride = false;
108 _spawnPhoenixes = false;
109 _hasPretendedToDie = false;
111 _platform = 0;
112 _noMelee = false;
113 _platformRoll = 0;
114 _noQuillTimes = 0;
116 me->SetModelVisible(true);
119 me->m_Events.KillAllEvents(false);
120 }
void Reset() override
Definition ScriptedCreature.h:524
void KillAllEvents(bool force)
Definition EventProcessor.cpp:82
EventProcessor m_Events
Definition Object.h:736
bool _canAttackCooldown
Definition boss_alar.cpp:405
bool _baseAttackOverride
Definition boss_alar.cpp:406
bool _spawnPhoenixes
Definition boss_alar.cpp:407

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
239 {
241 ScheduleTimedEvent(57s, [&]
242 {
244 }, 60s);
245 ScheduleTimedEvent(10s, [&]
246 {
248 }, 30s);
249 ScheduleTimedEvent(20s, [&]
250 {
251 // find spell from sniffs?
252 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
254 }, 30s);
255 ScheduleTimedEvent(34s, [&]
256 {
257 me->GetMotionMaster()->MovePoint(POINT_DIVE, alarPoints[POINT_DIVE], FORCED_MOVEMENT_NONE, 0.f, false, true);
258 scheduler.DelayAll(15s);
259 }, 57s);
260
263 }, 10min);
264
266 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:51
@ 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:296
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:277
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:2394
void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
Definition ScriptedCreature.cpp:349

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
341 {
342 scheduler.Schedule(timer, GROUP_FLAME_BUFFET, [this](TaskContext context)
343 {
346
347 context.Repeat(2s);
348 });
349 }
@ 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:2354
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:285
float GetCombatReach() const override
Definition Unit.h:877

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
269 {
270 if (targetToSpawnAt)
271 {
272 Position spawnPosition = DeterminePhoenixPosition(targetToSpawnAt->GetPosition());
273 for (uint8 i = 0; i < count; ++i)
274 {
276 }
277 }
278 }
std::uint8_t uint8
Definition Define.h:109
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition Object.h:54
@ 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:373

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.

358 {
360
361 scheduler.Update(diff);
362
363 if (!UpdateVictim())
364 return;
365
367 return;
368
369 if (!_noMelee)
371 }
@ UNIT_STATE_CASTING
Definition UnitDefines.h:188
bool UpdateVictim()
Definition CreatureAI.cpp:353
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:40
bool HasUnitState(const uint32 f) const
Definition Unit.h:736

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: