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 {
371 return;
372 }
373
374
381
382
383 uint32 insanityCounter = 0;
384 std::list<WorldObject*>::const_iterator itr = targets.begin();
386 {
388 if (!targetObj)
389 {
390 continue;
391 }
392
394
395 if (!plrTarget)
396 {
397 continue;
398 }
399
400
402
403
404 for (std::list<WorldObject*>::const_iterator itr2 = targets.begin(); itr2 != targets.end(); ++itr2)
405 {
406
408 if (!plrClone || plrClone == plrTarget)
409 {
410 continue;
411 }
412
414 {
416 summon->SetInCombatWith(plrTarget);
418
420 summon->SetPhaseMask(1 | (1 << (4 + insanityCounter)), true);
423 }
424 }
425
426 ++insanityCounter;
427 ++itr;
428 }
429 }
std::uint32_t uint32
Definition: Define.h:108
@ TEMPSUMMON_CORPSE_DESPAWN
Definition: Object.h:46
#define MAX_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:31
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ UNIT_FIELD_MINDAMAGE
Definition: UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition: UpdateFields.h:128
@ UNIT_STATE_STUNNED
Definition: Unit.h:328
@ UNIT_FLAG_NOT_SELECTABLE
Definition: Unit.h:473
@ 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:34
@ 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
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
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
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245
void GetPosition(float &x, float &y) const
Definition: Position.h:122
Definition: Player.h:1046
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: Unit.cpp:14548
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition: Unit.cpp:13492
bool IsInCombatWith(Unit const *who) const
Definition: Unit.cpp:21205
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18192
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
void RemoveAllAuras()
Definition: Unit.cpp:5239
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1481