refactor(Core/Unit): PC&NPC Immunity (#11986)

* initial

* refactor(Core/Unit): PC & NPC Immunities

Cherry-pick TC: 74af880217

Co-authored-by: Treeston <treeston.nmoc@gmail.com>

* fix builds error

Cherry-pick TC: 74af880217

Co-authored-by: Treeston <treeston.nmoc@gmail.com>

* Fix nef combat, and replace SetFlag by SetUnitFlag

* fix combat with jedoga

Co-authored-by: Treeston <treeston.nmoc@gmail.com>
This commit is contained in:
Maelthyr 2022-06-18 14:16:45 +02:00 committed by GitHub
parent 4bc99f8070
commit d928d8d96a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 450 additions and 328 deletions

View file

@ -215,7 +215,7 @@ void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->GetMotionMaster()->MoveTargetedHome();
if (HasImmuneToNPCFlags)
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(true);
Reset();
}
}
@ -497,10 +497,10 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
//disable npcflags
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
if (me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
if (me->IsImmuneToNPC())
{
HasImmuneToNPCFlags = true;
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(false);
}
LOG_DEBUG("scripts.ai", "EscortAI started with {} waypoints. ActiveAttacker = {}, Run = {}, PlayerGUID = {}",

View file

@ -1830,14 +1830,14 @@ bool Creature::CanStartAttack(Unit const* who) const
return false;
// This set of checks is should be done only for creatures
if ((HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters
(HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false
if ((IsImmuneToNPC() && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters
(IsImmuneToPC() && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false
{
return false;
}
if (Unit* owner = who->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) // immune to PC and target has player owner
if (owner->GetTypeId() == TYPEID_PLAYER && IsImmuneToPC()) // immune to PC and target has player owner
return false;
// Do not attack non-combat pets
@ -2368,7 +2368,7 @@ bool Creature::CanAssistTo(Unit const* u, Unit const* enemy, bool checkfaction /
if (IsCivilian())
return false;
if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC))
if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || IsImmuneToNPC())
return false;
// skip fighting creature

View file

@ -2088,7 +2088,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
// xinef: Remove Immunity flags
trigger->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
trigger->SetImmuneToNPC(false);
// xinef: set proper orientation, fixes cast against stealthed targets
if (target)
trigger->SetInFront(target);

View file

@ -2643,12 +2643,13 @@ void Player::InitStatsForLevel(bool reapplyMods)
// cleanup unit flags (will be re-applied if need at aura load).
RemoveFlag(UNIT_FIELD_FLAGS,
UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 |
UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_LOOTING |
UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED | UNIT_FLAG_PACIFIED |
UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED |
UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE |
UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT );
UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 |
UNIT_FLAG_LOOTING | UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED |
UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT |
UNIT_FLAG_DISARMED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING |
UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT |
UNIT_FLAG_TAXI_FLIGHT);
SetImmuneToAll(false);
SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); // must be set
SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);// must be set

View file

@ -13027,6 +13027,24 @@ void Unit::SetInCombatWith(Unit* enemy, uint32 duration)
SetInCombatState(false, enemy, duration);
}
void Unit::SetImmuneToPC(bool apply, bool keepCombat)
{
(void)keepCombat;
if (apply)
SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
else
RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
}
void Unit::SetImmuneToNPC(bool apply, bool keepCombat)
{
(void)keepCombat;
if (apply)
SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
else
RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
}
void Unit::CombatStart(Unit* victim, bool initialAggro)
{
// Xinef: Dont allow to start combat with triggers
@ -13140,8 +13158,8 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)
return;
// xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back
if (GetTypeId() == TYPEID_UNIT && enemy && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && enemy->GetCharmerOrOwnerPlayerOrPlayerItself())
RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // unit has engaged in combat, remove immunity so players can fight back
if (GetTypeId() == TYPEID_UNIT && enemy && IsImmuneToPC() && enemy->GetCharmerOrOwnerPlayerOrPlayerItself())
SetImmuneToPC(true); // unit has engaged in combat, remove immunity so players can fight back
if (IsInCombat())
return;
@ -13207,7 +13225,7 @@ void Unit::ClearInCombat()
if (Creature* creature = ToCreature())
{
if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // set immunity state to the one from db on evade
SetImmuneToPC(true); // set immunity state to the one from db on evade
ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
if (HasDynamicFlag(UNIT_DYNFLAG_TAPPED))
@ -13251,7 +13269,7 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const
if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return false;
if (HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself())
if (IsImmuneToPC() && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster())
@ -13306,11 +13324,11 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
}
// check flags
if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE_2)
|| (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
|| (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
|| (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
|| (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC())
|| (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC())
|| (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && 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 && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)))
|| ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC()))
return false;
// CvC case - can attack each other only when one of them is hostile
@ -13425,12 +13443,12 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
if (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
{
if (target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
if (target->IsImmuneToPC())
return false;
}
else
{
if (target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
if (target->IsImmuneToNPC())
return false;
}
}

View file

@ -1647,6 +1647,13 @@ public:
[[nodiscard]] bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); }
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 HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); }
void SetImmuneToNPC(bool apply, bool keepCombat = false);
bool IsImmuneToNPC() const { return HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); }
bool IsEngaged() const { return IsInCombat(); }
bool IsEngagedBy(Unit const* who) const { return IsInCombatWith(who); }

View file

@ -1113,7 +1113,7 @@ namespace Acore
{}
bool operator()(Unit* u)
{
if (!u->IsAlive() || u->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && !u->IsInCombat()))
if (!u->IsAlive() || u->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->IsImmuneToPC() && !u->IsInCombat()))
return false;
if (u->GetGUID() == i_funit->GetGUID())
return false;

View file

@ -2424,7 +2424,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
summon->SelectLevel(); // some summoned creaters have different from 1 DB data for level/hp
summon->ReplaceAllNpcFlags(NPCFlags(summon->GetCreatureTemplate()->npcflag));
summon->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToAll(true);
summon->SetReactState(REACT_PASSIVE);
// Xinef: Pet can have some auras in creature_addon or in scripts, do not remove them instantly

View file

@ -179,7 +179,7 @@ public:
me->SetFaction(FACTION_FRIENDLY);
// was set before event start, so set again
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
if (instance->GetData(TYPE_TOMB_OF_SEVEN) == DONE) // what is this trying to do? Probably some kind of crash recovery
{

View file

@ -752,7 +752,7 @@ public:
{
++TombEventCounter;
boss->SetFaction(FACTION_DARK_IRON_DWARVES);
boss->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
boss->SetImmuneToPC(false);
// find suitable target here.
Player* target = boss->SelectNearestPlayer(130);
@ -786,7 +786,7 @@ public:
boss->SetLootRecipient(nullptr);
}
boss->SetFaction(FACTION_FRIENDLY);
boss->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // think this is useless
boss->SetImmuneToPC(true); // think this is useless
if (i == 6) // doomrel needs explicit reset
{
boss->AI()->Reset();

View file

@ -79,7 +79,8 @@ public:
void Reset() override
{
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(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
@ -157,7 +158,8 @@ public:
me->CastSpell(me, SPELL_EMBERSEER_FULL_STRENGTH);
Talk(EMOTE_FREE_OF_BONDS);
Talk(YELL_FREE_OF_BONDS);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(false);
events.ScheduleEvent(EVENT_ENTER_COMBAT, 2000);
}
}
@ -338,7 +340,7 @@ public:
void Reset() override
{
me->SetUnitFlag(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);
@ -364,7 +366,7 @@ public:
{
if (data == 1 && value == 1)
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
DoZoneInCombat();
_events.CancelEvent(EVENT_ENCAGED_EMBERSEER);

View file

@ -114,11 +114,13 @@ public:
if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS)
{
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PREPARATION);
me->SetImmuneToAll(false);
return;
}
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PREPARATION);
me->SetImmuneToAll(true);
gythEvent = false;
victorGUID.Clear();
waveDoorGUID.Clear();

View file

@ -358,6 +358,7 @@ public:
DoCast(me, SPELL_NEFARIANS_BARRIER);
SetCombatMovement(false);
me->SetImmuneToPC(false);
AttackStart(SelectTarget(SelectTargetMethod::Random, 0, 200.f, true));
events.ScheduleEvent(EVENT_SHADOWBLINK, 500);
events.ScheduleEvent(EVENT_SHADOW_BOLT, 3000);
@ -499,7 +500,8 @@ public:
me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(true);
}
}

View file

@ -151,7 +151,8 @@ public:
{
summon->CastSpell(summon, SPELL_RAGNAROS_FADE);
summon->CastSpell(summon, SPELL_RAGNAROS_SUBMERGE_EFFECT, true);
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
summon->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
summon->SetImmuneToAll(true);
summon->SetReactState(REACT_PASSIVE);
}
}
@ -180,7 +181,7 @@ public:
else
{
events.SetPhase(PHASE_NONE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->SetFaction(FACTION_MAJORDOMO_FRIENDLY);
}
@ -282,7 +283,7 @@ public:
instance->SetBossState(DATA_MAJORDOMO_EXECUTUS, DONE);
events.CancelEventGroup(PHASE_COMBAT);
me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetFaction(FACTION_MAJORDOMO_FRIENDLY);
EnterEvadeMode();
Talk(SAY_DEFEAT);

View file

@ -137,7 +137,8 @@ public:
extraEvents.Reset();
extraEvents.SetPhase(PHASE_EMERGED);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
}
@ -276,7 +277,8 @@ public:
_isIntroDone = true;
extraEvents.SetPhase(PHASE_EMERGED);
me->RemoveAurasDueToSpell(SPELL_RAGNAROS_SUBMERGE_EFFECT);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
me->SetReactState(REACT_AGGRESSIVE);
DoZoneInCombat();
break;

View file

@ -107,7 +107,7 @@ void SummonCroneIfReady(InstanceScript* instance, Creature* creature)
if (creature->GetVictim())
pCrone->AI()->AttackStart(creature->GetVictim());
pCrone->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
pCrone->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
pCrone->SetImmuneToPC(false);
}
}
}

View file

@ -106,7 +106,7 @@ public:
summons.DespawnAll();
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false);
instance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
}
void JustSummoned(Creature* summon) override
@ -120,7 +120,7 @@ public:
void InitializeAI() override
{
ScriptedAI::InitializeAI();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
}
void JustDied(Unit*) override
@ -162,7 +162,8 @@ public:
if (me->isRegeneratingHealth())
{
me->SetRegeneratingHealth(false);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE);
me->SetImmuneToAll(true);
me->CombatStop();
me->SetReactState(REACT_PASSIVE);
LapseAction(ACTION_REMOVE_FLY);
@ -200,7 +201,7 @@ public:
switch (events2.ExecuteEvent())
{
case EVENT_INIT_COMBAT:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
if (Unit* target = SelectTargetFromPlayerList(50.0f))
AttackStart(target);
return;

View file

@ -219,7 +219,7 @@ public:
if (creature->AI()->GetData(DATA_IN_PROGRESS))
return true;
creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
creature->SetImmuneToPC(false);
creature->RemoveUnitFlag(UNIT_FLAG_SWIMMING);
player->CastSpell(creature, SPELL_DUEL, false);
@ -584,7 +584,7 @@ public:
{
ScriptedAI::MoveInLineOfSight(who);
if (!who->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC) && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f))
if (!who->IsImmuneToNPC() && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f))
if (Unit* owner = who->GetOwner())
if (Player* player = owner->ToPlayer())
{
@ -593,7 +593,7 @@ public:
creature->CastSpell(owner, 52517, true);
creature->AI()->SetGUID(me->GetGUID());
creature->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creature->SetImmuneToAll(true);
}
}
@ -743,7 +743,7 @@ public:
phase = PHASE_CHAINED;
events.Reset();
me->SetFaction(FACTION_CREATURE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8);
me->LoadEquipment(0, true);
}
@ -844,7 +844,7 @@ public:
else
{
me->SetFaction(FACTION_MONSTER);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
phase = PHASE_ATTACKING;
if (Player* target = ObjectAccessor::GetPlayer(*me, playerGUID))
@ -964,7 +964,7 @@ public:
{
npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature)
{
me->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetFaction(FACTION_FRIENDLY);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse.
}
@ -987,7 +987,8 @@ public:
me->SetSpeed(MOVE_RUN, 1.25f);
me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0);
me->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
me->SetFaction(FACTION_FRIENDLY);
}
}
@ -1097,7 +1098,8 @@ public:
{
me->SetFacingToObject(car);
// xinef: add some flags
car->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
car->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE);
car->SetImmuneToAll(true);
car->SetFaction(FACTION_FRIENDLY);
}
Talk(SAY_SCARLET_MINER_0);

View file

@ -255,7 +255,7 @@ public:
else
{
me->GetMotionMaster()->MoveTargetedHome();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(true);
Reset();
}
}
@ -313,7 +313,7 @@ public:
m_uiValrothGUID = summoned->GetGUID();
summoned->AddThreat(me, 0.0f);
summoned->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
summoned->SetImmuneToPC(false);
summons.Summon(summoned);
}
@ -666,7 +666,7 @@ public:
ExecuteSpeech_Counter = 0;
PlayerGUID.Clear();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
}
bool MeetQuestCondition(Player* player)
@ -780,7 +780,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_6, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -826,7 +826,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_8, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -872,7 +872,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_3, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -918,7 +918,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_7, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -964,7 +964,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_4, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1010,7 +1010,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_9, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1056,7 +1056,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_5, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1102,7 +1102,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_10, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1146,7 +1146,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_1, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1192,7 +1192,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_2, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);

View file

@ -465,7 +465,7 @@ public:
if (battleStarted == ENCOUNTER_STATE_OUTRO && cr->GetEntry() == NPC_DEFENDER_OF_THE_LIGHT)
{
cr->SetReactState(REACT_PASSIVE);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(true);
cr->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H);
cr->HandleEmoteCommand(EMOTE_STATE_READY1H);
}
@ -546,7 +546,7 @@ public:
events.Reset();
summons.DespawnAll();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetVisible(true);
@ -670,7 +670,7 @@ public:
break;
}
case EVENT_START_COUNTDOWN_14:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SummonCreatureGroup(5);
return;
case EVENT_FINISH_FIGHT_1:
@ -698,13 +698,13 @@ public:
{
summon->CombatStop(true);
summon->GetThreatMgr().ClearAllThreat();
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToAll(true);
summon->SetReactState(REACT_PASSIVE);
summon->GetMotionMaster()->Clear(false);
}
me->CombatStop(true);
me->GetThreatMgr().ClearAllThreat();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->Clear(false);
@ -1027,7 +1027,7 @@ public:
{
tirion->CastSpell(tirion, SPELL_TIRION_CHARGE, true);
tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
tirion->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
tirion->SetImmuneToAll(true);
}
break;
case EVENT_OUTRO_SCENE_44:

View file

@ -113,8 +113,7 @@ public:
me->SetDisableGravity(true);
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // for some reason he aggroes if we don't have this.
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); // might not be needed, but guardians and stuff like that could mess up.
me->SetImmuneToAll(true); // for some reason he aggroes if we don't have this.
}
void MovementInform(uint32 type, uint32 id) override
@ -154,8 +153,7 @@ public:
me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF));
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SetReactState(REACT_AGGRESSIVE);
break;
case INTRO_6:

View file

@ -139,7 +139,7 @@ public:
})
.Schedule(12s, [this](TaskContext context)
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
_phase = PHASE_COMBAT;
DoZoneInCombat();
@ -185,7 +185,7 @@ public:
}
});
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetFaction(FACTION_MONSTER);
summons.DoAction(ACTION_START_EVENT);
}
@ -293,13 +293,13 @@ struct npc_apothecary_genericAI : public ScriptedAI
{
if (action == ACTION_START_EVENT)
{
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetFaction(FACTION_MONSTER);
me->GetMotionMaster()->MovePoint(1, _movePos);
}
else if (action == ACTION_START_FIGHT)
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
DoZoneInCombat();
}
}

View file

@ -111,7 +111,8 @@ struct boss_jarien : public BossAI
});
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToNPC(true);
_talked = false;
_phase = PHASE_TALK;
}
@ -145,7 +146,8 @@ struct boss_jarien : public BossAI
_talked = true;
_phase = PHASE_FIGHT;
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToNPC(false);
});
}
@ -234,7 +236,8 @@ struct boss_sothos : public BossAI
});
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToNPC(true);
_talked = false;
_phase = PHASE_TALK;
}
@ -261,7 +264,8 @@ struct boss_sothos : public BossAI
_talked = true;
_phase = PHASE_FIGHT;
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToNPC(false);
})
.Schedule(3s, [this](TaskContext /*context*/)
{

View file

@ -201,14 +201,14 @@ public:
{
Creature* target = GetUnitOwner()->ToCreature();
target->SetReactState(REACT_PASSIVE);
target->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
target->SetImmuneToAll(true);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* target = GetUnitOwner()->ToCreature();
target->SetReactState(REACT_AGGRESSIVE);
target->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
target->SetImmuneToAll(false);
}
void Register() override

View file

@ -724,13 +724,13 @@ public:
if (ptarget->GetPositionX() > 120)
{
ptarget->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_SPEAR));
ptarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
ptarget->SetImmuneToPC(true);
ptarget->SetReactState(REACT_PASSIVE);
ptarget->AI()->SetData(0, 1);
}
else
{
ptarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
ptarget->SetImmuneToPC(true);
ptarget->SetReactState(REACT_PASSIVE);
ptarget->AI()->SetData(0, 2);
}

View file

@ -138,7 +138,7 @@ public:
}
}
me->RemoveAurasDueToSpell(SPELL_FRENZY);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
instance->SetBossState(DATA_OHGAN, NOT_STARTED);
me->Mount(MODEL_OHGAN_MOUNT);
reviveGUID.Clear();
@ -267,7 +267,7 @@ public:
}
break;
case EVENT_STARTED:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
break;
default:
break;

View file

@ -372,7 +372,7 @@ public:
continue;
else
c->AI()->Talk(SAY_MORLEN_4);
c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->SetImmuneToAll(false);
c->AI()->AttackStart(me);
}
break;

View file

@ -53,7 +53,7 @@ public:
phase = 0;
mockingBlowTimer = 5000;
shieldBashTimer = 8000;
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(true);
}
void sQuestAccept(Player* player, Quest const* quest) override
@ -62,7 +62,7 @@ public:
{
Talk(SAY_CORPORAL_1, player);
npc_escortAI::Start(true, false, player->GetGUID(), quest);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(false);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
}

View file

@ -53,7 +53,7 @@ public:
if (quest->GetQuestId() == QUEST_590)
{
creature->SetFaction(FACTION_ENEMY);
creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
creature->SetImmuneToPC(false);
CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, creature->AI())->AttackStart(player);
}
return true;
@ -80,8 +80,8 @@ public:
me->RestoreFaction();
if (!me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
if (!me->IsImmuneToPC())
me->SetImmuneToPC(true);
}
void EnterCombat(Unit* /*who*/) override { }
@ -104,7 +104,7 @@ public:
uiDamage = 0;
me->RestoreFaction();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->CombatStop(true);
m_uiPhase = 1;

View file

@ -1420,8 +1420,7 @@ public:
{
thrallGUID = temp->GetGUID();
temp->SetReactState(REACT_PASSIVE);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
temp->CastSpell(temp, SPELL_THRALL_BUFF);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
@ -1429,8 +1428,7 @@ public:
{
sylvanasGUID = temp->GetGUID();
temp->SetReactState(REACT_PASSIVE);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
for (uint8 i = 0; i < HORDE_FORCE_MAXCOUNT; ++i)
@ -1439,8 +1437,7 @@ public:
{
hordeForcesGUID[i] = temp->GetGUID();
temp->SetReactState(REACT_PASSIVE);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
}
@ -1451,8 +1448,7 @@ public:
if (Unit* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[i + 25].x, AllianceSpawn[i + 25].y, AllianceSpawn[i + 25].z, AllianceSpawn[i + 25].o, TEMPSUMMON_MANUAL_DESPAWN))
{
allianceForcesGUID[i] = temp->GetGUID();
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
}
@ -1476,7 +1472,7 @@ public:
if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
{
jaina->GetMotionMaster()->Clear();
jaina->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetImmuneToNPC(false);
jaina->SetReactState(REACT_AGGRESSIVE);
}
SetHoldState(true);
@ -1820,8 +1816,7 @@ public:
case 53:
if (Creature* putress = ObjectAccessor::GetCreature(*me, putressGUID))
{
putress->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
putress->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
putress->SetImmuneToAll(false);
putress->AddThreat(me, 100.0f);
me->AddThreat(putress, 100.0f);
putress->RemoveAura(SPELL_PUTRESS_CASTING_STATE);
@ -1894,7 +1889,7 @@ public:
case 66:
if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
jaina->AI()->Talk(JAINA_SAY_THRONE_1);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(true);
bStepping = false;
JumpToNextStep(0);
break;
@ -1907,8 +1902,7 @@ public:
if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
{
jaina->GetMotionMaster()->MovePoint(0, AllianceWP[8].x, AllianceWP[8].y, AllianceWP[8].z);
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
jaina->SetImmuneToAll(true);
}
SetEscortPaused(false);
bStepping = false;
@ -1933,12 +1927,12 @@ public:
break;
case 73:
Talk(WRYNN_SAY_THRONE_9);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToAll(false);
if (Creature* thrall = ObjectAccessor::GetCreature(*me, thrallGUID))
{
thrall->SetReactState(REACT_AGGRESSIVE);
thrall->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
thrall->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
thrall->SetImmuneToNPC(false);
thrall->SetImmuneToPC(true);
thrall->AddThreat(me, 100.0f);
me->AddThreat(thrall, 100.0f);
thrall->AI()->AttackStart(me);
@ -1946,8 +1940,8 @@ public:
if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasGUID))
{
sylvanas->SetReactState(REACT_AGGRESSIVE);
sylvanas->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
sylvanas->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
sylvanas->SetImmuneToNPC(false);
sylvanas->SetImmuneToPC(true);
sylvanas->AddThreat(me, 100.0f);
sylvanas->AI()->AttackStart(me);
me->AddThreat(sylvanas, 100.0f);
@ -1957,8 +1951,8 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, hordeForcesGUID[i]))
{
temp->SetReactState(REACT_AGGRESSIVE);
temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToNPC(false);
temp->SetImmuneToPC(true);
}
}
for (uint8 i = 0; i < ALLIANCE_FORCE_MAXCOUNT; ++i)
@ -1969,8 +1963,8 @@ public:
{
temp->SetReactState(REACT_AGGRESSIVE);
temp2->SetReactState(REACT_AGGRESSIVE);
temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp2->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(false);
temp2->SetImmuneToAll(false);
temp->AddThreat(temp2, 100.0f);
temp->AI()->AttackStart(temp2);
temp2->AddThreat(temp, 100.0f);
@ -2564,7 +2558,7 @@ public:
if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID))
{
sylvanas->GetMotionMaster()->Clear();
sylvanas->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
sylvanas->SetImmuneToAll(false);
sylvanas->SetReactState(REACT_AGGRESSIVE);
sylvanas->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
sylvanas->GetMotionMaster()->MoveFollow(me, 1, M_PI * 0.1f);
@ -2606,7 +2600,7 @@ public:
if (Unit* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[23].x, ThrallSpawn[23].y, ThrallSpawn[23].z, ThrallSpawn[23].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900 * IN_MILLISECONDS))
{
ValimathrasGUID = temp->GetGUID();
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
}
break;
case 3:
@ -2729,7 +2723,7 @@ public:
if (Unit* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[63].x, ThrallSpawn[63].y, ThrallSpawn[63].z, ThrallSpawn[63].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300 * IN_MILLISECONDS))
{
ValimathrasGUID = temp->GetGUID();
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
}
break;
case 13:
@ -2820,7 +2814,7 @@ public:
if (Creature* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[73].x, ThrallSpawn[73].y, ThrallSpawn[73].z, ThrallSpawn[73].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1200 * IN_MILLISECONDS))
{
ValimathrasGUID = temp->GetGUID();
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
temp->CastSpell(me, SPELL_AURA_OF_VARIMATHRAS);
temp->CastSpell(me, SPELL_OPENING_LEGION_PORTALS);
temp->AI()->Talk(SAY_CLOSE_DOOR);
@ -3671,7 +3665,7 @@ public:
case 137:
if (Creature* valimathras = ObjectAccessor::GetCreature(*me, ValimathrasGUID))
{
valimathras->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
valimathras->SetImmuneToAll(false);
valimathras->RemoveAura(SPELL_AURA_OF_VARIMATHRAS);
valimathras->RemoveAura(SPELL_OPENING_LEGION_PORTALS);
valimathras->AI()->Talk(SAY_VALIMATHRAS_ATTACK);
@ -3740,8 +3734,7 @@ public:
if (Creature* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[i + 25].x, AllianceSpawn[i + 25].y, AllianceSpawn[i + 25].z, AllianceSpawn[i + 25].o, TEMPSUMMON_MANUAL_DESPAWN))
{
allianceForcesGUID[i] = temp->GetGUID();
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(true);
temp->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true);
temp->SetReactState(REACT_PASSIVE);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
@ -3750,8 +3743,7 @@ public:
if (Creature* wrynn = me->SummonCreature(NPC_WRYNN, 1308.862f, 381.809f, -66.044243f, TEMPSUMMON_MANUAL_DESPAWN))
{
WrynnGUID = wrynn->GetGUID();
wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
wrynn->SetImmuneToAll(true);
wrynn->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
wrynn->SetReactState(REACT_PASSIVE);
wrynn->GetMotionMaster()->MovePoint(0, 1302.543f, 359.472f, -67.295f, true);
@ -3759,8 +3751,7 @@ public:
if (Creature* jaina = me->SummonCreature(NPC_JAINA, 1308.862f, 381.809f, -66.044243f, TEMPSUMMON_MANUAL_DESPAWN))
{
JainaGUID = jaina->GetGUID();
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
jaina->SetImmuneToAll(true);
jaina->SetReactState(REACT_PASSIVE);
}
JumpToNextStep(6 * IN_MILLISECONDS);
@ -3788,11 +3779,11 @@ public:
break;
// Wrynn Fight
case 152:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToAll(false);
if (Creature* wrynn = ObjectAccessor::GetCreature(*me, WrynnGUID))
{
wrynn->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
wrynn->SetImmuneToNPC(false);
wrynn->SetImmuneToPC(true);
wrynn->SetReactState(REACT_AGGRESSIVE);
wrynn->AddThreat(me, 100.0f);
me->AddThreat(wrynn, 100.0f);
@ -3803,7 +3794,7 @@ public:
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, allianceForcesGUID[i]))
{
temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetImmuneToAll(false);
temp->SetReactState(REACT_AGGRESSIVE);
temp->AddThreat(me, 100.0f);
temp->AI()->AttackStart(me);

View file

@ -1557,7 +1557,7 @@ struct npc_coren_direbrew : public ScriptedAI
{
_events.Reset();
_summons.DespawnAll();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetFaction(FACTION_FRIENDLY);
_events.SetPhase(PHASE_ALL);
@ -1596,7 +1596,7 @@ struct npc_coren_direbrew : public ScriptedAI
if (action == ACTION_START_FIGHT)
{
_events.SetPhase(PHASE_ONE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoZoneInCombat();
@ -1830,7 +1830,7 @@ struct npc_direbrew_antagonist : public ScriptedAI
Talk(SAY_ANTAGONIST_2);
break;
case ACTION_ANTAGONIST_HOSTILE:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoZoneInCombat();
break;

View file

@ -112,7 +112,7 @@ public:
damage = 0;
finished = true;
me->SetRegeneratingHealth(false);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
if (InstanceScript* pInstance = me->GetInstanceScript())

View file

@ -472,7 +472,7 @@ public:
{
summons.Despawn(cr);
summons.Summon(cr);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(true);
cr->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
Talk(SAY_PHASE501);
@ -972,7 +972,7 @@ public:
if (Creature* cr = GetEventNpc(NPC_CITY_MAN))
{
cr->UpdateEntry(NPC_INFINITE_HUNTER, nullptr, false);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(true);
cr->SetReactState(REACT_PASSIVE);
}
ScheduleNextEvent(currentEvent, 2000);
@ -981,7 +981,7 @@ public:
if (Creature* cr = GetEventNpc(NPC_CITY_MAN4))
{
cr->UpdateEntry(NPC_INFINITE_AGENT, nullptr, false);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(true);
cr->SetReactState(REACT_PASSIVE);
}
ScheduleNextEvent(currentEvent, 2000);
@ -996,14 +996,14 @@ public:
}
if (Creature* cr = GetEventNpc(NPC_INFINITE_AGENT)) // it is infinite agent now :)
{
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(false);
cr->SetReactState(REACT_AGGRESSIVE);
cr->SetInCombatWithZone();
cr->AddThreat(me, 0.0f);
}
if (Creature* cr = GetEventNpc(NPC_INFINITE_HUNTER)) // it is infinite hunter now :)
{
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(false);
cr->SetReactState(REACT_AGGRESSIVE);
cr->SetInCombatWithZone();
cr->AddThreat(me, 0.0f);
@ -1076,7 +1076,7 @@ public:
me->SummonCreature(NPC_TIME_RIFT, EventPos[EVENT_SRC_EPOCH], TEMPSUMMON_TIMED_DESPAWN, 20000);
if (Creature* cr = me->SummonCreature(NPC_EPOCH, EventPos[EVENT_SRC_EPOCH]))
{
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(true);
cr->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetTarget(cr->GetGUID());
cr->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_EPOCH]);
@ -1097,7 +1097,7 @@ public:
case EVENT_ACTION_PHASE3+18:
if (Creature* cr = GetEventNpc(NPC_EPOCH))
{
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(false);
cr->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
cr->SetReactState(REACT_AGGRESSIVE);
cr->AddThreat(me, 0.0f);
@ -1122,7 +1122,7 @@ public:
case EVENT_ACTION_PHASE5:
if (Creature* cr = GetEventNpc(NPC_MAL_GANIS))
{
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(false);
cr->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
cr->SetInCombatWithZone();
cr->AddThreat(me, 0.0f);

View file

@ -82,7 +82,7 @@ public:
summons.Summon(summon);
if (Creature* thrall = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetGuidData(DATA_THRALL_GUID)))
thrall->AI()->JustSummoned(summon);
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToAll(true);
if (summon->GetEntry() == NPC_SKARLOC_MOUNT)
return;
@ -103,7 +103,7 @@ public:
path.push_back(G3D::Vector3(startPath[i].GetPositionX(), startPath[i].GetPositionY(), startPath[i].GetPositionZ()));
me->GetMotionMaster()->MoveSplinePath(&path);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->Mount(SKARLOC_MOUNT_MODEL);
}
@ -168,13 +168,13 @@ public:
Talk(SAY_ENTER);
break;
case EVENT_START_FIGHT:
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SetInCombatWithZone();
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
if (summon->GetEntry() != NPC_SKARLOC_MOUNT)
{
summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToAll(false);
summon->SetInCombatWithZone();
}
break;

View file

@ -620,7 +620,7 @@ public:
case EVENT_SUMMON_CHRONO:
if (Creature* epoch = me->SummonCreature(NPC_EPOCH_HUNTER, 2640.49f, 696.15f, 64.31f, 4.51f, TEMPSUMMON_MANUAL_DESPAWN))
{
epoch->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
epoch->SetImmuneToAll(true);
epoch->AI()->Talk(SAY_EPOCH_ENTER1);
}
break;
@ -703,7 +703,7 @@ public:
case EVENT_CALL_EPOCH:
if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER))
{
epoch->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
epoch->SetImmuneToAll(false);
epoch->GetMotionMaster()->MovePoint(0, *me, false, true);
}
break;
@ -759,7 +759,7 @@ public:
Talk(SAY_EVENT_COMPLETE);
break;
case EVENT_THRALL_RUN_AWAY:
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
SetEscortPaused(false);
break;

View file

@ -258,14 +258,14 @@ public:
{
summon->SetFaction(faction);
if (remove)
summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToNPC(false);
else
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToNPC(true);
}
if (remove)
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(false);
else
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(true);
me->SetFaction(faction);
}

View file

@ -83,7 +83,7 @@ public:
return;
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
SetCombatMovement(true);
if (me->IsInCombat())

View file

@ -99,7 +99,7 @@ public:
void InitializeAI() override
{
me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->RestoreFaction();
_events.Reset();
@ -203,7 +203,7 @@ public:
Talk(TALK_0, player);
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
me->GetMotionMaster()->MoveFollow(player, 3.f, M_PI);

View file

@ -584,7 +584,7 @@ public:
{
npc_omenAI(Creature* creature) : ScriptedAI(creature)
{
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->GetMotionMaster()->MovePoint(1, 7549.977f, -2855.137f, 456.9678f);
}
@ -598,7 +598,7 @@ public:
if (pointId == 1)
{
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
if (Player* player = me->SelectNearestPlayer(40.0f))
AttackStart(player);
}

View file

@ -153,7 +153,7 @@ public:
creature->AI()->Talk(SAY_START);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
creature->SetImmuneToPC(false);
}
return true;
}

View file

@ -165,7 +165,8 @@ struct boss_jedoga_shadowseeker : public BossAI
void Reset() override
{
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
me->SetDisableGravity(true);
me->SetHover(true);
@ -254,7 +255,8 @@ struct boss_jedoga_shadowseeker : public BossAI
{
summon->GetMotionMaster()->MovePoint(POINT_INITIAL, VolunteerSpotPositions[i][1]);
summon->SetReactState(REACT_PASSIVE);
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC );
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
summon->SetImmuneToAll(true);
summons.Summon(summon);
}
}
@ -357,6 +359,7 @@ struct boss_jedoga_shadowseeker : public BossAI
me->ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
ReschedulleCombatEvents();
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL);
@ -583,7 +586,8 @@ struct npc_twilight_volunteer : public ScriptedAI
DoCastSelf(SPELL_ACTIVATE_INITIATE, true);
me->RemoveAurasDueToSpell(SPELL_WHITE_SPHERE);
me->SetControlled(false, UNIT_STATE_STUNNED);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
Talk(SAY_CHOSEN);
me->SetStandState(UNIT_STAND_STATE_STAND);

View file

@ -214,7 +214,7 @@ struct boss_taldaram : public BossAI
// Event not started
if (instance->GetData(DATA_TELDRAM_SPHERE1) != DONE || instance->GetData(DATA_TELDRAM_SPHERE2) != DONE)
{
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetDisableGravity(true);
me->SetHover(true);
if (!me->HasAura(SPELL_BEAM_VISUAL))
@ -260,7 +260,8 @@ struct boss_taldaram : public BossAI
me->SetDisableGravity(false);
me->SetHover(false);
me->RemoveAllAuras();
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE| UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
me->UpdatePosition(me->GetHomePosition(), true);
}
summons.DespawnEntry(NPC_JEDOGA_CONTROLLER);
@ -274,7 +275,8 @@ struct boss_taldaram : public BossAI
me->SetDisableGravity(false);
me->SetHover(false);
me->RemoveAllAuras();
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE| UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
}
}

View file

@ -310,7 +310,7 @@ public:
continue;
}
dragon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
dragon->SetImmuneToNPC(true);
dragon->SetFullHealth();
++dragonsCount;
@ -729,7 +729,7 @@ struct boss_sartharion_dragonAI : public BossAI
events.Reset();
ClearInstance();
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(false);
me->SetSpeed(MOVE_FLIGHT, 1.0f);
me->SetCanFly(false);
me->ResetLootMode();
@ -790,7 +790,7 @@ struct boss_sartharion_dragonAI : public BossAI
}
}
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(false);
me->SetInCombatWithZone();
}

View file

@ -105,7 +105,10 @@ public:
{
BossAI::Reset();
if (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE)
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(false);
}
}
void EnterCombat(Unit* who) override

View file

@ -187,7 +187,10 @@ public:
case DATA_BALTHARUS_THE_WARBORN:
if (GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE && GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE)
if (Creature* zarithrian = instance->GetCreature(GeneralZarithrianGUID))
zarithrian->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
{
zarithrian->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
zarithrian->SetImmuneToPC(false);
}
break;
case DATA_GENERAL_ZARITHRIAN:
if (state == DONE)

View file

@ -158,7 +158,8 @@ public:
me->GetThreatMgr().clearReferences();
me->SetRegeneratingHealth(false);
_EnterEvadeMode();
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
if( pInstance )
pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE);
}
@ -305,7 +306,8 @@ public:
me->GetThreatMgr().clearReferences();
me->SetRegeneratingHealth(false);
_EnterEvadeMode();
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
if( pInstance )
{
pInstance->SetData(BOSS_ARGENT_CHALLENGE, DONE);
@ -404,7 +406,8 @@ public:
events.Reset();
me->SetReactState(REACT_PASSIVE);
me->SetObjectScale(0.01f);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
events.ScheduleEvent(EVENT_MEMORY_SCALE, 500);
}
@ -440,7 +443,8 @@ public:
break;
case EVENT_MEMORY_START_ATTACK:
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
if( Unit* target = me->SelectNearestTarget(200.0f) )
{
AttackStart(target);

View file

@ -120,7 +120,8 @@ public:
summons.DespawnAll();
Phase = 1;
me->SetDisplayId(me->GetNativeDisplayId());
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
if( pInstance )
pInstance->SetData(BOSS_BLACK_KNIGHT, NOT_STARTED);
@ -193,7 +194,8 @@ public:
{
case SPELL_BLACK_KNIGHT_RES:
me->SetHealth(me->GetMaxHealth());
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
me->SetControlled(false, UNIT_STATE_STUNNED);
me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
@ -342,7 +344,8 @@ public:
{
Start(false, true, ObjectGuid::Empty, nullptr);
SetDespawnAtEnd(true);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
}
void DoAction(int32 param) override

View file

@ -400,7 +400,8 @@ public:
{
DoAction(1);
DoAction(2);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
me->SetReactState(REACT_AGGRESSIVE);
}
@ -488,7 +489,8 @@ public:
me->SetRegeneratingHealth(true);
me->RemoveUnitFlag(UNIT_FLAG_PACIFIED);
me->SetSpeed(MOVE_RUN, 1.0f, false);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->RemoveAllAuras();
AddCreatureAddonAuras();
@ -556,7 +558,8 @@ public:
me->StopMoving();
me->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
me->SetRegeneratingHealth(false);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
if( pInstance )
{
@ -584,7 +587,8 @@ public:
me->CombatStop(true);
me->GetMotionMaster()->Clear();
me->SetRegeneratingHealth(false);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
if( pInstance )
pInstance->SetData(DATA_GRAND_CHAMPION_DIED, BossOrder);
}
@ -627,7 +631,8 @@ public:
events.ScheduleEvent(EVENT_SHIELD_BREAKER, urand(5000, 8000));
events.ScheduleEvent(EVENT_THRUST, urand(3000, 5000));
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
if( Unit* target = me->SelectNearestTarget(200.0f) )
AttackStart(target);
DoZoneInCombat();
@ -720,7 +725,8 @@ public:
{
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
NewMountGUID = mount->GetGUID();
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
me->GetMotionMaster()->MovePoint(7, *mount);
events.RepeatEvent(200);
break;

View file

@ -733,7 +733,8 @@ public:
{
NPC_GrandChampionGUID[BossOrder] = pBoss->GetGUID();
pBoss->ToCreature()->SetReactState(REACT_PASSIVE);
pBoss->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PACIFIED);
pBoss->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PACIFIED);
pBoss->SetImmuneToAll(true);
pBoss->ToCreature()->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI / 2);
pBoss->AI()->SetData(BossOrder, (shortver ? 1 : 0));
@ -742,7 +743,8 @@ public:
{
NPC_GrandChampionMinionsGUID[BossOrder][i] = pAdd->GetGUID();
pAdd->SetReactState(REACT_PASSIVE);
pAdd->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
pAdd->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
pAdd->SetImmuneToAll(true);
pAdd->SetHomePosition(748.309f, 619.448f, 411.3f, M_PI / 2);
pAdd->GetMotionMaster()->MoveFollow(pBoss, 2.0f, (i + 1)*M_PI / 2);
}
@ -839,7 +841,8 @@ public:
if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[1][i]) )
{
c->SetReactState(REACT_AGGRESSIVE);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
c->SetImmuneToAll(false);
if( Unit* target = c->SelectNearestTarget(200.0f) )
c->AI()->AttackStart(target);
c->AI()->DoZoneInCombat();
@ -865,7 +868,8 @@ public:
if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[0][i]) )
{
c->SetReactState(REACT_AGGRESSIVE);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
c->SetImmuneToAll(false);
if( Unit* target = c->SelectNearestTarget(200.0f) )
c->AI()->AttackStart(target);
c->AI()->DoZoneInCombat();
@ -890,7 +894,8 @@ public:
if( Creature* c = instance->GetCreature(NPC_GrandChampionMinionsGUID[2][i]) )
{
c->SetReactState(REACT_AGGRESSIVE);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
c->SetImmuneToAll(false);
if( Unit* target = c->SelectNearestTarget(200.0f) )
c->AI()->AttackStart(target);
c->AI()->DoZoneInCombat();
@ -915,7 +920,8 @@ public:
if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) )
{
c->SetReactState(REACT_AGGRESSIVE);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
c->SetImmuneToAll(false);
if( Unit* target = c->SelectNearestTarget(200.0f) )
c->AI()->AttackStart(target);
c->AI()->DoZoneInCombat();
@ -952,7 +958,8 @@ public:
if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) )
{
c->SetReactState(REACT_AGGRESSIVE);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
c->SetImmuneToAll(false);
if( Unit* target = c->SelectNearestTarget(200.0f) )
c->AI()->AttackStart(target);
c->AI()->DoZoneInCombat();
@ -1056,7 +1063,8 @@ public:
if( Creature* c = instance->GetCreature(NPC_ArgentSoldierGUID[i][j]) )
{
c->SetReactState(REACT_AGGRESSIVE);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
c->SetImmuneToAll(false);
//c->AI()->DoZoneInCombat();
}
if( Creature* tirion = instance->GetCreature(NPC_TirionGUID) )
@ -1077,7 +1085,8 @@ public:
if( Creature* boss = instance->GetCreature(NPC_ArgentChampionGUID) )
{
boss->SetReactState(REACT_AGGRESSIVE);
boss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
boss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
boss->SetImmuneToAll(false);
if( Unit* target = boss->SelectNearestTarget(200.0f) )
boss->AI()->AttackStart(target);
boss->AI()->DoZoneInCombat();

View file

@ -66,7 +66,7 @@ public:
{
startFightTimer = 0;
uiHopelessnessCount = 0;
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetControlled(false, UNIT_STATE_ROOT);
events.Reset();
if (pInstance)
@ -75,7 +75,7 @@ public:
void EnterCombat(Unit* /*who*/) override
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 5000);
events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 11000);

View file

@ -63,7 +63,7 @@ public:
void Reset() override
{
startFightTimer = 0;
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
events.Reset();
if (pInstance)
pInstance->SetData(DATA_MARWYN, NOT_STARTED);
@ -71,7 +71,7 @@ public:
void EnterCombat(Unit* /*who*/) override
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
events.ScheduleEvent(EVENT_OBLITERATE, 15000);
events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000);

View file

@ -755,7 +755,10 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER))
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
}
}
};
};
@ -851,7 +854,10 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER))
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
}
}
};
};
@ -994,7 +1000,10 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER))
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
}
}
};
};
@ -1077,7 +1086,10 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER))
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
}
}
};
};
@ -1161,7 +1173,10 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
if (me->GetInstanceScript()->GetData(DATA_WAVE_NUMBER))
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
{
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
}
}
};
};

View file

@ -68,7 +68,7 @@ public:
break;
case 8:
_owner.SetReactState(REACT_AGGRESSIVE);
_owner.RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
_owner.SetImmuneToAll(false);
if (InstanceScript* instance = _owner.GetInstanceScript())
instance->SetData(DATA_BATTERED_HILT, 8);
break;
@ -96,7 +96,7 @@ public:
{
Position homePos = _owner.GetHomePosition();
_owner.SetReactState(REACT_PASSIVE);
_owner.SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
_owner.SetImmuneToAll(true);
_owner.SetVisible(false);
_owner.UpdatePosition(homePos.GetPositionX(), homePos.GetPositionY(), homePos.GetPositionZ(), homePos.GetOrientation(), true);
_owner.StopMovingOnCurrentPos();
@ -629,7 +629,7 @@ public:
if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID))
{
c->SetReactState(REACT_AGGRESSIVE);
c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->SetImmuneToAll(false);
c->RemoveAurasDueToSpell(70300);
}
break;
@ -889,7 +889,8 @@ public:
if (c->GetEntry() == entry)
{
TrashActive[j] = true;
c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
c->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
c->SetImmuneToAll(false);
c->AI()->DoAction(1);
break;
}
@ -918,7 +919,8 @@ public:
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
c->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
c->SetImmuneToAll(true);
c->Respawn(true);
c->UpdatePosition(c->GetHomePosition(), true);
c->StopMovingOnCurrentPos();

View file

@ -418,7 +418,8 @@ public:
c->CastSpell(c, 69753, false);
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
me->SetImmuneToAll(true);
me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
me->AddUnitState(UNIT_STATE_DIED);

View file

@ -930,7 +930,7 @@ public:
if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_TYRANNUS_GUID)))
{
c->AI()->Talk(SAY_PREFIGHT_1);
c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
c->SetImmuneToPC(false);
c->SetReactState(REACT_AGGRESSIVE);
//c->ClearUnitState(UNIT_STATE_ONVEHICLE);
if (Player* plr = c->SelectNearestPlayer(100.0f))

View file

@ -212,7 +212,7 @@ public:
me->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
}
}
@ -367,7 +367,8 @@ public:
{
case ACTION_STAND_UP:
summons.DespawnEntry(WORLD_TRIGGER);
me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetReactState(REACT_AGGRESSIVE);
@ -471,7 +472,7 @@ public:
me->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
}
}
@ -636,7 +637,8 @@ public:
{
case ACTION_STAND_UP:
summons.DespawnEntry(WORLD_TRIGGER);
me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetReactState(REACT_AGGRESSIVE);
@ -755,7 +757,7 @@ public:
me->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
}
}
@ -929,7 +931,8 @@ public:
{
case ACTION_STAND_UP:
summons.DespawnEntry(WORLD_TRIGGER);
me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetReactState(REACT_AGGRESSIVE);

View file

@ -251,7 +251,7 @@ public:
void Reset() override
{
_Reset();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(true);
me->SetReactState(REACT_DEFENSIVE);
events.Reset();
_introDone = false;
@ -323,7 +323,7 @@ public:
void AttackStart(Unit* victim) override
{
if (!_introDone || me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
if (!_introDone || me->IsImmuneToPC())
return;
ScriptedAI::AttackStart(victim);
@ -707,7 +707,7 @@ public:
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
{
deathbringer->AI()->DoAction(ACTION_INTRO_DONE);
deathbringer->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
deathbringer->SetImmuneToPC(false);
if (Player* target = deathbringer->SelectNearestPlayer(100.0f))
deathbringer->AI()->AttackStart(target);
}
@ -945,7 +945,7 @@ public:
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
{
deathbringer->AI()->DoAction(ACTION_INTRO_DONE);
deathbringer->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
deathbringer->SetImmuneToPC(false);
if (Player* target = deathbringer->SelectNearestPlayer(100.0f))
deathbringer->AI()->AttackStart(target);
}

View file

@ -1431,7 +1431,7 @@ public:
return;
me->setActive(true);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
me->SetDefaultMovementType(IDLE_MOTION_TYPE);
@ -1450,7 +1450,7 @@ public:
me->SetDisableGravity(false);
me->SetHomePosition(SpinestalkerLandPos);
me->SetFacingTo(SpinestalkerLandPos.GetOrientation());
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
}
void UpdateAI(uint32 diff) override
@ -1562,7 +1562,7 @@ public:
return;
me->setActive(true);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
me->SetDefaultMovementType(IDLE_MOTION_TYPE);
@ -1583,7 +1583,7 @@ public:
me->SetDisableGravity(false);
me->SetHomePosition(RimefangLandPos);
me->SetFacingTo(RimefangLandPos.GetOrientation());
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
}
else if (point == POINT_LAND_GROUND)
{

View file

@ -631,7 +631,7 @@ public:
boss_the_lich_kingAI(Creature* creature) : BossAI(creature, DATA_THE_LICH_KING)
{
me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetReactState(REACT_PASSIVE);
}
@ -658,7 +658,7 @@ public:
_Reset();
DoAction(ACTION_RESTORE_LIGHT);
SetEquipmentSlots(true);
if (me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
if (me->IsImmuneToPC())
me->SetStandState(UNIT_STAND_STATE_SIT);
}
@ -704,7 +704,7 @@ public:
Cell::VisitGridObjects(me, worker, 333.0f);
me->AddAura(SPELL_EMOTE_SIT_NO_SHEATH, me);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetReactState(REACT_PASSIVE);
me->SetStandState(UNIT_STAND_STATE_SIT);
}
@ -1207,7 +1207,7 @@ public:
spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly
spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players
spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000));
terenas->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); // to avoid being healed by player trinket procs. terenas' health doesn't matter on heroic
terenas->SetImmuneToAll(true); // to avoid being healed by player trinket procs. terenas' health doesn't matter on heroic
}
}
break;
@ -1454,7 +1454,7 @@ public:
if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
{
theLichKing->SetWalk(false);
theLichKing->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
theLichKing->SetImmuneToPC(false);
theLichKing->SetReactState(REACT_AGGRESSIVE);
theLichKing->SetInCombatWithZone();
if (!theLichKing->IsInCombat())
@ -1587,7 +1587,7 @@ public:
terenas->CastSpell((Unit*)nullptr, SPELL_MASS_RESURRECTION, false);
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
{
lichKing->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
lichKing->SetImmuneToNPC(false);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
me->RemoveAllAuras();
SetEquipmentSlots(true);
@ -3708,7 +3708,8 @@ public:
if (!target)
return;
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1);
target->SetImmuneToAll(false);
target->ForceValuesUpdateAtIndex(UNIT_FIELD_FLAGS);
VileSpiritActivateEvent(target).Execute(0, 0);
}

View file

@ -743,7 +743,8 @@ public:
return;
me->setActive(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
// Load Grid with Sister Svalna
me->GetMap()->LoadGrid(4356.71f, 2484.33f);
if (Creature* svalna = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_SISTER_SVALNA)))
@ -930,7 +931,8 @@ public:
Talk(SAY_CROK_INTRO_3);
break;
case EVENT_START_PATHING:
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
Start(true, true);
break;
case EVENT_SCOURGE_STRIKE:
@ -998,7 +1000,7 @@ public:
void Reset() override
{
_Reset();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
me->SetCanFly(true);
me->SetDisableGravity(true);
@ -1007,7 +1009,7 @@ public:
void AttackStart(Unit* victim) override
{
if (me->HasReactState(REACT_PASSIVE) || me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC))
if (me->HasReactState(REACT_PASSIVE) || me->IsImmuneToAll())
return;
BossAI::AttackStart(victim);
}
@ -1037,10 +1039,10 @@ public:
void EnterCombat(Unit* /*attacker*/) override
{
if (me->HasReactState(REACT_PASSIVE) || me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC))
if (me->HasReactState(REACT_PASSIVE) || me->IsImmuneToAll())
{
me->CombatStop(false);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->SetReactState(REACT_PASSIVE);
return;
}
@ -1121,7 +1123,7 @@ public:
if (type != EFFECT_MOTION_TYPE || id != POINT_LAND)
return;
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SetCanFly(false);
me->SetDisableGravity(false);
me->SetReactState(REACT_AGGRESSIVE);
@ -1915,7 +1917,8 @@ public:
if (Creature* target = GetTarget()->ToCreature())
{
target->SetReactState(REACT_PASSIVE);
target->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
target->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->SetImmuneToPC(true);
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_02);
}
}
@ -1925,7 +1928,8 @@ public:
if (Creature* target = GetTarget()->ToCreature())
{
target->SetReactState(REACT_AGGRESSIVE);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->SetImmuneToPC(false);
target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
}
}

View file

@ -225,7 +225,8 @@ public:
BossAI::Reset();
events.Reset();
summons.DespawnAll();
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_DISABLE_MOVE);
me->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE);
me->SetImmuneToPC(false);
me->SetReactState(REACT_PASSIVE);
secondPhase = false;
gateOpened = false;
@ -485,7 +486,8 @@ public:
Talk(EMOTE_PHASE_TWO);
me->CastSpell(me, SPELL_TELEPORT_LIVE, false);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_DISABLE_MOVE);
me->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE);
me->SetImmuneToPC(false);
me->RemoveAllAuras();
summons.DoZoneInCombat();
events.ScheduleEvent(EVENT_SHADOW_BOLT, 1000);

View file

@ -168,7 +168,7 @@ public:
cr->InterruptNonMeleeSpells(true);
cr->CastSpell(cr, SPELL_FEUGEN_CHAIN, false);
cr->SetDisableGravity(true);
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
cr->SetImmuneToPC(false);
cr->SetControlled(true, UNIT_STATE_ROOT);
}
if (Creature* cr = me->SummonCreature(NPC_TESLA_COIL, 3487.04f, -2911.68f, 318.75f, 0.0f))
@ -177,7 +177,7 @@ public:
cr->InterruptNonMeleeSpells(true);
cr->CastSpell(cr, SPELL_STALAGG_CHAIN, false);
cr->SetDisableGravity(true);
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
cr->SetImmuneToPC(false);
cr->SetControlled(true, UNIT_STATE_ROOT);
}
@ -403,7 +403,7 @@ public:
if (Creature* cr = me->FindNearestCreature(NPC_TESLA_COIL, 150.0f))
{
cr->CastSpell(cr, me->GetEntry() == NPC_STALAGG ? SPELL_STALAGG_CHAIN : SPELL_FEUGEN_CHAIN, false);
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
cr->SetImmuneToPC(false);
myCoil = cr->GetGUID();
}
}

View file

@ -377,7 +377,7 @@ public:
events.Reset();
summons.DespawnAll();
me->SetReactState(REACT_PASSIVE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
me->SetSheath(SHEATH_STATE_UNARMED);
me->SetFaction(190);
me->CastSpell(me, SPELL_DUAL_WIELD, true);
@ -403,7 +403,7 @@ public:
{
case ACTION_START_INTRO:
{
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetUnitFlag2(UNIT_FLAG2_DO_NOT_FADE_IN);
me->SetDisableGravity(true);
me->CastSpell(me, SPELL_ARRIVAL, true);
@ -446,7 +446,7 @@ public:
case ACTION_INIT_ALGALON:
_firstPull = false;
_fedOnTears = false;
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
break;
case ACTION_ASCEND:
summons.DespawnAll();
@ -477,7 +477,8 @@ public:
uint32 introDelay = 0;
me->setActive(true);
me->SetInCombatWithZone();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToNPC(true);
events.Reset();
events.SetPhase(PHASE_ROLE_PLAY);
@ -649,7 +650,7 @@ public:
break;
case EVENT_INTRO_FINISH:
events.Reset();
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(false);
if (Creature* brann = ObjectAccessor::GetCreature(*me, m_pInstance->GetGuidData(NPC_BRANN_BRONZBEARD_ALG)))
brann->AI()->DoAction(ACTION_FINISH_INTRO);
break;
@ -659,7 +660,8 @@ public:
break;
case EVENT_REMOVE_UNNATTACKABLE:
me->SetSheath(SHEATH_STATE_MELEE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToNPC(false);
break;
case EVENT_INTRO_TIMER_DONE:
events.SetPhase(PHASE_NORMAL);
@ -985,7 +987,8 @@ public:
{
case ACTION_ACTIVATE_STAR:
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
_isActive = true;
if (Player* target = SelectTargetFromPlayerList(250.0f))

View file

@ -770,7 +770,8 @@ public:
}
else
{
turret->ReplaceAllUnitFlags(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
turret->ReplaceAllUnitFlags(UNIT_FLAG_NOT_SELECTABLE);
turret->SetImmuneToAll(true);
if (turret->GetTypeId() == TYPEID_UNIT)
turret->ToCreature()->AI()->EnterEvadeMode();
}

View file

@ -185,7 +185,7 @@ public:
else // if (m_algalonTimer = TIMER_ALGALON_TO_SUMMON)
{
m_algalonTimer = TIMER_ALGALON_SUMMONED;
algalon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
algalon->SetImmuneToPC(false);
}
}
}

View file

@ -142,7 +142,7 @@ public:
me->SetCanFly(false);
me->SetDisableGravity(false);
me->SetFacingTo(0.25f);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
}
}

View file

@ -133,10 +133,11 @@ public:
events.Reset();
events2.Reset();
if (!Started)
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
else
{
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
me->SetHover(true);
}
}
@ -152,7 +153,7 @@ public:
if (data != 1 || param != 1 || Started || (instance && instance->GetData(DATA_SVALA_SORROWGRAVE) == DONE))
return;
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
Started = true;
me->setActive(true);
events2.ScheduleEvent(EVENT_SVALA_START, 5000);
@ -247,7 +248,7 @@ public:
me->UpdateEntry(NPC_SVALA_SORROWGRAVE);
me->SetCorpseDelay(sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE));
me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 6.0f);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
if (Creature* Arthas = ObjectAccessor::GetCreature(*me, ArthasGUID))
Arthas->InterruptNonMeleeSpells(false);
me->RemoveAllAuras();
@ -283,7 +284,7 @@ public:
break;
case EVENT_SVALA_TALK9:
me->SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 3.0f);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->LoadEquipment(1, true);
me->setActive(false);
if (Player* target = SelectTargetFromPlayerList(100.0f))

View file

@ -345,13 +345,15 @@ public:
if (Creature* pGuard1 = instance->GetCreature(NPC_ErekemGuardGUID[0]))
{
pGuard1->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
pGuard1->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
pGuard1->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
pGuard1->SetImmuneToNPC(false);
pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21);
}
if (Creature* pGuard2 = instance->GetCreature(NPC_ErekemGuardGUID[1]))
{
pGuard2->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
pGuard2->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
pGuard2->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
pGuard2->SetImmuneToNPC(false);
pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22);
}
break;
@ -384,7 +386,8 @@ public:
if (pBoss)
{
pBoss->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
pBoss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
pBoss->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
pBoss->SetImmuneToNPC(false);
pBoss->SetReactState(REACT_AGGRESSIVE);
if ((WaveCount == 6 && m_auiEncounter[0] == DONE) || (WaveCount == 12 && m_auiEncounter[1] == DONE))
pBoss->SetLootMode(0);
@ -497,7 +500,10 @@ public:
break;
case EVENT_CYANIGOSA_ATTACK:
if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID))
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
{
c->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
c->SetImmuneToNPC(false);
}
break;
}
}
@ -594,15 +600,15 @@ public:
HandleGameObject(GO_ZuramatCellGUID, false);
// respawn bosses
if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_ErekemGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[0])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[1])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_IchoronGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_LavanthorGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_XevozzGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_ZuramatGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC); }
if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_MoraggGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_ErekemGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[0])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_ErekemGuardGUID[1])) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_IchoronGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_LavanthorGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_XevozzGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_ZuramatGUID)) { c->DespawnOrUnsummon(); c->SetRespawnTime(3); c->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); c->SetImmuneToNPC(true); }
if (Creature* c = instance->GetCreature(NPC_CyanigosaGUID)) { c->DespawnOrUnsummon(); }
}

View file

@ -280,7 +280,7 @@ struct violet_hold_trashAI : public npc_escortAI
if (!who->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
{
me->InterruptNonMeleeSpells(false);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(false);
}
}
@ -372,7 +372,7 @@ struct violet_hold_trashAI : public npc_escortAI
void CreatureStartAttackDoor()
{
RemoveEscortState(STATE_ESCORT_ESCORTING | STATE_ESCORT_RETURNING | STATE_ESCORT_PAUSED);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(true);
me->CastSpell((Unit*)nullptr, SPELL_DESTROY_DOOR_SEAL, true);
}
@ -380,7 +380,7 @@ struct violet_hold_trashAI : public npc_escortAI
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToNPC(false);
me->SetHomePosition(1845.577759f + rand_norm() * 5 - 2.5f, 800.681152f + rand_norm() * 5 - 2.5f, 44.104248f, M_PI);
}

View file

@ -80,7 +80,7 @@ public:
owner->CastSpell(owner, SPELL_SUBDUED, true);
GetCaster()->CastSpell(GetCaster(), SPELL_DRAKE_HATCHLING_SUBDUED, true);
owner->SetFaction(FACTION_FRIENDLY);
owner->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
owner->SetImmuneToAll(true);
owner->DespawnOrUnsummon(3 * MINUTE * IN_MILLISECONDS);
}
@ -1505,7 +1505,7 @@ public:
void Reset() override
{
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToAll(true);
_events.ScheduleEvent(EVENT_THASSARIAN_CAST, 1000);
}
@ -1673,7 +1673,7 @@ public:
{
_arlosGUID = arlos->GetGUID();
arlos->SetWalk(true);
arlos->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
arlos->SetImmuneToAll(true);
arlos->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
arlos->GetMotionMaster()->MovePath(PATH_ARLOS, false);
}
@ -1681,7 +1681,7 @@ public:
{
_leryssaGUID = leryssa->GetGUID();
leryssa->SetWalk(true);
leryssa->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
leryssa->SetImmuneToAll(true);
leryssa->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
leryssa->GetMotionMaster()->MovePath(PATH_LERYSSA, false);
}

View file

@ -416,7 +416,7 @@ public:
if (me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f))
{
me->SetStandState(UNIT_STAND_STATE_DEAD);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->ReplaceAllDynamicFlags(UNIT_DYNFLAG_DEAD);
}
_phase = 0;
@ -743,7 +743,8 @@ public:
{
_playerGUID.Clear();
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToPC(false);
me->SetReactState(REACT_AGGRESSIVE);
}
@ -793,7 +794,8 @@ public:
{
if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
{
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToPC(true);
me->SetReactState(REACT_PASSIVE);
me->CombatStop(false);
_playerGUID = caster->GetGUID();

View file

@ -489,7 +489,7 @@ public:
events.RescheduleEvent(EVENT_START, 1000);
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
me->SetWalk(true);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
me->setActive(true);
me->SetReactState(REACT_PASSIVE);
}
@ -750,7 +750,7 @@ public:
else if (summon->GetEntry() != NPC_INVOKER_BASALEPH)
{
summon->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToAll(true);
summon->GetMotionMaster()->MovePoint(4, 6135.97f, 2753.84f, 573.92f);
}
}
@ -974,7 +974,7 @@ public:
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
{
summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToAll(false);
if (summon->GetEntry() >= NPC_TIRION_EBON_KNIGHT && summon->GetEntry() <= NPC_TIRION_MOGRAINE)
{
if (summon->GetEntry() == NPC_TIRION_MOGRAINE)

View file

@ -228,7 +228,7 @@ public:
me->SetDisableGravity(false);
me->CastSpell(me, SPELL_DUAL_WIELD, true);
me->LoadEquipment(0, true);
me->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
beamPosId = urand(0, 3);
}
@ -957,7 +957,7 @@ public:
case EVENT_AKAMA_SCENE_29:
if (Creature* illidan = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_ILLIDAN_STORMRAGE)))
{
illidan->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
illidan->SetImmuneToAll(false);
illidan->SetInCombatWithZone();
AttackStart(illidan);
}

View file

@ -131,7 +131,8 @@ public:
{
BossAI::Reset();
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(true);
me->SetWalk(true);
}
@ -249,7 +250,8 @@ public:
DoResetThreat();
me->GetVictim()->InterruptNonMeleeSpells(false);
me->AddThreat(me->GetVictim(), 1000000.0f);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToAll(false);
summonsGenerator.DoAction(ACTION_STOP_SPAWNING);
break;
}

View file

@ -58,7 +58,8 @@ public:
events.Reset();
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
canAttack = false;
if (instance)
@ -130,7 +131,8 @@ public:
events.ScheduleEvent(EVENT_SPELL_BOLT, 7000);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
canAttack = true;
break;
}

View file

@ -93,7 +93,8 @@ public:
ApplyImmunities(true);
SummonChannelers();
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(true);
if (instance)
instance->SetData(DATA_KELIDAN, NOT_STARTED);
}
@ -143,7 +144,8 @@ public:
return;
}
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetImmuneToAll(false);
if (Unit* target = me->SelectNearestPlayer(100.0f))
AttackStart(target);
}

View file

@ -240,7 +240,8 @@ public:
{
if (!prisoner->IsAlive())
prisoner->Respawn(true);
prisoner->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
prisoner->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
prisoner->SetImmuneToAll(true);
}
void StorePrisoner(Creature* creature)
@ -316,7 +317,8 @@ public:
for (ObjectGuid const& guid : prisoners)
if (Creature* prisoner = instance->GetCreature(guid))
{
prisoner->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
prisoner->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
prisoner->SetImmuneToAll(false);
prisoner->SetInCombatWithZone();
}
}

View file

@ -114,7 +114,8 @@ public:
_Reset();
me->CastSpell(me, SPELL_SHADOW_CAGE, true);
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(true);
}
void KilledUnit(Unit* /*victim*/) override
@ -184,7 +185,8 @@ public:
Talk(SAY_FREE);
break;
case EVENT_ENTER_COMBAT:
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(false);
me->SetReactState(REACT_AGGRESSIVE);
events.ScheduleEvent(EVENT_CLEAVE, 9000);
events.ScheduleEvent(EVENT_BLAST_NOVA, 60000);

View file

@ -92,7 +92,7 @@ public:
ScriptedAI::InitializeAI();
me->SetReactState(REACT_PASSIVE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
events2.Reset();
events2.ScheduleEvent(EVENT_TELEPORT_VISUAL, 0);
events2.ScheduleEvent(EVENT_MILLHOUSE_INTRO1, 3000);
@ -174,7 +174,7 @@ public:
case EVENT_MILLHOUSE_INTRO9:
me->SetFacingTo(M_PI * 1.5f);
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), M_PI * 1.5f);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SetReactState(REACT_AGGRESSIVE);
events2.ScheduleEvent(EVENT_SEARCH_FIGHT, 1000);
break;
@ -365,7 +365,7 @@ public:
{
_Reset();
me->setActive(false);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->CastSpell((Unit*)nullptr, SPELL_TARGET_OMEGA, false);
@ -379,7 +379,7 @@ public:
{
me->setActive(true);
me->InterruptNonMeleeSpells(false);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
events.ScheduleEvent(EVENT_WARDEN_INTRO1, 1500);
events.ScheduleEvent(EVENT_WARDEN_CHECK_PLAYERS, 1000);
instance->SetBossState(DATA_WARDEN_MELLICHAR, IN_PROGRESS);
@ -535,7 +535,7 @@ public:
case EVENT_WARDEN_INTRO25:
if (Creature* cr = me->SummonCreature(NPC_HARBINGER_SKYRISS, 445.763f, -191.639f, 44.64f, 1.60f, TEMPSUMMON_MANUAL_DESPAWN))
{
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetImmuneToAll(true);
cr->CastSpell(cr, SPELL_TELEPORT_VISUAL, true);
}
events.ScheduleEvent(EVENT_WARDEN_INTRO26, 1000);
@ -562,7 +562,7 @@ public:
me->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
if (Creature* creature = summons.GetCreatureWithEntry(NPC_HARBINGER_SKYRISS))
{
creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creature->SetImmuneToAll(false);
if (Player* player = SelectTargetFromPlayerList(50.0f))
AttackStart(player);
}

View file

@ -66,14 +66,14 @@ public:
{
_Reset();
events2.Reset();
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
}
void InitializeAI() override
{
BossAI::InitializeAI();
if (instance->GetBossState(DATA_SOCCOTHRATES) != DONE)
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
}
void JustDied(Unit* /*killer*/) override

View file

@ -75,7 +75,7 @@ public:
{
events.Reset();
summons.DespawnAll();
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
}
void EnterCombat(Unit* /*who*/) override

View file

@ -87,14 +87,14 @@ public:
_Reset();
events2.Reset();
me->CastSpell(me, SPELL_FEL_IMMOLATION, true);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
}
void InitializeAI() override
{
BossAI::InitializeAI();
if (!preFight)
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(true);
}
void JustDied(Unit* /*killer*/) override
@ -185,9 +185,9 @@ public:
if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DALLIAH)))
{
dalliah->SetFacingToObject(me);
dalliah->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
dalliah->SetImmuneToAll(false);
me->SetFacingToObject(dalliah);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
dalliah->SetHomePosition(dalliah->GetPositionX(), dalliah->GetPositionY(), dalliah->GetPositionZ(), 1.51737f);
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 4.725722f);
}

View file

@ -255,7 +255,8 @@ public:
{
if (spell->Id == SPELL_SUMMON_INFERNAL)
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_PACIFIED | UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(false);
me->SetDisplayId(MODEL_INFERNAL);
}
}

View file

@ -69,7 +69,7 @@ public:
}
else
{
creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creature->SetImmuneToAll(false);
Creature* cr;
if ((cr = creature->SummonCreature(17957, -186, -790, 43.8f, 4.2f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
cr->AI()->AttackStart(creature);

View file

@ -1773,7 +1773,7 @@ class spell_gen_creature_permanent_feign_death : public AuraScript
Unit* target = GetTarget();
target->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
target->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
target->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
target->SetImmuneToAll(true);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->SetReactState(REACT_PASSIVE);
@ -1784,7 +1784,7 @@ class spell_gen_creature_permanent_feign_death : public AuraScript
Unit* target = GetTarget();
target->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
target->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
target->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
target->SetImmuneToAll(false);
if (target->GetTypeId() == TYPEID_UNIT)
target->ToCreature()->SetReactState(REACT_AGGRESSIVE);

View file

@ -1100,7 +1100,7 @@ class spell_item_draenic_pale_ale : public SpellScript
summon->SetOwnerGUID(GetCaster()->GetGUID());
summon->SetFaction(GetCaster()->GetFaction());
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetImmuneToAll(true);
summon->SetReactState(REACT_PASSIVE);
summon->GetMotionMaster()->MoveFollow(GetCaster(), PET_FOLLOW_DIST, GetCaster()->GetAngle(summon), MOTION_SLOT_CONTROLLED);
GetSpell()->ExecuteLogEffectSummonObject(effIndex, summon);

View file

@ -717,7 +717,7 @@ class spell_q11198_take_down_tethyr : public SpellScript
{
PreventHitDefaultEffect(effIndex);
if (Unit* unit = GetHitUnit())
if (unit->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
if (unit->IsImmuneToPC())
return;
GetCaster()->CastCustomSpell(42576 /*SPELL_CANNON_BLAST*/, SPELLVALUE_BASE_POINT0, GetEffectValue(), GetCaster(), true);
}
@ -1002,13 +1002,13 @@ class spell_q11396_11399_force_shield_arcane_purple_x3 : public AuraScript
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
target->SetImmuneToPC(true);
target->SetControlled(true, UNIT_STATE_STUNNED);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
GetTarget()->SetImmuneToPC(false);
}
void Register() override

View file

@ -371,7 +371,8 @@ public:
if (!ValidThreatlist())
{
SetHomePosition();
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1);
me->SetImmuneToAll(true);
me->DespawnOrUnsummon(5000);
break;
}
@ -751,8 +752,10 @@ public:
SetHomePosition();
PreciousAI()->SetHomePosition();
Precious()->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
Precious()->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1);
Precious()->SetImmuneToAll(true);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1);
me->SetImmuneToAll(true);
Precious()->DespawnOrUnsummon(5000);
@ -962,7 +965,8 @@ public:
{
SetHomePosition();
me->RemoveAllMinionsByEntry(CREEPING_DOOM_ENTRY);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1);
me->SetImmuneToAll(true);
me->CombatStop(true);
me->Say(NELSON_DESPAWN_SAY);
me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
@ -1136,7 +1140,8 @@ public:
if (!ValidThreatlist())
{
SetHomePosition();
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1);
me->SetImmuneToAll(true);
me->CombatStop(true);
me->Say(FRANKLIN_DESPAWN_SAY);
me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);