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)
 
void JustEngagedWith (Unit *who) override
 Called for reaction when initially engaged.
 
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()
 
- 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)
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
void SummonedCreatureDespawnAll () override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void ScheduleHealthCheckEvent (uint32 healthPct, std::function< void()> exec)
 Executes a function once the creature reaches the defined health point percent.
 
void ScheduleHealthCheckEvent (std::initializer_list< uint8 > healthPct, std::function< void()> exec)
 
void ScheduleEnrageTimer (uint32 spellId, Milliseconds timer, uint8 textId=0)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER) override
 
void JustDied (Unit *) override
 
void JustReachedHome () override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=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.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
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 InitializeAI ()
 
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:
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast.
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished.
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Private Attributes

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)
 
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 }
Definition ScriptedCreature.h:467
@ DATA_NIGHTBANE
Definition karazhan.h:41
uint8 _skeletonCount
Definition boss_nightbane.cpp:492

References _skeletonCount.

Member Function Documentation

◆ AttackStart()

void boss_nightbane::AttackStart ( Unit who)
inlineoverridevirtual

Reimplemented from UnitAI.

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

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

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 }
void DamageTaken(Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
Called at any Damage from any attacker (before damage apply)
Definition ScriptedCreature.cpp:749
uint32 GetHealth() const
Definition Unit.h:1038
Creature * me
Definition ScriptedCreature.h:280
uint8 _airPhasesCompleted
Definition boss_nightbane.cpp:488

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()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE + 100.0f); // see nightbane
179 scheduler.Schedule(2s, [this](TaskContext /*context*/)
180 {
182 me->SetDisableGravity(true);
183 me->GetMotionMaster()->MoveTakeoff(POINT_INTRO_TAKE_OFF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10.0f, 13.99879f);
184 }).Schedule(4s, [this](TaskContext /*context*/)
185 {
186 me->GetMotionMaster()->MovePath(me->GetEntry()*10, false);
187 });
188 }
189 }
#define DEFAULT_VISIBILITY_INSTANCE
Definition ObjectDefines.h:41
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:32
@ UNIT_STATE_IGNORE_PATHFINDING
Definition UnitDefines.h:197
@ 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
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:3222
void SetVisibilityRange(float range)
Definition Map.h:196
void MovePath(uint32 path_id, bool repeatable)
Move the unit following a specific path. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:852
uint32 GetEntry() const
Definition Object.h:115
Definition TaskScheduler.h:421
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition TaskScheduler.h:232
MotionMaster * GetMotionMaster()
Definition Unit.h:1673
void AddUnitState(uint32 f)
Definition Unit.h:706
void SetStandState(uint8 state)
Definition Unit.cpp:16778
Map * GetMap() const
Definition Object.h:536
Talk
Definition hyjal.cpp:82
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References _phase, ACTION_START_INTRO, Unit::AddUnitState(), DEFAULT_VISIBILITY_INSTANCE, EMOTE_SUMMON, Object::GetEntry(), WorldObject::GetMap(), Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), ScriptedAI::me, MotionMaster::MovePath(), 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 CreatureAI.

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:504
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:340
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:3307
void SendMovementFlagUpdate(bool self=false)
Definition Unit.cpp:16756

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

Referenced by PathEndReached().

◆ FlyToClosestPreFlyWayPoint()

void boss_nightbane::FlyToClosestPreFlyWayPoint ( )
inline
439 {
440 Position closestWP = preFlyPos;
441 if (me->GetDistance(preFlyEastPos) < me->GetDistance(closestWP))
442 closestWP = preFlyEastPos;
443 if (me->GetDistance(preFlySouthPos) < me->GetDistance(closestWP))
444 closestWP = preFlySouthPos;
445 if (me->GetDistance(preFlyWestPos) < me->GetDistance(closestWP))
446 closestWP = preFlyWestPos;
447
448 me->GetMotionMaster()->Clear(false);
449 if (closestWP == preFlyPos)
451 else if (closestWP == preFlyEastPos)
453 else if (closestWP == preFlySouthPos)
455 else if (closestWP == preFlyWestPos)
457 }
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
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
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1256
Definition Position.h:27

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

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

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

◆ JustReachedHome()

void boss_nightbane::JustReachedHome ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

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

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

◆ JustSummoned()

void boss_nightbane::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from CreatureAI.

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

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.

287 {
288 if (_phase == PHASE_GROUND)
290 }
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 CreatureAI.

347 {
348 if (type != POINT_MOTION_TYPE)
349 return;
350
351 switch (id)
352 {
354 break;
355 case POINT_INTRO_LAND:
357 break;
359 scheduler.Schedule(0s, [this](TaskContext /*context*/)
360 {
362 });
363 break;
366 scheduler.Schedule(0s, [this](TaskContext /*context*/)
367 {
369 });
370 break;
371 case POINT_PRE_FLY:
372 scheduler.Schedule(0s, [this](TaskContext /*context*/)
373 {
374 me->GetMotionMaster()->MovePoint(POINT_FLY, flyPos);
375 });
376 break;
377 case POINT_FLY:
380 ScheduleFly();
381 ScheduleLand();
382 break;
384 scheduler.Schedule(0s, [this](TaskContext /*context*/)
385 {
387 });
388 break;
391 {
394 scheduler.Schedule(0s, [this](TaskContext /*context*/)
395 {
397 });
398 }
399 else
400 {
401 scheduler.Schedule(0s, [this](TaskContext /*context*/)
402 {
403 me->GetMotionMaster()->MovePath(me->GetEntry()*10+1, false);
404 });
405 }
406 break;
407 case POINT_LAND:
409 break;
410 }
411 }
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ 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
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
Definition ScriptedCreature.cpp:234
void ScheduleFly()
Definition boss_nightbane.cpp:229
uint8 _triggerCountTakeOffWhileFlying
Definition boss_nightbane.cpp:489
void ScheduleLand()
Definition boss_nightbane.cpp:459

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.

293 {
295 if (pathId == me->GetEntry()*10) // intro
296 {
297 me->GetMap()->SetVisibilityRange(DEFAULT_VISIBILITY_INSTANCE); // restore visibility
298 scheduler.Schedule(0s, [this](TaskContext /*context*/)
299 {
302 }).Schedule(3s, [this](TaskContext /*context*/)
303 {
304 me->SetDisableGravity(false);
305 me->SetCanFly(false);
311 }).Schedule(8s, [this](TaskContext /*context*/)
312 {
313 if (!SelectTargetFromPlayerList(45.0f))
314 {
316 }
317 });
318 }
319 else if (pathId == me->GetEntry()*10+1) // landing
320 {
323 {
325 scheduler.Schedule(0s, [this](TaskContext /*context*/)
326 {
328 });
329 }
330 else
331 {
332 scheduler.Schedule(0s, [this](TaskContext /*context*/)
333 {
336 me->SetDisableGravity(false);
337 me->SetCanFly(false);
341 });
342 }
343 }
344 }
@ EMOTE_ONESHOT_LAND
Definition SharedDefines.h:1964
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:251
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:275
@ UNIT_FLAG_IMMUNE_TO_PC
Definition UnitDefines.h:258
@ REACT_AGGRESSIVE
Definition Unit.h:550
Position const landPos
Definition boss_nightbane.cpp:110
Position const introLandPos
Definition boss_nightbane.cpp:104
@ EVADE_REASON_NO_HOSTILES
Definition CreatureAI.h:89
virtual void PathEndReached(uint32)
Definition CreatureAI.h:160
void SetInCombatWithZone()
Set in combat all units in the dungeon/raid. Affect only units with IsAIEnabled.
Definition Creature.cpp:2828
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:95
void ClearUnitState(uint32 f)
Definition Unit.h:708
void HandleEmoteCommand(uint32 emoteId)
Definition Unit.cpp:2011
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:720
void DoResetThreatList()
Definition ScriptedCreature.cpp:445
Player * SelectTargetFromPlayerList(float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
Definition ScriptedCreature.cpp:571
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 UnitAI.

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

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
230 {
232
233 scheduler.Schedule(2s, GROUP_AIR, [this](TaskContext /*context*/)
234 {
236 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f))
237 {
238 _skeletonSpawnPos = target->GetPosition();
241 _skeletonscheduler.Schedule(50ms, [this](TaskContext context)
242 {
243 //spawns skeletons every 2 seconds until skeletonCount is reached
245 {
248 context.Repeat(2s);
249 }
250 });
251 }
252 }).Schedule(15s, GROUP_AIR, [this](TaskContext context)
253 {
255 {
257 }
258 context.Repeat(6s);
259 }).Schedule(15500ms, GROUP_AIR, [this](TaskContext context)
260 {
263 context.Repeat(1500ms);
264 }).Schedule(20s, GROUP_AIR, [this](TaskContext /*context*/)
265 {
266 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
267 {
269 }
270 }).Schedule(14s, GROUP_AIR, [this](TaskContext context)
271 {
272 if (SelectTarget(SelectTargetMethod::MinDistance, 0, -40.0f, true))
273 {
275 }
276 context.Repeat(3s);
277 });
278 }
@ 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
Definition Unit.h:636
void SetFacingTo(float ori)
Definition Unit.cpp:20581
void SetFacingToObject(WorldObject *object)
Definition Unit.cpp:20591
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:1178
float GetOrientation() const
Definition Position.h:124
void GetPosition(float &x, float &y) const
Definition Position.h:126
Position _skeletonSpawnPos
Definition boss_nightbane.cpp:494
uint8 _skeletonSpawnCounter
Definition boss_nightbane.cpp:493

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, MinDistance, Random, 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
192 {
193 scheduler.Schedule(18s, 25s, GROUP_GROUND, [this](TaskContext context)
194 {
195 DoCastRandomTarget(SPELL_CHARRED_EARTH, 0, 100.0f, true);
196 context.Repeat(20s);
197 }).Schedule(25s, 35s, GROUP_GROUND, [this](TaskContext context)
198 {
200 context.Repeat(20s);
201 }).Schedule(45s, GROUP_GROUND, [this](TaskContext context)
202 {
204 context.Repeat(32s, 40s);
205 }).Schedule(12s, GROUP_GROUND, [this](TaskContext context)
206 {
207 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
208 {
209 if (!me->HasInArc(M_PI, target))
210 {
211 DoCast(target, SPELL_TAIL_SWEEP);
212 }
213 }
214 context.Repeat(15s);
215 }).Schedule(5s, GROUP_GROUND, [this](TaskContext context)
216 {
218 context.Repeat(6s, 12s);
219 }).Schedule(25s, GROUP_GROUND, [this](TaskContext context)
220 {
221 if (SelectTarget(SelectTargetMethod::MinDistance, 0, -40.0f, true))
222 {
224 }
225 context.Repeat(3s);
226 });
227 }
@ 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, MinDistance, Random, 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
460 {
461 scheduler.Schedule(35s, GROUP_LAND, [this](TaskContext) /*context*/
462 {
466
467 me->GetMotionMaster()->Clear(false);
469 });
470 }
@ 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
420 {
421 if (_phase != PHASE_GROUND)
422 {
424 return;
425 }
431 me->SetDisableGravity(true);
432 me->SetCanFly(true);
436 }
@ EMOTE_ONESHOT_LIFTOFF
Definition SharedDefines.h:1960
@ CURRENT_GENERIC_SPELL
Definition Unit.h:538
@ YELL_AIR_PHASE
Definition boss_nightbane.cpp:50
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4092
void FlyToClosestPreFlyWayPoint()
Definition boss_nightbane.cpp:438

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

Implements UnitAI.

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

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

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