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

Public Member Functions

 npc_necrotic_shard (Creature *creature)
 
void ScheduleMinionSpawnTask ()
 
void ScheduleCultistSpawnTask ()
 
void ScheduleTasks ()
 
void Reset () override
 
bool HasCampTypeAura ()
 
void SpellHit (Unit *caster, SpellInfo const *spell) override
 
void SpellHitTarget (Unit *, SpellInfo const *spellInfo) override
 
void DamageTaken (Unit *attacker, uint32 &damage, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void JustDied (Unit *) override
 
void HandleShardMinionSpawnerSmall ()
 
void SummonCultists ()
 
void UpdateFindersAmount ()
 
void DespawnCultists ()
 
void DespawnShadowsOfDoom ()
 
void DespawnEventDoodads ()
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
- 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)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
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 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
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () 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)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 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 IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
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 ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
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 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 (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:
 
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.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
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.
 
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.
 
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.
 
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.
 
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
 

Static Public Member Functions

static uint32 HasMinion (Unit *searcher, float searchDistance=ATTACK_DISTANCE)
 
- 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 ()
 

Private Attributes

uint32 _spellCampType = 0
 
uint32 _nearbyFinderCount = 0
 
uint8 _zapCount = 0
 

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
}
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
- 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

◆ npc_necrotic_shard()

npc_necrotic_shard::npc_necrotic_shard ( Creature creature)
inline
337 : ScriptedAI(creature)
338 {
339 me->setActive(true);
341 // No healing possible.
346 }
@ SPELL_EFFECT_HEAL
Definition SharedDefines.h:788
@ SPELL_EFFECT_HEAL_MAX_HEALTH
Definition SharedDefines.h:845
@ SPELL_EFFECT_HEAL_PCT
Definition SharedDefines.h:914
@ IMMUNITY_STATE
Definition SharedDefines.h:1395
@ IMMUNITY_EFFECT
Definition SharedDefines.h:1394
@ SPELL_AURA_PERIODIC_HEAL
Definition SpellAuraDefines.h:71
@ REACT_PASSIVE
Definition Unit.h:549
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:95
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:13474
void setActive(bool isActiveObject)
Definition Object.cpp:1075
Definition ScriptedCreature.h:190
Creature * me
Definition ScriptedCreature.h:280

References Unit::ApplySpellImmune(), IMMUNITY_EFFECT, IMMUNITY_STATE, ScriptedAI::me, REACT_PASSIVE, WorldObject::setActive(), Creature::SetReactState(), SPELL_AURA_PERIODIC_HEAL, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEAL_MAX_HEALTH, and SPELL_EFFECT_HEAL_PCT.

Member Function Documentation

◆ DamageTaken()

void npc_necrotic_shard::DamageTaken ( Unit ,
uint32 ,
DamageEffectType  ,
SpellSchoolMask   
)
inlineoverridevirtual

Called at any Damage from any attacker (before damage apply)

Note
It use for recalculation damage or special reaction at damage for attack reaction use AttackedBy called for non DOT damage in Unit::DealDamage also

Reimplemented from UnitAI.

501 {
502 if (attacker->GetFactionTemplateEntry() != me->GetFactionTemplateEntry())
503 damage = 0;
504 }
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:10095

References Unit::GetFactionTemplateEntry(), and ScriptedAI::me.

◆ DespawnCultists()

void npc_necrotic_shard::DespawnCultists ( )
inline
624 {
625 std::list<Creature*> cultistList;
627 for (Creature* cultist : cultistList)
628 if (cultist)
629 cultist->DespawnOrUnsummon();
630 }
#define INSPECT_DISTANCE
Definition ObjectDefines.h:27
Definition Creature.h:43
void GetCreatureListWithEntryInGrid(std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
Definition Object.cpp:2502
@ NPC_CULTIST_ENGINEER
Definition scourge_invasion.h:178

References WorldObject::GetCreatureListWithEntryInGrid(), INSPECT_DISTANCE, ScriptedAI::me, and NPC_CULTIST_ENGINEER.

Referenced by JustDied().

◆ DespawnEventDoodads()

void npc_necrotic_shard::DespawnEventDoodads ( )
inline
643 {
644 std::list<GameObject*> doodadList;
646 doodadList,
648 60.0f
649 );
650 for (GameObject* const& doodad : doodadList)
651 {
652 doodad->SetRespawnDelay(-1);
653 doodad->DespawnOrUnsummon();
654 }
655
656 std::list<Creature*> finderList;
658 finderList,
660 60.0f
661 );
662
663 for (Creature* const& finder : finderList)
664 finder->DespawnOrUnsummon();
665 }
Definition GameObject.h:120
void GetGameObjectListWithEntryInGrid(std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
Definition Object.cpp:2488
@ NPC_SCOURGE_INVASION_MINION_FINDER
Definition scourge_invasion.h:182
@ GO_UNDEAD_FIRE
Definition scourge_invasion.h:261
@ GO_UNDEAD_FIRE_AURA
Definition scourge_invasion.h:262
@ GO_SKULLPILE_03
Definition scourge_invasion.h:265
@ GO_SKULLPILE_04
Definition scourge_invasion.h:266
@ GO_SUMMONER_SHIELD
Definition scourge_invasion.h:259
@ GO_SUMMON_CIRCLE
Definition scourge_invasion.h:258
@ GO_SKULLPILE_01
Definition scourge_invasion.h:263
@ GO_SKULLPILE_02
Definition scourge_invasion.h:264

References WorldObject::GetCreatureListWithEntryInGrid(), WorldObject::GetGameObjectListWithEntryInGrid(), GO_SKULLPILE_01, GO_SKULLPILE_02, GO_SKULLPILE_03, GO_SKULLPILE_04, GO_SUMMON_CIRCLE, GO_SUMMONER_SHIELD, GO_UNDEAD_FIRE, GO_UNDEAD_FIRE_AURA, ScriptedAI::me, and NPC_SCOURGE_INVASION_MINION_FINDER.

Referenced by JustDied(), and ScheduleTasks().

◆ DespawnShadowsOfDoom()

void npc_necrotic_shard::DespawnShadowsOfDoom ( )
inline
633 {
634 std::list<Creature*> shadowList;
636 for (Creature* shadow : shadowList)
637 if (shadow && shadow->IsAlive() && !shadow->IsInCombat())
638 shadow->DespawnOrUnsummon();
639 }
@ NPC_SHADOW_OF_DOOM
Definition scourge_invasion.h:179

References WorldObject::GetCreatureListWithEntryInGrid(), ScriptedAI::me, and NPC_SHADOW_OF_DOOM.

Referenced by ScheduleCultistSpawnTask().

◆ HandleShardMinionSpawnerSmall()

void npc_necrotic_shard::HandleShardMinionSpawnerSmall ( )
inline
535 {
536 uint32 spawnLimit = urand(1, 3); // Up to 3 spawns.
537 uint32 spawned = 0;
538
539 std::list<Creature*> finderList;
541 if (finderList.empty())
542 return;
543
544 // On a fresh camp, first the minions are spawned close to the shard and then further and further out.
545 finderList.sort(Acore::ObjectDistanceOrderPred(me));
546
547 for (Creature* const& finder : finderList)
548 {
549 // Stop summoning Minions if we reached the max spawn amount.
550 if (spawned == spawnLimit)
551 break;
552
553 // Skip dead finders.
554 if (!finder->IsAlive())
555 continue;
556
557 // Don't take finders with Minions.
558 if (HasMinion(finder))
559 continue;
560
561 // A finder disappears after summoning the spawner NPC (which summons the minion).
562 // after 160-185 seconds a finder respawns on the same position as before.
563 if (finder->CastSpell(me, SPELL_FIND_CAMP_TYPE, true) == SPELL_CAST_OK)
564 {
565 // Values are from Sniffs (rounded). Shortest and Longest respawn time from a finder on the same spot.
566 finder->DespawnOrUnsummon(0s, randtime(150s, 200s)); // Delayed despawn to prevent stacked spawns
567 spawned++;
568 }
569 }
570 }
std::uint32_t uint32
Definition Define.h:107
Milliseconds randtime(Milliseconds min, Milliseconds max)
Definition Random.cpp:64
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
void GetCreatureListWithEntryInGrid(std::list< Creature * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
Definition ScriptedCreature.cpp:875
@ SPELL_CAST_OK
Definition SharedDefines.h:1138
Definition Object.h:754
@ SPELL_FIND_CAMP_TYPE
Definition scourge_invasion.h:73
static uint32 HasMinion(Unit *searcher, float searchDistance=ATTACK_DISTANCE)
Definition scourge_invasion.cpp:595

References GetCreatureListWithEntryInGrid(), HasMinion(), ScriptedAI::me, NPC_SCOURGE_INVASION_MINION_FINDER, randtime(), SPELL_CAST_OK, SPELL_FIND_CAMP_TYPE, and urand().

Referenced by ScheduleMinionSpawnTask().

◆ HasCampTypeAura()

bool npc_necrotic_shard::HasCampTypeAura ( )
inline
428 {
430 };
bool HasAnyAuras(Auras... spellIds) const
Checks if the unit has ANY specified auras.
Definition Unit.h:1395
@ SPELL_CAMP_TYPE_GHOST_SKELETON
Definition scourge_invasion.h:61
@ SPELL_CAMP_TYPE_GHOST_GHOUL
Definition scourge_invasion.h:62
@ SPELL_CAMP_TYPE_GHOUL_SKELETON
Definition scourge_invasion.h:63

References Unit::HasAnyAuras(), ScriptedAI::me, SPELL_CAMP_TYPE_GHOST_GHOUL, SPELL_CAMP_TYPE_GHOST_SKELETON, and SPELL_CAMP_TYPE_GHOUL_SKELETON.

Referenced by SpellHit().

◆ HasMinion()

static uint32 npc_necrotic_shard::HasMinion ( Unit searcher,
float  searchDistance = ATTACK_DISTANCE 
)
inlinestatic
596 {
597 uint32 minionCounter = 0;
598 std::list<Creature*> minionList;
599
601 minionList,
603 searchDistance
604 );
605 for (Creature const* minion : minionList)
606 if (minion && minion->IsAlive())
607 minionCounter++;
608
609 return minionCounter;
610 }
@ NPC_SPIRIT_OF_THE_DAMNED
Definition scourge_invasion.h:201
@ NPC_SPECTRAL_SOLDIER
Definition scourge_invasion.h:196
@ NPC_SKELETAL_SHOCKTROOPER
Definition scourge_invasion.h:194
@ NPC_GHOUL_BERSERKER
Definition scourge_invasion.h:195
@ NPC_LUMBERING_HORROR
Definition scourge_invasion.h:199
@ NPC_BONE_WITCH
Definition scourge_invasion.h:200

References WorldObject::GetCreatureListWithEntryInGrid(), NPC_BONE_WITCH, NPC_GHOUL_BERSERKER, NPC_LUMBERING_HORROR, NPC_SKELETAL_SHOCKTROOPER, NPC_SPECTRAL_SOLDIER, and NPC_SPIRIT_OF_THE_DAMNED.

Referenced by HandleShardMinionSpawnerSmall(), and SpellHit().

◆ JustDied()

void npc_necrotic_shard::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

507 {
508 switch (me->GetEntry())
509 {
512 {
514 shard->CastSpell(shard, spellId, true);
516 }
517 break;
519 // Buff Players.
521 // Sending the Death Bolt.
523 DespawnCultists(); // Despawn remaining Cultists (should never happen).
526 break;
527 default:
528 break;
529 }
530 }
@ TEMPSUMMON_MANUAL_DESPAWN
Definition Object.h:54
#define sWorldState
Definition WorldState.h:376
@ SAVE_ID_SCOURGE_INVASION
Definition WorldState.h:60
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition Creature.cpp:2182
uint32 GetEntry() const
Definition Object.h:116
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:284
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition UnitAI.h:391
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:2350
@ SPELL_COMMUNIQUE_CAMP_TO_RELAY_DEATH
Definition scourge_invasion.h:70
@ SPELL_CHOOSE_CAMP_TYPE
Definition scourge_invasion.h:66
@ SPELL_SOUL_REVIVAL
Definition scourge_invasion.h:60
@ NPC_NECROTIC_SHARD
Definition scourge_invasion.h:176
@ NPC_DAMAGED_NECROTIC_SHARD
Definition scourge_invasion.h:177
void GetPosition(float &x, float &y) const
Definition Position.h:126
void DespawnCultists()
Definition scourge_invasion.cpp:623
void DespawnEventDoodads()
Definition scourge_invasion.cpp:642
uint32 _spellCampType
Definition scourge_invasion.cpp:673

References _spellCampType, DespawnCultists(), DespawnEventDoodads(), Creature::DespawnOrUnsummon(), UnitAI::DoCastAOE(), UnitAI::DoCastSelf(), Object::GetEntry(), Position::GetPosition(), ScriptedAI::me, NPC_DAMAGED_NECROTIC_SHARD, NPC_NECROTIC_SHARD, SAVE_ID_SCOURGE_INVASION, SPELL_CHOOSE_CAMP_TYPE, SPELL_COMMUNIQUE_CAMP_TO_RELAY_DEATH, SPELL_SOUL_REVIVAL, WorldObject::SummonCreature(), sWorldState, and TEMPSUMMON_MANUAL_DESPAWN.

◆ Reset()

void npc_necrotic_shard::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

422 {
425 }
TaskScheduler scheduler
Definition CreatureAI.h:75
TaskScheduler & CancelAll()
Definition TaskScheduler.cpp:45
void ScheduleTasks()
Definition scourge_invasion.cpp:371

References TaskScheduler::CancelAll(), CreatureAI::scheduler, and ScheduleTasks().

◆ ScheduleCultistSpawnTask()

void npc_necrotic_shard::ScheduleCultistSpawnTask ( )
inline
361 {
362 scheduler.Schedule(5s, [this](TaskContext context) // Spawn Cultists every 60 minutes.
363 {
364 me->SetFullHealth();
365 DespawnShadowsOfDoom(); // Despawn all remaining Shadows before respawning the Cultists?
367 context.Repeat(1h);
368 });
369 }
Definition TaskScheduler.h:421
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition TaskScheduler.h:493
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition TaskScheduler.h:232
void SetFullHealth()
Definition Unit.h:1049
void SummonCultists()
Definition scourge_invasion.cpp:573
void DespawnShadowsOfDoom()
Definition scourge_invasion.cpp:632

References DespawnShadowsOfDoom(), ScriptedAI::me, TaskContext::Repeat(), TaskScheduler::Schedule(), CreatureAI::scheduler, Unit::SetFullHealth(), and SummonCultists().

Referenced by ScheduleTasks().

◆ ScheduleMinionSpawnTask()

void npc_necrotic_shard::ScheduleMinionSpawnTask ( )
inline
349 {
350 scheduler.Schedule(5s, [this](TaskContext context) // Spawn Minions every 5 seconds.
351 {
353 context.Repeat(5s);
354 });
355 }
void HandleShardMinionSpawnerSmall()
Definition scourge_invasion.cpp:534

References HandleShardMinionSpawnerSmall(), TaskContext::Repeat(), TaskScheduler::Schedule(), and CreatureAI::scheduler.

Referenced by ScheduleTasks(), and SpellHit().

◆ ScheduleTasks()

void npc_necrotic_shard::ScheduleTasks ( )
inline
372 {
374 {
375 // Just in case.
376 std::list<Creature*> shardList;
378 shardList,
381 );
382 for (Creature* shard : shardList)
383 if (shard != me)
384 shard->DespawnOnEvade();
385
386 scheduler.Schedule(10s, [this](const TaskContext& /*context*/) // Check if Doodads are spawned 5 seconds after spawn. If not: spawn them
387 {
388 std::list<GameObject*> objectList;
390 objectList,
392 50.0f
393 );
394
395 for (GameObject* go : objectList)
396 if (go && !go->isSpawned())
397 {
398 go->SetRespawnTime(0);
399 go->Respawn();
400 }
401 });
402 }
404 {
408 }
409
411 [&]() -> void // Check if there are a summoning circle, otherwise despawn
412 {
414 {
417 }
418 }, 60s);
419 }
#define CONTACT_DISTANCE
Definition ObjectDefines.h:23
GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool onlySpawned)
Definition ScriptedCreature.cpp:870
void ScheduleTimedEvent(Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
Definition ScriptedCreature.cpp:321
void ScheduleMinionSpawnTask()
Definition scourge_invasion.cpp:348
void UpdateFindersAmount()
Definition scourge_invasion.cpp:613
void ScheduleCultistSpawnTask()
Definition scourge_invasion.cpp:360

References CONTACT_DISTANCE, DespawnEventDoodads(), Creature::DespawnOrUnsummon(), GetClosestGameObjectWithEntry(), WorldObject::GetCreatureListWithEntryInGrid(), Object::GetEntry(), WorldObject::GetGameObjectListWithEntryInGrid(), GO_SKULLPILE_01, GO_SKULLPILE_02, GO_SKULLPILE_03, GO_SKULLPILE_04, GO_SUMMON_CIRCLE, GO_UNDEAD_FIRE, GO_UNDEAD_FIRE_AURA, ScriptedAI::me, NPC_DAMAGED_NECROTIC_SHARD, NPC_NECROTIC_SHARD, TaskScheduler::Schedule(), ScheduleCultistSpawnTask(), ScheduleMinionSpawnTask(), CreatureAI::scheduler, ScriptedAI::ScheduleTimedEvent(), and UpdateFindersAmount().

Referenced by Reset().

◆ SpellHit()

void npc_necrotic_shard::SpellHit ( Unit caster,
SpellInfo const *  spell 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

433 {
434 switch (spell->Id)
435 {
437 {
438 Creature::DealDamage(me, me, (me->GetMaxHealth() / 4), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
439 _zapCount++;
440 if (_zapCount >= 4)
441 me->KillSelf();
442 break;
443 }
445 {
446 me->CastSpell(static_cast<Unit*>(nullptr), SPELL_CAMP_RECEIVES_COMMUNIQUE, true);
447 break;
448 }
450 {
453 break;
454 }
456 {
458 {
462 }
463 break;
464 }
466 {
467 // Don't spawn more Minions than finders.
468 if (_nearbyFinderCount < HasMinion(me, 60.0f))
469 return;
470
471 static constexpr std::pair<uint32, uint32> auraSpellMap[] = {
475 };
476
477 for (auto const& [aura, spell] : auraSpellMap)
478 if (me->HasAura(aura))
479 {
480 caster->CastSpell(caster, spell, true);
481 break;
482 }
483 break;
484 }
485 default:
486 break;
487 }
488 }
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition CreatureAIImpl.h:25
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:297
@ DIRECT_DAMAGE
Definition Unit.h:249
Definition Unit.h:620
uint32 GetMaxHealth() const
Definition Unit.h:1032
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:1193
void KillSelf(bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.h:1161
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:824
@ SPELL_PH_SUMMON_MINION_TRAP_GHOST_SKELETON
Definition scourge_invasion.h:79
@ SPELL_COMMUNIQUE_RELAY_TO_CAMP
Definition scourge_invasion.h:51
@ SPELL_PH_SUMMON_MINION_TRAP_GHOUL_SKELETON
Definition scourge_invasion.h:82
@ SPELL_PH_SUMMON_MINION_TRAP_GHOST_GHOUL
Definition scourge_invasion.h:76
@ SPELL_ZAP_CRYSTAL_CORPSE
Definition scourge_invasion.h:141
@ SPELL_CAMP_RECEIVES_COMMUNIQUE
Definition scourge_invasion.h:56
uint32 _nearbyFinderCount
Definition scourge_invasion.cpp:674
bool HasCampTypeAura()
Definition scourge_invasion.cpp:427
uint8 _zapCount
Definition scourge_invasion.cpp:675

References _nearbyFinderCount, _spellCampType, _zapCount, Unit::CastSpell(), Unit::DealDamage(), DIRECT_DAMAGE, UnitAI::DoCastSelf(), Object::GetEntry(), Unit::GetMaxHealth(), Unit::HasAura(), HasCampTypeAura(), HasMinion(), SpellInfo::Id, Unit::KillSelf(), ScriptedAI::me, NPC_NECROTIC_SHARD, RAND(), ScheduleMinionSpawnTask(), SPELL_CAMP_RECEIVES_COMMUNIQUE, SPELL_CAMP_TYPE_GHOST_GHOUL, SPELL_CAMP_TYPE_GHOST_SKELETON, SPELL_CAMP_TYPE_GHOUL_SKELETON, SPELL_CHOOSE_CAMP_TYPE, SPELL_COMMUNIQUE_RELAY_TO_CAMP, SPELL_FIND_CAMP_TYPE, SPELL_PH_SUMMON_MINION_TRAP_GHOST_GHOUL, SPELL_PH_SUMMON_MINION_TRAP_GHOST_SKELETON, SPELL_PH_SUMMON_MINION_TRAP_GHOUL_SKELETON, SPELL_SCHOOL_MASK_NORMAL, SPELL_ZAP_CRYSTAL_CORPSE, and UpdateFindersAmount().

◆ SpellHitTarget()

void npc_necrotic_shard::SpellHitTarget ( Unit ,
SpellInfo const *  spellInfo 
)
inlineoverridevirtual

◆ SummonCultists()

void npc_necrotic_shard::SummonCultists ( )
inline
574 {
575 std::list<GameObject*> summonerShieldList;
577 for (GameObject* const& summonerShield : summonerShieldList)
578 summonerShield->DespawnOrUnsummon();
579
580 // We don't have all positions sniffed from the Cultists, so why not using this code which placing them almost perfectly into the circle while B's positions are sometimes way off?
582 {
583 for (int i = 0; i < 4; ++i)
584 {
585 float angle = (float(i) * (M_PI / 2.f)) + go->GetOrientation();
586 float x = go->GetPositionX() + 6.95f * std::cos(angle);
587 float y = go->GetPositionY() + 6.75f * std::sin(angle);
588 float z = go->GetPositionZ() + 5.0f;
589 me->UpdateGroundPositionZ(x, y, z);
591 }
592 }
593 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto HOUR
Definition Common.h:48
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition Object.h:47
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition Object.cpp:1523

References CONTACT_DISTANCE, GetClosestGameObjectWithEntry(), WorldObject::GetGameObjectListWithEntryInGrid(), GO_SUMMON_CIRCLE, GO_SUMMONER_SHIELD, HOUR, IN_MILLISECONDS, INSPECT_DISTANCE, ScriptedAI::me, NPC_CULTIST_ENGINEER, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, and WorldObject::UpdateGroundPositionZ().

Referenced by ScheduleCultistSpawnTask().

◆ UpdateAI()

void npc_necrotic_shard::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

668 {
669 scheduler.Update(diff);
670 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition TaskScheduler.cpp:27

References CreatureAI::scheduler, and TaskScheduler::Update().

◆ UpdateFindersAmount()

void npc_necrotic_shard::UpdateFindersAmount ( )
inline
614 {
616 std::list<Creature*> finderList;
618 for (Creature const* finder : finderList)
619 if (finder)
621 }

References _nearbyFinderCount, WorldObject::GetCreatureListWithEntryInGrid(), ScriptedAI::me, and NPC_SCOURGE_INVASION_MINION_FINDER.

Referenced by ScheduleTasks(), and SpellHit().

Member Data Documentation

◆ _nearbyFinderCount

uint32 npc_necrotic_shard::_nearbyFinderCount = 0
private

Referenced by SpellHit(), and UpdateFindersAmount().

◆ _spellCampType

uint32 npc_necrotic_shard::_spellCampType = 0
private

Referenced by JustDied(), and SpellHit().

◆ _zapCount

uint8 npc_necrotic_shard::_zapCount = 0
private

Referenced by SpellHit().


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