diff options
| author | treeston <treeston.mmoc@gmail.com> | 2017-07-09 02:07:29 +0200 |
|---|---|---|
| committer | treeston <treeston.mmoc@gmail.com> | 2017-07-09 02:07:29 +0200 |
| commit | 74af880217fc567c9949d7557408718af889402f (patch) | |
| tree | 7a39bedb3fbd1a618413ef60ca390c94f4298fea /src/server/scripts/EasternKingdoms | |
| parent | c6d799444572a6d3023a560d7d1c24b0d7a8d050 (diff) | |
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;
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
17 files changed, 40 insertions, 36 deletions
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp index 9b17017501b..b854239c303 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp @@ -142,7 +142,7 @@ public: void Reset() override { _Reset(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_FRIENDLY); events.SetPhase(PHASE_ALL); @@ -165,7 +165,7 @@ public: if (action == ACTION_START_FIGHT) { events.SetPhase(PHASE_ONE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON); me->SetInCombatWithZone(); @@ -398,7 +398,7 @@ public: Talk(SAY_ANTAGONIST_2); break; case ACTION_ANTAGONIST_HOSTILE: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON); me->SetInCombatWithZone(); break; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp index 787de8711f2..eb18eb74171 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_tomb_of_seven.cpp @@ -153,7 +153,7 @@ class boss_doomrel : public CreatureScript me->SetFaction(FACTION_FRIENDLY); // was set before event start, so set again - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); if (_instance->GetData(DATA_GHOSTKILL) >= 7) me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); @@ -241,7 +241,7 @@ class boss_doomrel : public CreatureScript CloseGossipMenuFor(player); //start event here me->SetFaction(FACTION_DARK_IRON_DWARVES); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->AI()->AttackStart(player); _instance->SetGuidData(DATA_EVENSTARTER, player->GetGUID()); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index cf569cbeba5..45125b6df4e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -357,7 +357,7 @@ public: if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter])) { boss->SetFaction(FACTION_DARK_IRON_DWARVES); - boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + boss->SetImmuneToPC(false); if (Unit* target = boss->SelectNearestTarget(500)) boss->AI()->AttackStart(target); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp index 61aa94b4d02..ea197a52c4c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -82,7 +82,8 @@ public: void Reset() override { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(true); events.Reset(); // Apply auras on spawn and reset // DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); // Need to find this in old DBC if possible @@ -160,7 +161,8 @@ public: me->CastSpell(me, SPELL_EMBERSEER_FULL_STRENGTH); Talk(EMOTE_FREE_OF_BONDS); Talk(YELL_FREE_OF_BONDS); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetImmuneToPC(false); events.ScheduleEvent(EVENT_ENTER_COMBAT, 2000); } } @@ -343,7 +345,7 @@ public: void Reset() override { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true)) Emberseer->AI()->SetData(1, 3); } @@ -357,7 +359,7 @@ public: { if (data == 1 && value == 1) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->InterruptSpell(CURRENT_CHANNELED_SPELL); _events.CancelEvent(EVENT_ENCAGED_EMBERSEER); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index 1f5bd2a4cd0..cbd1f362a1b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -192,7 +192,7 @@ public: void IsSummonedBy(Unit* /*summoner*/) override { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); DoZoneInCombat(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index b4b9e5da0e0..076966a2acb 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -213,7 +213,7 @@ public: me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); DoCast(me, SPELL_NEFARIANS_BARRIER); me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); AttackStart(target); events.ScheduleEvent(EVENT_SHADOW_BOLT, urand(3000, 10000)); events.ScheduleEvent(EVENT_FEAR, urand(10000, 20000)); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp index 96af55e719c..108697d666a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_ragnaros.cpp @@ -162,7 +162,8 @@ class boss_ragnaros : public CreatureScript break; case EVENT_INTRO_5: me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(false); _introState = 2; break; default: diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index ffabc345b4f..0c6144996f8 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -298,7 +298,7 @@ public: me->GetMotionMaster()->MoveAlongSplineChain(POINT_PHASE_TWO_LANDING, SPLINE_CHAIN_SECOND_LANDING, false); break; case EVENT_INTRO_LANDING: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->SetInCombatWithZone(); break; case EVENT_LAND: diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 68dee5eadc8..d2028b6ce19 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -684,7 +684,8 @@ public: // Anyway, I digress. // @todo This line below is obviously a hack. Duh. I'm just coming in here to hackfix the encounter to actually be completable. // It needs a rewrite. Badly. Please, take good care of it. - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetImmuneToPC(false); CycloneTimer = 30000; ChainLightningTimer = 10000; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 630e362957b..aa3b894bbe3 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -130,7 +130,7 @@ public: Initialize(); events.Reset(); me->SetFaction(FACTION_CREATURE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetStandState(UNIT_STAND_STATE_KNEEL); me->LoadEquipment(0, true); } @@ -236,7 +236,7 @@ public: else { me->SetFaction(FACTION_MONSTER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); phase = PHASE_ATTACKING; if (Player* target = ObjectAccessor::GetPlayer(*me, playerGUID)) @@ -603,7 +603,7 @@ public: if (m_bIsDuelInProgress) return true; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); player->CastSpell(me, SPELL_DUEL, false); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 2378d8ddad2..5e02a18caa6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -270,7 +270,7 @@ public: if (summoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) valrothGUID = summoned->GetGUID(); - summoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + summoned->SetImmuneToPC(false); } void SummonAcolyte(uint32 uiAmount) @@ -609,7 +609,7 @@ public: { Initialize(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); } bool MeetQuestCondition(Player* player) @@ -718,7 +718,7 @@ public: case 9: Talk(SAY_EXEC_TIME, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); break; case 10: Talk(SAY_EXEC_WAITING, player); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index d946e98706e..13854b91f36 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -448,7 +448,7 @@ public: headGUID.Clear(); } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); //instance->SetBossState(DATA_HORSEMAN_EVENT, NOT_STARTED); } diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp index e39bf1d83f3..70c5c4cb2d1 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/boss_apothecary_hummel.cpp @@ -135,7 +135,7 @@ class boss_apothecary_hummel : public CreatureScript events.SetPhase(PHASE_INTRO); events.ScheduleEvent(EVENT_HUMMEL_SAY_0, Milliseconds(1)); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_MONSTER); DummyEntryCheckPredicate pred; summons.DoAction(ACTION_START_EVENT, pred); @@ -214,7 +214,7 @@ class boss_apothecary_hummel : public CreatureScript break; case EVENT_START_FIGHT: { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetInCombatWithZone(); events.ScheduleEvent(EVENT_CALL_BAXTER, Seconds(6)); events.ScheduleEvent(EVENT_CALL_FRYE, Seconds(14)); @@ -289,13 +289,13 @@ struct npc_apothecary_genericAI : public ScriptedAI { if (action == ACTION_START_EVENT) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->SetFaction(FACTION_MONSTER); me->GetMotionMaster()->MovePoint(1, _movePos); } else if (action == ACTION_START_FIGHT) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->SetInCombatWithZone(); } } diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 9ec2a58f742..68d6d3034e3 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -258,7 +258,7 @@ public: case 1: { Creature* summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + summon->SetImmuneToPC(true); summon->SetReactState(REACT_DEFENSIVE); summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true); summon->AI()->Talk(SAY_ARCHMAGE); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 9598940bbd4..6e860bab46d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -381,13 +381,13 @@ class npc_harrison_jones : public CreatureScript if (target->GetPositionX() > 120) { target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_SPEAR)); - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + target->SetImmuneToPC(true); target->SetReactState(REACT_PASSIVE); target->AI()->SetData(0, 1); } else { - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + target->SetImmuneToPC(true); target->SetReactState(REACT_PASSIVE); target->AI()->SetData(0, 2); } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 17027e2d056..2dbc003a94a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -131,7 +131,7 @@ class boss_mandokir : public CreatureScript { _Reset(); Initialize(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(true); events.ScheduleEvent(EVENT_CHECK_START, 1000); if (Creature* speaker = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_VILEBRANCH_SPEAKER))) if (!speaker->IsAlive()) @@ -153,7 +153,7 @@ class boss_mandokir : public CreatureScript void JustReachedHome() override { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); } void EnterCombat(Unit* /*who*/) override @@ -231,7 +231,7 @@ class boss_mandokir : public CreatureScript events.ScheduleEvent(EVENT_CHECK_START, 1000); break; case EVENT_STARTED: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetImmuneToAll(false); me->GetMotionMaster()->MovePath(PATH_MANDOKIR, false); break; default: diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp index 19833db218c..374dd3ef5c4 100644 --- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp @@ -76,8 +76,8 @@ public: me->RestoreFaction(); - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + if (!me->IsImmuneToPC()) + me->SetImmuneToPC(true); } void EnterCombat(Unit* /*who*/) override { } @@ -89,7 +89,7 @@ public: uiDamage = 0; me->RestoreFaction(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(true); me->CombatStop(true); m_uiPhase = 1; @@ -143,7 +143,7 @@ public: if (quest->GetQuestId() == QUEST_590) { me->SetFaction(FACTION_ENEMY); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetImmuneToPC(false); AttackStart(player); } } |
