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) More...
 
void OnPowerUpdate (Powers, int32, int32, uint32 currentPower) override
 Called when the creature power updates. More...
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
 ~BossAI () override
 
bool CanRespawn () override
 
void DamageTaken (Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
 Called at any Damage from any attacker (before damage apply) More...
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
void SummonedCreatureDespawnAll () override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
void ScheduleHealthCheckEvent (uint32 healthPct, std::function< void()> exec)
 Executes a function once the creature reaches the defined health point percent. More...
 
void ScheduleHealthCheckEvent (std::initializer_list< uint8 > healthPct, std::function< void()> exec)
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER) override
 
void JustDied (Unit *) override
 
void JustReachedHome () override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply) More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged. More...
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
- 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)
 
 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

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
111: BossAI(creature, DATA_ARAN), _atieshReaction(false) { }
@ DATA_ARAN
Definition: karazhan.h:36
Definition: ScriptedCreature.h:457
bool _atieshReaction
Definition: boss_shade_of_aran.cpp:395

Member Function Documentation

◆ AttackStart()

void boss_shade_of_aran::AttackStart ( Unit who)
inlineoverridevirtual

Reimplemented from ScriptedAI.

168 {
169 if (who && who->isTargetableForAttack() && me->GetReactState() != REACT_PASSIVE)
170 {
171 if (me->Attack(who, false))
172 {
173 me->GetMotionMaster()->MoveChase(who, 45.0f, 0);
174 me->AddThreat(who, 0.0f);
175 }
176 }
177 }
@ REACT_PASSIVE
Definition: Unit.h:548
Creature * me
Definition: ScriptedCreature.h:280
ReactStates GetReactState() const
Definition: Creature.h:98
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: Unit.cpp:14608
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:10234
bool isTargetableForAttack(bool checkFakeDeath=true, Unit const *byWho=nullptr) const
Definition: Unit.cpp:13811
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

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
149 {
151 }
Position const roomCenter
Definition: boss_shade_of_aran.cpp:105
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1263
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118

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

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

197 {
198 BossAI::DamageTaken(doneBy, damage, damagetype, damageSchoolMask);
199
200 if ((damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE) && _drinking && me->GetReactState() == REACT_PASSIVE)
201 {
208 {
210 _drinking = false;
211 });
212 }
213 }
@ REACT_AGGRESSIVE
Definition: Unit.h:550
@ DIRECT_DAMAGE
Definition: Unit.h:248
@ SPELL_DIRECT_DAMAGE
Definition: Unit.h:249
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:32
@ SPELL_DRINK
Definition: boss_shade_of_aran.cpp:63
@ SPELL_AOE_PYROBLAST
Definition: boss_shade_of_aran.cpp:65
@ GROUP_DRINKING
Definition: boss_shade_of_aran.cpp:97
@ POWER_MANA
Definition: SharedDefines.h:269
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:229
TaskScheduler & CancelGroup(group_t const group)
Definition: TaskScheduler.cpp:53
Definition: TaskScheduler.h:415
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition: UnitAI.h:392
void DamageTaken(Unit *attacker, uint32 &damage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask) override
Called at any Damage from any attacker (before damage apply)
Definition: ScriptedCreature.cpp:718
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:97
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15521
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:892
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4891
void SetStandState(uint8 state)
Definition: Unit.cpp:16682
TaskScheduler _drinkScheduler
Definition: boss_shade_of_aran.cpp:388
bool _drinking
Definition: boss_shade_of_aran.cpp:393

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

185 {
187 _JustDied();
188
190 {
191 libraryDoor->SetGoState(GO_STATE_ACTIVE);
192 libraryDoor->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
193 }
194 }
@ GO_STATE_ACTIVE
Definition: GameObjectData.h:690
@ SAY_DEATH
Definition: boss_shade_of_aran.cpp:40
@ DATA_GO_LIBRARY_DOOR
Definition: karazhan.h:51
Talk
Definition: hyjal.cpp:82
@ GO_FLAG_NOT_SELECTABLE
Definition: SharedDefines.h:1607
InstanceScript *const instance
Definition: ScriptedCreature.h:464
void _JustDied()
Definition: ScriptedCreature.cpp:614
Definition: GameObject.h:121
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:95
Map * instance
Definition: InstanceScript.h:148
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3319

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

252 {
255
256 //handle timed closing door
257 scheduler.Schedule(15s, [this](TaskContext)
258 {
260 {
261 libraryDoor->SetGoState(GO_STATE_READY);
262 libraryDoor->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
263 }
264 }).Schedule(1s, [this](TaskContext context)
265 {
266 if (!_drinking)
267 {
268 if (me->IsNonMeleeSpellCast(false))
269 {
270 return;
271 }
272
273 std::list<uint32> normalSpells = { SPELL_ARCANE_MISSILE, SPELL_FIREBALL, SPELL_FROSTBOLT };
274 normalSpells.remove_if([&](uint32 spell) -> bool { return !me->CanCastSpell(spell); });
275
276 if (!normalSpells.empty())
277 {
278 // If we are able to cast spells, cast them.
279 _currentNormalSpell = Acore::Containers::SelectRandomContainerElement(normalSpells);
280
281 DoCastRandomTarget(_currentNormalSpell, 0, 100.0f);
282 if (me->GetVictim())
283 {
284 me->GetMotionMaster()->MoveChase(me->GetVictim(), 45.0f);
285 }
286 }
287 else
288 {
289 // Otherwise, chase in melee range for auto attacks (and drink mana potion, if needed).
290 me->SetWalk(false);
292
293 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_currentNormalSpell))
294 {
295 if (int32(me->GetPower(POWER_MANA)) < spellInfo->CalcPowerCost(me, (SpellSchoolMask)spellInfo->SchoolMask))
296 {
297 DoCastSelf(SPELL_POTION);
298 }
299 }
300 }
301 }
302 context.Repeat(2s);
303 }).Schedule(5s, [this](TaskContext context)
304 {
305 if (!_drinking)
306 {
308 }
309 context.Repeat(5s, 20s);
310 }).Schedule(6s, [this](TaskContext context)
311 {
312 if (!_drinking)
313 {
315
317
318 std::vector<uint32> superSpells = { SPELL_SUMMON_BLIZZARD, SPELL_AEXPLOSION, SPELL_FLAME_WREATH };
319
320 // Workaround for SelectRandomContainerElementIf
321 std::vector<uint32> allowedSpells;
322 std::copy_if(superSpells.begin(), superSpells.end(), std::back_inserter(allowedSpells), [&](uint32 superSpell) -> bool { return superSpell != _lastSuperSpell; });
323 _lastSuperSpell = allowedSpells[urand(0, allowedSpells.size() - 1)];
324
325 // SelectRandomContainerElementIf produces unexpected output. Reintroduce when issue is resolved:
326 // Sample results:
327 // Selected Super Spell: 3722304989
328 // superSpells elements : 29969 29973 30004
329 // _lastSuperSpell = Acore::Containers::SelectRandomContainerElementIf(superSpells, [&](uint32 superSpell) -> bool { return superSpell != _lastSuperSpell; });
330
331 me->InterruptNonMeleeSpells(true); // Super spell should have prio over normal spells
332
333 switch (_lastSuperSpell)
334 {
335 case SPELL_AEXPLOSION:
340 break;
343 break;
346 break;
347 }
348
350 }
351 context.Repeat(35s, 40s);
352 }).Schedule(12min, [this](TaskContext context)
353 {
354 for (uint32 i = 0; i < 5; ++i)
355 {
356 if (Creature* unit = me->SummonCreature(NPC_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
357 {
358 unit->Attack(me->GetVictim(), true);
359 unit->SetFaction(me->GetFaction());
360 }
361 }
362
364
365 context.Repeat(1min);
366 });
367 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
std::uint32_t uint32
Definition: Define.h:107
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: Object.h:48
#define sSpellMgr
Definition: SpellMgr.h:825
@ NPC_SHADOW_OF_ARAN
Definition: boss_shade_of_aran.cpp:85
@ SPELL_CHAINSOFICE
Definition: boss_shade_of_aran.cpp:50
@ SPELL_PLAYERPULL
Definition: boss_shade_of_aran.cpp:58
@ SPELL_AOE_CS
Definition: boss_shade_of_aran.cpp:57
@ SPELL_FLAME_WREATH
Definition: boss_shade_of_aran.cpp:53
@ SPELL_MASSSLOW
Definition: boss_shade_of_aran.cpp:52
@ SPELL_BLINK_CENTER
Definition: boss_shade_of_aran.cpp:61
@ SPELL_AEXPLOSION
Definition: boss_shade_of_aran.cpp:59
@ SPELL_SUMMON_BLIZZARD
Definition: boss_shade_of_aran.cpp:72
@ EMOTE_ARCANE_EXPLOSION
Definition: boss_shade_of_aran.cpp:42
@ SAY_AGGRO
Definition: boss_shade_of_aran.cpp:32
@ SAY_FLAMEWREATH
Definition: boss_shade_of_aran.cpp:33
@ SAY_TIMEOVER
Definition: boss_shade_of_aran.cpp:39
@ SAY_BLIZZARD
Definition: boss_shade_of_aran.cpp:34
@ SAY_EXPLOSION
Definition: boss_shade_of_aran.cpp:35
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:485
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
TaskScheduler scheduler
Definition: CreatureAI.h:76
void _JustEngagedWith()
Definition: ScriptedCreature.cpp:627
Definition: Creature.h:46
void ClearProhibitedSpellTimers()
Definition: Creature.cpp:2839
bool SetWalk(bool enable) override
Enable or disable the creature's walk mode by removing: MOVEMENTFLAG_WALKING. Infom also the client.
Definition: Creature.cpp:3178
void ResumeChasingVictim()
Helper to resume chasing current victim.
Definition: Creature.h:409
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:2355
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4111
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4081
uint32 GetFaction() const
Definition: Unit.h:755
Unit * GetVictim() const
Definition: Unit.h:789
Definition: SpellInfo.h:316
uint32 _currentNormalSpell
Definition: boss_shade_of_aran.cpp:390
uint32 _lastSuperSpell
Definition: boss_shade_of_aran.cpp:391

References _currentNormalSpell, _drinking, BossAI::_JustEngagedWith(), DATA_GO_LIBRARY_DOOR, Map::GetGameObject(), InstanceScript::GetGuidData(), BossAI::instance, InstanceScript::instance, Unit::IsNonMeleeSpellCast(), ScriptedAI::me, Creature::ResumeChasingVictim(), SAY_AGGRO, TaskScheduler::Schedule(), CreatureAI::scheduler, Creature::SetWalk(), and sSpellMgr.

◆ KilledUnit()

void boss_shade_of_aran::KilledUnit ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

180 {
181 Talk(SAY_KILL);
182 }
@ SAY_KILL
Definition: boss_shade_of_aran.cpp:38

References SAY_KILL.

◆ OnPowerUpdate()

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

Called when the creature power updates.

Reimplemented from UnitAI.

216 {
217 // Should drink at 10%, need 10% mana for mass polymorph
218 if (!_hasDrunk && me->GetMaxPower(POWER_MANA) && (currentPower * 100 / me->GetMaxPower(POWER_MANA)) < 13.5)
219 {
220 _hasDrunk = true;
222
223 // Start drinking after conjuring drinks
225 {
230 // If we set drinking earlier it will break when someone attacks aran while casting poly
231 _drinking = true;
232 }).Schedule(3s, GROUP_DRINKING, [this](TaskContext)
233 {
235 }).Schedule(6s, GROUP_DRINKING, [this](TaskContext)
236 {
239 }).Schedule(12s, GROUP_DRINKING, [this](TaskContext)
240 {
246 _drinking = false;
247 });
248 }
249 }
@ UNIT_STAND_STATE_SIT
Definition: UnitDefines.h:33
@ SPELL_CONJURE
Definition: boss_shade_of_aran.cpp:62
@ SPELL_MASS_POLY
Definition: boss_shade_of_aran.cpp:60
@ SPELL_ARCANE_MISSILE
Definition: boss_shade_of_aran.cpp:49
@ SAY_DRINK
Definition: boss_shade_of_aran.cpp:36
bool _hasDrunk
Definition: boss_shade_of_aran.cpp:394

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

114 {
116 // Reset the mana of the boss fully before resetting drinking
117 // If this was omitted, the boss would start drinking on reset if the mana was low on a wipe
120
121 _lastSuperSpell = 0;
123
124 _drinking = false;
125 _hasDrunk = false;
126
127 for (auto spell : immuneSpells)
128 me->ApplySpellImmune(0, IMMUNITY_ID, spell, true);
129
131 {
132 libraryDoor->SetGoState(GO_STATE_ACTIVE);
133 libraryDoor->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
134 }
135
138
140
141 for (auto const& spell : elementalSpells)
142 {
143 DoCastAOE(spell, true);
144 }
145 });
146 }
@ SPELL_SUMMON_WELEMENTAL_2
Definition: boss_shade_of_aran.cpp:68
@ SPELL_SUMMON_WELEMENTAL_3
Definition: boss_shade_of_aran.cpp:69
@ SPELL_SUMMON_WELEMENTAL_4
Definition: boss_shade_of_aran.cpp:70
@ SPELL_SUMMON_WELEMENTAL_1
Definition: boss_shade_of_aran.cpp:67
std::vector< uint32 > immuneSpells
Definition: boss_shade_of_aran.cpp:107
@ SAY_ELEMENTALS
Definition: boss_shade_of_aran.cpp:37
@ IMMUNITY_ID
Definition: SharedDefines.h:1400
TaskScheduler & CancelAll()
Definition: TaskScheduler.cpp:45
void ScheduleHealthCheckEvent(uint32 healthPct, std::function< void()> exec)
Executes a function once the creature reaches the defined health point percent.
Definition: ScriptedCreature.cpp:744
void Reset() override
Definition: ScriptedCreature.h:486
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13346

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.

154 {
156 {
158 _atieshReaction = true;
159 if (Unit* atieshOwner = ObjectAccessor::GetUnit(*me, guid))
160 {
161 me->PauseMovement(3000);
162 me->SetFacingToObject(atieshOwner);
163 }
164 }
165 }
@ ACTION_ATIESH_REACT
Definition: boss_shade_of_aran.cpp:102
@ SAY_ATIESH
Definition: boss_shade_of_aran.cpp:41
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
Definition: Unit.h:630
void SetFacingToObject(WorldObject *object)
Definition: Unit.cpp:20493
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:16625

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

Reimplemented from BossAI.

370 {
371 scheduler.Update(diff);
373
374 if (!UpdateVictim())
375 return;
376
377 if (!CheckAranInRoom())
378 {
380 return;
381 }
382
383 if (!_drinking)
385 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition: TaskScheduler.cpp:27
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
bool UpdateVictim()
Definition: CreatureAI.cpp:269
void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER) override
Definition: ScriptedCreature.h:488
bool CheckAranInRoom()
Definition: boss_shade_of_aran.cpp:148

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

Referenced by DamageTaken(), OnPowerUpdate(), and Reset().

◆ _hasDrunk

bool boss_shade_of_aran::_hasDrunk
private

Referenced by OnPowerUpdate(), and Reset().

◆ _lastSuperSpell

uint32 boss_shade_of_aran::_lastSuperSpell
private

Referenced by Reset().