TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boss_netherspite::boss_netherspiteAI Struct Reference

Public Member Functions

 boss_netherspiteAI (Creature *creature)
 
void Initialize ()
 
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 EnterCombat (Unit *) override
 
void JustDied (Unit *) override
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &) 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 OnPossess (bool)
 
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 DoResetThreat ()
 
float DoGetThreat (Unit *unit)
 
void DoModifyThreatPercent (Unit *unit, int32 pct)
 
void DoTeleportTo (float x, float y, float z, uint32 time=0)
 
void DoTeleportTo (float const pos[4])
 
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 constSelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, 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
 
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
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 CreatureAI (Creature *creature)
 
virtual ~CreatureAI ()
 
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 IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted () const
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=NULL, float maxRangeToNearestTarget=50.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 void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary constGetBoundary () const
 
- 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 void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectAggroTarget targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, PREDICATE const &predicate, uint32 maxTargets, SelectAggroTarget targetType)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void SpellInterrupted (uint32, uint32)
 
void AttackStartCaster (Unit *victim, float dist)
 
void DoCast (uint32 spellId)
 
void DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
void DoCastVictim (uint32 spellId, bool triggered=false)
 
void DoCastAOE (uint32 spellId, bool triggered=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spellId)
 
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 sQuestReward (Player *, Quest const *, uint32)
 
virtual bool sOnDummyEffect (Unit *, uint32, SpellEffIndex)
 
virtual void sOnGameEvent (bool, uint16)
 

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
bool IsFleeing
 

Additional Inherited Members

- Public Types inherited from CreatureAI
enum  EvadeReason { EVADE_REASON_NO_HOSTILES, EVADE_REASON_BOUNDARY, EVADE_REASON_SEQUENCE_BREAK, EVADE_REASON_OTHER }
 
- 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)
 
bool CheckBoundary (Position const *who=nullptr) const
 
void SetBoundary (CreatureBoundary const *boundary)
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

boss_netherspite::boss_netherspiteAI::boss_netherspiteAI ( Creature creature)
inline
79  : ScriptedAI(creature)
80  {
81  Initialize();
82  instance = creature->GetInstanceScript();
83 
84  PortalPhase = false;
85  PhaseTimer = 0;
86  EmpowermentTimer = 0;
87  PortalTimer = 0;
88  }
ScriptedAI(Creature *creature)
Definition: ScriptedCreature.cpp:100
uint32 PhaseTimer
Definition: boss_netherspite.cpp:102
InstanceScript * GetInstanceScript()
Definition: Object.cpp:1540
uint32 PortalTimer
Definition: boss_netherspite.cpp:107
bool PortalPhase
Definition: boss_netherspite.cpp:100
InstanceScript * instance
Definition: boss_netherspite.cpp:98
void Initialize()
Definition: boss_netherspite.cpp:90
uint32 EmpowermentTimer
Definition: boss_netherspite.cpp:106

+ Here is the call graph for this function:

Member Function Documentation

void boss_netherspite::boss_netherspiteAI::DestroyPortals ( )
inline
162  {
163  for (int i=0; i<3; ++i)
164  {
166  portal->DisappearAndDie();
168  portal->DisappearAndDie();
169  PortalGUID[i].Clear();
170  BeamTarget[i].Clear();
171  }
172  }
ObjectGuid PortalGUID[3]
Definition: boss_netherspite.cpp:108
Definition: Creature.h:467
Creature *const me
Definition: CreatureAI.h:71
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
ObjectGuid BeamTarget[3]
Definition: boss_netherspite.cpp:110
void Clear()
Definition: ObjectGuid.h:215
ObjectGuid BeamerGUID[3]
Definition: boss_netherspite.cpp:109

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float boss_netherspite::boss_netherspiteAI::dist ( float  xa,
float  ya,
float  xb,
float  yb 
)
inline
133  {
134  return std::sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb));
135  }

+ Here is the caller graph for this function:

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

Reimplemented from ScriptedAI.

263  {
264  HandleDoors(false);
266  }
void HandleDoors(bool open)
Definition: boss_netherspite.cpp:256
void SwitchToPortalPhase()
Definition: boss_netherspite.cpp:229

+ Here is the call graph for this function:

void boss_netherspite::boss_netherspiteAI::HandleDoors ( bool  open)
inline
257  {
259  Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
260  }
Definition: karazhan.h:49
Creature *const me
Definition: CreatureAI.h:71
InstanceScript * instance
Definition: boss_netherspite.cpp:98
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
Definition: GameObject.h:880
Definition: GameObject.h:822
Definition: GameObject.h:823
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:143

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_netherspite::boss_netherspiteAI::Initialize ( void  )
inline
91  {
92  Berserk = false;
93  NetherInfusionTimer = 540000;
94  VoidZoneTimer = 15000;
95  NetherbreathTimer = 3000;
96  }
uint32 NetherbreathTimer
Definition: boss_netherspite.cpp:105
uint32 NetherInfusionTimer
Definition: boss_netherspite.cpp:104
uint32 VoidZoneTimer
Definition: boss_netherspite.cpp:103
bool Berserk
Definition: boss_netherspite.cpp:101

+ Here is the caller graph for this function:

bool boss_netherspite::boss_netherspiteAI::IsBetween ( WorldObject u1,
WorldObject target,
WorldObject u2 
)
inline
113  {
114  if (!u1 || !u2 || !target)
115  return false;
116 
117  float xn, yn, xp, yp, xh, yh;
118  xn = u1->GetPositionX();
119  yn = u1->GetPositionY();
120  xp = u2->GetPositionX();
121  yp = u2->GetPositionY();
122  xh = target->GetPositionX();
123  yh = target->GetPositionY();
124 
125  // check if target is between (not checking distance from the beam yet)
126  if (dist(xn, yn, xh, yh) >= dist(xn, yn, xp, yp) || dist(xp, yp, xh, yh) >= dist(xn, yn, xp, yp))
127  return false;
128  // check distance from the beam
129  return (std::abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn, yn, xp, yp) < 1.5f);
130  }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
float GetPositionY() const
Definition: Position.h:105
float GetPositionX() const
Definition: Position.h:104
float dist(float xa, float ya, float xb, float yb)
Definition: boss_netherspite.cpp:132

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from ScriptedAI.

269  {
270  HandleDoors(true);
271  DestroyPortals();
272  }
void DestroyPortals()
Definition: boss_netherspite.cpp:161
void HandleDoors(bool open)
Definition: boss_netherspite.cpp:256

+ Here is the call graph for this function:

void boss_netherspite::boss_netherspiteAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

138  {
139  Initialize();
140 
141  HandleDoors(true);
142  DestroyPortals();
143  }
void DestroyPortals()
Definition: boss_netherspite.cpp:161
void HandleDoors(bool open)
Definition: boss_netherspite.cpp:256
void Initialize()
Definition: boss_netherspite.cpp:90

+ Here is the call graph for this function:

void boss_netherspite::boss_netherspiteAI::SummonPortals ( )
inline
146  {
147  uint8 r = rand32() % 4;
148  uint8 pos[3];
149  pos[RED_PORTAL] = ((r % 2) ? (r > 1 ? 2 : 1) : 0);
150  pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1));
151  pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0)
152 
153  for (int i = 0; i < 3; ++i)
154  if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
155  {
156  PortalGUID[i] = portal->GetGUID();
157  portal->AddAura(PortalVisual[i], portal);
158  }
159  }
const uint32 PortalID[3]
Definition: boss_netherspite.cpp:60
ObjectGuid PortalGUID[3]
Definition: boss_netherspite.cpp:108
const uint32 PortalVisual[3]
Definition: boss_netherspite.cpp:61
Definition: boss_netherspite.cpp:55
Definition: Creature.h:467
Creature *const me
Definition: CreatureAI.h:71
Definition: Object.h:56
uint32 rand32()
Definition: Random.cpp:64
uint8_t uint8
Definition: Define.h:152
Definition: boss_netherspite.cpp:56
const float PortalCoord[3][3]
Definition: boss_netherspite.cpp:47
Definition: boss_netherspite.cpp:57
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_netherspite::boss_netherspiteAI::SwitchToBanishPhase ( )
inline
242  {
245  DoCast(me, SPELL_BANISH_VISUAL, true);
246  DoCast(me, SPELL_BANISH_ROOT, true);
247  DestroyPortals();
248  PhaseTimer = 30000;
249  PortalPhase = false;
251 
252  for (uint8 i = 0; i < 3; ++i)
254  }
const uint32 NetherBuff[3]
Definition: boss_netherspite.cpp:64
Definition: boss_netherspite.cpp:34
void DestroyPortals()
Definition: boss_netherspite.cpp:161
uint32 PhaseTimer
Definition: boss_netherspite.cpp:102
bool PortalPhase
Definition: boss_netherspite.cpp:100
Creature *const me
Definition: CreatureAI.h:71
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
Definition: boss_netherspite.cpp:40
Definition: boss_netherspite.cpp:41
uint8_t uint8
Definition: Define.h:152
Definition: boss_netherspite.cpp:42
Definition: boss_netherspite.cpp:36

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_netherspite::boss_netherspiteAI::SwitchToPortalPhase ( )
inline
230  {
233  SummonPortals();
234  PhaseTimer = 60000;
235  PortalPhase = true;
236  PortalTimer = 10000;
237  EmpowermentTimer = 10000;
239  }
uint32 PhaseTimer
Definition: boss_netherspite.cpp:102
uint32 PortalTimer
Definition: boss_netherspite.cpp:107
void SummonPortals()
Definition: boss_netherspite.cpp:145
bool PortalPhase
Definition: boss_netherspite.cpp:100
Creature *const me
Definition: CreatureAI.h:71
Definition: boss_netherspite.cpp:33
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
uint32 EmpowermentTimer
Definition: boss_netherspite.cpp:106
Definition: boss_netherspite.cpp:40
Definition: boss_netherspite.cpp:41

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from ScriptedAI.

275  {
276  if (!UpdateVictim())
277  return;
278 
279  // Void Zone
280  if (VoidZoneTimer <= diff)
281  {
283  VoidZoneTimer = 15000;
284  } else VoidZoneTimer -= diff;
285 
286  // NetherInfusion Berserk
287  if (!Berserk && NetherInfusionTimer <= diff)
288  {
291  Berserk = true;
292  } else NetherInfusionTimer -= diff;
293 
294  if (PortalPhase) // PORTAL PHASE
295  {
296  // Distribute beams and buffs
297  if (PortalTimer <= diff)
298  {
299  UpdatePortals();
300  PortalTimer = 1000;
301  } else PortalTimer -= diff;
302 
303  // Empowerment & Nether Burn
304  if (EmpowermentTimer <= diff)
305  {
308  EmpowermentTimer = 90000;
309  } else EmpowermentTimer -= diff;
310 
311  if (PhaseTimer <= diff)
312  {
313  if (!me->IsNonMeleeSpellCast(false))
314  {
316  return;
317  }
318  } else PhaseTimer -= diff;
319  }
320  else // BANISH PHASE
321  {
322  // Netherbreath
323  if (NetherbreathTimer <= diff)
324  {
325  if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true))
326  DoCast(target, SPELL_NETHERBREATH);
327  NetherbreathTimer = urand(5000, 7000);
328  } else NetherbreathTimer -= diff;
329 
330  if (PhaseTimer <= diff)
331  {
332  if (!me->IsNonMeleeSpellCast(false))
333  {
335  return;
336  }
337  } else PhaseTimer -= diff;
338  }
339 
341  }
uint32 NetherbreathTimer
Definition: boss_netherspite.cpp:105
bool UpdateVictim()
Definition: CreatureAI.cpp:233
void SwitchToBanishPhase()
Definition: boss_netherspite.cpp:241
uint32 PhaseTimer
Definition: boss_netherspite.cpp:102
uint32 NetherInfusionTimer
Definition: boss_netherspite.cpp:104
Definition: boss_netherspite.cpp:43
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:14463
uint32 PortalTimer
Definition: boss_netherspite.cpp:107
uint32 VoidZoneTimer
Definition: boss_netherspite.cpp:103
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:2886
bool PortalPhase
Definition: boss_netherspite.cpp:100
Creature *const me
Definition: CreatureAI.h:71
void SwitchToPortalPhase()
Definition: boss_netherspite.cpp:229
Definition: UnitAI.h:35
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition: UnitAI.cpp:91
Definition: boss_netherspite.cpp:39
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
Definition: boss_netherspite.cpp:37
uint32 EmpowermentTimer
Definition: boss_netherspite.cpp:106
bool Berserk
Definition: boss_netherspite.cpp:101
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:49
void UpdatePortals()
Definition: boss_netherspite.cpp:174
Definition: boss_netherspite.cpp:42
Definition: Unit.h:1305
Definition: boss_netherspite.cpp:38
Definition: boss_netherspite.cpp:36

+ Here is the call graph for this function:

void boss_netherspite::boss_netherspiteAI::UpdatePortals ( )
inline
175  {
176  for (int j = 0; j < 3; ++j) // j = color
178  {
179  // the one who's been cast upon before
180  Unit* current = ObjectAccessor::GetUnit(*portal, BeamTarget[j]);
181  // temporary store for the best suitable beam reciever
182  Unit* target = me;
183 
184  Map::PlayerList const& players = me->GetMap()->GetPlayers();
185 
186  // get the best suitable target
187  for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
188  {
189  Player* p = i->GetSource();
190  if (p && p->IsAlive() // alive
191  && (!target || target->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best
192  && !p->HasAura(PlayerDebuff[j]) // not exhausted
193  && !p->HasAura(PlayerBuff[(j + 1) % 3]) // not on another beam
194  && !p->HasAura(PlayerBuff[(j + 2) % 3])
195  && IsBetween(me, p, portal)) // on the beam
196  target = p;
197  }
198 
199  // buff the target
200  if (target->GetTypeId() == TYPEID_PLAYER)
201  target->AddAura(PlayerBuff[j], target);
202  else
203  target->AddAura(NetherBuff[j], target);
204  // cast visual beam on the chosen target if switched
205  // simple target switching isn't working -> using BeamerGUID to cast (workaround)
206  if (!current || target != current)
207  {
208  BeamTarget[j] = target->GetGUID();
209  // remove currently beaming portal
210  if (Creature* beamer = ObjectAccessor::GetCreature(*portal, BeamerGUID[j]))
211  {
212  beamer->CastSpell(target, PortalBeam[j], false);
213  beamer->DisappearAndDie();
214  BeamerGUID[j].Clear();
215  }
216  // create new one and start beaming on the target
217  if (Creature* beamer = portal->SummonCreature(PortalID[j], portal->GetPositionX(), portal->GetPositionY(), portal->GetPositionZ(), portal->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 60000))
218  {
219  beamer->CastSpell(target, PortalBeam[j], false);
220  BeamerGUID[j] = beamer->GetGUID();
221  }
222  }
223  // aggro target if Red Beam
224  if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
225  me->getThreatManager().addThreat(target, 100000.0f+DoGetThreat(me->GetVictim()));
226  }
227  }
const uint32 PortalID[3]
Definition: boss_netherspite.cpp:60
const uint32 NetherBuff[3]
Definition: boss_netherspite.cpp:64
ObjectGuid PortalGUID[3]
Definition: boss_netherspite.cpp:108
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
Map * GetMap() const
Definition: Object.h:543
void addThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: ThreatManager.cpp:406
const uint32 PlayerDebuff[3]
Definition: boss_netherspite.cpp:65
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:14463
const uint32 PlayerBuff[3]
Definition: boss_netherspite.cpp:63
Definition: boss_netherspite.cpp:55
Definition: Creature.h:467
iterator begin()
Definition: MapRefManager.h:37
Creature *const me
Definition: CreatureAI.h:71
TypeID GetTypeId() const
Definition: Object.h:113
float DoGetThreat(Unit *unit)
Definition: ScriptedCreature.cpp:266
Unit * GetVictim() const
Definition: Unit.h:1379
Definition: Object.h:56
Definition: LinkedList.h:141
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
const uint32 PortalBeam[3]
Definition: boss_netherspite.cpp:62
ObjectGuid BeamTarget[3]
Definition: boss_netherspite.cpp:110
void Clear()
Definition: ObjectGuid.h:215
PlayerList const & GetPlayers() const
Definition: Map.h:433
bool IsBetween(WorldObject *u1, WorldObject *target, WorldObject *u2)
Definition: boss_netherspite.cpp:112
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: MapRefManager.h:26
Definition: ObjectGuid.h:33
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1612
ObjectGuid BeamerGUID[3]
Definition: boss_netherspite.cpp:109
ThreatManager & getThreatManager()
Definition: Unit.h:1998
Definition: Unit.h:1305
iterator end()
Definition: MapRefManager.h:38
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

ObjectGuid boss_netherspite::boss_netherspiteAI::BeamerGUID[3]
ObjectGuid boss_netherspite::boss_netherspiteAI::BeamTarget[3]
bool boss_netherspite::boss_netherspiteAI::Berserk
uint32 boss_netherspite::boss_netherspiteAI::EmpowermentTimer
InstanceScript* boss_netherspite::boss_netherspiteAI::instance
uint32 boss_netherspite::boss_netherspiteAI::NetherbreathTimer
uint32 boss_netherspite::boss_netherspiteAI::NetherInfusionTimer
uint32 boss_netherspite::boss_netherspiteAI::PhaseTimer
ObjectGuid boss_netherspite::boss_netherspiteAI::PortalGUID[3]
bool boss_netherspite::boss_netherspiteAI::PortalPhase
uint32 boss_netherspite::boss_netherspiteAI::PortalTimer
uint32 boss_netherspite::boss_netherspiteAI::VoidZoneTimer

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