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

Public Member Functions

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

Private Attributes

uint8 _phase
 
uint8 _airPhasesCompleted
 
uint8 _triggerCountTakeOffWhileFlying
 
TaskScheduler _skeletonscheduler
 
uint8 _skeletonCount
 
uint8 _skeletonSpawnCounter
 
Position _skeletonSpawnPos
 

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

boss_nightbane::boss_nightbane ( Creature creature)
inline
114 : BossAI(creature, DATA_NIGHTBANE)
115 {
116 _skeletonCount = 5;
117 }
@ DATA_NIGHTBANE
Definition: karazhan.h:41
Definition: ScriptedCreature.h:467
uint8 _skeletonCount
Definition: boss_nightbane.cpp:493

References _skeletonCount.

Member Function Documentation

◆ AttackStart()

void boss_nightbane::AttackStart ( Unit who)
inlineoverridevirtual

Reimplemented from ScriptedAI.

282 {
283 if (_phase == PHASE_GROUND)
285 }
@ PHASE_GROUND
Definition: boss_nightbane.cpp:63
void AttackStart(Unit *) override
Definition: ScriptedCreature.cpp:210
uint8 _phase
Definition: boss_nightbane.cpp:488

References _phase, ScriptedAI::AttackStart(), and PHASE_GROUND.

◆ DamageTaken()

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

153 {
154 if (_airPhasesCompleted < 3)
155 {
156 if (damage >= me->GetHealth())
157 {
158 damage = me->GetHealth() - 1;
159 }
160 }
161 BossAI::DamageTaken(attacker, damage, damageEffectType, spellSchoolMask);
162 }
Creature * me
Definition: ScriptedCreature.h:280
void DamageTaken(Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
Called at any Damage from any attacker (before damage apply)
Definition: ScriptedCreature.cpp:748
uint32 GetHealth() const
Definition: Unit.h:1029
uint8 _airPhasesCompleted
Definition: boss_nightbane.cpp:489

References _airPhasesCompleted, BossAI::DamageTaken(), Unit::GetHealth(), and ScriptedAI::me.

◆ DoAction()

void boss_nightbane::DoAction ( int32  action)
inlineoverridevirtual

Reimplemented from UnitAI.

172 {
173 if (action == ACTION_START_INTRO)
174 {
175 me->GetMap()->LoadGrid(-11260.0f, -1771.0f); // load grid at far end of intro path
176 me->GetMap()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE + 100.0f); // see nightbane
180 scheduler.Schedule(2s, [this](TaskContext /*context*/)
181 {
183 me->SetDisableGravity(true);
184 me->GetMotionMaster()->MoveTakeoff(POINT_INTRO_TAKE_OFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10.0f, 13.99879f);
185 }).Schedule(4s, [this](TaskContext /*context*/)
186 {
187 me->GetMotionMaster()->MovePath(me->GetEntry()*10, false);
188 });
189 }
190 }
Talk
Definition: hyjal.cpp:82
@ EMOTE_SUMMON
Definition: boss_nightbane.cpp:48
@ ACTION_START_INTRO
Definition: boss_nightbane.cpp:57
@ POINT_INTRO_TAKE_OFF
Definition: boss_nightbane.cpp:77
@ PHASE_INTRO
Definition: boss_nightbane.cpp:62
#define DEFAULT_VISIBILITY_INSTANCE
Definition: ObjectDefines.h:41
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:32
@ UNIT_STATE_IGNORE_PATHFINDING
Definition: UnitDefines.h:176
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:232
Definition: TaskScheduler.h:421
TaskScheduler scheduler
Definition: CreatureAI.h:75
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING....
Definition: Creature.cpp:3205
uint32 GetEntry() const
Definition: Object.h:115
Map * GetMap() const
Definition: Object.h:536
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 AddUnitState(uint32 f)
Definition: Unit.h:700
void SetStandState(uint8 state)
Definition: Unit.cpp:16726
void LoadGrid(float x, float y)
Definition: Map.cpp:495
void SetVisibilityRange(float range)
Definition: Map.h:350

References _phase, ACTION_START_INTRO, Unit::AddUnitState(), DEFAULT_VISIBILITY_INSTANCE, EMOTE_SUMMON, Object::GetEntry(), WorldObject::GetMap(), Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Map::LoadGrid(), ScriptedAI::me, PHASE_INTRO, POINT_INTRO_TAKE_OFF, TaskScheduler::Schedule(), CreatureAI::scheduler, Creature::SetDisableGravity(), Unit::SetStandState(), Map::SetVisibilityRange(), UNIT_STAND_STATE_STAND, and UNIT_STATE_IGNORE_PATHFINDING.

◆ EnterEvadeMode()

void boss_nightbane::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from BossAI.

144 {
146 me->SetCanFly(true);
147 me->SetDisableGravity(true);
150 }
Position const homePos
Definition: boss_nightbane.cpp:103
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition: ScriptedCreature.h:498
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:336
bool SetCanFly(bool enable, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition: Creature.cpp:3290
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16704

References BossAI::EnterEvadeMode(), homePos, ScriptedAI::me, Unit::SendMovementFlagUpdate(), Creature::SetCanFly(), Creature::SetDisableGravity(), and Creature::SetHomePosition().

Referenced by PathEndReached().

◆ FlyToClosestPreFlyWayPoint()

void boss_nightbane::FlyToClosestPreFlyWayPoint ( )
inline
440 {
441 Position closestWP = preFlyPos;
442 if (me->GetDistance(preFlyEastPos) < me->GetDistance(closestWP))
443 closestWP = preFlyEastPos;
444 if (me->GetDistance(preFlySouthPos) < me->GetDistance(closestWP))
445 closestWP = preFlySouthPos;
446 if (me->GetDistance(preFlyWestPos) < me->GetDistance(closestWP))
447 closestWP = preFlyWestPos;
448
449 me->GetMotionMaster()->Clear(false);
450 if (closestWP == preFlyPos)
452 else if (closestWP == preFlyEastPos)
454 else if (closestWP == preFlySouthPos)
456 else if (closestWP == preFlyWestPos)
458 }
Position const preFlyEastPos
Definition: boss_nightbane.cpp:106
@ POINT_PRE_FLY_EAST
Definition: boss_nightbane.cpp:80
@ POINT_PRE_FLY
Definition: boss_nightbane.cpp:83
@ POINT_PRE_FLY_SOUTH
Definition: boss_nightbane.cpp:81
@ POINT_PRE_FLY_WEST
Definition: boss_nightbane.cpp:82
Position const preFlyWestPos
Definition: boss_nightbane.cpp:107
Position const preFlyPos
Definition: boss_nightbane.cpp:108
Position const preFlySouthPos
Definition: boss_nightbane.cpp:105
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1256
Definition: Position.h:27
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:213
void Clear(bool reset=true)
Definition: MotionMaster.h:167

References MotionMaster::Clear(), WorldObject::GetDistance(), Unit::GetMotionMaster(), ScriptedAI::me, MotionMaster::MovePoint(), POINT_PRE_FLY, POINT_PRE_FLY_EAST, POINT_PRE_FLY_SOUTH, POINT_PRE_FLY_WEST, preFlyEastPos, preFlyPos, preFlySouthPos, and preFlyWestPos.

Referenced by TriggerHealthTakeOff().

◆ JustEngagedWith()

void boss_nightbane::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from BossAI.

165 {
169 }
@ YELL_AGGRO
Definition: boss_nightbane.cpp:49
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition: ScriptedCreature.h:497
void ScheduleGround()
Definition: boss_nightbane.cpp:192

References BossAI::JustEngagedWith(), ScheduleGround(), and YELL_AGGRO.

◆ JustReachedHome()

void boss_nightbane::JustReachedHome ( )
inlineoverridevirtual

Reimplemented from BossAI.

138 {
141 }
void JustReachedHome() override
Definition: ScriptedCreature.h:500
void DespawnOnEvade(Seconds respawnDelay=20s)
Definition: Creature.cpp:2186

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

◆ JustSummoned()

void boss_nightbane::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from BossAI.

415 {
416 summon->AI()->AttackStart(me->GetVictim());
417 summons.Summon(summon);
418 }
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:88
SummonList summons
Definition: ScriptedCreature.h:511
CreatureAI * AI() const
Definition: Creature.h:140
Unit * GetVictim() const
Definition: Unit.h:853

References Creature::AI(), UnitAI::AttackStart(), Unit::GetVictim(), ScriptedAI::me, SummonList::Summon(), and BossAI::summons.

◆ MoveInLineOfSight()

void boss_nightbane::MoveInLineOfSight ( Unit who)
inlineoverridevirtual

Reimplemented from CreatureAI.

288 {
289 if (_phase == PHASE_GROUND)
291 }
virtual void MoveInLineOfSight(Unit *)
Definition: CreatureAI.cpp:169

References _phase, CreatureAI::MoveInLineOfSight(), and PHASE_GROUND.

◆ MovementInform()

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

Reimplemented from ScriptedAI.

348 {
349 if (type != POINT_MOTION_TYPE)
350 return;
351
352 switch (id)
353 {
355 break;
356 case POINT_INTRO_LAND:
358 break;
360 scheduler.Schedule(0s, [this](TaskContext /*context*/)
361 {
363 });
364 break;
367 scheduler.Schedule(0s, [this](TaskContext /*context*/)
368 {
370 });
371 break;
372 case POINT_PRE_FLY:
373 scheduler.Schedule(0s, [this](TaskContext /*context*/)
374 {
375 me->GetMotionMaster()->MovePoint(POINT_FLY, flyPos);
376 });
377 break;
378 case POINT_FLY:
381 ScheduleFly();
382 ScheduleLand();
383 break;
385 scheduler.Schedule(0s, [this](TaskContext /*context*/)
386 {
388 });
389 break;
392 {
395 scheduler.Schedule(0s, [this](TaskContext /*context*/)
396 {
398 });
399 }
400 else
401 {
402 scheduler.Schedule(0s, [this](TaskContext /*context*/)
403 {
404 me->GetMotionMaster()->MovePath(me->GetEntry()*10+1, false);
405 });
406 }
407 break;
408 case POINT_LAND:
410 break;
411 }
412 }
@ EMOTE_BREATH
Definition: boss_nightbane.cpp:52
@ POINT_INTRO_LAND
Definition: boss_nightbane.cpp:79
@ POINT_FLY
Definition: boss_nightbane.cpp:84
@ POINT_LAND
Definition: boss_nightbane.cpp:88
@ POINT_LANDING_PRE
Definition: boss_nightbane.cpp:85
@ POINT_LANDING_WEST
Definition: boss_nightbane.cpp:86
@ PHASE_FLY
Definition: boss_nightbane.cpp:64
Position const flyPos
Definition: boss_nightbane.cpp:109
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:48
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
Definition: ScriptedCreature.cpp:234
void ScheduleFly()
Definition: boss_nightbane.cpp:230
uint8 _triggerCountTakeOffWhileFlying
Definition: boss_nightbane.cpp:490
void ScheduleLand()
Definition: boss_nightbane.cpp:460

References _airPhasesCompleted, _phase, _triggerCountTakeOffWhileFlying, ScriptedAI::DoStartMovement(), EMOTE_BREATH, flyPos, Object::GetEntry(), Unit::GetMotionMaster(), Unit::GetVictim(), ScriptedAI::me, PHASE_FLY, POINT_FLY, POINT_INTRO_LAND, POINT_INTRO_TAKE_OFF, POINT_LAND, POINT_LANDING_PRE, POINT_LANDING_WEST, POINT_MOTION_TYPE, POINT_PRE_FLY, POINT_PRE_FLY_EAST, POINT_PRE_FLY_SOUTH, POINT_PRE_FLY_WEST, preFlyPos, preFlySouthPos, preFlyWestPos, TaskScheduler::Schedule(), ScheduleFly(), ScheduleLand(), and CreatureAI::scheduler.

◆ PathEndReached()

void boss_nightbane::PathEndReached ( uint32  pathId)
inlineoverridevirtual

Reimplemented from CreatureAI.

294 {
296 if (pathId == me->GetEntry()*10) // intro
297 {
298 me->GetMap()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE); // restore visibility
299 scheduler.Schedule(0s, [this](TaskContext /*context*/)
300 {
303 }).Schedule(3s, [this](TaskContext /*context*/)
304 {
305 me->SetDisableGravity(false);
306 me->SetCanFly(false);
312 }).Schedule(8s, [this](TaskContext /*context*/)
313 {
314 if (!SelectTargetFromPlayerList(45.0f))
315 {
317 }
318 });
319 }
320 else if (pathId == me->GetEntry()*10+1) // landing
321 {
324 {
326 scheduler.Schedule(0s, [this](TaskContext /*context*/)
327 {
329 });
330 }
331 else
332 {
333 scheduler.Schedule(0s, [this](TaskContext /*context*/)
334 {
337 me->SetDisableGravity(false);
338 me->SetCanFly(false);
342 });
343 }
344 }
345 }
Position const landPos
Definition: boss_nightbane.cpp:110
Position const introLandPos
Definition: boss_nightbane.cpp:104
@ EMOTE_ONESHOT_LAND
Definition: SharedDefines.h:1964
@ REACT_AGGRESSIVE
Definition: Unit.h:550
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:230
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
@ UNIT_FLAG_IMMUNE_TO_PC
Definition: UnitDefines.h:237
@ EVADE_REASON_NO_HOSTILES
Definition: CreatureAI.h:89
virtual void PathEndReached(uint32)
Definition: CreatureAI.h:160
void DoResetThreatList()
Definition: ScriptedCreature.cpp:445
Player * SelectTargetFromPlayerList(float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
Definition: ScriptedCreature.cpp:571
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition: Creature.cpp:2811
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:94
void ClearUnitState(uint32 f)
Definition: Unit.h:702
void HandleEmoteCommand(uint32 emoteId)
Definition: Unit.cpp:2000
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:714
void EnterEvadeMode(EvadeReason why) override
Definition: boss_nightbane.cpp:143

References _airPhasesCompleted, _phase, _triggerCountTakeOffWhileFlying, Unit::ClearUnitState(), DEFAULT_VISIBILITY_INSTANCE, ScriptedAI::DoResetThreatList(), EMOTE_ONESHOT_LAND, EnterEvadeMode(), CreatureAI::EVADE_REASON_NO_HOSTILES, Object::GetEntry(), WorldObject::GetMap(), Unit::GetMotionMaster(), Unit::HandleEmoteCommand(), introLandPos, landPos, ScriptedAI::me, MotionMaster::MovePoint(), CreatureAI::PathEndReached(), PHASE_GROUND, POINT_INTRO_LAND, POINT_LAND, POINT_PRE_FLY_SOUTH, preFlySouthPos, REACT_AGGRESSIVE, Unit::RemoveUnitFlag(), TaskScheduler::Schedule(), ScheduleGround(), CreatureAI::scheduler, ScriptedAI::SelectTargetFromPlayerList(), Creature::SetCanFly(), Creature::SetDisableGravity(), Creature::SetInCombatWithZone(), Creature::SetReactState(), Map::SetVisibilityRange(), UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, and UNIT_STATE_IGNORE_PATHFINDING.

◆ Reset()

void boss_nightbane::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

120 {
123
126
127 me->SetSpeed(MOVE_RUN, 2.0f);
128 me->SetCanFly(true);
131
132 ScheduleHealthCheckEvent({ 75, 50, 25 }, [&]{
134 });
135 }
@ REACT_PASSIVE
Definition: Unit.h:548
@ MOVE_RUN
Definition: UnitDefines.h:329
TaskScheduler & CancelAll()
Definition: TaskScheduler.cpp:45
void ScheduleHealthCheckEvent(uint32 healthPct, std::function< void()> exec)
Executes a function once the creature reaches the defined health point percent.
Definition: ScriptedCreature.cpp:774
void Reset() override
Definition: ScriptedCreature.h:496
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14429
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:713
void TriggerHealthTakeOff()
Definition: boss_nightbane.cpp:420
TaskScheduler _skeletonscheduler
Definition: boss_nightbane.cpp:492

References _airPhasesCompleted, _skeletonscheduler, _triggerCountTakeOffWhileFlying, TaskScheduler::CancelAll(), ScriptedAI::me, MOVE_RUN, REACT_PASSIVE, BossAI::Reset(), BossAI::ScheduleHealthCheckEvent(), Creature::SetCanFly(), Creature::SetReactState(), Unit::SetSpeed(), Unit::SetUnitFlag(), TriggerHealthTakeOff(), and UNIT_FLAG_NON_ATTACKABLE.

◆ ScheduleFly()

void boss_nightbane::ScheduleFly ( )
inline
231 {
233
234 scheduler.Schedule(2s, GROUP_AIR, [this](TaskContext /*context*/)
235 {
237 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f))
238 {
239 _skeletonSpawnPos = target->GetPosition();
242 _skeletonscheduler.Schedule(50ms, [this](TaskContext context)
243 {
244 //spawns skeletons every 2 seconds until skeletonCount is reached
246 {
249 context.Repeat(2s);
250 }
251 });
252 }
253 }).Schedule(15s, GROUP_AIR, [this](TaskContext context)
254 {
255 if (Unit* target = SelectTarget(SelectTargetMethod::Random))
256 {
258 }
259 context.Repeat(6s);
260 }).Schedule(15500ms, GROUP_AIR, [this](TaskContext context)
261 {
264 context.Repeat(1500ms);
265 }).Schedule(20s, GROUP_AIR, [this](TaskContext /*context*/)
266 {
267 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
268 {
270 }
271 }).Schedule(14s, GROUP_AIR, [this](TaskContext context)
272 {
273 if (SelectTarget(SelectTargetMethod::MinDistance, 0, -40.0f, true))
274 {
276 }
277 context.Repeat(3s);
278 });
279 }
@ SPELL_DISTRACTING_ASH
Definition: boss_nightbane.cpp:41
@ SPELL_RAIN_OF_BONES
Definition: boss_nightbane.cpp:39
@ SPELL_FIREBALL_BARRAGE
Definition: boss_nightbane.cpp:43
@ SPELL_SMOKING_BLAST
Definition: boss_nightbane.cpp:37
@ SPELL_SMOKING_BLAST_T
Definition: boss_nightbane.cpp:38
@ SPELL_SUMMON_SKELETON
Definition: boss_nightbane.cpp:40
@ GROUP_AIR
Definition: boss_nightbane.cpp:71
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:493
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:248
SpellCastResult DoCastVictim(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:240
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
float GetOrientation() const
Definition: Position.h:119
void GetPosition(float &x, float &y) const
Definition: Position.h:121
Definition: Unit.h:630
void SetFacingTo(float ori)
Definition: Unit.cpp:20527
void SetFacingToObject(WorldObject *object)
Definition: Unit.cpp:20537
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1167
Position _skeletonSpawnPos
Definition: boss_nightbane.cpp:495
uint8 _skeletonSpawnCounter
Definition: boss_nightbane.cpp:494

References _skeletonCount, _skeletonscheduler, _skeletonSpawnCounter, _skeletonSpawnPos, Unit::CastSpell(), UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoCastVictim(), ScriptedAI::DoResetThreatList(), Position::GetOrientation(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::GetVictim(), GROUP_AIR, ScriptedAI::me, TaskContext::Repeat(), TaskScheduler::Schedule(), CreatureAI::scheduler, UnitAI::SelectTarget(), Unit::SetFacingTo(), Unit::SetFacingToObject(), SPELL_DISTRACTING_ASH, SPELL_FIREBALL_BARRAGE, SPELL_RAIN_OF_BONES, SPELL_SMOKING_BLAST, SPELL_SMOKING_BLAST_T, and SPELL_SUMMON_SKELETON.

Referenced by MovementInform().

◆ ScheduleGround()

void boss_nightbane::ScheduleGround ( )
inline
193 {
194 scheduler.Schedule(18s, 25s, GROUP_GROUND, [this](TaskContext context)
195 {
196 DoCastRandomTarget(SPELL_CHARRED_EARTH, 0, 100.0f, true);
197 context.Repeat(20s);
198 }).Schedule(25s, 35s, GROUP_GROUND, [this](TaskContext context)
199 {
201 context.Repeat(20s);
202 }).Schedule(45s, GROUP_GROUND, [this](TaskContext context)
203 {
205 context.Repeat(32s, 40s);
206 }).Schedule(12s, GROUP_GROUND, [this](TaskContext context)
207 {
208 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
209 {
210 if (!me->HasInArc(M_PI, target))
211 {
212 DoCast(target, SPELL_TAIL_SWEEP);
213 }
214 }
215 context.Repeat(15s);
216 }).Schedule(5s, GROUP_GROUND, [this](TaskContext context)
217 {
219 context.Repeat(6s, 12s);
220 }).Schedule(25s, GROUP_GROUND, [this](TaskContext context)
221 {
222 if (SelectTarget(SelectTargetMethod::MinDistance, 0, -40.0f, true))
223 {
225 }
226 context.Repeat(3s);
227 });
228 }
@ SPELL_SMOLDERING_BREATH
Definition: boss_nightbane.cpp:33
@ SPELL_CHARRED_EARTH
Definition: boss_nightbane.cpp:34
@ SPELL_CLEAVE
Definition: boss_nightbane.cpp:31
@ SPELL_BELLOWING_ROAR
Definition: boss_nightbane.cpp:35
@ SPELL_TAIL_SWEEP
Definition: boss_nightbane.cpp:32
@ GROUP_GROUND
Definition: boss_nightbane.cpp:70
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
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition: Position.cpp:141

References UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoCastRandomTarget(), UnitAI::DoCastVictim(), GROUP_GROUND, Position::HasInArc(), ScriptedAI::me, TaskContext::Repeat(), TaskScheduler::Schedule(), CreatureAI::scheduler, UnitAI::SelectTarget(), SPELL_BELLOWING_ROAR, SPELL_CHARRED_EARTH, SPELL_CLEAVE, SPELL_FIREBALL_BARRAGE, SPELL_SMOLDERING_BREATH, and SPELL_TAIL_SWEEP.

Referenced by JustEngagedWith(), and PathEndReached().

◆ ScheduleLand()

void boss_nightbane::ScheduleLand ( )
inline
461 {
462 scheduler.Schedule(35s, GROUP_LAND, [this](TaskContext) /*context*/
463 {
467
468 me->GetMotionMaster()->Clear(false);
470 });
471 }
@ YELL_LAND_PHASE
Definition: boss_nightbane.cpp:51
@ PHASE_TRANSITION
Definition: boss_nightbane.cpp:65
@ GROUP_LAND
Definition: boss_nightbane.cpp:72
TaskScheduler & CancelGroup(group_t const group)
Definition: TaskScheduler.cpp:53

References _phase, TaskScheduler::CancelGroup(), MotionMaster::Clear(), Unit::GetMotionMaster(), GROUP_AIR, GROUP_LAND, ScriptedAI::me, MotionMaster::MovePoint(), PHASE_TRANSITION, POINT_LANDING_PRE, preFlyPos, TaskScheduler::Schedule(), CreatureAI::scheduler, and YELL_LAND_PHASE.

Referenced by MovementInform().

◆ TriggerHealthTakeOff()

void boss_nightbane::TriggerHealthTakeOff ( )
inline
421 {
422 if (_phase != PHASE_GROUND)
423 {
425 return;
426 }
432 me->SetDisableGravity(true);
433 me->SetCanFly(true);
437 }
@ YELL_AIR_PHASE
Definition: boss_nightbane.cpp:50
@ EMOTE_ONESHOT_LIFTOFF
Definition: SharedDefines.h:1960
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:538
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4060
void FlyToClosestPreFlyWayPoint()
Definition: boss_nightbane.cpp:439

References _phase, _triggerCountTakeOffWhileFlying, TaskScheduler::CancelGroup(), CURRENT_GENERIC_SPELL, EMOTE_ONESHOT_LIFTOFF, FlyToClosestPreFlyWayPoint(), GROUP_GROUND, Unit::HandleEmoteCommand(), Unit::InterruptSpell(), ScriptedAI::me, PHASE_GROUND, PHASE_TRANSITION, CreatureAI::scheduler, Unit::SendMovementFlagUpdate(), Creature::SetCanFly(), Creature::SetDisableGravity(), and YELL_AIR_PHASE.

Referenced by Reset().

◆ UpdateAI()

void boss_nightbane::UpdateAI ( uint32  )
inlineoverridevirtual

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

Reimplemented from BossAI.

474 {
475 scheduler.Update(diff);
477
478 if (!UpdateVictim())
479 return;
480
481 if (_phase == PHASE_GROUND)
482 {
484 }
485 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition: TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
bool UpdateVictim()
Definition: CreatureAI.cpp:280

References _phase, _skeletonscheduler, UnitAI::DoMeleeAttackIfReady(), PHASE_GROUND, CreatureAI::scheduler, TaskScheduler::Update(), and CreatureAI::UpdateVictim().

Member Data Documentation

◆ _airPhasesCompleted

uint8 boss_nightbane::_airPhasesCompleted
private

◆ _phase

◆ _skeletonCount

uint8 boss_nightbane::_skeletonCount
private

Referenced by boss_nightbane(), and ScheduleFly().

◆ _skeletonscheduler

TaskScheduler boss_nightbane::_skeletonscheduler
private

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

◆ _skeletonSpawnCounter

uint8 boss_nightbane::_skeletonSpawnCounter
private

Referenced by ScheduleFly().

◆ _skeletonSpawnPos

Position boss_nightbane::_skeletonSpawnPos
private

Referenced by ScheduleFly().

◆ _triggerCountTakeOffWhileFlying

uint8 boss_nightbane::_triggerCountTakeOffWhileFlying
private