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. More...
 
void KilledUnit (Unit *) override
 
void JustDied (Unit *) override
 
void SelectAddEntry ()
 
void SpawnAdds ()
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
void UseAbility ()
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply) More...
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
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. More...
 
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 DoTeleportPlayer (Unit *unit, Position pos)
 
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 IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
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)
 
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. More...
 
void Talk (uint8 id, Milliseconds delay)
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
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 JustEngagedWith (Unit *)
 Called for reaction when initially engaged. More...
 
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 SummonedCreatureEvade (Creature *)
 
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
 Called when unit is charmed. More...
 
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 ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
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 *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
- 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
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 Called when unit is charmed. More...
 
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)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following: More...
 
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. More...
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat. More...
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 Called at any Damage to any victim (before damage apply) More...
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage from any attacker (before damage apply) More...
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal. More...
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates. More...
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals. More...
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations. More...
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT) More...
 
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)
 To specify the caster as target if the spell is self-cast. More...
 
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, bool withTank=true)
 Cast the spell on a random unit from the threat list. More...
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim. More...
 
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)
 Called when a summon reaches a waypoint or point movement finished. More...
 
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
 

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
 
TaskScheduler scheduler
 
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:190
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
void SelectAddEntry()
Definition: boss_hexlord.cpp:341
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.

328 {
330
332
333 for (uint8 i = 0; i < 4; ++i)
334 {
336 if (Temp && Temp->IsAlive())
337 Unit::DealDamage(Temp, Temp, Temp->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
338 }
339 }
std::uint8_t uint8
Definition: Define.h:109
@ DONE
Definition: InstanceScript.h:60
@ DIRECT_DAMAGE
Definition: Unit.h:248
@ DATA_HEXLORDEVENT
Definition: zulaman.h:33
@ SAY_DEATH
Definition: boss_hexlord.cpp:38
Talk
Definition: hyjal.cpp:82
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:297
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
Creature * me
Definition: ScriptedCreature.h:280
Definition: Unit.h:630
bool IsAlive() const
Definition: Unit.h:1204
uint32 GetHealth() const
Definition: Unit.h:869
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:811
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.

295 {
297
300
301 for (uint8 i = 0; i < 4; ++i)
302 {
304 if (creature && creature->IsAlive())
305 creature->AI()->AttackStart(me->GetVictim());
306 else
307 {
309 break;
310 }
311 }
312 }
@ IN_PROGRESS
Definition: InstanceScript.h:58
@ SAY_AGGRO
Definition: boss_hexlord.cpp:33
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:213
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
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:143
Unit * GetVictim() const
Definition: Unit.h:789

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.

315 {
316 switch (urand(0, 1))
317 {
318 case 0:
320 break;
321 case 1:
323 break;
324 }
325 }
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 }
@ NOT_STARTED
Definition: InstanceScript.h:57
void SpawnAdds()
Definition: boss_hexlord.cpp:356
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, NOT_STARTED, PlayerAbility_Timer, ResetTimer, ZoneScript::SetData(), SiphonSoul_Timer, SpawnAdds(), and SpiritBolts_Timer.

◆ SelectAddEntry()

void boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SelectAddEntry ( )
inline
342 {
343 std::vector<uint32> AddList;
344
345 for (uint8 i = 0; i < 8; ++i)
346 AddList.push_back(AddEntryList[i]);
347
348 while (AddList.size() > 4)
349 AddList.erase(AddList.begin() + rand() % AddList.size());
350
351 uint8 i = 0;
352 for (std::vector<uint32>::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr, ++i)
353 AddEntry[i] = *itr;
354 }
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
357 {
358 for (uint8 i = 0; i < 4; ++i)
359 {
360 Creature* creature = (ObjectAccessor::GetCreature((*me), AddGUID[i]));
361 if (!creature || !creature->IsAlive())
362 {
363 if (creature) creature->setDeathState(DeathState::Dead);
365 if (creature) AddGUID[i] = creature->GetGUID();
366 }
367 else
368 {
369 creature->AI()->EnterEvadeMode();
370 creature->SetPosition(Pos_X[i], POS_Y, POS_Z, ORIENT);
371 creature->StopMovingOnCurrentPos();
372 }
373 }
374 }
@ TEMPSUMMON_DEAD_DESPAWN
Definition: Object.h:51
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
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition: Creature.cpp:1960
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3149
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
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:2355
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16645

References AddEntry, AddGUID, Creature::AI(), 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  )
inlineoverridevirtual

Use to start attacking a target. Called just before JustEngagedWith()

Reimplemented from ScriptedAI.

377 {
378 if (!UpdateVictim())
379 return;
380
381 if (ResetTimer <= diff)
382 {
383 if (me->IsWithinDist3d(119.223f, 1035.45f, 29.4481f, 10))
384 {
386 return;
387 }
388 ResetTimer = 5000;
389 }
390 else ResetTimer -= diff;
391
392 if (CheckAddState_Timer <= diff)
393 {
394 for (uint8 i = 0; i < 4; ++i)
396 if (temp->IsAlive() && !temp->GetVictim())
397 temp->AI()->AttackStart(me->GetVictim());
398
399 CheckAddState_Timer = 5000;
400 }
401 else CheckAddState_Timer -= diff;
402
403 if (DrainPower_Timer <= diff)
404 {
407 DrainPower_Timer = urand(40000, 55000); // must cast in 60 sec, or buff/debuff will disappear
408 }
409 else DrainPower_Timer -= diff;
410
411 if (SpiritBolts_Timer <= diff)
412 {
413 if (DrainPower_Timer < 12000) // channel 10 sec
414 SpiritBolts_Timer = 13000; // cast drain power first
415 else
416 {
419 SpiritBolts_Timer = 40000;
420 SiphonSoul_Timer = 10000; // ready to drain
421 PlayerAbility_Timer = 99999;
422 }
423 }
424 else SpiritBolts_Timer -= diff;
425
426 if (SiphonSoul_Timer <= diff)
427 {
428 Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 70, true);
429 Unit* trigger = DoSpawnCreature(NPC_TEMP_TRIGGER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 30000);
430 if (!target || !trigger)
431 {
433 return;
434 }
435 else
436 {
437 trigger->SetDisplayId(11686);
439 trigger->CastSpell(target, SPELL_SIPHON_SOUL, true);
440 trigger->GetMotionMaster()->MoveChase(me);
441
442 //DoCast(target, SPELL_SIPHON_SOUL, true);
443 //me->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, target->GetGUID());
444 //me->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SIPHON_SOUL);
445
446 PlayerGUID = target->GetGUID();
447 PlayerAbility_Timer = urand(8000, 10000);
448 PlayerClass = target->getClass() - 1;
449
450 if (target->IsClass(CLASS_DRUID))
452 else if (target->IsClass(CLASS_PRIEST) && target->HasSpell(15473))
453 PlayerClass = CLASS_PRIEST; // shadow priest
454
455 SiphonSoul_Timer = 99999; // buff lasts 30 sec
456 }
457 }
458 else SiphonSoul_Timer -= diff;
459
460 if (PlayerAbility_Timer <= diff)
461 {
462 //Unit* target = ObjectAccessor::GetUnit(*me, PlayerGUID);
463 //if (target && target->IsAlive())
464 //{
465 UseAbility();
466 PlayerAbility_Timer = urand(8000, 10000);
467 //}
468 }
469 else PlayerAbility_Timer -= diff;
470
472 }
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:47
@ 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:151
@ CLASS_PRIEST
Definition: SharedDefines.h:145
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:110
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:177
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:307
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition: Object.cpp:1295
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition: Unit.cpp:16718
MotionMaster * GetMotionMaster()
Definition: Unit.h:1601
uint8 getClass() const
Definition: Unit.h:747
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition: Unit.h:748
virtual bool HasSpell(uint32) const
Definition: Unit.h:1099
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:1168
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:683
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:313
void UseAbility()
Definition: boss_hexlord.cpp:474
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(), Unit::IsClass(), 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
475 {
476 uint8 random = urand(0, 2);
477 Unit* target = nullptr;
478 switch (PlayerAbility[PlayerClass][random].target)
479 {
481 target = me;
482 break;
484 target = me->GetVictim();
485 break;
487 default:
488 target = SelectTarget(SelectTargetMethod::Random, 0, 100, true);
489 break;
491 target = DoSelectLowestHpFriendly(50, 0);
492 break;
494 {
495 std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, PlayerAbility[PlayerClass][random].spell);
496 if (!templist.empty())
497 target = *(templist.begin());
498 }
499 break;
500 }
501 if (target)
502 DoCast(target, PlayerAbility[PlayerClass][random].spell, false);
503 }
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:480
std::list< Creature * > DoFindFriendlyMissingBuff(float range, uint32 spellId)
Definition: ScriptedCreature.cpp:499

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().