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

Public Member Functions

 boss_sapphironAI (Creature *creature)
 
void Initialize ()
 
void InitializeAI () override
 
void Reset () override
 
void EnterCombat (Unit *) override
 
void SpellHitTarget (Unit *target, SpellInfo const *spell) override
 
void JustDied (Unit *) override
 
void MovementInform (uint32, uint32 id) override
 
void DoAction (int32 param) override
 
void EnterPhaseGround ()
 
void ClearIceBlock ()
 
uint32 GetData (uint32 data) const override
 
void UpdateAI (uint32 diff) override
 
void CastExplosion ()
 
- Public Member Functions inherited from BossAI
 BossAI (Creature *creature, uint32 bossId)
 
virtual ~BossAI ()
 
void JustSummoned (Creature *summon) override
 
void SummonedCreatureDespawn (Creature *summon) override
 
virtual void ExecuteEvent (uint32)
 
virtual void ScheduleTasks ()
 
void JustReachedHome () override
 
bool CanAIAttack (Unit const *target) const 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 SpellHit (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 ()
 
void OnCharmed (bool apply) override
 
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 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)
 

Private Attributes

Phases _phase
 
uint32 _iceboltCount
 
IceBlockMap _iceblocks
 
bool _canTheHundredClub
 
Map_map
 

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 ()
 
- Public Attributes inherited from BossAI
InstanceScript *const instance
 
- Public Attributes inherited from ScriptedAI
bool IsFleeing
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from BossAI
void _Reset ()
 
void _EnterCombat ()
 
void _JustDied ()
 
void _JustReachedHome ()
 
void _DespawnAtEvade ()
 
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)
 
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 BossAI
EventMap events
 
SummonList summons
 
TaskScheduler scheduler
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

boss_sapphiron::boss_sapphironAI::boss_sapphironAI ( Creature creature)
inline
94  :
95  BossAI(creature, BOSS_SAPPHIRON), _iceboltCount(0), _map(me->GetMap())
96  {
97  Initialize();
98  }
Map * GetMap() const
Definition: Object.h:543
Creature *const me
Definition: CreatureAI.h:71
Definition: naxxramas.h:40
uint32 _iceboltCount
Definition: boss_sapphiron.cpp:403
void Initialize()
Definition: boss_sapphiron.cpp:100
BossAI(Creature *creature, uint32 bossId)
Definition: ScriptedCreature.cpp:444
Map * _map
Definition: boss_sapphiron.cpp:406

+ Here is the call graph for this function:

Member Function Documentation

void boss_sapphiron::boss_sapphironAI::CastExplosion ( )
inline
363  {
364  DoZoneInCombat(); // make sure everyone is in threatlist
365  std::vector<Unit*> targets;
366  std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
367  for (; i != me->getThreatManager().getThreatList().end(); ++i)
368  {
369  Unit* target = (*i)->getTarget();
370  if (target->GetTypeId() != TYPEID_PLAYER)
371  continue;
372 
373  if (target->HasAura(SPELL_ICEBOLT))
374  {
376  targets.push_back(target);
377  continue;
378  }
379 
380  for (IceBlockMap::const_iterator itr = _iceblocks.begin(); itr != _iceblocks.end(); ++itr)
381  {
382  if (GameObject* go = ObjectAccessor::GetGameObject(*me, itr->second))
383  {
384  if (go->IsInBetween(me, target, 2.0f)
385  && me->GetExactDist2d(target->GetPositionX(), target->GetPositionY()) - me->GetExactDist2d(go->GetPositionX(), go->GetPositionY()) < 5.0f)
386  {
388  targets.push_back(target);
389  break;
390  }
391  }
392  }
393  }
394 
396 
397  for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
398  (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false);
399  }
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
Definition: SharedDefines.h:1866
Definition: boss_sapphiron.cpp:41
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
Definition: CreatureAI.cpp:47
ThreatContainer::StorageType const & getThreatList() const
Definition: ThreatManager.h:263
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
IceBlockMap _iceblocks
Definition: boss_sapphiron.cpp:404
Creature *const me
Definition: CreatureAI.h:71
TypeID GetTypeId() const
Definition: Object.h:113
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:137
float GetPositionY() const
Definition: Position.h:105
Definition: GameObject.h:880
Definition: ObjectGuid.h:33
ThreatManager & getThreatManager()
Definition: Unit.h:1998
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:143
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: boss_sapphiron.cpp:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_sapphiron::boss_sapphironAI::ClearIceBlock ( )
inline
207  {
208  for (IceBlockMap::const_iterator itr = _iceblocks.begin(); itr != _iceblocks.end(); ++itr)
209  {
210  if (Player* player = ObjectAccessor::GetPlayer(*me, itr->first))
211  player->RemoveAura(SPELL_ICEBOLT);
212 
213  if (GameObject* go = ObjectAccessor::GetGameObject(*me, itr->second))
214  go->Delete();
215  }
216  _iceblocks.clear();
217  }
IceBlockMap _iceblocks
Definition: boss_sapphiron.cpp:404
Creature *const me
Definition: CreatureAI.h:71
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:184
Definition: GameObject.h:880
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:143
Definition: boss_sapphiron.cpp:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_sapphiron::boss_sapphironAI::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

186  {
187  if (param == DATA_SAPPHIRON_BIRTH)
188  {
191  }
192  }
Definition: naxxramas.h:48
Definition: boss_sapphiron.cpp:71
Phases _phase
Definition: boss_sapphiron.cpp:402
Definition: boss_sapphiron.cpp:52
void ScheduleEvent(uint32 eventId, Milliseconds const &time, uint32 group=0, uint8 phase=0)
Definition: EventMap.h:123
Definition: Common.h:103
EventMap events
Definition: ScriptedCreature.h:371

+ Here is the call graph for this function:

void boss_sapphiron::boss_sapphironAI::EnterCombat ( Unit )
inlineoverridevirtual

Reimplemented from BossAI.

141  {
142  _EnterCombat();
143 
144  me->CastSpell(me, SPELL_FROST_AURA, true);
145 
150  }
void _EnterCombat()
Definition: ScriptedCreature.cpp:480
Definition: Common.h:97
Creature *const me
Definition: CreatureAI.h:71
Definition: boss_sapphiron.cpp:46
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void ScheduleEvent(uint32 eventId, Milliseconds const &time, uint32 group=0, uint8 phase=0)
Definition: EventMap.h:123
void EnterPhaseGround()
Definition: boss_sapphiron.cpp:194
Definition: Common.h:103
EventMap events
Definition: ScriptedCreature.h:371
Definition: boss_sapphiron.cpp:34
Definition: boss_sapphiron.cpp:72
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: boss_sapphiron.cpp:59

+ Here is the call graph for this function:

void boss_sapphiron::boss_sapphironAI::EnterPhaseGround ( )
inline
195  {
204  }
Definition: Unit.h:1131
void SetPhase(uint8 phase)
Definition: EventMap.cpp:27
Definition: boss_sapphiron.cpp:53
Definition: boss_sapphiron.cpp:63
Phases _phase
Definition: boss_sapphiron.cpp:402
Definition: boss_sapphiron.cpp:61
Creature *const me
Definition: CreatureAI.h:71
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
Definition: boss_sapphiron.cpp:62
void ScheduleEvent(uint32 eventId, Milliseconds const &time, uint32 group=0, uint8 phase=0)
Definition: EventMap.h:123
Definition: boss_sapphiron.cpp:64
Definition: boss_sapphiron.cpp:60
Definition: Common.h:103
EventMap events
Definition: ScriptedCreature.h:371
void SetReactState(ReactStates st)
Definition: Creature.h:502

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 boss_sapphiron::boss_sapphironAI::GetData ( uint32  data) const
inlineoverridevirtual

Reimplemented from UnitAI.

220  {
221  if (data == DATA_THE_HUNDRED_CLUB)
222  return _canTheHundredClub;
223 
224  return 0;
225  }
bool _canTheHundredClub
Definition: boss_sapphiron.cpp:405
Definition: boss_sapphiron.cpp:81
void boss_sapphiron::boss_sapphironAI::Initialize ( void  )
inline
101  {
102  _phase = PHASE_NULL;
103 
104  _canTheHundredClub = true;
105  }
Definition: boss_sapphiron.cpp:51
bool _canTheHundredClub
Definition: boss_sapphiron.cpp:405
Phases _phase
Definition: boss_sapphiron.cpp:402

+ Here is the caller graph for this function:

void boss_sapphiron::boss_sapphironAI::InitializeAI ( )
inlineoverridevirtual

Reimplemented from UnitAI.

108  {
109  _canTheHundredClub = true;
110 
111  float x, y, z;
112  me->GetPosition(x, y, z);
113  me->SummonGameObject(GO_BIRTH, x, y, z, 0, 0, 0, 0, 0, 0);
114  me->SetVisible(false);
117 
119  }
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition: Object.cpp:2372
bool _canTheHundredClub
Definition: boss_sapphiron.cpp:405
Definition: Unit.h:674
Definition: Unit.h:1129
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
virtual void InitializeAI()
Definition: UnitAI.h:130
Creature *const me
Definition: CreatureAI.h:71
G3D::int16 z
Definition: Vector3int16.h:46
void GetPosition(float &x, float &y) const
Definition: Position.h:109
void SetVisible(bool x)
Definition: Unit.cpp:10368
G3D::int16 y
Definition: Vector2int16.h:38
Definition: naxxramas.h:153
Definition: UpdateFields.h:109
G3D::int16 x
Definition: Vector2int16.h:37
void SetReactState(ReactStates st)
Definition: Creature.h:502

+ Here is the call graph for this function:

void boss_sapphiron::boss_sapphironAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from BossAI.

174  {
175  _JustDied();
176  me->CastSpell(me, SPELL_DIES, true);
177  }
void _JustDied()
Definition: ScriptedCreature.cpp:471
Creature *const me
Definition: CreatureAI.h:71
Definition: boss_sapphiron.cpp:44
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869

+ Here is the call graph for this function:

void boss_sapphiron::boss_sapphironAI::MovementInform ( uint32  ,
uint32  id 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

180  {
181  if (id == 1)
183  }
Definition: boss_sapphiron.cpp:65
void ScheduleEvent(uint32 eventId, Milliseconds const &time, uint32 group=0, uint8 phase=0)
Definition: EventMap.h:123
EventMap events
Definition: ScriptedCreature.h:371

+ Here is the call graph for this function:

void boss_sapphiron::boss_sapphironAI::Reset ( )
inlineoverridevirtual

Reimplemented from BossAI.

122  {
123  _Reset();
124 
125  if (_phase == PHASE_FLIGHT)
126  {
127  ClearIceBlock();
129  if (me->IsHovering())
130  {
132  me->SetHover(false);
133  }
134  me->SetDisableGravity(false);
135  }
136 
137  Initialize();
138  }
Definition: Unit.h:1131
Phases _phase
Definition: boss_sapphiron.cpp:402
bool SetDisableGravity(bool disable, bool packetOnly=false)
Definition: Unit.cpp:15818
bool IsHovering() const
Definition: Unit.h:1669
Creature *const me
Definition: CreatureAI.h:71
bool SetHover(bool enable, bool packetOnly=false)
Definition: Unit.cpp:16018
void ClearIceBlock()
Definition: boss_sapphiron.cpp:206
Definition: SharedDefines.h:2482
void _Reset()
Definition: ScriptedCreature.cpp:457
void Initialize()
Definition: boss_sapphiron.cpp:100
void HandleEmoteCommand(uint32 anim_id)
Definition: Unit.cpp:1444
Definition: boss_sapphiron.cpp:54
void SetReactState(ReactStates st)
Definition: Creature.h:502

+ Here is the call graph for this function:

void boss_sapphiron::boss_sapphironAI::SpellHitTarget ( Unit target,
SpellInfo const spell 
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

153  {
154  switch(spell->Id)
155  {
156  case SPELL_ICEBOLT:
157  {
158  IceBlockMap::iterator itr = _iceblocks.find(target->GetGUID());
159  if (itr != _iceblocks.end() && !itr->second)
160  {
161  if (GameObject* iceblock = me->SummonGameObject(GO_ICEBLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, 0, 0, 0, 0, 25))
162  itr->second = iceblock->GetGUID();
163  }
164  break;
165  }
166  case SPELL_CHECK_RESISTS:
167  if (target && target->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
168  _canTheHundredClub = false;
169  break;
170  }
171  }
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition: Object.cpp:2372
bool _canTheHundredClub
Definition: boss_sapphiron.cpp:405
Definition: boss_sapphiron.cpp:78
Definition: SharedDefines.h:278
IceBlockMap _iceblocks
Definition: boss_sapphiron.cpp:404
Creature *const me
Definition: CreatureAI.h:71
float GetPositionY() const
Definition: Position.h:105
Definition: boss_sapphiron.cpp:82
Definition: boss_sapphiron.cpp:46
float GetPositionZ() const
Definition: Position.h:106
Definition: GameObject.h:880
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32 GetResistance(SpellSchools school) const
Definition: Unit.h:1422
float GetPositionX() const
Definition: Position.h:104
Definition: boss_sapphiron.cpp:39

+ Here is the call graph for this function:

void boss_sapphiron::boss_sapphironAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from BossAI.

228  {
229  if (!_phase)
230  return;
231 
232  events.Update(diff);
233 
234  if (_phase != PHASE_BIRTH && !UpdateVictim())
235  return;
236 
237  if (_phase == PHASE_GROUND)
238  {
239  while (uint32 eventId = events.ExecuteEvent())
240  {
241  switch (eventId)
242  {
243  case EVENT_CHECK_RESISTS:
246  return;
247  case EVENT_BERSERK:
250  return;
251  case EVENT_CLEAVE:
254  return;
255  case EVENT_TAIL:
258  return;
259  case EVENT_DRAIN:
262  return;
263  case EVENT_BLIZZARD:
264  {
266  summon->GetMotionMaster()->MoveRandom(40);
268  break;
269  }
270  case EVENT_FLIGHT:
271  if (HealthAbovePct(10))
272  {
276  me->AttackStop();
277  float x, y, z, o;
278  me->GetHomePosition(x, y, z, o);
279  me->GetMotionMaster()->MovePoint(1, x, y, z);
280  return;
281  }
282  break;
283  }
284  }
285 
287  }
288  else
289  {
290  if (uint32 eventId = events.ExecuteEvent())
291  {
292  switch (eventId)
293  {
294  case EVENT_CHECK_RESISTS:
297  return;
298  case EVENT_LIFTOFF:
300  me->SetDisableGravity(true);
301  me->SetHover(true);
303  _iceboltCount = RAID_MODE(2, 3);
304  return;
305  case EVENT_ICEBOLT:
306  {
307  std::vector<Unit*> targets;
308  std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
309  for (; i != me->getThreatManager().getThreatList().end(); ++i)
310  if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT))
311  targets.push_back((*i)->getTarget());
312 
313  if (targets.empty())
314  _iceboltCount = 0;
315  else
316  {
317  std::vector<Unit*>::const_iterator itr = targets.begin();
318  advance(itr, rand32() % targets.size());
319  _iceblocks.insert(std::make_pair((*itr)->GetGUID(), ObjectGuid::Empty));
320  DoCast(*itr, SPELL_ICEBOLT);
321  --_iceboltCount;
322  }
323 
324  if (_iceboltCount)
326  else
328  return;
329  }
330  case EVENT_BREATH:
331  {
335  return;
336  }
337  case EVENT_EXPLOSION:
338  CastExplosion();
339  ClearIceBlock();
341  return;
342  case EVENT_LAND:
345  me->SetHover(false);
346  me->SetDisableGravity(false);
348  return;
349  case EVENT_GROUND:
351  return;
352  case EVENT_BIRTH:
353  me->SetVisible(true);
356  return;
357  }
358  }
359  }
360  }
Definition: boss_sapphiron.cpp:28
bool AttackStop()
Definition: Unit.cpp:7337
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:167
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: boss_sapphiron.cpp:36
Definition: Unit.h:674
bool UpdateVictim()
Definition: CreatureAI.cpp:233
Definition: Unit.h:1131
Definition: boss_sapphiron.cpp:71
Definition: boss_sapphiron.cpp:38
void SetPhase(uint8 phase)
Definition: EventMap.cpp:27
Definition: Unit.h:1129
Definition: boss_sapphiron.cpp:53
Definition: boss_sapphiron.cpp:63
Definition: boss_sapphiron.cpp:26
Definition: boss_sapphiron.cpp:77
Definition: boss_sapphiron.cpp:65
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
Definition: boss_sapphiron.cpp:69
bool HealthAbovePct(uint32 pct) const
Definition: ScriptedCreature.h:248
Definition: boss_sapphiron.cpp:67
ThreatContainer::StorageType const & getThreatList() const
Definition: ThreatManager.h:263
Definition: boss_sapphiron.cpp:29
Definition: boss_sapphiron.cpp:43
Definition: Creature.h:467
Phases _phase
Definition: boss_sapphiron.cpp:402
bool SetDisableGravity(bool disable, bool packetOnly=false)
Definition: Unit.cpp:15818
Definition: boss_sapphiron.cpp:42
Definition: boss_sapphiron.cpp:61
Definition: boss_sapphiron.cpp:70
void advance(octet_iterator &it, distance_type n, octet_iterator end)
Definition: checked.h:190
Definition: boss_sapphiron.cpp:68
IceBlockMap _iceblocks
Definition: boss_sapphiron.cpp:404
Creature *const me
Definition: CreatureAI.h:71
void MovePoint(uint32 id, Position const &pos, bool generatePath=true)
Definition: MotionMaster.h:172
bool SetHover(bool enable, bool packetOnly=false)
Definition: Unit.cpp:16018
Definition: boss_sapphiron.cpp:27
Definition: Object.h:56
void CastExplosion()
Definition: boss_sapphiron.cpp:362
G3D::int16 z
Definition: Vector3int16.h:46
Creature * DoSummon(uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
Definition: CreatureAI.cpp:377
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32 _iceboltCount
Definition: boss_sapphiron.cpp:403
void ClearIceBlock()
Definition: boss_sapphiron.cpp:206
Definition: SharedDefines.h:2482
Definition: boss_sapphiron.cpp:46
Definition: boss_sapphiron.cpp:52
void SetVisible(bool x)
Definition: Unit.cpp:10368
uint32_t uint32
Definition: Define.h:150
Definition: boss_sapphiron.cpp:62
G3D::int16 y
Definition: Vector2int16.h:38
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
Definition: boss_sapphiron.cpp:35
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void ScheduleEvent(uint32 eventId, Milliseconds const &time, uint32 group=0, uint8 phase=0)
Definition: EventMap.h:123
Definition: boss_sapphiron.cpp:64
Definition: boss_sapphiron.cpp:60
void Update(uint32 time)
Definition: EventMap.h:54
const T & RAID_MODE(const T &normal10, const T &normal25) const
Definition: ScriptedCreature.h:293
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
Definition: ObjectGuid.h:33
void EnterPhaseGround()
Definition: boss_sapphiron.cpp:194
Definition: UpdateFields.h:109
Definition: Common.h:103
uint32 ExecuteEvent()
Definition: EventMap.cpp:46
ThreatManager & getThreatManager()
Definition: Unit.h:1998
uint32 rand32()
Definition: Random.cpp:64
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:49
EventMap events
Definition: ScriptedCreature.h:371
void HandleEmoteCommand(uint32 anim_id)
Definition: Unit.cpp:1444
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:159
G3D::int16 x
Definition: Vector2int16.h:37
Definition: boss_sapphiron.cpp:66
Definition: boss_sapphiron.cpp:72
Definition: boss_sapphiron.cpp:54
void SetReactState(ReactStates st)
Definition: Creature.h:502
Definition: boss_sapphiron.cpp:39
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:672
Definition: boss_sapphiron.cpp:59

+ Here is the call graph for this function:

Member Data Documentation

bool boss_sapphiron::boss_sapphironAI::_canTheHundredClub
private
IceBlockMap boss_sapphiron::boss_sapphironAI::_iceblocks
private
uint32 boss_sapphiron::boss_sapphironAI::_iceboltCount
private
Map* boss_sapphiron::boss_sapphironAI::_map
private
Phases boss_sapphiron::boss_sapphironAI::_phase
private

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