Hi, I'm Treeston, and welcome to Combat PR Prep Refactors.

Today, we're moving UNIT_FLAG_IMMUNE_TO_PC and UNIT_FLAG_IMMUNE_TO_NPC to higher-level abstraction so combat manager can react to it.
New methods on Unit:
- void SetImmuneTo<All/PC/NPC>(apply, keepCombat = false);
- bool IsImmuneTo<All/PC/NPC>() const;

(cherry picked from commit 74af880217)
This commit is contained in:
treeston
2017-07-09 02:07:29 +02:00
committed by Shauren
parent befbfbb655
commit 2dfafa69eb
82 changed files with 294 additions and 203 deletions

View File

@@ -136,7 +136,7 @@ class boss_apothecary_hummel : public CreatureScript
events.SetPhase(PHASE_INTRO);
events.ScheduleEvent(EVENT_HUMMEL_SAY_0, Milliseconds(1));
me->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetImmuneToPC(true);
me->SetFaction(FACTION_MONSTER);
DummyEntryCheckPredicate pred;
summons.DoAction(ACTION_START_EVENT, pred);
@@ -217,8 +217,7 @@ class boss_apothecary_hummel : public CreatureScript
break;
case EVENT_START_FIGHT:
{
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SetInCombatWithZone();
events.ScheduleEvent(EVENT_CALL_BAXTER, Seconds(6));
events.ScheduleEvent(EVENT_CALL_FRYE, Seconds(14));
@@ -293,14 +292,13 @@ struct npc_apothecary_genericAI : public ScriptedAI
{
if (action == ACTION_START_EVENT)
{
me->AddUnitFlag(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);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetImmuneToAll(false);
me->SetInCombatWithZone();
}
}

View File

@@ -258,7 +258,7 @@ public:
case 1:
{
Creature* summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
summon->AddUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
summon->SetImmuneToPC(true);
summon->SetReactState(REACT_DEFENSIVE);
summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true);
summon->AI()->Talk(SAY_ARCHMAGE);