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. More...
 
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) More...
 
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() More...
 
Position DeterminePhoenixPosition (Position playerPosition)
 
- 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
 
- 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)
 
 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 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)
 
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_alar()

boss_alar::boss_alar ( Creature creature)
inline
99 : BossAI(creature, DATA_ALAR)
100 {
101 me->SetCombatMovement(false);
103 {
105 });
106 }
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
@ DATA_ALAR
Definition: the_eye.h:29
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
Definition: TaskScheduler.h:194
TaskScheduler scheduler
Definition: CreatureAI.h:76
Creature * me
Definition: ScriptedCreature.h:280
Definition: ScriptedCreature.h:457
void SetCombatMovement(bool allowMovement)
Definition: Creature.cpp:3833
bool HasUnitState(const uint32 f) const
Definition: Unit.h:673

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.

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

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

◆ ConstructWaypointsAndMove()

void boss_alar::ConstructWaypointsAndMove ( )
inline
377 {
378 me->StopMoving();
379 if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath()))
380 {
381 Movement::PointsArray pathPoints;
382 pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
383 for (uint8 i = 0; i < i_path->size(); ++i)
384 {
385 WaypointData const* node = i_path->at(i);
386 pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
387 }
388 me->GetMotionMaster()->MoveSplinePath(&pathPoints);
389 }
390 }
std::uint8_t uint8
Definition: Define.h:109
std::vector< WaypointData * > WaypointPath
Definition: WaypointMgr.h:47
#define sWaypointMgr
Definition: WaypointMgr.h:78
std::vector< Vector3 > PointsArray
Definition: MoveSplineInitArgs.h:28
uint32 GetWaypointPath() const
Definition: Creature.h:347
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
void StopMoving()
Definition: Unit.cpp:16606
void MoveSplinePath(Movement::PointsArray *path)
Definition: MotionMaster.cpp:454
Definition: WaypointMgr.h:37
float z
Definition: WaypointMgr.h:39
float x
Definition: WaypointMgr.h:39
float y
Definition: WaypointMgr.h:39

References sWaypointMgr, WaypointData::x, WaypointData::y, and WaypointData::z.

Referenced by JustReachedHome(), 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 BossAI.

210 {
211 if (damage >= me->GetHealth() && _platform < POINT_MIDDLE)
212 {
213 damage = 0;
215 {
216 _hasPretendedToDie = true;
220 {
221 me->SetVisible(false);
222 }).Schedule(8s, [this](TaskContext)
223 {
225 }).Schedule(12s, [this](TaskContext)
226 {
228 me->SetVisible(true);
231 }).Schedule(16001ms, [this](TaskContext)
232 {
235 _noMelee = false;
240 });
241 }
242 }
243 }
@ REACT_AGGRESSIVE
Definition: Unit.h:550
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:32
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
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
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:229
Definition: TaskScheduler.h:415
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition: UnitAI.h:392
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3149
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:97
void SetVisible(bool x)
Definition: Unit.cpp:14189
uint32 GetMaxHealth() const
Definition: Unit.h:870
void SetHealth(uint32 val)
Definition: Unit.cpp:15433
uint32 GetHealth() const
Definition: Unit.h:869
Unit * GetVictim() const
Definition: Unit.h:789
void SetStandState(uint8 state)
Definition: Unit.cpp:16682
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:684
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:313
bool _noMelee
Definition: boss_alar.cpp:449
TaskScheduler _transitionScheduler
Definition: boss_alar.cpp:454
uint8 _platform
Definition: boss_alar.cpp:450
void ScheduleAbilities()
Definition: boss_alar.cpp:258
void PretendToDie(Creature *creature)
Definition: boss_alar.cpp:245

References alarPoints, POINT_MIDDLE, PretendToDie(), REACT_AGGRESSIVE, 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
415 {
416 // set finalPosition to playerPosition in case the fraction fails
417 Position finalPosition = playerPosition;
418 float playerXPosition = playerPosition.GetPositionX();
419 float playerYPosition = playerPosition.GetPositionY();
420 float centreXPosition = alarPoints[POINT_MIDDLE].GetPositionX();
421 float centreYPosition = alarPoints[POINT_MIDDLE].GetPositionY();
422 float deltaX = std::abs(playerXPosition-centreXPosition);
423 float deltaY = std::abs(playerYPosition-centreYPosition);
424 int8 signMultiplier[2] = {1, 1};
425 // if fraction has x position 0.0f we get nan as a result
426 if (float playerFraction = deltaX/deltaY)
427 {
428 // player angle based on delta X and delta Y
429 float playerAngle = std::atan(playerFraction);
430 float phoenixDeltaYPosition = std::cos(playerAngle)*INNER_CIRCLE_RADIUS;
431 float phoenixDeltaXPosition = std::sin(playerAngle)*INNER_CIRCLE_RADIUS;
432 // as calculations are absolute values we have to multiply in the end
433 // should be negative if player position was further down than centre
434 if (playerXPosition < centreXPosition)
435 signMultiplier[0] = -1;
436 if (playerYPosition < centreYPosition)
437 signMultiplier[1] = -1;
438 // phoenix position based on set distance
439 finalPosition = {centreXPosition+signMultiplier[0]*phoenixDeltaXPosition, centreYPosition+signMultiplier[1]*phoenixDeltaYPosition, 0.0f, 0.0f};
440 }
441 return finalPosition;
442 }
std::int8_t int8
Definition: Define.h:105
const float INNER_CIRCLE_RADIUS
Definition: boss_alar.cpp:94
Definition: Position.h:28

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

◆ DoDiveBomb()

void boss_alar::DoDiveBomb ( )
inline
302 {
303 _noMelee = true;
304 scheduler.Schedule(2s, [this](TaskContext)
305 {
306 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 110.0f, true))
307 {
308 SpawnPhoenixes(2, target);
309 }
310 }).Schedule(6s, [this](TaskContext)
311 {
312 me->SetModelVisible(true);
314 }).Schedule(10s, [this](TaskContext)
315 {
317 _noMelee = false;
318 });
319 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 90.0f, true))
320 {
321 DoCast(target, SPELL_DIVE_BOMB);
322 me->SetPosition(*target);
324 }
326
327 }
@ 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:630
void SetModelVisible(bool on)
Definition: Unit.cpp:14199
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4891
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16645
void SpawnPhoenixes(uint8 count, Unit *targetToSpawnAt)
Definition: boss_alar.cpp:289

References Random, SPELL_DIVE_BOMB, SPELL_DIVE_BOMB_VISUAL, and SPELL_REBIRTH_DIVE.

◆ EnterEvadeMode()

void boss_alar::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from BossAI.

173 {
174 if (why == EVADE_REASON_BOUNDARY)
175 {
177 }
178 else
179 {
180 if (me->GetThreatMgr().GetThreatList().empty())
181 {
183 }
184 }
185 }
@ EVADE_REASON_BOUNDARY
Definition: CreatureAI.h:91
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition: ScriptedCreature.h:488
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:274
ThreatMgr & GetThreatMgr()
Definition: Unit.h:839

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

◆ JustDied()

void boss_alar::JustDied ( Unit killer)
inlineoverridevirtual

Reimplemented from BossAI.

188 {
189 BossAI::JustDied(killer);
190 me->SetModelVisible(true);
191
192 if (Map* map = me->GetMap())
193 {
194 map->DoForAllPlayers([&](Player* player)
195 {
197 {
198 if (player->HasAura(SPELL_ASHTONGUE_RUSE))
199 {
200 player->AreaExploredOrEventHappens(QUEST_RUSE_OF_THE_ASHTONGUE);
201 }
202 }
203 });
204 }
205 }
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
@ QUEST_RUSE_OF_THE_ASHTONGUE
Definition: boss_alar.cpp:91
void JustDied(Unit *) override
Definition: ScriptedCreature.h:489
Map * GetMap() const
Definition: Object.h:531
Definition: Player.h:1064
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1424
Definition: Map.h:313

References WorldObject::GetMap(), Player::GetQuestStatus(), BossAI::JustDied(), ScriptedAI::me, QUEST_RUSE_OF_THE_ASHTONGUE, QUEST_STATUS_INCOMPLETE, and Unit::SetModelVisible().

◆ JustEngagedWith()

void boss_alar::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from BossAI.

136 {
138 scheduler.Schedule(0s, [this](TaskContext context)
139 {
141 {
142 _noQuillTimes = 0;
143 _platformRoll = RAND(0, 1);
144 _platform = _platformRoll ? 0 : 3;
147 }
148 else
149 {
150 if (_noQuillTimes++ > 0)
151 {
152 me->SetOrientation(alarPoints[_platform].GetOrientation());
153 SpawnPhoenixes(1, me);
154 }
156 _platform = (_platform+1)%4;
158 }
160 });
162 }
bool roll_chance_i(int chance)
Definition: Random.h:59
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition: CreatureAIImpl.h:30
@ POINT_PLATFORM
Definition: boss_alar.cpp:68
@ POINT_QUILL
Definition: boss_alar.cpp:69
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:485
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition: ScriptedCreature.h:487
void SetOrientation(float orientation)
Definition: Position.h:112
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:211
void ScheduleMainSpellAttack(std::chrono::seconds timer)
Definition: boss_alar.cpp:364
uint8 _noQuillTimes
Definition: boss_alar.cpp:452
uint8 _platformRoll
Definition: boss_alar.cpp:451
std::chrono::seconds _platformMoveRepeatTimer
Definition: boss_alar.cpp:453

References _noQuillTimes, _platform, _platformMoveRepeatTimer, _platformRoll, alarPoints, 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 BossAI.

127 {
129 if (me->IsEngaged())
130 {
132 }
133 }
void JustReachedHome() override
Definition: ScriptedCreature.h:490
bool IsEngaged() const
Definition: Unit.h:817
void ConstructWaypointsAndMove()
Definition: boss_alar.cpp:376

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

◆ MoveInLineOfSight()

void boss_alar::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

207{ }

◆ MovementInform()

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

Reimplemented from ScriptedAI.

330 {
331 if (type != POINT_MOTION_TYPE)
332 {
333 if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat())
334 {
336 }
337 return;
338 }
339
340 switch (id)
341 {
342 case POINT_QUILL:
344 scheduler.Schedule(1s, [this](TaskContext)
345 {
347 });
349 break;
350 case POINT_DIVE:
351 scheduler.Schedule(1s, [this](TaskContext)
352 {
354 }).Schedule(5s, [this](TaskContext)
355 {
356 DoDiveBomb();
357 });
358 break;
359 default:
360 return;
361 }
362 }
@ ESCORT_MOTION_TYPE
Definition: MotionMaster.h:55
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:46
@ POINT_DIVE
Definition: boss_alar.cpp:71
@ SPELL_FLAME_QUILLS
Definition: boss_alar.cpp:32
@ GROUP_FLAME_BUFFET
Definition: boss_alar.cpp:84
TaskScheduler & CancelGroup(group_t const group)
Definition: TaskScheduler.cpp:53
Movement::MoveSpline * movespline
Definition: Unit.h:1818
bool IsInCombat() const
Definition: Unit.h:820
bool Finalized() const
Definition: MoveSpline.h:116
void DoDiveBomb()
Definition: boss_alar.cpp:301

References ESCORT_MOTION_TYPE, GROUP_FLAME_BUFFET, POINT_DIVE, POINT_MOTION_TYPE, POINT_QUILL, SPELL_DIVE_BOMB_VISUAL, and SPELL_FLAME_QUILLS.

◆ PretendToDie()

void boss_alar::PretendToDie ( Creature creature)
inline
246 {
247 _noMelee = true;
249 creature->InterruptNonMeleeSpells(true);
250 creature->RemoveAllAuras();
252 creature->SetReactState(REACT_PASSIVE);
253 creature->GetMotionMaster()->MovementExpired(false);
254 creature->GetMotionMaster()->MoveIdle();
256 }
@ REACT_PASSIVE
Definition: Unit.h:548
@ UNIT_STAND_STATE_DEAD
Definition: UnitDefines.h:39
TaskScheduler & CancelAll()
Definition: TaskScheduler.cpp:45
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4111
void RemoveAllAuras()
Definition: Unit.cpp:5290
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:683
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:178
void MoveIdle()
Definition: MotionMaster.cpp:232

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

◆ Reset()

void boss_alar::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

109 {
111 _canAttackCooldown = true;
112 _baseAttackOverride = false;
113 _spawnPhoenixes = false;
114 _hasPretendedToDie = false;
116 _platform = 0;
117 _noMelee = false;
118 _platformRoll = 0;
119 _noQuillTimes = 0;
121 me->SetModelVisible(true);
124 }
void Reset() override
Definition: ScriptedCreature.h:486
bool _canAttackCooldown
Definition: boss_alar.cpp:446
bool _baseAttackOverride
Definition: boss_alar.cpp:447
bool _spawnPhoenixes
Definition: boss_alar.cpp:448

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

◆ ScheduleAbilities()

void boss_alar::ScheduleAbilities ( )
inline
259 {
261 ScheduleTimedEvent(57s, [&]
262 {
264 }, 60s);
265 ScheduleTimedEvent(10s, [&]
266 {
268 }, 30s);
269 ScheduleTimedEvent(20s, [&]
270 {
271 // find spell from sniffs?
272 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
273 {
275 }
276 }, 30s);
277 ScheduleTimedEvent(34s, [&]
278 {
279 me->GetMotionMaster()->MovePoint(POINT_DIVE, alarPoints[POINT_DIVE], false, true);
280 scheduler.DelayAll(15s);
281 }, 57s);
282 ScheduleUniqueTimedEvent(10min, [&]
283 {
287 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:53
constexpr auto MINUTE
Definition: Common.h:47
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:47
@ EVENT_SPELL_BERSERK
Definition: boss_alar.cpp:75
@ 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
TaskScheduler & DelayAll(std::chrono::duration< _Rep, _Period > const &duration)
Delays all tasks with the given duration.
Definition: TaskScheduler.h:280
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:259
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:240
void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
Definition: ScriptedCreature.cpp:312
void ScheduleUniqueTimedEvent(Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
Definition: ScriptedCreature.h:362
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:2355

References alarPoints, EVENT_SPELL_BERSERK, IN_MILLISECONDS, MINUTE, NPC_FLAME_PATCH, POINT_DIVE, Random, SPELL_BERSERK, SPELL_CHARGE, SPELL_MELT_ARMOR, and TEMPSUMMON_TIMED_DESPAWN.

◆ ScheduleMainSpellAttack()

void boss_alar::ScheduleMainSpellAttack ( std::chrono::seconds  timer)
inline
365 {
366 scheduler.Schedule(timer, GROUP_FLAME_BUFFET, [this](TaskContext context)
367 {
369 {
370 DoCastVictim(SPELL_FLAME_BUFFET);
371 }
372 context.Repeat(2s);
373 });
374 }
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Select nearest hostile unit within the given distance (regardless of threat list).
Definition: Creature.cpp:2383
float GetCombatReach() const override
Definition: Unit.h:770

References GROUP_FLAME_BUFFET, and TaskContext::Repeat().

Referenced by JustEngagedWith().

◆ SpawnPhoenixes()

void boss_alar::SpawnPhoenixes ( uint8  count,
Unit targetToSpawnAt 
)
inline
290 {
291 if (targetToSpawnAt)
292 {
293 Position spawnPosition = DeterminePhoenixPosition(targetToSpawnAt->GetPosition());
294 for (uint8 i = 0; i < count; ++i)
295 {
297 }
298 }
299 }
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: Object.h:50
@ NPC_EMBER_OF_ALAR
Definition: boss_alar.cpp:65
void GetPosition(float &x, float &y) const
Definition: Position.h:122
Position DeterminePhoenixPosition(Position playerPosition)
Definition: boss_alar.cpp:414

References Position::GetPosition(), NPC_EMBER_OF_ALAR, and TEMPSUMMON_CORPSE_TIMED_DESPAWN.

Referenced by JustEngagedWith().

◆ UpdateAI()

void boss_alar::UpdateAI ( uint32  )
inlineoverridevirtual

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

Reimplemented from BossAI.

393 {
395
396 if (!UpdateVictim())
397 {
398 return;
399 }
400
401 scheduler.Update(diff);
402
404 {
405 return;
406 }
407
408 if (!_noMelee)
409 {
411 }
412 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition: TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
bool UpdateVictim()
Definition: CreatureAI.cpp:269

References UNIT_STATE_CASTING.

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

◆ _noMelee

bool boss_alar::_noMelee
private

Referenced by Reset().

◆ _noQuillTimes

uint8 boss_alar::_noQuillTimes
private

Referenced by JustEngagedWith(), and Reset().

◆ _platform

uint8 boss_alar::_platform
private

Referenced by 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

Referenced by Reset().