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

Public Member Functions

 boss_hex_lord_malacrassAI (Creature *creature)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void KilledUnit (Unit *) override
 
void JustDied (Unit *) override
 
void SelectAddEntry ()
 
void SpawnAdds ()
 
void UpdateAI (uint32 diff) override
 
void UseAbility ()
 
- 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
 
ObjectGuid AddGUID [4]
 
uint32 AddEntry [4]
 
ObjectGuid PlayerGUID
 
uint32 SpiritBolts_Timer
 
uint32 DrainPower_Timer
 
uint32 SiphonSoul_Timer
 
uint32 PlayerAbility_Timer
 
uint32 CheckAddState_Timer
 
uint32 ResetTimer
 
uint32 PlayerClass
 
- 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_hex_lord_malacrassAI()

boss_hexlord_malacrass::boss_hex_lord_malacrassAI::boss_hex_lord_malacrassAI ( Creature creature)
inline
258 : ScriptedAI(creature)
259 {
260 instance = creature->GetInstanceScript();
262 }
Definition: ScriptedCreature.h:192
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
void SelectAddEntry()
Definition: boss_hexlord.cpp:344
InstanceScript * instance
Definition: boss_hexlord.cpp:264

References WorldObject::GetInstanceScript(), instance, and SelectAddEntry().

Member Function Documentation

◆ JustDied()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

331 {
333
335
336 for (uint8 i = 0; i < 4; ++i)
337 {
339 if (Temp && Temp->IsAlive())
340 Unit::DealDamage(Temp, Temp, Temp->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
341 }
342 }
std::uint8_t uint8
Definition: Define.h:110
@ DIRECT_DAMAGE
Definition: Unit.h:435
@ DONE
Definition: InstanceScript.h:59
@ SAY_DEATH
Definition: boss_hexlord.cpp:38
@ DATA_HEXLORDEVENT
Definition: zulaman.h:33
Talk
Definition: boss_fathomlord_karathress.cpp:23
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:269
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:204
Creature * me
Definition: ScriptedCreature.h:282
Definition: Unit.h:1290
bool IsAlive() const
Definition: Unit.h:1808
uint32 GetHealth() const
Definition: Unit.h:1440
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition: Unit.cpp:815
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:53
ObjectGuid AddGUID[4]
Definition: boss_hexlord.cpp:266

References AddGUID, DATA_HEXLORDEVENT, Unit::DealDamage(), DIRECT_DAMAGE, DONE, Unit::GetHealth(), ObjectAccessor::GetUnit(), instance, Unit::IsAlive(), ScriptedAI::me, SAY_DEATH, ZoneScript::SetData(), and SPELL_SCHOOL_MASK_NORMAL.

◆ JustEngagedWith()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustEngagedWith ( Unit )
inlineoverridevirtual

Called for reaction when initially engaged.

Reimplemented from ScriptedAI.

298 {
300
303
304 for (uint8 i = 0; i < 4; ++i)
305 {
307 if (creature && creature->IsAlive())
308 creature->AI()->AttackStart(me->GetVictim());
309 else
310 {
312 break;
313 }
314 }
315 }
@ IN_PROGRESS
Definition: InstanceScript.h:57
@ SAY_AGGRO
Definition: boss_hexlord.cpp:33
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:215
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:28
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:95
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:197
Definition: Creature.h:46
CreatureAI * AI() const
Definition: Creature.h:135
Unit * GetVictim() const
Definition: Unit.h:1386

References AddGUID, Creature::AI(), UnitAI::AttackStart(), DATA_HEXLORDEVENT, CreatureAI::DoZoneInCombat(), CreatureAI::EnterEvadeMode(), ObjectAccessor::GetCreature(), Unit::GetVictim(), IN_PROGRESS, instance, Unit::IsAlive(), ScriptedAI::me, SAY_AGGRO, and ZoneScript::SetData().

◆ KilledUnit()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::KilledUnit ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

318 {
319 switch (urand(0, 1))
320 {
321 case 0:
323 break;
324 case 1:
326 break;
327 }
328 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ SAY_KILL_TWO
Definition: boss_hexlord.cpp:35
@ SAY_KILL_ONE
Definition: boss_hexlord.cpp:34

References SAY_KILL_ONE, SAY_KILL_TWO, and urand().

◆ Reset()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

281 {
283
284 SpiritBolts_Timer = 20000;
285 DrainPower_Timer = 60000;
286 SiphonSoul_Timer = 100000;
287 PlayerAbility_Timer = 99999;
288 CheckAddState_Timer = 5000;
289 ResetTimer = 5000;
290
291 SpawnAdds();
292
295 }
@ UNIT_VIRTUAL_ITEM_SLOT_ID
Definition: UpdateFields.h:116
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ SHEATH_STATE_MELEE
Definition: Unit.h:127
@ NOT_STARTED
Definition: InstanceScript.h:56
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
void SpawnAdds()
Definition: boss_hexlord.cpp:359
uint32 DrainPower_Timer
Definition: boss_hexlord.cpp:272
uint32 SpiritBolts_Timer
Definition: boss_hexlord.cpp:271
uint32 CheckAddState_Timer
Definition: boss_hexlord.cpp:275
uint32 ResetTimer
Definition: boss_hexlord.cpp:276
uint32 PlayerAbility_Timer
Definition: boss_hexlord.cpp:274
uint32 SiphonSoul_Timer
Definition: boss_hexlord.cpp:273

References CheckAddState_Timer, DATA_HEXLORDEVENT, DrainPower_Timer, instance, ScriptedAI::me, NOT_STARTED, PlayerAbility_Timer, ResetTimer, Object::SetByteValue(), ZoneScript::SetData(), Object::SetUInt32Value(), SHEATH_STATE_MELEE, SiphonSoul_Timer, SpawnAdds(), SpiritBolts_Timer, UNIT_FIELD_BYTES_2, and UNIT_VIRTUAL_ITEM_SLOT_ID.

◆ SelectAddEntry()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SelectAddEntry ( )
inline
345 {
346 std::vector<uint32> AddList;
347
348 for (uint8 i = 0; i < 8; ++i)
349 AddList.push_back(AddEntryList[i]);
350
351 while (AddList.size() > 4)
352 AddList.erase(AddList.begin() + rand() % AddList.size());
353
354 uint8 i = 0;
355 for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i)
356 AddEntry[i] = *itr;
357 }
static uint32 AddEntryList[8]
Definition: boss_hexlord.cpp:137
uint32 AddEntry[4]
Definition: boss_hexlord.cpp:267

References AddEntry, and AddEntryList.

Referenced by boss_hex_lord_malacrassAI().

◆ SpawnAdds()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds ( )
inline
360 {
361 for (uint8 i = 0; i < 4; ++i)
362 {
363 Creature* creature = (ObjectAccessor::GetCreature((*me), AddGUID[i]));
364 if (!creature || !creature->IsAlive())
365 {
366 if (creature) creature->setDeathState(DEAD);
368 if (creature) AddGUID[i] = creature->GetGUID();
369 }
370 else
371 {
372 creature->AI()->EnterEvadeMode();
373 creature->SetPosition(Pos_X[i], POS_Y, POS_Z, ORIENT);
374 creature->StopMovingOnCurrentPos();
375 }
376 }
377 }
@ TEMPSUMMON_DEAD_DESPAWN
Definition: Object.h:48
@ DEAD
Definition: Unit.h:319
static float Pos_X[4]
Definition: boss_hexlord.cpp:135
#define POS_Z
Definition: boss_hexlord.cpp:133
#define ORIENT
Definition: boss_hexlord.cpp:131
#define POS_Y
Definition: boss_hexlord.cpp:132
void setDeathState(DeathState s, bool despawn=false) override
Definition: Creature.cpp:1934
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3055
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
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
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16863

References AddEntry, AddGUID, Creature::AI(), DEAD, CreatureAI::EnterEvadeMode(), ObjectAccessor::GetCreature(), Object::GetGUID(), Unit::IsAlive(), ScriptedAI::me, ORIENT, Pos_X, POS_Y, POS_Z, Creature::setDeathState(), Creature::SetPosition(), Unit::StopMovingOnCurrentPos(), WorldObject::SummonCreature(), and TEMPSUMMON_DEAD_DESPAWN.

Referenced by Reset().

◆ UpdateAI()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from ScriptedAI.

380 {
381 if (!UpdateVictim())
382 return;
383
384 if (ResetTimer <= diff)
385 {
386 if (me->IsWithinDist3d(119.223f, 1035.45f, 29.4481f, 10))
387 {
389 return;
390 }
391 ResetTimer = 5000;
392 }
393 else ResetTimer -= diff;
394
395 if (CheckAddState_Timer <= diff)
396 {
397 for (uint8 i = 0; i < 4; ++i)
399 if (temp->IsAlive() && !temp->GetVictim())
400 temp->AI()->AttackStart(me->GetVictim());
401
402 CheckAddState_Timer = 5000;
403 }
404 else CheckAddState_Timer -= diff;
405
406 if (DrainPower_Timer <= diff)
407 {
410 DrainPower_Timer = urand(40000, 55000); // must cast in 60 sec, or buff/debuff will disappear
411 }
412 else DrainPower_Timer -= diff;
413
414 if (SpiritBolts_Timer <= diff)
415 {
416 if (DrainPower_Timer < 12000) // channel 10 sec
417 SpiritBolts_Timer = 13000; // cast drain power first
418 else
419 {
422 SpiritBolts_Timer = 40000;
423 SiphonSoul_Timer = 10000; // ready to drain
424 PlayerAbility_Timer = 99999;
425 }
426 }
427 else SpiritBolts_Timer -= diff;
428
429 if (SiphonSoul_Timer <= diff)
430 {
431 Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 70, true);
432 Unit* trigger = DoSpawnCreature(NPC_TEMP_TRIGGER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 30000);
433 if (!target || !trigger)
434 {
436 return;
437 }
438 else
439 {
440 trigger->SetDisplayId(11686);
442 trigger->CastSpell(target, SPELL_SIPHON_SOUL, true);
443 trigger->GetMotionMaster()->MoveChase(me);
444
445 //DoCast(target, SPELL_SIPHON_SOUL, true);
446 //me->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, target->GetGUID());
447 //me->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SIPHON_SOUL);
448
449 PlayerGUID = target->GetGUID();
450 PlayerAbility_Timer = urand(8000, 10000);
451 PlayerClass = target->getClass() - 1;
452
453 if (PlayerClass == CLASS_DRUID - 1)
455 else if (PlayerClass == CLASS_PRIEST - 1 && target->HasSpell(15473))
456 PlayerClass = CLASS_PRIEST; // shadow priest
457
458 SiphonSoul_Timer = 99999; // buff lasts 30 sec
459 }
460 }
461 else SiphonSoul_Timer -= diff;
462
463 if (PlayerAbility_Timer <= diff)
464 {
465 //Unit* target = ObjectAccessor::GetUnit(*me, PlayerGUID);
466 //if (target && target->IsAlive())
467 //{
468 UseAbility();
469 PlayerAbility_Timer = urand(8000, 10000);
470 //}
471 }
472 else PlayerAbility_Timer -= diff;
473
475 }
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:44
@ UNIT_FLAG_NOT_SELECTABLE
Definition: Unit.h:473
@ SAY_DRAIN_POWER
Definition: boss_hexlord.cpp:36
@ SAY_SPIRIT_BOLTS
Definition: boss_hexlord.cpp:37
@ NPC_TEMP_TRIGGER
Definition: boss_hexlord.cpp:43
@ SPELL_SPIRIT_BOLTS
Definition: boss_hexlord.cpp:48
@ SPELL_SIPHON_SOUL
Definition: boss_hexlord.cpp:50
@ SPELL_DRAIN_POWER
Definition: boss_hexlord.cpp:49
@ CLASS_DRUID
Definition: SharedDefines.h:123
@ CLASS_PRIEST
Definition: SharedDefines.h:117
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
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:178
bool UpdateVictim()
Definition: CreatureAI.cpp:269
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
Definition: ScriptedCreature.cpp:305
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1295
MotionMaster * GetMotionMaster()
Definition: Unit.h:2262
uint8 getClass() const
Definition: Unit.h:1426
virtual bool HasSpell(uint32) const
Definition: Unit.h:1702
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:16936
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1481
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Definition: MotionMaster.cpp:299
void UseAbility()
Definition: boss_hexlord.cpp:477
ObjectGuid PlayerGUID
Definition: boss_hexlord.cpp:269
uint32 PlayerClass
Definition: boss_hexlord.cpp:278

References AddGUID, Unit::CastSpell(), CheckAddState_Timer, CLASS_DRUID, CLASS_PRIEST, UnitAI::DoCast(), UnitAI::DoMeleeAttackIfReady(), ScriptedAI::DoSpawnCreature(), DrainPower_Timer, CreatureAI::EnterEvadeMode(), Unit::getClass(), ObjectAccessor::GetCreature(), Object::GetGUID(), Unit::GetMotionMaster(), Unit::GetVictim(), Unit::HasSpell(), WorldObject::IsWithinDist3d(), ScriptedAI::me, MotionMaster::MoveChase(), NPC_TEMP_TRIGGER, PlayerAbility_Timer, PlayerClass, PlayerGUID, ResetTimer, SAY_DRAIN_POWER, SAY_SPIRIT_BOLTS, UnitAI::SelectTarget(), Unit::SetDisplayId(), Unit::SetUnitFlag(), SiphonSoul_Timer, SPELL_DRAIN_POWER, SPELL_SIPHON_SOUL, SPELL_SPIRIT_BOLTS, SpiritBolts_Timer, TEMPSUMMON_TIMED_DESPAWN, UNIT_FLAG_NOT_SELECTABLE, CreatureAI::UpdateVictim(), urand(), and UseAbility().

◆ UseAbility()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UseAbility ( )
inline
478 {
479 uint8 random = urand(0, 2);
480 Unit* target = nullptr;
481 switch (PlayerAbility[PlayerClass][random].target)
482 {
484 target = me;
485 break;
487 target = me->GetVictim();
488 break;
490 default:
491 target = SelectTarget(SelectTargetMethod::Random, 0, 100, true);
492 break;
494 target = DoSelectLowestHpFriendly(50, 0);
495 break;
497 {
498 std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, PlayerAbility[PlayerClass][random].spell);
499 if (!templist.empty())
500 target = *(templist.begin());
501 }
502 break;
503 }
504 if (target)
505 DoCast(target, PlayerAbility[PlayerClass][random].spell, false);
506 }
static PlayerAbilityStruct PlayerAbility[][3]
Definition: boss_hexlord.cpp:166
@ ABILITY_TARGET_HEAL
Definition: boss_hexlord.cpp:154
@ ABILITY_TARGET_VICTIM
Definition: boss_hexlord.cpp:152
@ ABILITY_TARGET_ENEMY
Definition: boss_hexlord.cpp:153
@ ABILITY_TARGET_SELF
Definition: boss_hexlord.cpp:151
@ ABILITY_TARGET_BUFF
Definition: boss_hexlord.cpp:155
Unit * DoSelectLowestHpFriendly(float range, uint32 minHPDiff=1)
Definition: ScriptedCreature.cpp:455
std::list< Creature * > DoFindFriendlyMissingBuff(float range, uint32 spellId)
Definition: ScriptedCreature.cpp:474

References ABILITY_TARGET_BUFF, ABILITY_TARGET_ENEMY, ABILITY_TARGET_HEAL, ABILITY_TARGET_SELF, ABILITY_TARGET_VICTIM, UnitAI::DoCast(), ScriptedAI::DoFindFriendlyMissingBuff(), ScriptedAI::DoSelectLowestHpFriendly(), Unit::GetVictim(), ScriptedAI::me, PlayerAbility, PlayerClass, UnitAI::SelectTarget(), and urand().

Referenced by UpdateAI().

Member Data Documentation

◆ AddEntry

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::AddEntry[4]

Referenced by SelectAddEntry(), and SpawnAdds().

◆ AddGUID

ObjectGuid boss_hexlord_malacrass::boss_hex_lord_malacrassAI::AddGUID[4]

◆ CheckAddState_Timer

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::CheckAddState_Timer

Referenced by Reset(), and UpdateAI().

◆ DrainPower_Timer

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::DrainPower_Timer

Referenced by Reset(), and UpdateAI().

◆ instance

InstanceScript* boss_hexlord_malacrass::boss_hex_lord_malacrassAI::instance

◆ PlayerAbility_Timer

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::PlayerAbility_Timer

Referenced by Reset(), and UpdateAI().

◆ PlayerClass

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::PlayerClass

Referenced by UpdateAI(), and UseAbility().

◆ PlayerGUID

ObjectGuid boss_hexlord_malacrass::boss_hex_lord_malacrassAI::PlayerGUID

Referenced by UpdateAI().

◆ ResetTimer

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::ResetTimer

Referenced by Reset(), and UpdateAI().

◆ SiphonSoul_Timer

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SiphonSoul_Timer

Referenced by Reset(), and UpdateAI().

◆ SpiritBolts_Timer

uint32 boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpiritBolts_Timer

Referenced by Reset(), and UpdateAI().