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

Public Member Functions

 boss_shade_of_aran (Creature *creature)
 
void Reset () override
 
bool CheckAranInRoom ()
 
void SetGUID (ObjectGuid guid, int32 id) override
 
void AttackStart (Unit *who) override
 
void KilledUnit (Unit *) override
 
void JustDied (Unit *) override
 
void DamageTaken (Unit *doneBy, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void OnPowerUpdate (Powers, int32, int32, uint32 currentPower) override
 Called when the creature power updates.
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
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 ()
 
virtual void PathEndReached (uint32)
 
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 void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
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 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

TaskScheduler _drinkScheduler
 
uint32 _currentNormalSpell
 
uint32 _lastSuperSpell
 
bool _drinking
 
bool _hasDrunk
 
bool _atieshReaction
 

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

boss_shade_of_aran::boss_shade_of_aran ( Creature creature)
inline
112: BossAI(creature, DATA_ARAN), _atieshReaction(false) { }
Definition ScriptedCreature.h:467
@ DATA_ARAN
Definition karazhan.h:36
bool _atieshReaction
Definition boss_shade_of_aran.cpp:396

Member Function Documentation

◆ AttackStart()

void boss_shade_of_aran::AttackStart ( Unit who)
inlineoverridevirtual

Reimplemented from UnitAI.

169 {
170 if (who && who->isTargetableForAttack() && me->GetReactState() != REACT_PASSIVE)
171 {
172 if (me->Attack(who, false))
173 {
174 me->GetMotionMaster()->MoveChase(who, 45.0f, 0);
175 me->AddThreat(who, 0.0f);
176 }
177 }
178 }
@ REACT_PASSIVE
Definition Unit.h:548
ReactStates GetReactState() const
Definition Creature.h:96
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:313
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition Unit.cpp:14705
MotionMaster * GetMotionMaster()
Definition Unit.h:1673
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:10313
bool isTargetableForAttack(bool checkFakeDeath=true, Unit const *byWho=nullptr) const
Definition Unit.cpp:13906
Creature * me
Definition ScriptedCreature.h:280

References Unit::AddThreat(), Unit::Attack(), Unit::GetMotionMaster(), Creature::GetReactState(), Unit::isTargetableForAttack(), ScriptedAI::me, MotionMaster::MoveChase(), and REACT_PASSIVE.

◆ CheckAranInRoom()

bool boss_shade_of_aran::CheckAranInRoom ( )
inline
150 {
152 }
Position const roomCenter
Definition boss_shade_of_aran.cpp:106
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1274
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References WorldObject::GetDistance2d(), Position::GetPositionX(), Position::GetPositionY(), ScriptedAI::me, and roomCenter.

Referenced by UpdateAI().

◆ DamageTaken()

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

198 {
199 BossAI::DamageTaken(doneBy, damage, damagetype, damageSchoolMask);
200
201 if ((damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE) && _drinking && me->GetReactState() == REACT_PASSIVE)
202 {
209 {
211 _drinking = false;
212 });
213 }
214 }
@ POWER_MANA
Definition SharedDefines.h:269
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:32
@ REACT_AGGRESSIVE
Definition Unit.h:550
@ DIRECT_DAMAGE
Definition Unit.h:248
@ SPELL_DIRECT_DAMAGE
Definition Unit.h:249
@ SPELL_DRINK
Definition boss_shade_of_aran.cpp:64
@ SPELL_AOE_PYROBLAST
Definition boss_shade_of_aran.cpp:66
@ GROUP_DRINKING
Definition boss_shade_of_aran.cpp:98
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
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:95
Definition TaskScheduler.h:421
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition TaskScheduler.h:232
TaskScheduler & CancelGroup(group_t const group)
Definition TaskScheduler.cpp:53
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition UnitAI.h:392
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition Unit.cpp:15618
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1066
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4941
void SetStandState(uint8 state)
Definition Unit.cpp:16778
TaskScheduler _drinkScheduler
Definition boss_shade_of_aran.cpp:389
bool _drinking
Definition boss_shade_of_aran.cpp:394

References _drinking, _drinkScheduler, TaskScheduler::CancelGroup(), BossAI::DamageTaken(), DIRECT_DAMAGE, UnitAI::DoCastSelf(), Unit::GetMaxPower(), Creature::GetReactState(), GROUP_DRINKING, ScriptedAI::me, POWER_MANA, REACT_AGGRESSIVE, REACT_PASSIVE, Unit::RemoveAurasDueToSpell(), TaskScheduler::Schedule(), Unit::SetPower(), Creature::SetReactState(), Unit::SetStandState(), SPELL_AOE_PYROBLAST, SPELL_DIRECT_DAMAGE, SPELL_DRINK, and UNIT_STAND_STATE_STAND.

◆ JustDied()

void boss_shade_of_aran::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

186 {
188 _JustDied();
189
191 {
192 libraryDoor->SetGoState(GO_STATE_ACTIVE);
193 libraryDoor->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
194 }
195 }
@ GO_STATE_ACTIVE
Definition GameObjectData.h:689
@ GO_FLAG_NOT_SELECTABLE
Definition SharedDefines.h:1607
@ SAY_DEATH
Definition boss_shade_of_aran.cpp:41
InstanceScript *const instance
Definition ScriptedCreature.h:474
void _JustDied()
Definition ScriptedCreature.cpp:644
Definition GameObject.h:120
ObjectGuid GetGuidData(uint32 type) const override
Definition InstanceScript.cpp:110
Map * instance
Definition InstanceScript.h:149
GameObject * GetGameObject(ObjectGuid const guid)
Definition Map.cpp:2503
Talk
Definition hyjal.cpp:82
@ DATA_GO_LIBRARY_DOOR
Definition karazhan.h:51

References BossAI::_JustDied(), DATA_GO_LIBRARY_DOOR, Map::GetGameObject(), InstanceScript::GetGuidData(), GO_FLAG_NOT_SELECTABLE, GO_STATE_ACTIVE, BossAI::instance, InstanceScript::instance, and SAY_DEATH.

◆ JustEngagedWith()

void boss_shade_of_aran::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from CreatureAI.

253 {
256
257 //handle timed closing door
258 scheduler.Schedule(15s, [this](TaskContext)
259 {
261 {
262 libraryDoor->SetGoState(GO_STATE_READY);
263 libraryDoor->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
264 }
265 }).Schedule(1s, [this](TaskContext context)
266 {
267 if (!_drinking)
268 {
269 if (me->IsNonMeleeSpellCast(false))
270 {
271 return;
272 }
273
274 std::list<uint32> normalSpells = { SPELL_ARCANE_MISSILE, SPELL_FIREBALL, SPELL_FROSTBOLT };
275 normalSpells.remove_if([&](uint32 spell) -> bool { return !me->CanCastSpell(spell); });
276
277 if (!normalSpells.empty())
278 {
279 // If we are able to cast spells, cast them.
281
283 if (me->GetVictim())
284 {
285 me->GetMotionMaster()->MoveChase(me->GetVictim(), 45.0f);
286 }
287 }
288 else
289 {
290 // Otherwise, chase in melee range for auto attacks (and drink mana potion, if needed).
291 me->SetWalk(false);
293
294 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_currentNormalSpell))
295 {
296 if (int32(me->GetPower(POWER_MANA)) < spellInfo->CalcPowerCost(me, (SpellSchoolMask)spellInfo->SchoolMask))
297 {
299 }
300 }
301 }
302 }
303 context.Repeat(2s);
304 }).Schedule(5s, [this](TaskContext context)
305 {
306 if (!_drinking)
307 {
309 }
310 context.Repeat(5s, 20s);
311 }).Schedule(6s, [this](TaskContext context)
312 {
313 if (!_drinking)
314 {
316
318
319 std::vector<uint32> superSpells = { SPELL_SUMMON_BLIZZARD, SPELL_AEXPLOSION, SPELL_FLAME_WREATH };
320
321 // Workaround for SelectRandomContainerElementIf
322 std::vector<uint32> allowedSpells;
323 std::copy_if(superSpells.begin(), superSpells.end(), std::back_inserter(allowedSpells), [&](uint32 superSpell) -> bool { return superSpell != _lastSuperSpell; });
324 _lastSuperSpell = allowedSpells[urand(0, allowedSpells.size() - 1)];
325
326 // SelectRandomContainerElementIf produces unexpected output. Reintroduce when issue is resolved:
327 // Sample results:
328 // Selected Super Spell: 3722304989
329 // superSpells elements : 29969 29973 30004
330 // _lastSuperSpell = Acore::Containers::SelectRandomContainerElementIf(superSpells, [&](uint32 superSpell) -> bool { return superSpell != _lastSuperSpell; });
331
332 me->InterruptNonMeleeSpells(true); // Super spell should have prio over normal spells
333
334 switch (_lastSuperSpell)
335 {
336 case SPELL_AEXPLOSION:
341 break;
344 break;
347 break;
348 }
349
351 }
352 context.Repeat(35s, 40s);
353 }).Schedule(12min, [this](TaskContext context)
354 {
355 for (uint32 i = 0; i < 5; ++i)
356 {
357 if (Creature* unit = me->SummonCreature(NPC_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
358 {
359 unit->Attack(me->GetVictim(), true);
360 unit->SetFaction(me->GetFaction());
361 }
362 }
363
365
366 context.Repeat(1min);
367 });
368 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:49
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
SpellSchoolMask
Definition SharedDefines.h:295
#define sSpellMgr
Definition SpellMgr.h:825
@ NPC_SHADOW_OF_ARAN
Definition boss_shade_of_aran.cpp:86
@ SPELL_CHAINSOFICE
Definition boss_shade_of_aran.cpp:51
@ SPELL_PLAYERPULL
Definition boss_shade_of_aran.cpp:59
@ SPELL_AOE_CS
Definition boss_shade_of_aran.cpp:58
@ SPELL_FLAME_WREATH
Definition boss_shade_of_aran.cpp:54
@ SPELL_MASSSLOW
Definition boss_shade_of_aran.cpp:53
@ SPELL_BLINK_CENTER
Definition boss_shade_of_aran.cpp:62
@ SPELL_AEXPLOSION
Definition boss_shade_of_aran.cpp:60
@ SPELL_SUMMON_BLIZZARD
Definition boss_shade_of_aran.cpp:73
@ SPELL_POTION
Definition boss_shade_of_aran.cpp:65
@ EMOTE_ARCANE_EXPLOSION
Definition boss_shade_of_aran.cpp:43
@ SAY_AGGRO
Definition boss_shade_of_aran.cpp:33
@ SAY_FLAMEWREATH
Definition boss_shade_of_aran.cpp:34
@ SAY_TIMEOVER
Definition boss_shade_of_aran.cpp:40
@ SAY_BLIZZARD
Definition boss_shade_of_aran.cpp:35
@ SAY_EXPLOSION
Definition boss_shade_of_aran.cpp:36
void _JustEngagedWith()
Definition ScriptedCreature.cpp:657
TaskScheduler scheduler
Definition CreatureAI.h:75
Definition Creature.h:43
bool CanCastSpell(uint32 spellID) const
Returns true if the creature is able to cast the spell.
Definition Creature.cpp:3845
void ClearProhibitedSpellTimers()
Definition Creature.cpp:2861
bool SetWalk(bool enable) override
Enable or disable the creature's walk mode by removing: MOVEMENTFLAG_WALKING. Infom also the client.
Definition Creature.cpp:3208
void ResumeChasingVictim()
Helper to resume chasing current victim.
Definition Creature.h:414
Definition SpellInfo.h:316
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition TaskScheduler.h:493
SpellCastResult DoCastRandomTarget(uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
Cast the spell on a random unit from the threat list.
Definition UnitAI.cpp:259
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:248
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition Unit.cpp:4161
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:4131
uint32 GetFaction() const
Definition Unit.h:817
Unit * GetVictim() const
Definition Unit.h:862
uint32 GetPower(Powers power) const
Definition Unit.h:1065
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:2368
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:133
uint32 _currentNormalSpell
Definition boss_shade_of_aran.cpp:391
uint32 _lastSuperSpell
Definition boss_shade_of_aran.cpp:392

References _currentNormalSpell, _drinking, BossAI::_JustEngagedWith(), _lastSuperSpell, Creature::CanCastSpell(), Creature::ClearProhibitedSpellTimers(), DATA_GO_LIBRARY_DOOR, UnitAI::DoCastAOE(), UnitAI::DoCastRandomTarget(), UnitAI::DoCastSelf(), EMOTE_ARCANE_EXPLOSION, Unit::GetFaction(), Map::GetGameObject(), InstanceScript::GetGuidData(), Unit::GetMotionMaster(), Unit::GetPower(), Unit::GetVictim(), BossAI::instance, InstanceScript::instance, Unit::InterruptNonMeleeSpells(), Unit::IsNonMeleeSpellCast(), ScriptedAI::me, MotionMaster::MoveChase(), NPC_SHADOW_OF_ARAN, POWER_MANA, TaskContext::Repeat(), Creature::ResumeChasingVictim(), SAY_AGGRO, SAY_BLIZZARD, SAY_EXPLOSION, SAY_FLAMEWREATH, SAY_TIMEOVER, TaskScheduler::Schedule(), CreatureAI::scheduler, Acore::Containers::SelectRandomContainerElement(), Creature::SetWalk(), SPELL_AEXPLOSION, SPELL_AOE_CS, SPELL_BLINK_CENTER, SPELL_CHAINSOFICE, SPELL_FLAME_WREATH, SPELL_MASSSLOW, SPELL_PLAYERPULL, SPELL_POTION, SPELL_SUMMON_BLIZZARD, sSpellMgr, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, and urand().

◆ KilledUnit()

void boss_shade_of_aran::KilledUnit ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

181 {
182 Talk(SAY_KILL);
183 }
@ SAY_KILL
Definition boss_shade_of_aran.cpp:39

References SAY_KILL.

◆ OnPowerUpdate()

void boss_shade_of_aran::OnPowerUpdate ( Powers  ,
int32  ,
int32  ,
uint32   
)
inlineoverridevirtual

Called when the creature power updates.

Reimplemented from UnitAI.

217 {
218 // Should drink at 10%, need 10% mana for mass polymorph
219 if (!_hasDrunk && me->GetMaxPower(POWER_MANA) && (currentPower * 100 / me->GetMaxPower(POWER_MANA)) < 13.5)
220 {
221 _hasDrunk = true;
223
224 // Start drinking after conjuring drinks
226 {
231 // If we set drinking earlier it will break when someone attacks aran while casting poly
232 _drinking = true;
233 }).Schedule(3s, GROUP_DRINKING, [this](TaskContext)
234 {
236 }).Schedule(6s, GROUP_DRINKING, [this](TaskContext)
237 {
240 }).Schedule(12s, GROUP_DRINKING, [this](TaskContext)
241 {
247 _drinking = false;
248 });
249 }
250 }
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:33
@ SPELL_CONJURE
Definition boss_shade_of_aran.cpp:63
@ SPELL_MASS_POLY
Definition boss_shade_of_aran.cpp:61
@ SPELL_ARCANE_MISSILE
Definition boss_shade_of_aran.cpp:50
@ SAY_DRINK
Definition boss_shade_of_aran.cpp:37
bool _hasDrunk
Definition boss_shade_of_aran.cpp:395

References _drinking, _drinkScheduler, _hasDrunk, TaskScheduler::CancelGroup(), UnitAI::DoCastAOE(), UnitAI::DoCastSelf(), Unit::GetMaxPower(), GROUP_DRINKING, Unit::InterruptNonMeleeSpells(), ScriptedAI::me, POWER_MANA, REACT_AGGRESSIVE, REACT_PASSIVE, Unit::RemoveAurasDueToSpell(), SAY_DRINK, TaskScheduler::Schedule(), Unit::SetPower(), Creature::SetReactState(), Unit::SetStandState(), SPELL_AOE_PYROBLAST, SPELL_ARCANE_MISSILE, SPELL_CONJURE, SPELL_DRINK, SPELL_MASS_POLY, UNIT_STAND_STATE_SIT, and UNIT_STAND_STATE_STAND.

◆ Reset()

void boss_shade_of_aran::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

115 {
117 // Reset the mana of the boss fully before resetting drinking
118 // If this was omitted, the boss would start drinking on reset if the mana was low on a wipe
121
122 _lastSuperSpell = 0;
124
125 _drinking = false;
126 _hasDrunk = false;
127
128 for (auto spell : immuneSpells)
129 me->ApplySpellImmune(0, IMMUNITY_ID, spell, true);
130
132 {
133 libraryDoor->SetGoState(GO_STATE_ACTIVE);
134 libraryDoor->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
135 }
136
139
141
142 for (auto const& spell : elementalSpells)
143 {
144 DoCastAOE(spell, true);
145 }
146 });
147 }
@ IMMUNITY_ID
Definition SharedDefines.h:1400
@ SPELL_SUMMON_WELEMENTAL_2
Definition boss_shade_of_aran.cpp:69
@ SPELL_SUMMON_WELEMENTAL_3
Definition boss_shade_of_aran.cpp:70
@ SPELL_SUMMON_WELEMENTAL_4
Definition boss_shade_of_aran.cpp:71
@ SPELL_SUMMON_WELEMENTAL_1
Definition boss_shade_of_aran.cpp:68
std::vector< uint32 > immuneSpells
Definition boss_shade_of_aran.cpp:108
@ SAY_ELEMENTALS
Definition boss_shade_of_aran.cpp:38
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

References _currentNormalSpell, _drinking, _drinkScheduler, _hasDrunk, _lastSuperSpell, Unit::ApplySpellImmune(), TaskScheduler::CancelAll(), DATA_GO_LIBRARY_DOOR, UnitAI::DoCastAOE(), Map::GetGameObject(), InstanceScript::GetGuidData(), Unit::GetMaxPower(), GO_FLAG_NOT_SELECTABLE, GO_STATE_ACTIVE, immuneSpells, IMMUNITY_ID, BossAI::instance, InstanceScript::instance, ScriptedAI::me, POWER_MANA, BossAI::Reset(), SAY_ELEMENTALS, BossAI::ScheduleHealthCheckEvent(), Unit::SetPower(), SPELL_SUMMON_WELEMENTAL_1, SPELL_SUMMON_WELEMENTAL_2, SPELL_SUMMON_WELEMENTAL_3, and SPELL_SUMMON_WELEMENTAL_4.

◆ SetGUID()

void boss_shade_of_aran::SetGUID ( ObjectGuid  guid,
int32  id 
)
inlineoverridevirtual

Reimplemented from UnitAI.

155 {
157 {
159 _atieshReaction = true;
160 if (Unit* atieshOwner = ObjectAccessor::GetUnit(*me, guid))
161 {
162 me->PauseMovement(3000);
163 me->SetFacingToObject(atieshOwner);
164 }
165 }
166 }
@ ACTION_ATIESH_REACT
Definition boss_shade_of_aran.cpp:103
@ SAY_ATIESH
Definition boss_shade_of_aran.cpp:42
Definition Unit.h:636
void SetFacingToObject(WorldObject *object)
Definition Unit.cpp:20591
virtual void PauseMovement(uint32 timer=0, uint8 slot=0)
Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.
Definition Unit.cpp:16721
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition ObjectAccessor.cpp:199

References _atieshReaction, ACTION_ATIESH_REACT, ObjectAccessor::GetUnit(), ScriptedAI::me, Unit::PauseMovement(), SAY_ATIESH, and Unit::SetFacingToObject().

◆ UpdateAI()

void boss_shade_of_aran::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

371 {
372 scheduler.Update(diff);
374
375 if (!UpdateVictim())
376 return;
377
378 if (!CheckAranInRoom())
379 {
381 return;
382 }
383
384 if (!_drinking)
386 }
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition ScriptedCreature.h:504
bool UpdateVictim()
Definition CreatureAI.cpp:280
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:39
bool CheckAranInRoom()
Definition boss_shade_of_aran.cpp:149

References _drinking, _drinkScheduler, CheckAranInRoom(), UnitAI::DoMeleeAttackIfReady(), BossAI::EnterEvadeMode(), CreatureAI::scheduler, TaskScheduler::Update(), and CreatureAI::UpdateVictim().

Member Data Documentation

◆ _atieshReaction

bool boss_shade_of_aran::_atieshReaction
private

Referenced by SetGUID().

◆ _currentNormalSpell

uint32 boss_shade_of_aran::_currentNormalSpell
private

Referenced by JustEngagedWith(), and Reset().

◆ _drinking

bool boss_shade_of_aran::_drinking
private

◆ _drinkScheduler

TaskScheduler boss_shade_of_aran::_drinkScheduler
private

◆ _hasDrunk

bool boss_shade_of_aran::_hasDrunk
private

Referenced by OnPowerUpdate(), and Reset().

◆ _lastSuperSpell

uint32 boss_shade_of_aran::_lastSuperSpell
private

Referenced by JustEngagedWith(), and Reset().


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