291 {
293 if (!caster)
294 {
295 targets.clear();
296 return;
297 }
298
299 if (!targets.empty())
300 {
301 targets.remove_if([
this](
WorldObject* targetObj) ->
bool
302 {
305 });
306 }
307
308 if (targets.empty())
309 return;
310
311
318
319
320 uint32 insanityCounter = 0;
321 std::list<WorldObject*>::const_iterator itr = targets.begin();
323 {
325 if (!targetObj)
326 continue;
327
329
330 if (!plrTarget)
331 continue;
332
333
335
336
337 for (std::list<WorldObject*>::const_iterator itr2 = targets.begin(); itr2 != targets.end(); ++itr2)
338 {
339
341 if (!plrClone || plrClone == plrTarget || !plrClone->
IsAlive())
342 continue;
343
345 {
347
348 summon->AddThreat(plrTarget, 0.0f);
349 summon->SetInCombatWith(plrTarget);
351 summon->SetPhaseMask(1 | (1 << (4 + insanityCounter)), true);
354 }
355 }
356
357 ++insanityCounter;
358 ++itr;
359 }
360 }
std::uint32_t uint32
Definition Define.h:107
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:30
@ TEMPSUMMON_CORPSE_DESPAWN
Definition Object.h:52
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:173
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:279
@ UNIT_FIELD_MINDAMAGE
Definition UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition UpdateFields.h:128
@ NPC_TWISTED_VISAGE
Definition boss_herald_volazj.cpp:73
@ MAX_INSANITY_TARGETS
Definition boss_herald_volazj.cpp:76
const std::array< uint32, MAX_INSANITY_TARGETS > InsanitySpells
Definition boss_herald_volazj.cpp:80
@ INSANITY_VISUAL
Definition boss_herald_volazj.cpp:35
@ SPELL_CLONE_PLAYER
Definition boss_herald_volazj.cpp:36
@ SPELL_WHISPER_INSANITY
Definition boss_herald_volazj.cpp:44
@ SAY_INSANITY
Definition boss_herald_volazj.cpp:55
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0ms)
Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
Definition CreatureAI.cpp:53
bool IsPlayer() const
Definition Object.h:201
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:294
Player * ToPlayer()
Definition Object.h:202
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition Unit.cpp:13662
bool IsAlive() const
Definition Unit.h:1748
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18074
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:1194
void RemoveAllAuras()
Definition Unit.cpp:5387
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:733
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:2359
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1278
void GetPosition(float &x, float &y) const
Definition Position.h:126