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

Public Member Functions

 boss_netherspiteAI (Creature *creature)
 
bool IsBetween (WorldObject *u1, WorldObject *target, WorldObject *u2)
 
float dist (float xa, float ya, float xb, float yb)
 
void Reset () override
 
void SummonPortals ()
 
void DestroyPortals ()
 
void UpdatePortals ()
 
void SwitchToPortalPhase ()
 
void SwitchToBanishPhase ()
 
void HandleDoors (bool open)
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void JustDied (Unit *) override
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 
void UpdateAI (uint32 diff) override
 
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 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 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)
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
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.
 
void Talk (uint8 id, Milliseconds delay)
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
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.
 
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 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
 
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 ==================
 
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 *)
 
- 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
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 
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)
 
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 (NOTE: Creature engage logic should NOT be here, but in JustEngagedWith, which happens once threat is established!)
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
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)
 
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)
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the max threat target, which may not always 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)
 
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
 

Public Attributes

InstanceScriptinstance
 
bool PortalPhase
 
bool Berserk
 
uint32 PhaseTimer
 
uint32 VoidZoneTimer
 
uint32 NetherInfusionTimer
 
uint32 NetherbreathTimer
 
uint32 EmpowermentTimer
 
uint32 PortalTimer
 
ObjectGuid PortalGUID [3]
 
ObjectGuid BeamerGUID [3]
 
ObjectGuid BeamTarget [3]
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
bool IsFleeing
 

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 ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- 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 CreatureAI
Creature *const me
 
EventMap events
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ boss_netherspiteAI()

boss_netherspite::boss_netherspiteAI::boss_netherspiteAI ( Creature creature)
inline
80 : ScriptedAI(creature)
81 {
82 instance = creature->GetInstanceScript();
83 }
Definition: ScriptedCreature.h:192
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
InstanceScript * instance
Definition: boss_netherspite.cpp:85

References WorldObject::GetInstanceScript(), and instance.

Member Function Documentation

◆ DestroyPortals()

void boss_netherspite::boss_netherspiteAI::DestroyPortals ( )
inline
152 {
153 for (int i = 0; i < 3; ++i)
154 {
156 portal->DisappearAndDie();
158 portal->DisappearAndDie();
159 PortalGUID[i].Clear();
160 BeamTarget[i].Clear();
161 }
162 }
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:215
Creature * me
Definition: ScriptedCreature.h:282
Definition: Creature.h:46
void Clear()
Definition: ObjectGuid.h:140
ObjectGuid BeamerGUID[3]
Definition: boss_netherspite.cpp:96
ObjectGuid BeamTarget[3]
Definition: boss_netherspite.cpp:97
ObjectGuid PortalGUID[3]
Definition: boss_netherspite.cpp:95

References BeamerGUID, BeamTarget, ObjectGuid::Clear(), ObjectAccessor::GetCreature(), ScriptedAI::me, and PortalGUID.

Referenced by JustDied(), Reset(), and SwitchToBanishPhase().

◆ dist()

float boss_netherspite::boss_netherspiteAI::dist ( float  xa,
float  ya,
float  xb,
float  yb 
)
inline
120 {
121 return std::sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb));
122 }

Referenced by IsBetween().

◆ HandleDoors()

void boss_netherspite::boss_netherspiteAI::HandleDoors ( bool  open)
inline
249 {
251 Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
252 }
@ GO_STATE_READY
Definition: GameObjectData.h:691
@ GO_STATE_ACTIVE
Definition: GameObjectData.h:690
@ DATA_GO_MASSIVE_DOOR
Definition: karazhan.h:53
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:189
Definition: GameObject.h:122
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:94

References DATA_GO_MASSIVE_DOOR, ObjectAccessor::GetGameObject(), InstanceScript::GetGuidData(), GO_STATE_ACTIVE, GO_STATE_READY, instance, and ScriptedAI::me.

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

◆ IsBetween()

bool boss_netherspite::boss_netherspiteAI::IsBetween ( WorldObject u1,
WorldObject target,
WorldObject u2 
)
inline
100 {
101 if (!u1 || !u2 || !target)
102 return false;
103
104 float xn, yn, xp, yp, xh, yh;
105 xn = u1->GetPositionX();
106 yn = u1->GetPositionY();
107 xp = u2->GetPositionX();
108 yp = u2->GetPositionY();
109 xh = target->GetPositionX();
110 yh = target->GetPositionY();
111
112 // check if target is between (not checking distance from the beam yet)
113 if (dist(xn, yn, xh, yh) >= dist(xn, yn, xp, yp) || dist(xp, yp, xh, yh) >= dist(xn, yn, xp, yp))
114 return false;
115 // check distance from the beam
116 return (std::abs((xn - xp) * yh + (yp - yn) * xh - xn * yp + xp * yn) / dist(xn, yn, xp, yp) < 1.5f);
117 }
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
float dist(float xa, float ya, float xb, float yb)
Definition: boss_netherspite.cpp:119

References dist(), Position::GetPositionX(), and Position::GetPositionY().

Referenced by UpdatePortals().

◆ JustDied()

void boss_netherspite::boss_netherspiteAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

262 {
263 HandleDoors(true);
265 }
void DestroyPortals()
Definition: boss_netherspite.cpp:151
void HandleDoors(bool open)
Definition: boss_netherspite.cpp:248

References DestroyPortals(), and HandleDoors().

◆ JustEngagedWith()

void boss_netherspite::boss_netherspiteAI::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from ScriptedAI.

255 {
256 HandleDoors(false);
259 }
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:95
void SwitchToPortalPhase()
Definition: boss_netherspite.cpp:221

References CreatureAI::DoZoneInCombat(), HandleDoors(), and SwitchToPortalPhase().

◆ Reset()

void boss_netherspite::boss_netherspiteAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

125 {
126 Berserk = false;
127 NetherInfusionTimer = 540000;
128 VoidZoneTimer = 15000;
129 NetherbreathTimer = 3000;
130
131 HandleDoors(true);
133 }
uint32 NetherInfusionTimer
Definition: boss_netherspite.cpp:91
uint32 NetherbreathTimer
Definition: boss_netherspite.cpp:92
uint32 VoidZoneTimer
Definition: boss_netherspite.cpp:90
bool Berserk
Definition: boss_netherspite.cpp:88

References Berserk, DestroyPortals(), HandleDoors(), NetherbreathTimer, NetherInfusionTimer, and VoidZoneTimer.

◆ SummonPortals()

void boss_netherspite::boss_netherspiteAI::SummonPortals ( )
inline
136 {
137 uint8 r = rand() % 4;
138 uint8 pos[3];
139 pos[RED_PORTAL] = ((r % 2) ? (r > 1 ? 2 : 1) : 0);
140 pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1));
141 pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0)
142
143 for (int i = 0; i < 3; ++i)
144 if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
145 {
146 PortalGUID[i] = portal->GetGUID();
147 portal->AddAura(PortalVisual[i], portal);
148 }
149 }
std::uint8_t uint8
Definition: Define.h:110
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:44
const float PortalCoord[3][3]
Definition: boss_netherspite.cpp:47
const uint32 PortalID[3]
Definition: boss_netherspite.cpp:61
@ GREEN_PORTAL
Definition: boss_netherspite.cpp:57
@ RED_PORTAL
Definition: boss_netherspite.cpp:56
@ BLUE_PORTAL
Definition: boss_netherspite.cpp:58
const uint32 PortalVisual[3]
Definition: boss_netherspite.cpp:62
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:2318

References BLUE_PORTAL, GREEN_PORTAL, ScriptedAI::me, PortalCoord, PortalGUID, PortalID, PortalVisual, RED_PORTAL, WorldObject::SummonCreature(), and TEMPSUMMON_TIMED_DESPAWN.

Referenced by SwitchToPortalPhase().

◆ SwitchToBanishPhase()

void boss_netherspite::boss_netherspiteAI::SwitchToBanishPhase ( )
inline
234 {
240 PhaseTimer = 30000;
241 PortalPhase = false;
243
244 for (uint8 i = 0; i < 3; ++i)
246 }
@ SPELL_NETHERBURN_AURA
Definition: boss_netherspite.cpp:37
@ SPELL_EMPOWERMENT
Definition: boss_netherspite.cpp:43
@ SPELL_BANISH_VISUAL
Definition: boss_netherspite.cpp:41
@ EMOTE_PHASE_BANISH
Definition: boss_netherspite.cpp:35
@ SPELL_BANISH_ROOT
Definition: boss_netherspite.cpp:42
const uint32 NetherBuff[3]
Definition: boss_netherspite.cpp:65
Talk
Definition: boss_fathomlord_karathress.cpp:23
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:178
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4835
bool PortalPhase
Definition: boss_netherspite.cpp:87
uint32 PhaseTimer
Definition: boss_netherspite.cpp:89

References DestroyPortals(), UnitAI::DoCast(), EMOTE_PHASE_BANISH, ScriptedAI::me, NetherBuff, PhaseTimer, PortalPhase, Unit::RemoveAurasDueToSpell(), SPELL_BANISH_ROOT, SPELL_BANISH_VISUAL, SPELL_EMPOWERMENT, and SPELL_NETHERBURN_AURA.

Referenced by UpdateAI().

◆ SwitchToPortalPhase()

void boss_netherspite::boss_netherspiteAI::SwitchToPortalPhase ( )
inline
222 {
226 PhaseTimer = 60000;
227 PortalPhase = true;
228 PortalTimer = 10000;
229 EmpowermentTimer = 10000;
231 }
@ EMOTE_PHASE_PORTAL
Definition: boss_netherspite.cpp:34
uint32 EmpowermentTimer
Definition: boss_netherspite.cpp:93
void SummonPortals()
Definition: boss_netherspite.cpp:135
uint32 PortalTimer
Definition: boss_netherspite.cpp:94

References EMOTE_PHASE_PORTAL, EmpowermentTimer, ScriptedAI::me, PhaseTimer, PortalPhase, PortalTimer, Unit::RemoveAurasDueToSpell(), SPELL_BANISH_ROOT, SPELL_BANISH_VISUAL, and SummonPortals().

Referenced by JustEngagedWith(), and UpdateAI().

◆ UpdateAI()

void boss_netherspite::boss_netherspiteAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from ScriptedAI.

268 {
269 if (!UpdateVictim())
270 return;
271
272 // Void Zone
273 if (VoidZoneTimer <= diff)
274 {
275 DoCast(SelectTarget(SelectTargetMethod::Random, 1, 45, true), SPELL_VOIDZONE, true);
276 VoidZoneTimer = 15000;
277 }
278 else
279 VoidZoneTimer -= diff;
280
281 // NetherInfusion Berserk
282 if (!Berserk && NetherInfusionTimer <= diff)
283 {
286 Berserk = true;
287 }
288 else
289 NetherInfusionTimer -= diff;
290
291 if (PortalPhase) // PORTAL PHASE
292 {
293 // Distribute beams and buffs
294 if (PortalTimer <= diff)
295 {
297 PortalTimer = 1000;
298 }
299 else
300 PortalTimer -= diff;
301
302 // Empowerment & Nether Burn
303 if (EmpowermentTimer <= diff)
304 {
307 EmpowermentTimer = 90000;
308 }
309 else
310 EmpowermentTimer -= diff;
311
312 if (PhaseTimer <= diff)
313 {
314 if (!me->IsNonMeleeSpellCast(false))
315 {
317 return;
318 }
319 }
320 else
321 PhaseTimer -= diff;
322 }
323 else // BANISH PHASE
324 {
325 // Netherbreath
326 if (NetherbreathTimer <= diff)
327 {
328 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 40, true))
329 DoCast(target, SPELL_NETHERBREATH);
330 NetherbreathTimer = urand(5000, 7000);
331 }
332 else
333 NetherbreathTimer -= diff;
334
335 if (PhaseTimer <= diff)
336 {
337 if (!me->IsNonMeleeSpellCast(false))
338 {
340 return;
341 }
342 }
343 else
344 PhaseTimer -= diff;
345 }
346
348 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ SPELL_NETHER_INFUSION
Definition: boss_netherspite.cpp:39
@ SPELL_VOIDZONE
Definition: boss_netherspite.cpp:38
@ SPELL_NETHERSPITE_ROAR
Definition: boss_netherspite.cpp:44
@ SPELL_NETHERBREATH
Definition: boss_netherspite.cpp:40
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:40
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:111
bool UpdateVictim()
Definition: CreatureAI.cpp:269
Definition: Unit.h:1290
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4039
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:19031
void SwitchToBanishPhase()
Definition: boss_netherspite.cpp:233
void UpdatePortals()
Definition: boss_netherspite.cpp:164

References Unit::AddAura(), Berserk, UnitAI::DoCast(), UnitAI::DoMeleeAttackIfReady(), EmpowermentTimer, Unit::IsNonMeleeSpellCast(), ScriptedAI::me, NetherbreathTimer, NetherInfusionTimer, PhaseTimer, PortalPhase, PortalTimer, UnitAI::SelectTarget(), SPELL_EMPOWERMENT, SPELL_NETHER_INFUSION, SPELL_NETHERBREATH, SPELL_NETHERBURN_AURA, SPELL_NETHERSPITE_ROAR, SPELL_VOIDZONE, SwitchToBanishPhase(), SwitchToPortalPhase(), UpdatePortals(), CreatureAI::UpdateVictim(), urand(), and VoidZoneTimer.

◆ UpdatePortals()

void boss_netherspite::boss_netherspiteAI::UpdatePortals ( )
inline
165 {
166 for (int j = 0; j < 3; ++j) // j = color
168 {
169 // the one who's been cast upon before
170 Unit* current = ObjectAccessor::GetUnit(*portal, BeamTarget[j]);
171 // temporary store for the best suitable beam reciever
172 Unit* target = me;
173
174 if (Map* map = me->GetMap())
175 {
176 Map::PlayerList const& players = map->GetPlayers();
177
178 // get the best suitable target
179 for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
180 {
181 Player* p = i->GetSource();
182 if (p && p->IsAlive() // alive
183 && (!target || target->GetDistance2d(portal) > p->GetDistance2d(portal)) // closer than current best
184 && !p->HasAura(PlayerDebuff[j]) // not exhausted
185 && !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam
186 && !p->HasAura(PlayerBuff[(j + 2) % 3])
187 && IsBetween(me, p, portal)) // on the beam
188 target = p;
189 }
190 }
191 // buff the target
192 if (target->GetTypeId() == TYPEID_PLAYER)
193 target->AddAura(PlayerBuff[j], target);
194 else
195 target->AddAura(NetherBuff[j], target);
196 // cast visual beam on the chosen target if switched
197 // simple target switching isn't working -> using BeamerGUID to cast (workaround)
198 if (!current || target != current)
199 {
200 BeamTarget[j] = target->GetGUID();
201 // remove currently beaming portal
202 if (Creature* beamer = ObjectAccessor::GetCreature(*portal, BeamerGUID[j]))
203 {
204 beamer->CastSpell(target, PortalBeam[j], false);
205 beamer->DisappearAndDie();
206 BeamerGUID[j].Clear();
207 }
208 // create new one and start beaming on the target
209 if (Creature* beamer = portal->SummonCreature(PortalID[j], portal->GetPositionX(), portal->GetPositionY(), portal->GetPositionZ(), portal->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 60000))
210 {
211 beamer->CastSpell(target, PortalBeam[j], false);
212 BeamerGUID[j] = beamer->GetGUID();
213 }
214 }
215 // aggro target if Red Beam
216 if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
217 me->GetThreatMgr().AddThreat(target, 100000.0f + DoGetThreat(me->GetVictim()));
218 }
219 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
const uint32 PlayerBuff[3]
Definition: boss_netherspite.cpp:64
const uint32 PortalBeam[3]
Definition: boss_netherspite.cpp:63
const uint32 PlayerDebuff[3]
Definition: boss_netherspite.cpp:66
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:204
Definition: LinkedList.h:139
float DoGetThreat(Unit *unit)
Definition: ScriptedCreature.cpp:422
void AddThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: ThreatMgr.cpp:437
TypeID GetTypeId() const
Definition: Object.h:121
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Map * GetMap() const
Definition: Object.h:517
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1263
Definition: Player.h:1046
bool IsAlive() const
Definition: Unit.h:1808
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5610
Unit * GetVictim() const
Definition: Unit.h:1386
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2145
Definition: Map.h:312
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37
bool IsBetween(WorldObject *u1, WorldObject *target, WorldObject *u2)
Definition: boss_netherspite.cpp:99

References Unit::AddAura(), ThreatMgr::AddThreat(), BeamerGUID, BeamTarget, MapRefMgr::begin(), ObjectGuid::Clear(), ScriptedAI::DoGetThreat(), MapRefMgr::end(), ObjectAccessor::GetCreature(), WorldObject::GetDistance2d(), Object::GetGUID(), WorldObject::GetMap(), Unit::GetThreatMgr(), Object::GetTypeId(), ObjectAccessor::GetUnit(), Unit::GetVictim(), Unit::HasAura(), Unit::IsAlive(), IsBetween(), ScriptedAI::me, NetherBuff, PlayerBuff, PlayerDebuff, PortalBeam, PortalGUID, PortalID, RED_PORTAL, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_DESPAWN, and TYPEID_PLAYER.

Referenced by UpdateAI().

Member Data Documentation

◆ BeamerGUID

ObjectGuid boss_netherspite::boss_netherspiteAI::BeamerGUID[3]

Referenced by DestroyPortals(), and UpdatePortals().

◆ BeamTarget

ObjectGuid boss_netherspite::boss_netherspiteAI::BeamTarget[3]

Referenced by DestroyPortals(), and UpdatePortals().

◆ Berserk

bool boss_netherspite::boss_netherspiteAI::Berserk

Referenced by Reset(), and UpdateAI().

◆ EmpowermentTimer

uint32 boss_netherspite::boss_netherspiteAI::EmpowermentTimer

Referenced by SwitchToPortalPhase(), and UpdateAI().

◆ instance

InstanceScript* boss_netherspite::boss_netherspiteAI::instance

Referenced by boss_netherspiteAI(), and HandleDoors().

◆ NetherbreathTimer

uint32 boss_netherspite::boss_netherspiteAI::NetherbreathTimer

Referenced by Reset(), and UpdateAI().

◆ NetherInfusionTimer

uint32 boss_netherspite::boss_netherspiteAI::NetherInfusionTimer

Referenced by Reset(), and UpdateAI().

◆ PhaseTimer

uint32 boss_netherspite::boss_netherspiteAI::PhaseTimer

◆ PortalGUID

ObjectGuid boss_netherspite::boss_netherspiteAI::PortalGUID[3]

◆ PortalPhase

bool boss_netherspite::boss_netherspiteAI::PortalPhase

◆ PortalTimer

uint32 boss_netherspite::boss_netherspiteAI::PortalTimer

Referenced by SwitchToPortalPhase(), and UpdateAI().

◆ VoidZoneTimer

uint32 boss_netherspite::boss_netherspiteAI::VoidZoneTimer

Referenced by Reset(), and UpdateAI().