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

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