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

@@ -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;