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
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table. More...
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon. More...
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged. More...
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed. More...
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 Called when unit is charmed. More...
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following: More...
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat. More...
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat. More...
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 Called at any Damage to any victim (before damage apply) More...
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage from any attacker (before damage apply) More...
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal. More...
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates. More...
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals. More...
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations. More...
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT) More...
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast. More...
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list. More...
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim. More...
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished. More...
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Private 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
98 : BossAI(creature, DATA_ALAR)
99 {
100 me->SetCombatMovement(false);
102 {
104 });
105 }
@ DATA_ALAR
Definition: the_eye.h:29
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164
TaskScheduler & SetValidator(P &&predicate)
Sets a validator which is asked if tasks are allowed to be executed.
Definition: TaskScheduler.h:197
TaskScheduler scheduler
Definition: CreatureAI.h:75
Creature * me
Definition: ScriptedCreature.h:280
Definition: ScriptedCreature.h:467
void SetCombatMovement(bool allowMovement)
Definition: Creature.cpp:3846
bool HasUnitState(const uint32 f) const
Definition: Unit.h:701

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:664
bool isMoving() const
Definition: Unit.h:1575
bool _hasPretendedToDie
Definition: boss_alar.cpp:418

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

◆ ConstructWaypointsAndMove()

void boss_alar::ConstructWaypointsAndMove ( )
inline
356 {
357 me->StopMoving();
358 if (WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath()))
359 {
360 Movement::PointsArray pathPoints;
361 pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
362 for (uint8 i = 0; i < i_path->size(); ++i)
363 {
364 WaypointData const* node = i_path->at(i);
365 pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
366 }
367 me->GetMotionMaster()->MoveSplinePath(&pathPoints);
368 }
369 }
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:346
float GetPositionZ() const
Definition: Position.h:118
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
MotionMaster * GetMotionMaster()
Definition: Unit.h:1620
void StopMoving()
Definition: Unit.cpp:16650
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 Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Creature::GetWaypointPath(), ScriptedAI::me, MotionMaster::MoveSplinePath(), Unit::StopMoving(), sWaypointMgr, WaypointData::x, WaypointData::y, and WaypointData::z.

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 BossAI.

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 }
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
@ REACT_AGGRESSIVE
Definition: Unit.h:550
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:32
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:232
Definition: TaskScheduler.h:421
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition: UnitAI.h:392
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3154
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:94
void ResumeChasingVictim()
Helper to resume chasing current victim.
Definition: Creature.h:408
void SetVisible(bool x)
Definition: Unit.cpp:14232
uint32 GetMaxHealth() const
Definition: Unit.h:1030
void SetHealth(uint32 val)
Definition: Unit.cpp:15478
uint32 GetHealth() const
Definition: Unit.h:1029
void SetStandState(uint8 state)
Definition: Unit.cpp:16726
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:714
bool _noMelee
Definition: boss_alar.cpp:422
TaskScheduler _transitionScheduler
Definition: boss_alar.cpp:427
uint8 _platform
Definition: boss_alar.cpp:423
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
388 {
389 // set finalPosition to playerPosition in case the fraction fails
390 Position finalPosition = playerPosition;
391 float playerXPosition = playerPosition.GetPositionX();
392 float playerYPosition = playerPosition.GetPositionY();
393 float centreXPosition = alarPoints[POINT_MIDDLE].GetPositionX();
394 float centreYPosition = alarPoints[POINT_MIDDLE].GetPositionY();
395 float deltaX = std::abs(playerXPosition-centreXPosition);
396 float deltaY = std::abs(playerYPosition-centreYPosition);
397 int8 signMultiplier[2] = {1, 1};
398 // if fraction has x position 0.0f we get nan as a result
399 if (float playerFraction = deltaX/deltaY)
400 {
401 // player angle based on delta X and delta Y
402 float playerAngle = std::atan(playerFraction);
403 float phoenixDeltaYPosition = std::cos(playerAngle)*INNER_CIRCLE_RADIUS;
404 float phoenixDeltaXPosition = std::sin(playerAngle)*INNER_CIRCLE_RADIUS;
405 // as calculations are absolute values we have to multiply in the end
406 // should be negative if player position was further down than centre
407 if (playerXPosition < centreXPosition)
408 signMultiplier[0] = -1;
409 if (playerYPosition < centreYPosition)
410 signMultiplier[1] = -1;
411 // phoenix position based on set distance
412 finalPosition = {centreXPosition+signMultiplier[0]*phoenixDeltaXPosition, centreYPosition+signMultiplier[1]*phoenixDeltaYPosition, 0.0f, 0.0f};
413 }
414 return finalPosition;
415 }
std::int8_t int8
Definition: Define.h:105
const float INNER_CIRCLE_RADIUS
Definition: boss_alar.cpp:93
Definition: Position.h:27

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:630
void SetModelVisible(bool on)
Definition: Unit.cpp:14242
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4909
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16689
void SpawnPhoenixes(uint8 count, Unit *targetToSpawnAt)
Definition: boss_alar.cpp:272

References _noMelee, UnitAI::DoCast(), UnitAI::DoCastSelf(), ScriptedAI::me, 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 BossAI.

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

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.

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

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 BossAI.

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 }
bool roll_chance_i(int chance)
Definition: Random.h:59
@ POINT_PLATFORM
Definition: boss_alar.cpp:68
@ POINT_QUILL
Definition: boss_alar.cpp:69
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition: CreatureAIImpl.h:25
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:493
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition: ScriptedCreature.h:497
void SetOrientation(float orientation)
Definition: Position.h:111
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:213
void ScheduleMainSpellAttack(std::chrono::seconds timer)
Definition: boss_alar.cpp:344
uint8 _noQuillTimes
Definition: boss_alar.cpp:425
uint8 _platformRoll
Definition: boss_alar.cpp:424
std::chrono::seconds _platformMoveRepeatTimer
Definition: boss_alar.cpp:426

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())
131 }
void JustReachedHome() override
Definition: ScriptedCreature.h:500
bool IsEngaged() const
Definition: Unit.h:881
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 ScriptedAI.

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 }
@ POINT_DIVE
Definition: boss_alar.cpp:71
@ SPELL_FLAME_QUILLS
Definition: boss_alar.cpp:32
@ GROUP_FLAME_BUFFET
Definition: boss_alar.cpp:83
@ ESCORT_MOTION_TYPE
Definition: MotionMaster.h:57
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:48
TaskScheduler & CancelGroup(group_t const group)
Definition: TaskScheduler.cpp:53
Movement::MoveSpline * movespline
Definition: Unit.h:1979
bool IsInCombat() const
Definition: Unit.h:884
bool Finalized() const
Definition: MoveSpline.h:116
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 }
@ 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:4129
void RemoveAllAuras()
Definition: Unit.cpp:5319
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:713
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:180
void MoveIdle()
Definition: MotionMaster.cpp:232

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 BossAI.

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 KillAllEvents(bool force)
Definition: EventProcessor.cpp:82
void Reset() override
Definition: ScriptedCreature.h:496
EventProcessor m_Events
Definition: Object.h:642
bool _canAttackCooldown
Definition: boss_alar.cpp:419
bool _baseAttackOverride
Definition: boss_alar.cpp:420
bool _spawnPhoenixes
Definition: boss_alar.cpp:421

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], 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
@ 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
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:48
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:107
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: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:321
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition: Object.cpp:2366

References _transitionScheduler, EventProcessor::AddEventAtOffset(), alarPoints, TaskScheduler::CancelAll(), TaskScheduler::DelayAll(), UnitAI::DoCastRandomTarget(), UnitAI::DoCastSelf(), UnitAI::DoCastVictim(), Unit::GetMotionMaster(), IN_MILLISECONDS, WorldObject::m_Events, ScriptedAI::me, MINUTE, NPC_FLAME_PATCH, POINT_DIVE, 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:2388
float GetCombatReach() const override
Definition: Unit.h:828

References UnitAI::DoCastVictim(), 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 }
@ NPC_EMBER_OF_ALAR
Definition: boss_alar.cpp:65
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: Object.h:51
void GetPosition(float &x, float &y) const
Definition: Position.h:121
Position DeterminePhoenixPosition(Position playerPosition)
Definition: boss_alar.cpp:387

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

Reimplemented from BossAI.

372 {
374
375 if (!UpdateVictim())
376 return;
377
378 scheduler.Update(diff);
379
381 return;
382
383 if (!_noMelee)
385 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition: TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
bool UpdateVictim()
Definition: CreatureAI.cpp:280

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