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
88 changed files with 450 additions and 328 deletions

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)