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

Public Member Functions

 boss_janalai (Creature *creature)
 
void Reset () override
 
void JustDied (Unit *killer) override
 
void JustSummoned (Creature *summon) override
 
void DamageDealt (Unit *target, uint32 &damage, DamageEffectType) override
 Called at any Damage to any victim (before damage apply) More...
 
void JustEngagedWith (Unit *who) override
 Called for reaction when initially engaged. More...
 
void SetData (uint32 index, uint32 data) override
 
bool HatchAllEggs (uint32 hatchAction)
 
void FireWall ()
 
void SpawnBombs ()
 
void Boom ()
 
void StartBombing ()
 
void ThrowBombs ()
 
bool CheckEvadeIfOutOfCombatArea () const override
 
- 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 _isBombing
 
bool _isFlameBreathing
 
bool _sideHatched [2]
 

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

boss_janalai::boss_janalai ( Creature creature)
inline
119 : BossAI(creature, DATA_JANALAI)
120 {
122 {
124 });
125 }
@ DATA_JANALAI
Definition: zulaman.h:30
@ 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
bool HasUnitState(const uint32 f) const
Definition: Unit.h:701

References Unit::HasUnitState(), ScriptedAI::me, CreatureAI::scheduler, TaskScheduler::SetValidator(), and UNIT_STATE_CASTING.

Member Function Documentation

◆ Boom()

void boss_janalai::Boom ( )
inline
300 {
301 summons.DoForAllSummons([&](WorldObject* summon) {
302 if (summon->GetEntry() == NPC_FIRE_BOMB)
303 {
304 if (Creature* bomb = summon->ToCreature())
305 {
306 bomb->AI()->DoCastSelf(SPELL_FIRE_BOMB_DAMAGE, true);
307 bomb->RemoveAllAuras();
308 }
309 }
310 });
311 }
@ NPC_FIRE_BOMB
Definition: boss_janalai.cpp:69
void DoForAllSummons(std::function< void(WorldObject *)> exec)
Definition: ScriptedCreature.h:140
SummonList summons
Definition: ScriptedCreature.h:511
uint32 GetEntry() const
Definition: Object.h:115
Definition: Object.h:410

References SummonList::DoForAllSummons(), Object::GetEntry(), NPC_FIRE_BOMB, and BossAI::summons.

◆ CheckEvadeIfOutOfCombatArea()

bool boss_janalai::CheckEvadeIfOutOfCombatArea ( ) const
inlineoverridevirtual

Reimplemented from ScriptedAI.

365 {
366 return me->GetPositionZ() <= 12.0f;
367 }
float GetPositionZ() const
Definition: Position.h:118

◆ DamageDealt()

void boss_janalai::DamageDealt ( Unit ,
uint32 ,
DamageEffectType   
)
inlineoverridevirtual

Called at any Damage to any victim (before damage apply)

Reimplemented from UnitAI.

174 {
176 {
177 if (!me->HasInArc(M_PI / 6, target))
178 damage = 0;
179 }
180 }
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition: Position.cpp:141
bool _isFlameBreathing
Definition: boss_janalai.cpp:370

References _isFlameBreathing, Position::HasInArc(), and ScriptedAI::me.

◆ FireWall()

void boss_janalai::FireWall ( )
inline
271 {
272 for (uint8 i = 0; i < 4; ++i)
273 {
274 uint8 wallNum = i == 0 || i == 2 ? 3 : 2;
275
276 for (uint8 j = 0; j < wallNum; j++)
277 {
278 Creature* wall = wallNum == 3
279 ? me->SummonCreature(NPC_FIRE_BOMB, fireWallCoords[i].GetPositionX(), fireWallCoords[i].GetPositionY() + 5 * (j - 1), fireWallCoords[i].GetPositionZ(), fireWallCoords[i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 15000)
280 : me->SummonCreature(NPC_FIRE_BOMB, fireWallCoords[i].GetPositionX() - 2 + 4 * j, fireWallCoords[i].GetPositionY(), fireWallCoords[i].GetPositionZ(), fireWallCoords[i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 15000);
281
282 if (wall)
283 wall->AI()->DoCastSelf(SPELL_FIRE_WALL, true);
284 }
285 }
286 }
std::uint8_t uint8
Definition: Define.h:109
@ SPELL_FIRE_WALL
Definition: boss_janalai.cpp:43
const Position fireWallCoords[4]
Definition: boss_janalai.cpp:77
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:48
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition: UnitAI.h:392
Definition: Creature.h:43
CreatureAI * AI() const
Definition: Creature.h:140
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 Creature::AI(), UnitAI::DoCastSelf(), fireWallCoords, ScriptedAI::me, NPC_FIRE_BOMB, SPELL_FIRE_WALL, WorldObject::SummonCreature(), and TEMPSUMMON_TIMED_DESPAWN.

◆ HatchAllEggs()

bool boss_janalai::HatchAllEggs ( uint32  hatchAction)
inline
250 {
251 std::list<Creature* > eggList;
252 me->GetCreaturesWithEntryInRange(eggList, 100.0f, NPC_EGG);
253 if (eggList.empty())
254 return false;
255
256 if (hatchAction == HATCH_RESET)
257 {
258 for (Creature* egg : eggList)
259 egg->Respawn();
260
262 }
263 else if (hatchAction == HATCH_ALL)
265
266 eggList.clear();
267 return true;
268 }
@ NPC_AMANI_HATCHLING
Definition: zulaman.h:60
@ HATCH_ALL
Definition: boss_janalai.cpp:106
@ HATCH_RESET
Definition: boss_janalai.cpp:105
@ NPC_EGG
Definition: boss_janalai.cpp:68
@ SPELL_HATCH_EGG_ALL
Definition: boss_janalai.cpp:57
void DespawnEntry(uint32 entry)
Definition: ScriptedCreature.cpp:54
void GetCreaturesWithEntryInRange(std::list< Creature * > &creatureList, float radius, uint32 entry)
Definition: Object.cpp:3097

References SummonList::DespawnEntry(), UnitAI::DoCastSelf(), WorldObject::GetCreaturesWithEntryInRange(), HATCH_ALL, HATCH_RESET, ScriptedAI::me, NPC_AMANI_HATCHLING, NPC_EGG, SPELL_HATCH_EGG_ALL, and BossAI::summons.

Referenced by Reset().

◆ JustDied()

void boss_janalai::JustDied ( Unit killer)
inlineoverridevirtual

Reimplemented from BossAI.

155 {
157 BossAI::JustDied(killer);
158 }
Talk
Definition: hyjal.cpp:82
@ SAY_DEATH
Definition: boss_janalai.cpp:34
void JustDied(Unit *) override
Definition: ScriptedCreature.h:499

References BossAI::JustDied(), and SAY_DEATH.

◆ JustEngagedWith()

void boss_janalai::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from BossAI.

183 {
186 //schedule abilities
187 ScheduleTimedEvent(30s, [&]{
188 StartBombing();
189 }, 20s, 40s);
190
191 scheduler.Schedule(10s, GROUP_HATCHING, [this](TaskContext context)
192 {
193 if (_sideHatched[0] && _sideHatched[1])
194 return;
195
197
198 if (_sideHatched[0] && !_sideHatched[1])
199 {
202 }
203 else if (!_sideHatched[0] && _sideHatched[1])
204 {
207 }
208 else
209 {
212 }
213
214 context.Repeat(90s);
215 });
216
217 ScheduleTimedEvent(8s, [&]{
218 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
219 {
220 me->AttackStop();
221 me->GetMotionMaster()->Clear();
222 DoCast(target, SPELL_FLAME_BREATH);
223 me->StopMoving();
224 _isFlameBreathing = true;
225 // placeholder time idk yet
226 scheduler.Schedule(2s, [this](TaskContext)
227 {
228 _isFlameBreathing = false;
229 });
230 }
231 }, 8s);
232
235 }, 5min, 5min, GROUP_ENRAGE);
236
240 }, 10min);
241 }
@ NPC_AMANI_HATCHER
Definition: boss_janalai.cpp:67
@ GROUP_ENRAGE
Definition: boss_janalai.cpp:112
@ GROUP_HATCHING
Definition: boss_janalai.cpp:113
@ SAY_AGGRO
Definition: boss_janalai.cpp:28
@ SAY_SUMMON_HATCHER
Definition: boss_janalai.cpp:30
@ SAY_BERSERK
Definition: boss_janalai.cpp:32
@ SPELL_ENRAGE
Definition: boss_janalai.cpp:44
@ SPELL_FLAME_BREATH
Definition: boss_janalai.cpp:42
@ SPELL_BERSERK
Definition: boss_janalai.cpp:48
const Position hatcherway[2][5]
Definition: boss_janalai.cpp:85
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: Object.h:51
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:107
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:232
Definition: TaskScheduler.h:421
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:493
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
void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
Definition: ScriptedCreature.cpp:321
void JustEngagedWith(Unit *) override
Called for reaction when initially engaged.
Definition: ScriptedCreature.h:497
EventProcessor m_Events
Definition: Object.h:642
Definition: Unit.h:630
MotionMaster * GetMotionMaster()
Definition: Unit.h:1620
void StopMoving()
Definition: Unit.cpp:16650
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition: Unit.cpp:10403
void StartBombing()
Definition: boss_janalai.cpp:313
bool _sideHatched[2]
Definition: boss_janalai.cpp:371

References _isFlameBreathing, _sideHatched, EventProcessor::AddEventAtOffset(), Unit::AttackStop(), UnitAI::DoCast(), UnitAI::DoCastSelf(), Unit::GetMotionMaster(), GROUP_ENRAGE, GROUP_HATCHING, hatcherway, BossAI::JustEngagedWith(), WorldObject::m_Events, ScriptedAI::me, NPC_AMANI_HATCHER, TaskContext::Repeat(), SAY_AGGRO, SAY_BERSERK, SAY_SUMMON_HATCHER, TaskScheduler::Schedule(), CreatureAI::scheduler, ScriptedAI::ScheduleTimedEvent(), UnitAI::SelectTarget(), SPELL_BERSERK, SPELL_ENRAGE, SPELL_FLAME_BREATH, StartBombing(), Unit::StopMoving(), WorldObject::SummonCreature(), and TEMPSUMMON_CORPSE_TIMED_DESPAWN.

◆ JustSummoned()

void boss_janalai::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from BossAI.

161 {
162 if (summon->GetEntry() == NPC_AMANI_HATCHLING)
163 {
164 if (summon->GetPositionY() > 1150)
165 summon->GetMotionMaster()->MovePoint(0, hatcherway[0][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[0][3].GetPositionY());
166 else
167 summon->GetMotionMaster()->MovePoint(0, hatcherway[1][3].GetPositionX() + rand() % 4 - 2, 1150.0f + rand() % 4 - 2, hatcherway[1][3].GetPositionY());
168 }
169
170 BossAI::JustSummoned(summon);
171 }
void JustSummoned(Creature *summon) override
Definition: ScriptedCreature.cpp:703
float GetPositionY() const
Definition: Position.h:117
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:213

References Object::GetEntry(), Unit::GetMotionMaster(), Position::GetPositionY(), hatcherway, BossAI::JustSummoned(), MotionMaster::MovePoint(), and NPC_AMANI_HATCHLING.

◆ Reset()

void boss_janalai::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

128 {
131 _isBombing = false;
132 _isFlameBreathing = false;
133
136 me->AttackStop();
141 });
142
144 if (!me->HasAura(SPELL_ENRAGE))
147 });
148
149 me->m_Events.KillAllEvents(false);
150 _sideHatched[0] = false;
151 _sideHatched[1] = false;
152 }
const Position janalainPos
Definition: boss_janalai.cpp:75
@ SAY_ALL_EGGS
Definition: boss_janalai.cpp:31
@ SPELL_HATCH_ALL
Definition: boss_janalai.cpp:47
void KillAllEvents(bool force)
Definition: EventProcessor.cpp:82
void CancelEventGroup(uint8 group)
Definition: EventProcessor.cpp:114
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:248
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 SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3154
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5698
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16689
void Clear(bool reset=true)
Definition: MotionMaster.h:167
bool HatchAllEggs(uint32 hatchAction)
Definition: boss_janalai.cpp:249
bool _isBombing
Definition: boss_janalai.cpp:369

References _isBombing, _isFlameBreathing, _sideHatched, Unit::AttackStop(), EventProcessor::CancelEventGroup(), MotionMaster::Clear(), UnitAI::DoCastAOE(), UnitAI::DoCastSelf(), Unit::GetMotionMaster(), GROUP_ENRAGE, Unit::HasAura(), HATCH_RESET, HatchAllEggs(), janalainPos, EventProcessor::KillAllEvents(), WorldObject::m_Events, ScriptedAI::me, BossAI::Reset(), SAY_ALL_EGGS, BossAI::ScheduleHealthCheckEvent(), Creature::SetPosition(), SPELL_ENRAGE, SPELL_HATCH_ALL, and Unit::StopMovingOnCurrentPos().

◆ SetData()

void boss_janalai::SetData ( uint32  index,
uint32  data 
)
inlineoverridevirtual

Reimplemented from UnitAI.

244 {
245 if (index == DATA_ALL_EGGS_HATCHED)
246 _sideHatched[data] = true;
247 }
@ DATA_ALL_EGGS_HATCHED
Definition: boss_janalai.cpp:114

References _sideHatched, and DATA_ALL_EGGS_HATCHED.

◆ SpawnBombs()

void boss_janalai::SpawnBombs ( )
inline
289 {
290 float dx, dy;
291 for (int i = 0; i < MAX_BOMB_COUNT; ++i)
292 {
293 dx = float(irand(-area_dx / 2, area_dx / 2));
294 dy = float(irand(-area_dy / 2, area_dy / 2));
296 }
297 }
int32 irand(int32 min, int32 max)
Definition: Random.cpp:37
const int area_dx
Definition: boss_janalai.cpp:72
@ MAX_BOMB_COUNT
Definition: boss_janalai.cpp:111
const int area_dy
Definition: boss_janalai.cpp:73
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
Definition: ScriptedCreature.cpp:316

References area_dx, area_dy, ScriptedAI::DoSpawnCreature(), irand(), MAX_BOMB_COUNT, NPC_FIRE_BOMB, and TEMPSUMMON_TIMED_DESPAWN.

◆ StartBombing()

void boss_janalai::StartBombing ( )
inline
314 {
316 me->AttackStop();
321
322 FireWall();
323 SpawnBombs();
324 _isBombing = true;
325
326 me->GetMap()->DoForAllPlayers([&](Player* player)
327 {
328 if (player->IsAlive())
329 DoTeleportPlayer(player, janalainPos.GetPositionX() - 5 + rand() % 10, janalainPos.GetPositionY() - 5 + rand() % 10, janalainPos.GetPositionZ(), 0.0f);
330 });
331 //DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far
332 ThrowBombs();
333
334 scheduler.Schedule(11s, [this](TaskContext)
335 {
336 Boom();
337 _isBombing = false;
338
340 });
341 }
@ SAY_FIRE_BOMBS
Definition: boss_janalai.cpp:29
@ SPELL_FIRE_BOMB_CHANNEL
Definition: boss_janalai.cpp:51
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
Definition: ScriptedCreature.cpp:464
Map * GetMap() const
Definition: Object.h:536
float GetPositionX() const
Definition: Position.h:116
Definition: Player.h:1081
bool IsAlive() const
Definition: Unit.h:1654
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4909
void DoForAllPlayers(std::function< void(Player *)> exec)
Definition: Map.cpp:3827
void Boom()
Definition: boss_janalai.cpp:299
void ThrowBombs()
Definition: boss_janalai.cpp:343
void SpawnBombs()
Definition: boss_janalai.cpp:288
void FireWall()
Definition: boss_janalai.cpp:270

References Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::IsAlive(), janalainPos, SAY_FIRE_BOMBS, and SPELL_FIRE_BOMB_CHANNEL.

Referenced by JustEngagedWith().

◆ ThrowBombs()

void boss_janalai::ThrowBombs ( )
inline
344 {
345 std::chrono::milliseconds bombTimer = 100ms;
346
347 summons.DoForAllSummons([this, &bombTimer](WorldObject* summon) {
348 if (summon->GetEntry() == NPC_FIRE_BOMB)
349 {
350 if (Creature* bomb = summon->ToCreature())
351 {
352 bomb->m_Events.AddEventAtOffset([this, bomb] {
353 bomb->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
354 DoCast(bomb, SPELL_FIRE_BOMB_THROW, true);
355 bomb->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
356 }, bombTimer);
357 }
358
359 bombTimer += 100ms;
360 }
361 });
362 }

References Object::GetEntry(), NPC_FIRE_BOMB, and summons.

Member Data Documentation

◆ _isBombing

bool boss_janalai::_isBombing
private

Referenced by Reset().

◆ _isFlameBreathing

bool boss_janalai::_isFlameBreathing
private

Referenced by DamageDealt(), JustEngagedWith(), and Reset().

◆ _sideHatched

bool boss_janalai::_sideHatched[2]
private

Referenced by JustEngagedWith(), Reset(), and SetData().