352 {
354 if (!caster)
355 {
356 targets.clear();
357 return;
358 }
359
360 if (!targets.empty())
361 {
362 targets.remove_if([
this](
WorldObject* targetObj) ->
bool
363 {
366 });
367 }
368
369 if (targets.empty())
370 return;
371
372
379
380
381 uint32 insanityCounter = 0;
382 std::list<WorldObject*>::const_iterator itr = targets.begin();
384 {
386 if (!targetObj)
387 continue;
388
390
391 if (!plrTarget)
392 continue;
393
394
396
397
398 for (std::list<WorldObject*>::const_iterator itr2 = targets.begin(); itr2 != targets.end(); ++itr2)
399 {
400
402 if (!plrClone || plrClone == plrTarget || !plrClone->
IsAlive())
403 continue;
404
406 {
408
409 summon->AddThreat(plrTarget, 0.0f);
410 summon->SetInCombatWith(plrTarget);
412 summon->SetPhaseMask(1 | (1 << (4 + insanityCounter)), true);
415 }
416 }
417
418 ++insanityCounter;
419 ++itr;
420 }
421 }
std::uint32_t uint32
Definition Define.h:107
#define MAX_VISIBILITY_DISTANCE
Definition ObjectDefines.h:31
@ TEMPSUMMON_CORPSE_DESPAWN
Definition Object.h:50
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:173
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:275
@ 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:87
@ 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=0s)
Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
Definition CreatureAI.cpp:50
bool IsPlayer() const
Definition Object.h:200
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:305
Player * ToPlayer()
Definition Object.h:201
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition Unit.cpp:13626
bool IsAlive() const
Definition Unit.h:1707
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18086
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:1178
void RemoveAllAuras()
Definition Unit.cpp:5351
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:719
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:2368
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1256
void GetPosition(float &x, float &y) const
Definition Position.h:126