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

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