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

Public Member Functions

 boss_malchezaarAI (Creature *creature)
 
void Initialize ()
 
void Reset () override
 
void KilledUnit (Unit *) override
 
void JustDied (Unit *) override
 
void EnterCombat (Unit *) override
 
void InfernalCleanup ()
 
void AxesCleanup ()
 
void ClearWeapons ()
 
void EnfeebleHealthEffect ()
 
void EnfeebleResetHealth ()
 
void SummonInfernal (const uint32)
 
void UpdateAI (uint32 diff) override
 
void DoMeleeAttacksIfReady ()
 
void Cleanup (Creature *infernal, InfernalPoint *point)
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &) 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
 
uint32 EnfeebleTimer
 
uint32 EnfeebleResetTimer
 
uint32 ShadowNovaTimer
 
uint32 SWPainTimer
 
uint32 SunderArmorTimer
 
uint32 AmplifyDamageTimer
 
uint32 Cleave_Timer
 
uint32 InfernalTimer
 
uint32 AxesTargetSwitchTimer
 
uint32 InfernalCleanupTimer
 
GuidVector infernals
 
std::vector< InfernalPoint * > positions
 
ObjectGuid axes [2]
 
ObjectGuid enfeeble_targets [5]
 
uint64 enfeeble_health [5]
 
uint32 phase
 
- 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_malchezaar::boss_malchezaarAI::boss_malchezaarAI ( Creature creature)
inline
187  : ScriptedAI(creature)
188  {
189  Initialize();
190 
191  instance = creature->GetInstanceScript();
192  }
ScriptedAI(Creature *creature)
Definition: ScriptedCreature.cpp:100
InstanceScript * GetInstanceScript()
Definition: Object.cpp:1540
InstanceScript * instance
Definition: boss_prince_malchezaar.cpp:215
void Initialize()
Definition: boss_prince_malchezaar.cpp:194

+ Here is the call graph for this function:

Member Function Documentation

void boss_malchezaar::boss_malchezaarAI::AxesCleanup ( )
inline
293  {
294  for (uint8 i = 0; i < 2; ++i)
295  {
296  Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]);
297  if (axe && axe->IsAlive())
298  axe->KillSelf();
299  axes[i].Clear();
300  }
301  }
void KillSelf(bool durabilityLoss=true)
Definition: Unit.h:1515
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
Creature *const me
Definition: CreatureAI.h:71
bool IsAlive() const
Definition: Unit.h:1692
void Clear()
Definition: ObjectGuid.h:215
uint8_t uint8
Definition: Define.h:152
ObjectGuid axes[2]
Definition: boss_prince_malchezaar.cpp:230
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_malchezaar::boss_malchezaarAI::Cleanup ( Creature infernal,
InfernalPoint point 
)
inline
577  {
578  for (GuidVector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr)
579  {
580  if (*itr == infernal->GetGUID())
581  {
582  infernals.erase(itr);
583  break;
584  }
585  }
586 
587  positions.push_back(point);
588  }
GuidVector infernals
Definition: boss_prince_malchezaar.cpp:227
std::vector< InfernalPoint * > positions
Definition: boss_prince_malchezaar.cpp:228
ObjectGuid const & GetGUID() const
Definition: Object.h:105

+ Here is the call graph for this function:

void boss_malchezaar::boss_malchezaarAI::ClearWeapons ( )
inline
304  {
306  me->SetCanDualWield(false);
307  }
void SetCanDualWield(bool value) override
Definition: Creature.cpp:1423
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
Definition: ScriptedCreature.cpp:364
Definition: CreatureAI.h:63
Creature *const me
Definition: CreatureAI.h:71
Definition: CreatureAI.h:64

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_malchezaar::boss_malchezaarAI::DoMeleeAttacksIfReady ( )
inline
558  {
560  {
561  //Check for base attack
562  if (me->isAttackReady() && me->GetVictim())
563  {
565  me->resetAttackTimer();
566  }
567  //Check for offhand attack
568  if (me->isAttackReady(OFF_ATTACK) && me->GetVictim())
569  {
572  }
573  }
574  }
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false)
Definition: Unit.cpp:1874
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:2886
Creature *const me
Definition: CreatureAI.h:71
Definition: Unit.h:618
Unit * GetVictim() const
Definition: Unit.h:1379
bool IsWithinMeleeRange(const Unit *obj, float dist=MELEE_RANGE) const
Definition: Unit.cpp:508
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:1357
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:481

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_malchezaar::boss_malchezaarAI::EnfeebleHealthEffect ( )
inline
310  {
311  const SpellInfo* info = sSpellMgr->GetSpellInfo(SPELL_ENFEEBLE_EFFECT);
312  if (!info)
313  return;
314 
316  std::vector<Unit*> targets;
317 
318  if (t_list.empty())
319  return;
320 
321  //begin + 1, so we don't target the one with the highest threat
322  ThreatContainer::StorageType::const_iterator itr = t_list.begin();
323  std::advance(itr, 1);
324  for (; itr != t_list.end(); ++itr) //store the threat list in a different container
325  if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
326  if (target->IsAlive() && target->GetTypeId() == TYPEID_PLAYER)
327  targets.push_back(target);
328 
329  //cut down to size if we have more than 5 targets
330  while (targets.size() > 5)
331  targets.erase(targets.begin() + rand32() % targets.size());
332 
333  uint32 i = 0;
334  for (std::vector<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i)
335  if (Unit* target = *iter)
336  {
337  enfeeble_targets[i] = target->GetGUID();
338  enfeeble_health[i] = target->GetHealth();
339 
340  target->CastSpell(target, SPELL_ENFEEBLE, true, 0, 0, me->GetGUID());
341  target->SetHealth(1);
342  }
343  }
Definition: boss_prince_malchezaar.cpp:79
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
Definition: SpellInfo.h:326
ThreatContainer::StorageType const & getThreatList() const
Definition: ThreatManager.h:263
void advance(octet_iterator &it, distance_type n, octet_iterator end)
Definition: checked.h:190
Creature *const me
Definition: CreatureAI.h:71
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
uint64 enfeeble_health[5]
Definition: boss_prince_malchezaar.cpp:232
ObjectGuid const & GetGUID() const
Definition: Object.h:105
ObjectGuid enfeeble_targets[5]
Definition: boss_prince_malchezaar.cpp:231
Definition: ObjectGuid.h:33
std::list< HostileReference * > StorageType
Definition: ThreatManager.h:149
ThreatManager & getThreatManager()
Definition: Unit.h:1998
uint32 rand32()
Definition: Random.cpp:64
Definition: Unit.h:1305
Definition: boss_prince_malchezaar.cpp:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_malchezaar::boss_malchezaarAI::EnfeebleResetHealth ( )
inline
346  {
347  for (uint8 i = 0; i < 5; ++i)
348  {
350  if (target && target->IsAlive())
351  target->SetHealth(enfeeble_health[i]);
352  enfeeble_targets[i].Clear();
353  enfeeble_health[i] = 0;
354  }
355  }
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
Creature *const me
Definition: CreatureAI.h:71
bool IsAlive() const
Definition: Unit.h:1692
uint64 enfeeble_health[5]
Definition: boss_prince_malchezaar.cpp:232
void Clear()
Definition: ObjectGuid.h:215
ObjectGuid enfeeble_targets[5]
Definition: boss_prince_malchezaar.cpp:231
uint8_t uint8
Definition: Define.h:152
void SetHealth(uint32 val)
Definition: Unit.cpp:11537
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_malchezaar::boss_malchezaarAI::EnterCombat ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

272  {
273  Talk(SAY_AGGRO);
274 
275  instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), false); // Open the door leading further in
276  }
Definition: karazhan.h:50
InstanceScript * instance
Definition: boss_prince_malchezaar.cpp:215
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
Definition: InstanceScript.cpp:397
Definition: boss_prince_malchezaar.cpp:66

+ Here is the call graph for this function:

void boss_malchezaar::boss_malchezaarAI::InfernalCleanup ( )
inline
279  {
280  //Infernal Cleanup
281  for (GuidVector::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr)
282  if (Unit* pInfernal = ObjectAccessor::GetUnit(*me, *itr))
283  if (pInfernal->IsAlive())
284  {
285  pInfernal->SetVisible(false);
286  pInfernal->setDeathState(JUST_DIED);
287  }
288 
289  infernals.clear();
290  }
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
GuidVector infernals
Definition: boss_prince_malchezaar.cpp:227
Definition: Unit.h:542
Creature *const me
Definition: CreatureAI.h:71
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_malchezaar::boss_malchezaarAI::Initialize ( void  )
inline
195  {
196  EnfeebleTimer = 30000;
197  EnfeebleResetTimer = 38000;
198  ShadowNovaTimer = 35500;
199  SWPainTimer = 20000;
200  AmplifyDamageTimer = 5000;
201  Cleave_Timer = 8000;
202  InfernalTimer = 40000;
203  InfernalCleanupTimer = 47000;
204  AxesTargetSwitchTimer = urand(7500, 20000);
205  SunderArmorTimer = urand(5000, 10000);
206  phase = 1;
207 
208  for (uint8 i = 0; i < 5; ++i)
209  {
210  enfeeble_targets[i].Clear();
211  enfeeble_health[i] = 0;
212  }
213  }
uint32 phase
Definition: boss_prince_malchezaar.cpp:234
uint32 SWPainTimer
Definition: boss_prince_malchezaar.cpp:219
uint32 Cleave_Timer
Definition: boss_prince_malchezaar.cpp:222
uint32 EnfeebleTimer
Definition: boss_prince_malchezaar.cpp:216
uint32 ShadowNovaTimer
Definition: boss_prince_malchezaar.cpp:218
uint32 AxesTargetSwitchTimer
Definition: boss_prince_malchezaar.cpp:224
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32 AmplifyDamageTimer
Definition: boss_prince_malchezaar.cpp:221
uint64 enfeeble_health[5]
Definition: boss_prince_malchezaar.cpp:232
uint32 EnfeebleResetTimer
Definition: boss_prince_malchezaar.cpp:217
void Clear()
Definition: ObjectGuid.h:215
ObjectGuid enfeeble_targets[5]
Definition: boss_prince_malchezaar.cpp:231
uint32 InfernalTimer
Definition: boss_prince_malchezaar.cpp:223
uint8_t uint8
Definition: Define.h:152
uint32 SunderArmorTimer
Definition: boss_prince_malchezaar.cpp:220
uint32 InfernalCleanupTimer
Definition: boss_prince_malchezaar.cpp:225

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void boss_malchezaar::boss_malchezaarAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

257  {
258  Talk(SAY_DEATH);
259 
260  AxesCleanup();
261  ClearWeapons();
262  InfernalCleanup();
263  positions.clear();
264 
265  for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
266  positions.push_back(&InfernalPoints[i]);
267 
269  }
void InfernalCleanup()
Definition: boss_prince_malchezaar.cpp:278
Definition: karazhan.h:50
Definition: boss_prince_malchezaar.cpp:74
Definition: boss_prince_malchezaar.cpp:76
InstanceScript * instance
Definition: boss_prince_malchezaar.cpp:215
void ClearWeapons()
Definition: boss_prince_malchezaar.cpp:303
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
std::vector< InfernalPoint * > positions
Definition: boss_prince_malchezaar.cpp:228
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
Definition: InstanceScript.cpp:397
uint8_t uint8
Definition: Define.h:152
static InfernalPoint InfernalPoints[]
Definition: boss_prince_malchezaar.cpp:39
void AxesCleanup()
Definition: boss_prince_malchezaar.cpp:292

+ Here is the call graph for this function:

void boss_malchezaar::boss_malchezaarAI::KilledUnit ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

252  {
253  Talk(SAY_SLAY);
254  }
Definition: boss_prince_malchezaar.cpp:72
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42

+ Here is the call graph for this function:

void boss_malchezaar::boss_malchezaarAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

237  {
238  AxesCleanup();
239  ClearWeapons();
240  InfernalCleanup();
241  positions.clear();
242 
243  Initialize();
244 
245  for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
246  positions.push_back(&InfernalPoints[i]);
247 
249  }
void InfernalCleanup()
Definition: boss_prince_malchezaar.cpp:278
Definition: karazhan.h:50
Definition: boss_prince_malchezaar.cpp:76
InstanceScript * instance
Definition: boss_prince_malchezaar.cpp:215
void ClearWeapons()
Definition: boss_prince_malchezaar.cpp:303
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
std::vector< InfernalPoint * > positions
Definition: boss_prince_malchezaar.cpp:228
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
Definition: InstanceScript.cpp:397
void Initialize()
Definition: boss_prince_malchezaar.cpp:194
uint8_t uint8
Definition: Define.h:152
static InfernalPoint InfernalPoints[]
Definition: boss_prince_malchezaar.cpp:39
void AxesCleanup()
Definition: boss_prince_malchezaar.cpp:292

+ Here is the call graph for this function:

void boss_malchezaar::boss_malchezaarAI::SummonInfernal ( const uint32  )
inline
358  {
359  InfernalPoint *point = NULL;
360  Position pos;
361  if ((me->GetMapId() != 532) || positions.empty())
362  pos = me->GetRandomNearPosition(60);
363  else
364  {
366  pos.Relocate(point->x, point->y, INFERNAL_Z, frand(0.0f, float(M_PI * 2)));
367  }
368 
370 
371  if (infernal)
372  {
374  infernal->setFaction(me->getFaction());
375  if (point)
376  ENSURE_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->point = point;
377  ENSURE_AI(netherspite_infernal::netherspite_infernalAI, infernal->AI())->malchezaar = me->GetGUID();
378 
379  infernals.push_back(infernal->GetGUID());
380  DoCast(infernal, SPELL_INFERNAL_RELAY);
381  }
382 
383  Talk(SAY_SUMMON);
384  }
GuidVector infernals
Definition: boss_prince_malchezaar.cpp:227
C::value_type const & SelectRandomContainerElement(C const &container)
Definition: Containers.h:68
#define M_PI
Definition: Common.h:163
uint32 getFaction() const
Definition: Unit.h:1466
double frand()
Definition: Vector3.cpp:170
Definition: boss_prince_malchezaar.cpp:73
Definition: boss_prince_malchezaar.cpp:93
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Definition: boss_prince_malchezaar.cpp:94
Definition: boss_prince_malchezaar.cpp:110
void setFaction(uint32 faction)
Definition: Unit.h:1467
Creature *const me
Definition: CreatureAI.h:71
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
void Relocate(float x, float y)
Definition: Position.h:67
float x
Definition: boss_prince_malchezaar.cpp:34
Definition: Object.h:56
Position GetRandomNearPosition(float radius)
Definition: Object.cpp:2643
CreatureAI * AI() const
Definition: Creature.h:525
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
uint32 GetMapId() const
Definition: Position.h:254
std::vector< InfernalPoint * > positions
Definition: boss_prince_malchezaar.cpp:228
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void SetDisplayId(uint32 modelId) override
Definition: Creature.cpp:2664
Definition: Position.h:27
Definition: boss_prince_malchezaar.cpp:32
#define INFERNAL_Z
Definition: boss_prince_malchezaar.cpp:37
float y
Definition: boss_prince_malchezaar.cpp:34
Definition: boss_prince_malchezaar.cpp:90
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_malchezaar::boss_malchezaarAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from ScriptedAI.

387  {
388  if (!UpdateVictim())
389  return;
390 
391  if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that
392  {
394  EnfeebleResetTimer = 0;
395  } else EnfeebleResetTimer -= diff;
396 
397  if (me->HasUnitState(UNIT_STATE_STUNNED)) // While shifting to phase 2 malchezaar stuns himself
398  return;
399 
400  if (me->GetVictim() && me->GetTarget() != me->EnsureVictim()->GetGUID())
402 
403  if (phase == 1)
404  {
405  if (HealthBelowPct(60))
406  {
407  me->InterruptNonMeleeSpells(false);
408 
409  phase = 2;
410 
411  //animation
413 
414  //text
416 
417  //passive thrash aura
418  DoCast(me, SPELL_THRASH_AURA, true);
419 
420  //models
422 
424  me->SetCanDualWield(true);
425  }
426  }
427  else if (phase == 2)
428  {
429  if (HealthBelowPct(30))
430  {
431  InfernalTimer = 15000;
432 
433  phase = 3;
434 
435  ClearWeapons();
436 
437  //remove thrash
439 
441 
442  Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
443  for (uint8 i = 0; i < 2; ++i)
444  {
446  if (axe)
447  {
449  axe->setFaction(me->getFaction());
450  axes[i] = axe->GetGUID();
451  if (target)
452  {
453  axe->AI()->AttackStart(target);
454  //axe->getThreatManager().tauntApply(target); //Taunt Apply and fade out does not work properly
455  // So we'll use a hack to add a lot of threat to our target
456  axe->AddThreat(target, 10000000.0f);
457  }
458  }
459  }
460 
461  if (ShadowNovaTimer > 35000)
463 
464  return;
465  }
466 
467  if (SunderArmorTimer <= diff)
468  {
470  SunderArmorTimer = urand(10000, 18000);
471  } else SunderArmorTimer -= diff;
472 
473  if (Cleave_Timer <= diff)
474  {
476  Cleave_Timer = urand(6000, 12000);
477  } else Cleave_Timer -= diff;
478  }
479  else
480  {
481  if (AxesTargetSwitchTimer <= diff)
482  {
483  AxesTargetSwitchTimer = urand(7500, 20000);
484 
485  if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
486  {
487  for (uint8 i = 0; i < 2; ++i)
488  {
489  if (Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]))
490  {
491  if (axe->GetVictim())
492  DoModifyThreatPercent(axe->GetVictim(), -100);
493  if (target)
494  axe->AddThreat(target, 1000000.0f);
495  //axe->getThreatManager().tauntFadeOut(axe->GetVictim());
496  //axe->getThreatManager().tauntApply(target);
497  }
498  }
499  }
500  } else AxesTargetSwitchTimer -= diff;
501 
502  if (AmplifyDamageTimer <= diff)
503  {
504  if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
505  DoCast(target, SPELL_AMPLIFY_DAMAGE);
506  AmplifyDamageTimer = urand(20000, 30000);
507  } else AmplifyDamageTimer -= diff;
508  }
509 
510  //Time for global and double timers
511  if (InfernalTimer <= diff)
512  {
513  SummonInfernal(diff);
514  InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise
515  } else InfernalTimer -= diff;
516 
517  if (ShadowNovaTimer <= diff)
518  {
520  ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1);
521  } else ShadowNovaTimer -= diff;
522 
523  if (phase != 2)
524  {
525  if (SWPainTimer <= diff)
526  {
527  Unit* target = NULL;
528  if (phase == 1)
529  target = me->GetVictim(); // the tank
530  else // anyone but the tank
531  target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
532 
533  if (target)
534  DoCast(target, SPELL_SW_PAIN);
535 
536  SWPainTimer = 20000;
537  } else SWPainTimer -= diff;
538  }
539 
540  if (phase != 3)
541  {
542  if (EnfeebleTimer <= diff)
543  {
545  EnfeebleTimer = 30000;
546  ShadowNovaTimer = 5000;
547  EnfeebleResetTimer = 9000;
548  } else EnfeebleTimer -= diff;
549  }
550 
551  if (phase == 2)
553  else
555  }
void EnfeebleHealthEffect()
Definition: boss_prince_malchezaar.cpp:309
Unit * EnsureVictim() const
Definition: Unit.h:1381
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
Definition: Unit.cpp:10691
Definition: boss_prince_malchezaar.cpp:88
uint32 phase
Definition: boss_prince_malchezaar.cpp:234
uint32 SWPainTimer
Definition: boss_prince_malchezaar.cpp:219
void SetCanDualWield(bool value) override
Definition: Creature.cpp:1423
uint32 Cleave_Timer
Definition: boss_prince_malchezaar.cpp:222
void EnfeebleResetHealth()
Definition: boss_prince_malchezaar.cpp:345
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
Definition: ScriptedCreature.cpp:364
bool UpdateVictim()
Definition: CreatureAI.cpp:233
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
void DoMeleeAttacksIfReady()
Definition: boss_prince_malchezaar.cpp:557
Definition: boss_prince_malchezaar.cpp:86
uint32 getFaction() const
Definition: Unit.h:1466
uint32 EnfeebleTimer
Definition: boss_prince_malchezaar.cpp:216
bool HealthBelowPct(uint32 pct) const
Definition: ScriptedCreature.h:247
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition: Unit.h:1458
Definition: boss_prince_malchezaar.cpp:82
Definition: boss_prince_malchezaar.cpp:87
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
uint32 GetAttackTime(WeaponAttackType att) const
Definition: Unit.cpp:10326
uint32 ShadowNovaTimer
Definition: boss_prince_malchezaar.cpp:218
Definition: CreatureAI.h:63
void setFaction(uint32 faction)
Definition: Unit.h:1467
void ClearWeapons()
Definition: boss_prince_malchezaar.cpp:303
Creature *const me
Definition: CreatureAI.h:71
uint32 AxesTargetSwitchTimer
Definition: boss_prince_malchezaar.cpp:224
Definition: boss_prince_malchezaar.cpp:96
Definition: boss_prince_malchezaar.cpp:68
Definition: Unit.h:553
Definition: Unit.h:618
Definition: UnitAI.h:35
void DoModifyThreatPercent(Unit *unit, int32 pct)
Definition: ScriptedCreature.cpp:273
Unit * GetVictim() const
Definition: Unit.h:1379
float GetPositionY() const
Definition: Position.h:105
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
CreatureAI * AI() const
Definition: Creature.h:525
Definition: boss_prince_malchezaar.cpp:85
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition: UnitAI.cpp:91
float GetPositionZ() const
Definition: Position.h:106
Definition: boss_prince_malchezaar.cpp:91
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void SummonInfernal(const uint32)
Definition: boss_prince_malchezaar.cpp:357
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
uint32 AmplifyDamageTimer
Definition: boss_prince_malchezaar.cpp:221
Definition: boss_prince_malchezaar.cpp:84
uint32 EnfeebleResetTimer
Definition: boss_prince_malchezaar.cpp:217
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
ObjectGuid GetTarget() const
Definition: Unit.h:2209
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: boss_prince_malchezaar.cpp:67
uint32 InfernalTimer
Definition: boss_prince_malchezaar.cpp:223
Definition: UpdateFields.h:109
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:2916
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:49
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
uint8_t uint8
Definition: Define.h:152
uint32 SunderArmorTimer
Definition: boss_prince_malchezaar.cpp:220
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition: UnitAI.cpp:159
uint32_t uint32
Definition: g3dmath.h:168
ObjectGuid axes[2]
Definition: boss_prince_malchezaar.cpp:230
Definition: boss_prince_malchezaar.cpp:81
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29
Definition: Unit.h:698
void SetTarget(ObjectGuid const &guid) override
Definition: Creature.cpp:2675
Definition: Unit.h:617
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:

Member Data Documentation

uint32 boss_malchezaar::boss_malchezaarAI::AmplifyDamageTimer
ObjectGuid boss_malchezaar::boss_malchezaarAI::axes[2]
uint32 boss_malchezaar::boss_malchezaarAI::AxesTargetSwitchTimer
uint32 boss_malchezaar::boss_malchezaarAI::Cleave_Timer
uint64 boss_malchezaar::boss_malchezaarAI::enfeeble_health[5]
ObjectGuid boss_malchezaar::boss_malchezaarAI::enfeeble_targets[5]
uint32 boss_malchezaar::boss_malchezaarAI::EnfeebleResetTimer
uint32 boss_malchezaar::boss_malchezaarAI::EnfeebleTimer
uint32 boss_malchezaar::boss_malchezaarAI::InfernalCleanupTimer
GuidVector boss_malchezaar::boss_malchezaarAI::infernals
uint32 boss_malchezaar::boss_malchezaarAI::InfernalTimer
InstanceScript* boss_malchezaar::boss_malchezaarAI::instance
uint32 boss_malchezaar::boss_malchezaarAI::phase
std::vector<InfernalPoint*> boss_malchezaar::boss_malchezaarAI::positions
uint32 boss_malchezaar::boss_malchezaarAI::ShadowNovaTimer
uint32 boss_malchezaar::boss_malchezaarAI::SunderArmorTimer
uint32 boss_malchezaar::boss_malchezaarAI::SWPainTimer

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