353 {
355 if (!caster)
356 {
357 targets.clear();
358 return;
359 }
360
361 if (!targets.empty())
362 {
363 targets.remove_if([
this](
WorldObject* targetObj) ->
bool
364 {
367 });
368 }
369
370 if (targets.empty())
371 {
372 return;
373 }
374
375
382
383
384 uint32 insanityCounter = 0;
385 std::list<WorldObject*>::const_iterator itr = targets.begin();
387 {
389 if (!targetObj)
390 {
391 continue;
392 }
393
395
396 if (!plrTarget)
397 {
398 continue;
399 }
400
401
403
404
405 for (std::list<WorldObject*>::const_iterator itr2 = targets.begin(); itr2 != targets.end(); ++itr2)
406 {
407
409 if (!plrClone || plrClone == plrTarget)
410 {
411 continue;
412 }
413
415 {
417 summon->SetInCombatWith(plrTarget);
419
421 summon->SetPhaseMask(1 | (1 << (4 + insanityCounter)), true);
424 }
425 }
426
427 ++insanityCounter;
428 ++itr;
429 }
430 }
std::uint32_t uint32
Definition: Define.h:107
@ NPC_TWISTED_VISAGE
Definition: boss_herald_volazj.cpp:74
@ MAX_INSANITY_TARGETS
Definition: boss_herald_volazj.cpp:77
const std::array< uint32, MAX_INSANITY_TARGETS > InsanitySpells
Definition: boss_herald_volazj.cpp:88
@ INSANITY_VISUAL
Definition: boss_herald_volazj.cpp:35
@ SPELL_CLONE_PLAYER
Definition: boss_herald_volazj.cpp:37
@ SPELL_WHISPER_INSANITY
Definition: boss_herald_volazj.cpp:45
@ SAY_INSANITY
Definition: boss_herald_volazj.cpp:56
#define MAX_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:31
@ TEMPSUMMON_CORPSE_DESPAWN
Definition: Object.h:50
@ UNIT_FIELD_MINDAMAGE
Definition: UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition: UpdateFields.h:128
@ UNIT_STATE_STUNNED
Definition: UnitDefines.h:152
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
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
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:2366
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1256
void GetPosition(float &x, float &y) const
Definition: Position.h:121
Definition: Player.h:1081
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: Unit.cpp:14653
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition: Unit.cpp:13581
bool IsInCombatWith(Unit const *who) const
Definition: Unit.cpp:21038
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18034
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:1167
void RemoveAllAuras()
Definition: Unit.cpp:5319
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:713