diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index c75a697aee..4d07e9d6b2 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -394,7 +394,8 @@ int32 CreatureAI::VisualizeBoundary(uint32 duration, Unit* owner, bool fill) con if (TempSummon* point = owner->SummonCreature(BOUNDARY_VISUALIZE_CREATURE, Position(startPosition.GetPositionX() + front.first*BOUNDARY_VISUALIZE_STEP_SIZE, startPosition.GetPositionY() + front.second*BOUNDARY_VISUALIZE_STEP_SIZE, spawnZ), TEMPSUMMON_TIMED_DESPAWN, duration * IN_MILLISECONDS)) { point->SetObjectScale(BOUNDARY_VISUALIZE_CREATURE_SCALE); - point->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_STUNNED | UNIT_FLAG_IMMUNE_TO_NPC); + point->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + point->SetImmuneToAll(true); if (!hasOutOfBoundsNeighbor) point->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index d346f4932d..cf507e58ec 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -145,7 +145,7 @@ void EscortAI::EnterEvadeMode(EvadeReason /*why*/) { me->GetMotionMaster()->MoveTargetedHome(); if (_hasImmuneToNPCFlags) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); Reset(); } } @@ -415,10 +415,10 @@ void EscortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, // disable npcflags me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) + if (me->IsImmuneToNPC()) { _hasImmuneToNPCFlags = true; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); } TC_LOG_DEBUG("scripts", "EscortAI::Start: (script: %s, creature entry: %u) started with %u waypoints. ActiveAttacker = %d, Run = %d, Player = %s", me->GetScriptName().c_str(), me->GetEntry(), uint32(_path.nodes.size()), _activeAttacker, _running, _playerGUID.ToString().c_str()); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 521e7122cc..a6c77c3448 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -769,7 +769,8 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* node, bool recapture) if (Creature* siegeEngine = GetBGCreature(siegeType)) { - siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_CANNOT_SWIM|UNIT_FLAG_IMMUNE_TO_PC); + siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_CANNOT_SWIM); + siegeEngine->SetImmuneToPC(true); siegeEngine->SetFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]); } } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index e0947cf51b..b7f656c1a9 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1697,9 +1697,8 @@ bool Creature::CanStartAttack(Unit const* who, bool force) const return false; // This set of checks is should be done only for creatures - if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) // flag is valid only for non player characters - || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER) // immune to PC and target is a player, return false - || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) // player pets are immune to pc as well + if ((IsImmuneToNPC() && !who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + || (IsImmuneToPC() && who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE))) return false; // Do not attack non-combat pets @@ -2285,7 +2284,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / if (IsCivilian()) return false; - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC)) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || IsImmuneToNPC()) return false; // skip fighting creature diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index edb88919ee..31eb947056 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -2001,7 +2001,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, TriggerCastFlags trigge return; // remove immunity flags, to allow spell to target anything - trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC); + trigger->SetImmuneToAll(false); if (Unit* owner = GetOwner()) { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d2fad8bc2f..3d204dc006 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8448,6 +8448,24 @@ void Unit::SetInCombatWith(Unit* enemy) SetInCombatState(false, enemy); } +void Unit::SetImmuneToPC(bool apply, bool keepCombat) +{ + (void)keepCombat; + if (apply) + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + else + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); +} + +void Unit::SetImmuneToNPC(bool apply, bool keepCombat) +{ + (void)keepCombat; + if (apply) + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + else + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); +} + void Unit::CombatStart(Unit* target, bool initialAggro) { if (initialAggro) @@ -8645,12 +8663,11 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo // check flags if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NOT_ATTACKABLE_2) - || (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) - || (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))) - return false; - + || (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->IsImmuneToNPC()) + || (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && IsImmuneToNPC()) + || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->IsImmuneToPC()) if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR8_ATTACK_IGNORE_IMMUNE_TO_PC_FLAG)) - && (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + && (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->IsImmuneToPC()) // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly && GetEntry() != WORLD_TRIGGER) return false; @@ -8760,12 +8777,12 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co { if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) { - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + if (target->IsImmuneToPC()) return false; } else { - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) + if (target->IsImmuneToNPC()) return false; } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 714254b799..26d319af88 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1256,6 +1256,13 @@ class TC_GAME_API Unit : public WorldObject bool IsThreatened() const { return CanHaveThreatList() && !GetThreatManager().IsThreatListEmpty(); } bool IsThreatenedBy(Unit const* who) const { return who && CanHaveThreatList() && GetThreatManager().IsThreatenedBy(who); } + void SetImmuneToAll(bool apply, bool keepCombat = false) { SetImmuneToPC(apply, keepCombat); SetImmuneToNPC(apply, keepCombat); } + bool IsImmuneToAll() const { return IsImmuneToPC() && IsImmuneToNPC(); } + void SetImmuneToPC(bool apply, bool keepCombat = false); + bool IsImmuneToPC() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } + void SetImmuneToNPC(bool apply, bool keepCombat = false); + bool IsImmuneToNPC() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); } + bool IsInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } bool IsPetInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); } bool IsInCombatWith(Unit const* who) const; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp index a3269c92c7..1f13acc9ee 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp @@ -142,7 +142,7 @@ public: void Reset() override { _Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_FRIENDLY); events.SetPhase(PHASE_ALL); @@ -165,7 +165,7 @@ public: if (action == ACTION_START_FIGHT) { events.SetPhase(PHASE_ONE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON); me->SetInCombatWithZone(); @@ -398,7 +398,7 @@ public: Talk(SAY_ANTAGONIST_2); break; case ACTION_ANTAGONIST_HOSTILE: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON); me->SetInCombatWithZone(); break; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp index 41ad924ab7..bbd44d3f12 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp @@ -156,7 +156,7 @@ class boss_doomrel : public CreatureScript CloseGossipMenuFor(player); //start event here me->SetFaction(FACTION_DARK_IRON_DWARVES); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->AI()->AttackStart(player); InstanceScript* instance = me->GetInstanceScript(); if (instance) @@ -186,7 +186,7 @@ class boss_doomrel : public CreatureScript me->SetFaction(FACTION_FRIENDLY); // was set before event start, so set again - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); if (_instance->GetData(DATA_GHOSTKILL) >= 7) me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index 51b3768d24..da7a36642b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -356,7 +356,7 @@ public: if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter])) { boss->SetFaction(FACTION_DARK_IRON_DWARVES); - boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + boss->SetImmuneToPC(false); if (Unit* target = boss->SelectNearestTarget(500)) boss->AI()->AttackStart(target); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp index 0a086b9537..7facf73f19 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -84,7 +84,8 @@ public: void Reset() override { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); events.Reset(); // Apply auras on spawn and reset // DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); // Need to find this in old DBC if possible @@ -162,7 +163,8 @@ public: me->CastSpell(me, SPELL_EMBERSEER_FULL_STRENGTH); Talk(EMOTE_FREE_OF_BONDS); Talk(YELL_FREE_OF_BONDS); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); events.ScheduleEvent(EVENT_ENTER_COMBAT, 2000); } } @@ -345,7 +347,7 @@ public: void Reset() override { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true)) Emberseer->AI()->SetData(1, 3); } @@ -359,7 +361,7 @@ public: { if (data == 1 && value == 1) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->InterruptSpell(CURRENT_CHANNELED_SPELL); _events.CancelEvent(EVENT_ENCAGED_EMBERSEER); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index ff734d49ce..10c1ad57f6 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -191,7 +191,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); DoZoneInCombat(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index bbb70034c9..bb4bbdf74d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -211,7 +211,7 @@ public: me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); DoCast(me, SPELL_NEFARIANS_BARRIER); me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); AttackStart(target); events.ScheduleEvent(EVENT_SHADOW_BOLT, urand(3000, 10000)); events.ScheduleEvent(EVENT_FEAR, urand(10000, 20000)); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp index 67751ac1e2..57205dcf06 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp @@ -161,7 +161,8 @@ class boss_ragnaros : public CreatureScript break; case EVENT_INTRO_5: me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(false); _introState = 2; break; default: diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index c8f90b9206..478f92610e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -299,7 +299,7 @@ public: me->GetMotionMaster()->MoveAlongSplineChain(POINT_PHASE_TWO_LANDING, SPLINE_CHAIN_SECOND_LANDING, false); break; case EVENT_INTRO_LANDING: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetInCombatWithZone(); break; case EVENT_LAND: diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index c602ffb182..4f1292e1fe 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -678,7 +678,8 @@ public: // Anyway, I digress. // @todo This line below is obviously a hack. Duh. I'm just coming in here to hackfix the encounter to actually be completable. // It needs a rewrite. Badly. Please, take good care of it. - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(false); CycloneTimer = 30000; ChainLightningTimer = 10000; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 5b23c5d053..f19f7eacd3 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -442,7 +442,7 @@ public: headGUID.Clear(); } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); //instance->SetBossState(DATA_HORSEMAN_EVENT, NOT_STARTED); } diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp index f24e027e3c..83fb7b87ae 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp @@ -136,7 +136,7 @@ class boss_apothecary_hummel : public CreatureScript events.SetPhase(PHASE_INTRO); events.ScheduleEvent(EVENT_HUMMEL_SAY_0, Milliseconds(1)); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_MONSTER); DummyEntryCheckPredicate pred; summons.DoAction(ACTION_START_EVENT, pred); @@ -215,7 +215,7 @@ class boss_apothecary_hummel : public CreatureScript break; case EVENT_START_FIGHT: { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetInCombatWithZone(); events.ScheduleEvent(EVENT_CALL_BAXTER, Seconds(6)); events.ScheduleEvent(EVENT_CALL_FRYE, Seconds(14)); @@ -289,13 +289,13 @@ struct npc_apothecary_genericAI : public ScriptedAI { if (action == ACTION_START_EVENT) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_MONSTER); me->GetMotionMaster()->MovePoint(1, _movePos); } else if (action == ACTION_START_FIGHT) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetInCombatWithZone(); } } diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp index 3adbaa9581..0a1bc77ced 100644 --- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp @@ -649,7 +649,7 @@ public: _explosivesGuids.clear(); if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS)) { - sironas->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + sironas->SetImmuneToAll(false); me->SetFacingToObject(sironas); } _moveTimer = 1 * IN_MILLISECONDS; diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index 5b391c73cf..e1a861bc38 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -54,7 +54,7 @@ public: { npc_omenAI(Creature* creature) : ScriptedAI(creature) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->GetMotionMaster()->MovePoint(1, 7549.977f, -2855.137f, 456.9678f); } @@ -68,7 +68,7 @@ public: if (pointId == 1) { me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); if (Player* player = me->SelectNearestPlayer(40.0f)) AttackStart(player); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index 84da88df2a..c92b76f3ed 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -77,7 +77,10 @@ class boss_general_zarithrian : public CreatureScript { _Reset(); if (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); + } } bool CanAIAttack(Unit const* target) const override diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index 67597a76be..cddb01b7c2 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -175,7 +175,10 @@ class instance_ruby_sanctum : public InstanceMapScript { if (GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) if (Creature* zarithrian = GetCreature(DATA_GENERAL_ZARITHRIAN)) - zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + { + zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + zarithrian->SetImmuneToPC(false); + } } void SetData(uint32 type, uint32 data) override diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 6e069f48f8..e744c23d52 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -109,11 +109,10 @@ void AggroAllPlayers(Creature* temp) if (player->IsAlive()) { - temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + temp->SetImmuneToPC(true); temp->SetReactState(REACT_AGGRESSIVE); - temp->SetInCombatWith(player); - player->SetInCombatWith(temp); - temp->GetThreatManager().AddThreat(player, 0.0f); + temp->EngageWithTarget(player); } } } @@ -328,7 +327,8 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); } void Initialize() @@ -465,7 +465,8 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); } void Initialize() @@ -608,7 +609,8 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); } void Initialize() @@ -759,7 +761,8 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); } void Initialize() @@ -919,7 +922,8 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); } void Initialize() diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index addcd99680..f8ad7169d4 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -487,7 +487,8 @@ class boss_toc_champion_controller : public CreatureScript { _summons.Summon(champion); champion->SetReactState(REACT_PASSIVE); - champion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + champion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + champion->SetImmuneToPC(false); if (playerTeam == ALLIANCE) { champion->SetHomePosition(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 0); @@ -518,7 +519,8 @@ class boss_toc_champion_controller : public CreatureScript if (Creature* summon = ObjectAccessor::GetCreature(*me, *i)) { summon->SetReactState(REACT_AGGRESSIVE); - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + summon->SetImmuneToPC(false); } } break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 0b8b9a7b22..461de90569 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -120,7 +120,8 @@ class boss_jaraxxus : public CreatureScript _JustReachedHome(); instance->SetBossState(BOSS_JARAXXUS, FAIL); DoCast(me, SPELL_JARAXXUS_CHAINS); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); } void KilledUnit(Unit* who) override diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 3f1c1bdd42..a62c8b75e9 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -204,7 +204,8 @@ class boss_gormok : public CreatureScript { case 0: instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); break; @@ -613,7 +614,8 @@ struct boss_jormungarAI : public BossAI case EVENT_SUMMON_ACIDMAW: if (Creature* acidmaw = me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { - acidmaw->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + acidmaw->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + acidmaw->SetImmuneToPC(false); acidmaw->SetReactState(REACT_AGGRESSIVE); acidmaw->SetInCombatWithZone(); acidmaw->CastSpell(acidmaw, SPELL_EMERGE); @@ -770,7 +772,8 @@ class boss_dreadscale : public CreatureScript { case 0: instance->DoCloseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); break; @@ -943,7 +946,8 @@ class boss_icehowl : public CreatureScript break; case 2: instance->DoUseDoorOrButton(instance->GetGuidData(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 27ce5fdd9d..d237500f82 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -200,7 +200,8 @@ struct boss_twin_baseAI : public BossAI switch (uiId) { case 1: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); break; default: diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 26c9926fb0..3ec2a4eefc 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -253,7 +253,8 @@ class npc_announcer_toc10 : public CreatureScript if (Creature* jaraxxus = ObjectAccessor::GetCreature(*player, instance->GetGuidData(NPC_JARAXXUS))) { jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS); - jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + jaraxxus->SetImmuneToPC(false); jaraxxus->SetReactState(REACT_DEFENSIVE); jaraxxus->SetInCombatWithZone(); } @@ -442,7 +443,8 @@ class npc_fizzlebang_toc : public CreatureScript _instance->SetData(TYPE_EVENT, 1180); if (Creature* jaraxxus = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_JARAXXUS))) { - jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + jaraxxus->SetImmuneToPC(false); jaraxxus->SetReactState(REACT_AGGRESSIVE); jaraxxus->SetInCombatWithZone(); } @@ -539,7 +541,8 @@ class npc_fizzlebang_toc : public CreatureScript Talk(SAY_STAGE_1_04); if (Creature* jaraxxus = me->SummonCreature(NPC_JARAXXUS, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 5.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { - jaraxxus->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + jaraxxus->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + jaraxxus->SetImmuneToPC(true); jaraxxus->SetReactState(REACT_PASSIVE); jaraxxus->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()-10, ToCCommonLoc[1].GetPositionZ()); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 7da963ff8a..17ffa51067 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -213,7 +213,7 @@ class npc_drakkari_invader : public CreatureScript if (type == POINT_MOTION_TYPE && pointId == POINT_LANDING) { me->Dismount(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); DoCastAOE(SPELL_INVADER_TAUNT); } } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp index d57ee9c153..eb7b02364b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_horAI.cpp @@ -27,7 +27,7 @@ void boss_horAI::Reset() { _Reset(); me->SetVisible(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->SetReactState(REACT_PASSIVE); if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED) instance->ProcessEvent(nullptr, EVENT_DO_WIPE); @@ -38,7 +38,7 @@ void boss_horAI::DoAction(int32 actionId) switch (actionId) { case ACTION_ENTER_COMBAT: // called by InstanceScript when boss shall enter in combat. - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetReactState(REACT_AGGRESSIVE); DoZoneInCombat(me, 150.0f); break; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 64026d906a..d1c09f77cd 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -1033,7 +1033,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { - lichking->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + lichking->SetImmuneToPC(true); lichking->RemoveAllAttackers(); DeleteAllFromThreatList(lichking, me->GetGUID()); @@ -1047,7 +1047,8 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript case EVENT_ESCAPE_6: if (Creature* lichking = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING_ESCAPE))) { - lichking->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_PACIFIED); + lichking->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + lichking->SetImmuneToPC(false); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) { @@ -1930,7 +1931,7 @@ class npc_frostsworn_general : public CreatureScript { if (Creature* reflection = me->SummonCreature(NPC_REFLECTION, *target, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000)) { - reflection->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + reflection->SetImmuneToPC(false); target->CastSpell(reflection, SPELL_CLONE, true); target->CastSpell(reflection, SPELL_GHOST_VISUAL, true); reflection->AI()->AttackStart(target); @@ -2165,7 +2166,7 @@ struct npc_escape_event_trash : public ScriptedAI DoZoneInCombat(me, 0.0f); if (Creature* leader = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER))) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetInCombatWith(leader); leader->SetInCombatWith(me); AddThreat(leader, 0.0f); @@ -2596,7 +2597,7 @@ class npc_quel_delar_sword : public CreatureScript if (_intro) _events.ScheduleEvent(EVENT_QUEL_DELAR_INIT, 0); else - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); } void JustEngagedWith(Unit* /*victim*/) override @@ -2664,7 +2665,7 @@ class npc_quel_delar_sword : public CreatureScript case EVENT_QUEL_DELAR_FIGHT: Talk(SAY_QUEL_DELAR_SWORD); me->GetMotionMaster()->MovePoint(0, QuelDelarMovement[2]); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); break; default: break; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 21e12161bf..861162656c 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -594,7 +594,8 @@ class instance_halls_of_reflection : public InstanceMapScript if (Creature* temp = instance->GetCreature(guid)) { temp->CastSpell(temp, SPELL_SPIRIT_ACTIVATE, false); - temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE); + temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + temp->SetImmuneToAll(false); temp->AI()->DoZoneInCombat(temp, 100.00f); } } diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 798630a9a4..dbcc806578 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -108,7 +108,7 @@ class boss_drakkari_colossus : public CreatureScript if (GetData(DATA_INTRO_DONE)) { me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->RemoveAura(SPELL_FREEZE_ANIM); } @@ -140,7 +140,7 @@ class boss_drakkari_colossus : public CreatureScript me->GetMotionMaster()->MoveIdle(); me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); DoCast(me, SPELL_FREEZE_ANIM); break; case ACTION_UNFREEZE_COLOSSUS: @@ -149,7 +149,7 @@ class boss_drakkari_colossus : public CreatureScript return; me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->RemoveAura(SPELL_FREEZE_ANIM); me->SetInCombatWithZone(); @@ -163,7 +163,7 @@ class boss_drakkari_colossus : public CreatureScript void DamageTaken(Unit* /*attacker*/, uint32& damage) override { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + if (me->IsImmuneToPC()) damage = 0; if (phase == COLOSSUS_PHASE_NORMAL || diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 774bbcc9ff..4c6a1eb4cb 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -243,7 +243,8 @@ class boss_blood_council_controller : public CreatureScript for (uint32 bossData : PrincesData) if (Creature* prince = ObjectAccessor::GetCreature(*me, instance->GetGuidData(bossData))) { - prince->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + prince->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + prince->SetImmuneToPC(false); if (bossData == DATA_PRINCE_VALANAR) prince->SetHealth(prince->GetMaxHealth()); } @@ -451,7 +452,7 @@ struct BloodPrincesBossAI : public BossAI summons.DespawnAll(); me->SetCombatPulseDelay(0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); _isEmpowered = false; me->SetHealth(_spawnHealth); instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, uint32(true)); @@ -560,7 +561,8 @@ struct BloodPrincesBossAI : public BossAI { case ACTION_STAND_UP: me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index e4cc25d3ae..7759ac01e1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -296,7 +296,7 @@ class boss_deathbringer_saurfang : public CreatureScript events.Reset(); events.SetPhase(PHASE_COMBAT); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); if (!_introDone) { DoCast(me, SPELL_GRIP_OF_AGONY); @@ -324,7 +324,7 @@ class boss_deathbringer_saurfang : public CreatureScript void AttackStart(Unit* victim) override { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + if (me->IsImmuneToPC()) return; ScriptedAI::AttackStart(victim); @@ -334,7 +334,7 @@ class boss_deathbringer_saurfang : public CreatureScript { ScriptedAI::EnterEvadeMode(why); if (_introDone) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); } void JustReachedHome() override @@ -370,7 +370,8 @@ class boss_deathbringer_saurfang : public CreatureScript _dead = true; _JustDied(); _EnterEvadeMode(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); DoCastAOE(SPELL_REMOVE_MARKS_OF_THE_FALLEN_CHAMPION); DoCast(me, SPELL_ACHIEVEMENT, true); @@ -490,7 +491,7 @@ class boss_deathbringer_saurfang : public CreatureScript case EVENT_INTRO_FINISH: events.SetPhase(PHASE_COMBAT); _introDone = true; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case EVENT_SUMMON_BLOOD_BEAST: for (uint32 i10 = 0; i10 < 2; ++i10) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 91f9501c9f..9e456a08ea 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -248,7 +248,10 @@ class boss_professor_putricide : public CreatureScript me->GetMotionMaster()->MovementExpired(); if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); + } } void JustEngagedWith(Unit* who) override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index a65eb486ac..3975eafa6a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -846,7 +846,7 @@ class npc_rimefang : public CreatureScript me->setActive(true); me->SetFarVisible(true); me->SetSpeedRate(MOVE_FLIGHT, 2.0f); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_FLIGHT) * 0.001f); me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); me->SetDefaultMovementType(IDLE_MOTION_TYPE); @@ -868,7 +868,7 @@ class npc_rimefang : public CreatureScript me->SetDisableGravity(false); me->SetHomePosition(RimefangLandPos); me->SetFacingTo(RimefangLandPos.GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index e35901c9d7..e92baef8f4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -506,7 +506,7 @@ class boss_the_lich_king : public CreatureScript void Reset() override { _Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetReactState(REACT_PASSIVE); events.SetPhase(PHASE_INTRO); Initialize(); @@ -912,7 +912,7 @@ class boss_the_lich_king : public CreatureScript break; case EVENT_FINISH_INTRO: me->SetWalk(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); events.SetPhase(PHASE_ONE); DoZoneInCombat(); @@ -1832,7 +1832,7 @@ class npc_terenas_menethil : public CreatureScript if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING))) { lichKing->AI()->DoAction(ACTION_FINISH_OUTRO); - lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + lichKing->SetImmuneToNPC(false); if (Creature* tirion = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->AttackStart(lichKing); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 1eec0131fa..88d46e0926 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -726,7 +726,7 @@ class boss_sister_svalna : public CreatureScript me->setActive(true); me->SetFarVisible(true); _isEventInProgress = true; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); events.ScheduleEvent(EVENT_SVALNA_START, 25000); break; case ACTION_RESURRECT_CAPTAINS: @@ -761,8 +761,7 @@ class boss_sister_svalna : public CreatureScript _isEventInProgress = false; me->setActive(false); - me->SetFarVisible(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetDisableGravity(false); me->SetHover(false); } @@ -936,7 +935,7 @@ class npc_crok_scourgebane : public CreatureScript { // pause pathing until trash pack is cleared case 0: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); Talk(SAY_CROK_COMBAT_WP_0); if (!_aliveTrash.empty()) SetEscortPaused(true); @@ -1680,7 +1679,8 @@ class spell_icc_stoneform : public SpellScriptLoader if (Creature* target = GetTarget()->ToCreature()) { target->SetReactState(REACT_PASSIVE); - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + target->SetImmuneToPC(true); target->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_02); } } @@ -1690,7 +1690,8 @@ class spell_icc_stoneform : public SpellScriptLoader if (Creature* target = GetTarget()->ToCreature()) { target->SetReactState(REACT_AGGRESSIVE); - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + target->SetImmuneToPC(false); target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 65b84d88e0..ee6f6b5c6b 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -224,7 +224,8 @@ public: return; _Reset(); me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); _skeletonCount = 0; _bansheeCount = 0; _abominationCount = 0; @@ -424,7 +425,8 @@ public: case EVENT_PHASE_TWO: me->CastStop(); events.SetPhase(PHASE_TWO); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); ResetThreatList(); me->SetReactState(REACT_AGGRESSIVE); Talk(EMOTE_PHASE_TWO); @@ -521,7 +523,7 @@ public: case ACTION_BEGIN_ENCOUNTER: if (instance->GetBossState(BOSS_KELTHUZAD) != NOT_STARTED) return; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); instance->SetBossState(BOSS_KELTHUZAD, IN_PROGRESS); events.SetPhase(PHASE_ONE); DoZoneInCombat(); @@ -805,7 +807,7 @@ public: me->RemoveAllAuras(); me->CombatStop(); me->StopMoving(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->DespawnOrUnsummon(30 * IN_MILLISECONDS); // just in case anything interrupts the movement me->GetMotionMaster()->MoveTargetedHome(); break; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index 10a11b1ea3..c4d32ddf45 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -105,7 +105,8 @@ public: { DoCastAOE(SPELL_TELEPORT_BACK); me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); } balconyCount = 0; @@ -244,7 +245,8 @@ public: case EVENT_BALCONY: events.SetPhase(PHASE_BALCONY); me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true, true); me->AttackStop(); me->StopMoving(); me->RemoveAllAuras(); @@ -300,7 +302,8 @@ public: EnterPhaseGround(); break; case EVENT_GROUND_ATTACKABLE: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); break; } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 55de0f9e78..7b3ecd7c57 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -321,7 +321,8 @@ public: me->DespawnOrUnsummon(0, Seconds(30)); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetImmuneToPC(true); me->setActive(false); if (Creature* feugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN))) feugen->AI()->DoAction(ACTION_BEGIN_RESET_ENCOUNTER); @@ -385,7 +386,7 @@ public: ballLightningUnlocked = false; me->RemoveAura(SPELL_THADDIUS_INACTIVE_VISUAL); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); DoZoneInCombat(); @@ -639,7 +640,7 @@ public: if (!isOverloading) { isOverloading = true; - caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + caster->SetImmuneToPC(false); if (Creature* creatureCaster = caster->ToCreature()) creatureCaster->AI()->Talk(EMOTE_TESLA_LINK_BREAKS); me->RemoveAura(SPELL_STALAGG_CHAIN_VISUAL); @@ -656,7 +657,7 @@ public: refreshBeam = false; caster->CastStop(); caster->CastSpell(me, SPELL_STALAGG_CHAIN_VISUAL, true); - caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + caster->SetImmuneToPC(true); } } @@ -898,7 +899,7 @@ public: if (!isOverloading) { isOverloading = true; - caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + caster->SetImmuneToPC(false); if (Creature* creatureCaster = caster->ToCreature()) creatureCaster->AI()->Talk(EMOTE_TESLA_LINK_BREAKS); me->RemoveAura(SPELL_STALAGG_CHAIN_VISUAL); @@ -915,7 +916,7 @@ public: refreshBeam = false; caster->CastStop(); caster->CastSpell(me, SPELL_FEUGEN_CHAIN_VISUAL, true); - caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + caster->SetImmuneToPC(true); } } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 0442badc26..466d83f640 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -375,7 +375,7 @@ public: Initialize(); me->SetDisableGravity(true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); // TO DO: find what in core is making boss slower than in retail (when correct speed data) or find missing movement flag update or forced spline change me->SetSpeedRate(MOVE_FLIGHT, _flySpeed * 0.25f); @@ -466,7 +466,7 @@ public: pos.m_positionZ = alexstraszaBunny->GetPositionZ(); alexstraszaBunny->GetNearPoint2D(nullptr, pos.m_positionX, pos.m_positionY, 30.0f, alexstraszaBunny->GetAngle(me)); me->GetMotionMaster()->MoveLand(POINT_LAND_P_ONE, pos); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); events.ScheduleEvent(EVENT_LAND_START_ENCOUNTER, 7*IN_MILLISECONDS, 1, PHASE_NOT_STARTED); diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 9f088c6417..660c93b3d6 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -138,14 +138,14 @@ class boss_keristrasza : public CreatureScript { if (remove) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (me->HasAura(SPELL_FROZEN_PRISON)) me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); } else { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoCast(me, SPELL_FROZEN_PRISON, false); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index ab70a18c98..20005f5dd3 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -285,7 +285,8 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader if (caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6)) { caster->ToCreature()->SetReactState(REACT_PASSIVE); - caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6); + caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_UNK_6); + caster->SetImmuneToAll(true, true); } } } @@ -295,7 +296,8 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader if (Unit* caster = GetCaster()) { caster->ToCreature()->SetReactState(REACT_AGGRESSIVE); - caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6); + caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_UNK_6); + caster->SetImmuneToAll(false); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index ac3637ea55..84947b527f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -379,11 +379,12 @@ class boss_algalon_the_observer : public CreatureScript events.ScheduleEvent(EVENT_DESPAWN_ALGALON_2, 17000); events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000); me->DespawnOrUnsummon(34000); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToNPC(true); break; case ACTION_INIT_ALGALON: _firstPull = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; } } @@ -396,7 +397,8 @@ class boss_algalon_the_observer : public CreatureScript void JustEngagedWith(Unit* /*target*/) override { uint32 introDelay = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToNPC(true); events.Reset(); events.SetPhase(PHASE_ROLE_PLAY); @@ -504,7 +506,7 @@ class boss_algalon_the_observer : public CreatureScript { instance->SetBossState(BOSS_ALGALON, FAIL); BossAI::EnterEvadeMode(why); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetSheath(SHEATH_STATE_UNARMED); } @@ -579,7 +581,7 @@ class boss_algalon_the_observer : public CreatureScript break; case EVENT_INTRO_FINISH: events.Reset(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case EVENT_START_COMBAT: instance->SetBossState(BOSS_ALGALON, IN_PROGRESS); @@ -588,7 +590,8 @@ class boss_algalon_the_observer : public CreatureScript { events.SetPhase(PHASE_NORMAL); me->SetSheath(SHEATH_STATE_MELEE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToNPC(false); me->SetReactState(REACT_DEFENSIVE); DoCastAOE(SPELL_SUPERMASSIVE_FAIL, true); //! Workaround for Creature::_IsTargetAcceptable returning false diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index dcd290a8cc..d8d5a6de4b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1356,7 +1356,8 @@ class npc_healthy_spore : public CreatureScript npc_healthy_sporeAI(Creature* creature) : ScriptedAI(creature) { SetCombatMovement(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); me->SetReactState(REACT_PASSIVE); DoCast(me, SPELL_HEALTHY_SPORE_VISUAL); DoCast(me, SPELL_POTENT_PHEROMONES); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index feb556e79d..6877db56e1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -181,7 +181,8 @@ class boss_ignis : public CreatureScript { summon->SetFaction(FACTION_MONSTER_2); summon->SetReactState(REACT_AGGRESSIVE); - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED | UNIT_FLAG_IMMUNE_TO_PC); + summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED); + summon->SetImmuneToPC(false); summon->SetControlled(false, UNIT_STATE_ROOT); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index cce1971e76..63891949da 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -981,7 +981,8 @@ class boss_vx_001 : public CreatureScript events.ScheduleEvent(EVENT_FLAME_SUPPRESSANT_VX, 6000); [[fallthrough]]; case DO_START_VX001: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); // Remove emotestate. //me->SetHover(true); // Blizzard handles hover animation like this it seems. @@ -1157,7 +1158,8 @@ class boss_aerial_command_unit : public CreatureScript events.ScheduleEvent(EVENT_SUMMON_FIRE_BOTS, 1000, 0, PHASE_AERIAL_COMMAND_UNIT); [[fallthrough]]; case DO_START_AERIAL: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); me->SetHover(true); me->SetDisableGravity(false); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index df107bc9bd..9bc1b0cbba 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -474,7 +474,7 @@ class boss_thorim : public CreatureScript me->SetReactState(REACT_PASSIVE); me->SetDisableGravity(true); me->SetControlled(true, UNIT_STATE_ROOT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); events.SetPhase(PHASE_NULL); @@ -631,7 +631,7 @@ class boss_thorim : public CreatureScript if (Creature* runicColossus = instance->GetCreature(DATA_RUNIC_COLOSSUS)) { - runicColossus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + runicColossus->SetImmuneToPC(false); runicColossus->AI()->DoAction(ACTION_ACTIVATE_ADDS); } @@ -836,7 +836,7 @@ class boss_thorim : public CreatureScript if (++_killedCount >= 6) { // Event starts - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); DoZoneInCombat(me); } break; @@ -1355,7 +1355,7 @@ struct npc_thorim_minibossAI : public ScriptedAI { for (ObjectGuid const& guid : _summons) if (Creature* summon = ObjectAccessor::GetCreature(*me, guid)) - summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + summon->SetImmuneToPC(false); } } @@ -1425,7 +1425,7 @@ class npc_runic_colossus : public CreatureScript if (Creature* giant = _instance->GetCreature(DATA_RUNE_GIANT)) { - giant->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + giant->SetImmuneToPC(false); giant->AI()->DoAction(ACTION_ACTIVATE_ADDS); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index bbe7191aa9..6639d729a9 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -1048,7 +1048,8 @@ class boss_brain_of_yogg_saron : public CreatureScript void Reset() override { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); DoCast(me, SPELL_MATCH_HEALTH); _summons.DespawnAll(); } @@ -1062,7 +1063,8 @@ class boss_brain_of_yogg_saron : public CreatureScript DoCastAOE(SPELL_SHATTERED_ILLUSION_REMOVE, true); DoCast(me, SPELL_MATCH_HEALTH_2, true); // it doesn't seem to hit Yogg-Saron here DoCast(me, SPELL_BRAIN_HURT_VISUAL, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); if (Creature* voice = _instance->GetCreature(DATA_VOICE_OF_YOGG_SARON)) voice->AI()->DoAction(ACTION_PHASE_THREE); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 8dd15a0c39..89bbce820a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -229,7 +229,7 @@ class instance_ulduar : public InstanceMapScript if (_algalonTimer && _algalonTimer <= 60) algalon->AI()->DoAction(ACTION_INIT_ALGALON); else - algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + algalon->SetImmuneToPC(false); } // Keepers at Observation Ring diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index c3748b5cf3..b2d1f03483 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -113,7 +113,8 @@ class boss_ingvar_the_plunderer : public CreatureScript { if (me->GetEntry() != NPC_INGVAR) me->UpdateEntry(NPC_INGVAR); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); _Reset(); } @@ -129,7 +130,8 @@ class boss_ingvar_the_plunderer : public CreatureScript me->StopMoving(); DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true, true); Talk(SAY_DEATH); } @@ -227,7 +229,8 @@ class boss_ingvar_the_plunderer : public CreatureScript break; case EVENT_JUST_TRANSFORMED: ScheduleSecondPhase(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); if (Unit* target = me->GetThreatManager().SelectVictim()) AttackStart(target); else diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 1b95df774b..2575160131 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -292,7 +292,7 @@ public: } case ACTION_START_FIGHT: me->RemoveAurasDueToSpell(SPELL_FREEZE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); DoZoneInCombat(); if (Creature* orb = ObjectAccessor::GetCreature(*me, _orb)) orb->DespawnOrUnsummon(1000); @@ -345,7 +345,7 @@ struct PalehoofMinionsBossAI : public BossAI if (actionId == ACTION_START_FIGHT) { me->RemoveAurasDueToSpell(SPELL_FREEZE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); DoZoneInCombat(); } } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 5abbc5ba40..48bb602b08 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -265,7 +265,8 @@ public: Talk(SAY_DRAKE_DEATH); DoCast(me, SPELL_SKADI_TELEPORT, true); summons.DespawnEntry(NPC_WORLD_TRIGGER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); _phase = PHASE_GROUND; diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index fab8a32611..d569069428 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -558,7 +558,7 @@ class instance_violet_hold : public InstanceMapScript { if (Creature* moragg = GetCreature(DATA_MORAGG)) { - moragg->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + moragg->SetImmuneToAll(false); moragg->AI()->DoZoneInCombat(moragg, 200.0f); } }); @@ -591,12 +591,12 @@ class instance_violet_hold : public InstanceMapScript for (uint32 i = DATA_EREKEM_GUARD_1; i <= DATA_EREKEM_GUARD_2; ++i) { if (Creature* guard = instance->GetCreature(GetGuidData(i))) - guard->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + guard->SetImmuneToAll(false); } if (Creature* erekem = GetCreature(DATA_EREKEM)) { - erekem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + erekem->SetImmuneToAll(false); erekem->AI()->DoZoneInCombat(erekem, 200.0f); } }); @@ -619,7 +619,7 @@ class instance_violet_hold : public InstanceMapScript { if (Creature* ichoron = GetCreature(DATA_ICHORON)) { - ichoron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + ichoron->SetImmuneToAll(false); ichoron->AI()->DoZoneInCombat(ichoron, 200.0f); } }); @@ -641,7 +641,7 @@ class instance_violet_hold : public InstanceMapScript { if (Creature* lavanthor = GetCreature(DATA_LAVANTHOR)) { - lavanthor->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + lavanthor->SetImmuneToAll(false); lavanthor->AI()->DoZoneInCombat(lavanthor, 200.0f); } }); @@ -668,7 +668,7 @@ class instance_violet_hold : public InstanceMapScript { if (Creature* xevozz = GetCreature(DATA_XEVOZZ)) { - xevozz->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + xevozz->SetImmuneToAll(false); xevozz->AI()->DoZoneInCombat(xevozz, 200.0f); } }); @@ -694,7 +694,7 @@ class instance_violet_hold : public InstanceMapScript { if (Creature* zuramat = GetCreature(DATA_ZURAMAT)) { - zuramat->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + zuramat->SetImmuneToAll(false); zuramat->AI()->DoZoneInCombat(zuramat, 200.0f); } }); @@ -734,7 +734,7 @@ class instance_violet_hold : public InstanceMapScript UpdateKilledBoss(guard); guard->GetMotionMaster()->MoveTargetedHome(); - guard->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + guard->SetImmuneToAll(true); } } [[fallthrough]]; @@ -747,7 +747,7 @@ class instance_violet_hold : public InstanceMapScript } boss->GetMotionMaster()->MoveTargetedHome(); - boss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + boss->SetImmuneToAll(true); break; } } @@ -902,7 +902,7 @@ class instance_violet_hold : public InstanceMapScript { cyanigosa->RemoveAurasDueToSpell(SPELL_CYANIGOSA_ARCANE_POWER_STATE); cyanigosa->CastSpell(cyanigosa, SPELL_CYANIGOSA_TRANSFORM, true); - cyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + cyanigosa->SetImmuneToAll(false); } }); }); diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index b7f2581ec1..dca901aaeb 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -726,7 +726,7 @@ public: owner->CastSpell(owner, SPELL_SUBDUED, true); GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true); owner->SetFaction(35); - owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + owner->SetImmuneToAll(true); owner->DespawnOrUnsummon(3 * MINUTE*IN_MILLISECONDS); } diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index b69fa562ea..dc7388cb2e 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -576,7 +576,7 @@ class npc_wyrmrest_defender : public CreatureScript { case SPELL_WYRMREST_DEFENDER_MOUNT: Talk(WHISPER_MOUNTED, me->GetCharmerOrOwner()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); break; // Both below are for checking low hp warning diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index f2361b8b51..23c4b7019f 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -368,7 +368,7 @@ public: if (me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f)) { me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); } _phase = 0; @@ -568,7 +568,8 @@ public: { _playerGUID.Clear(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(false); me->SetReactState(REACT_AGGRESSIVE); } @@ -617,7 +618,8 @@ public: { if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(true); me->SetReactState(REACT_PASSIVE); me->CombatStop(false); _playerGUID = caster->GetGUID(); diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 50c1977833..ba2402fae5 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -719,7 +719,7 @@ class npc_wild_wyrm : public CreatureScript InitSpellsForPhase(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); } void DoAction(int32 action) override @@ -758,7 +758,7 @@ class npc_wild_wyrm : public CreatureScript _playerGuid = caster->GetGUID(); DoCastAOE(SPELL_FULL_HEAL_MANA, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->GetMotionMaster()->MovePoint(POINT_START_FIGHT, *caster); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 8d880c5362..10a7e2a8be 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -804,7 +804,7 @@ public: events.ScheduleEvent(EVENT_ENCOUNTER_START, Seconds(3), GROUP_PHASE_ALL); break; case EVENT_ENCOUNTER_START: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); DoZoneInCombat(); if (Creature* akama = instance->GetCreature(DATA_AKAMA)) akama->AI()->DoAction(ACTION_START_ENCOUNTER); @@ -1176,7 +1176,7 @@ public: break; case POINT_MINIONS: _events.SetPhase(PHASE_MINIONS); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(false); me->SetReactState(REACT_AGGRESSIVE); if (Creature* illidan = _instance->GetCreature(DATA_ILLIDAN_STORMRAGE)) illidan->AI()->DoAction(ACTION_START_MINIONS_WEAVE); @@ -1309,7 +1309,7 @@ public: me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToNPC(true); _events.ScheduleEvent(EVENT_AKAMA_MINIONS_MOVE, Seconds(4)); break; case EVENT_AKAMA_MINIONS_MOVE: diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 0933d5e32a..aa011b0cea 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -221,7 +221,7 @@ public: { _Reset(); Initialize(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); me->SetWalk(true); @@ -262,7 +262,7 @@ public: { _isInPhaseOne = false; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetWalk(false); events.ScheduleEvent(EVENT_ADD_THREAT, Milliseconds(100)); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 44cfba549b..6b1c3462e0 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -157,7 +157,7 @@ public: DoCast(me, SPELL_SUBMERGE); // submerge anim me->SetVisible(false); // we start invis under water, submerged me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); } void JustDied(Unit* /*killer*/) override @@ -218,7 +218,7 @@ public: { WaitTimer = 3000; CanStartEvent = true; // fresh fished from pool - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } else @@ -348,7 +348,7 @@ public: Submerged = false; me->InterruptNonMeleeSpells(false); // shouldn't be any me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->RemoveFlag(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); DoCast(me, SPELL_EMERGE, true); Spawned = false; diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp index b17f440c3a..d86eb99be9 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp @@ -326,7 +326,8 @@ public: { if (action == ACTION_AHUNE_RETREAT) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->RemoveAurasDueToSpell(SPELL_ICE_SPEAR_AURA); _events.ScheduleEvent(EVENT_SYNCH_HEALTH, Seconds(3), 0, PHASE_TWO); } @@ -334,7 +335,8 @@ public: { _events.Reset(); DoCast(me, SPELL_ICE_SPEAR_AURA); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); } } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index 4b67473f6c..6737999545 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -107,14 +107,16 @@ class boss_broggok : public CreatureScript break; case ACTION_ACTIVATE_BROGGOK: me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); events.ScheduleEvent(EVENT_SLIME_SPRAY, 10000); events.ScheduleEvent(EVENT_POISON_BOLT, 7000); events.ScheduleEvent(EVENT_POISON_CLOUD, 5000); break; case ACTION_RESET_BROGGOK: me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); break; } } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index 40c4e113cf..507049cdf0 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -95,7 +95,8 @@ class boss_kelidan_the_breaker : public CreatureScript Initialize(); SummonChannelers(); me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(true); } void JustEngagedWith(Unit* who) override @@ -139,7 +140,8 @@ class boss_kelidan_the_breaker : public CreatureScript return; } me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToAll(false); if (killer) AttackStart(killer); } diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 3dc942047e..a54cc9f12e 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -196,7 +196,8 @@ class instance_blood_furnace : public InstanceMapScript { if (!prisoner->IsAlive()) prisoner->Respawn(true); - prisoner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + prisoner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + prisoner->SetImmuneToAll(true); } void StorePrisoner(Creature* creature) @@ -284,7 +285,8 @@ class instance_blood_furnace : public InstanceMapScript for (GuidSet::const_iterator i = prisoners.begin(); i != prisoners.end(); ++i) if (Creature* prisoner = instance->GetCreature(*i)) { - prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE); + prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + prisoner->SetImmuneToAll(false); prisoner->SetInCombatWithZone(); } } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index bb1e928ab1..8fcdd135b9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -250,7 +250,8 @@ class boss_magtheridon : public CreatureScript CombatStart(); break; case EVENT_RELEASED: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetInCombatWithZone(); instance->SetData(DATA_MANTICRON_CUBE, ACTION_ENABLE); events.ScheduleEvent(EVENT_CLEAVE, Seconds(10)); diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp index fa113919f9..4e04fdb075 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.cpp @@ -94,9 +94,9 @@ class boss_shattered_executioner : public CreatureScript me->AddLootMode(LOOT_MODE_HARD_MODE_1); if (instance->GetBossState(DATA_KARGATH) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); else - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); Initialize(); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index 25a1928622..93b0465836 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -98,7 +98,8 @@ class boss_harbinger_skyriss : public CreatureScript void Reset() override { - _Reset(); + if (!Intro) + me->SetImmuneToPC(true); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); Initialize(); @@ -185,7 +186,7 @@ class boss_harbinger_skyriss : public CreatureScript Intro_Timer = 3000; break; case 3: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); Intro = true; break; } diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 06b11c031b..081f145693 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -968,7 +968,7 @@ public: me->RestoreFaction(); me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); } void DamageTaken(Unit* /*attacker*/, uint32 &damage) override @@ -983,7 +983,7 @@ public: me->GetThreatManager().ClearAllThreat(); me->CombatStop(true); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); Talk(SAY_DEFEATED); _events.ScheduleEvent(EVENT_EVADE, Minutes(1)); @@ -1003,7 +1003,7 @@ public: _events.ScheduleEvent(EVENT_ATTACK, Seconds(2)); break; case EVENT_ATTACK: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetFaction(FACTION_MONSTER_2); me->EngageWithTarget(ObjectAccessor::GetPlayer(*me, _playerGUID)); _events.ScheduleEvent(EVENT_FIREBALL, 1); diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index a5119ca597..82312b6423 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -166,7 +166,8 @@ public: { if (spell->Id == SPELL_SUMMON_INFERNAL) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); me->SetDisplayId(MODEL_INFERNAL); } } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index ffdee6079f..f295ac6351 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -277,13 +277,13 @@ class spell_q11396_11399_force_shield_arcane_purple_x3 : public SpellScriptLoade void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + target->SetImmuneToPC(true); target->AddUnitState(UNIT_STATE_ROOT); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + GetTarget()->SetImmuneToPC(false); } void Register() override diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 9ed1e56809..16fb9eee40 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -249,7 +249,7 @@ public: { summon->SetVisible(false); summon->SetReactState(REACT_PASSIVE); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + summon->SetImmuneToPC(true); } return false; }