azerothcore / azerothcore-wotlk

Complete Open Source and Modular solution for MMO
http://www.azerothcore.org
GNU Affero General Public License v3.0
6.52k stars 2.61k forks source link

Blood Furnace - Broggok Lever Not Starting Encounter #15873

Closed LeFroid closed 1 year ago

LeFroid commented 1 year ago

Current Behaviour

After activating the lever just in front of Broggok, instead of starting the boss encounter, it is a no-op. One is able to toggle the lever many times and see that it does not start the encounter.

Expected Blizzlike Behaviour

The fel orcs which are in the side chambers should start coming out and attacking. After each wave, the next group is activated and attacks. When all orcs are defeated, Broggok enters and attacks the group.

Source

See: https://www.youtube.com/watch?v=YRo_n25_zkk

Steps to reproduce the problem

  1. .tele TheBloodFurnace
  2. Enter instance, kill the maker or skip ahead to second boss room with Broggok
  3. Toggle the lever and observe that nothing happens

Extra Notes

No response

AC rev. hash/commit

e2cfb5c5a95a38c278d76db8deecdb2596d543aa

Operating system

Gentoo Linux x64

Custom changes or Modules

mod-ah-bot mod-eluna mod-progression-system mod-skip-dk-starting-area mod-solocraft mod-transmog mod-weekend-xp mod-zone-difficulty

Gultask commented 1 year ago

I can't reproduce it. Are you sure you're doing the full event? 4 Cages open in sequence, and you have to kill all adds to continue the encounter.

LeFroid commented 1 year ago

Yes, I killed the first boss, cleared the room and proceeded to pull the lever to no effect. I took a brief recording to demonstrate

https://user-images.githubusercontent.com/2191538/230771922-5bdc0e05-454c-4f4b-b022-f1ea15417c17.mp4

LeFroid commented 1 year ago

Strangely, I was able to get the event working after "throwing the kitchen sink" at the problem by partially reverting 65f031c34017b203aa1db3bced000fb10b52ff90 and partially merging the TrinityCore implementation. I probably made more changes than is absolutely necessary to fix the event in the process.

The event only started working when I explicitly used GameObjectAI inside GameObjectScript and BossAI nested in CreatureScript. Why that fixed the issue, I have no idea.

This was the exact change. Is anyone else experiencing an issue with this dungeon?

--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -15,6 +15,7 @@
  * with this program. If not, see <http://www.gnu.org/licenses/>.
  */

+#include "GameObjectAI.h"
 #include "ScriptMgr.h"
 #include "ScriptedCreature.h"
 #include "SpellAuraEffects.h"
@@ -29,64 +30,77 @@ enum eEnums
     SPELL_POISON_CLOUD      = 30916,
     SPELL_POISON_BOLT       = 30917,
     SPELL_POISON            = 30914,
+    SPELL_SUMMON_INCOMBAT_TRIGGER = 26837,
 };

-struct boss_broggok : public BossAI
+class boss_broggok : public CreatureScript
 {
-    boss_broggok(Creature* creature) : BossAI(creature, DATA_BROGGOK) { }
+    public:
+        boss_broggok() : CreatureScript("boss_broggok") { }

-    void Reset() override
-    {
-        _Reset();
-        me->SetReactState(REACT_PASSIVE);
-        me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
-        me->SetImmuneToAll(true);
-    }
+        struct boss_broggokAI : public BossAI
+        {
+            boss_broggokAI(Creature* creature) : BossAI(creature, DATA_BROGGOK) { }

-    void JustEngagedWith(Unit* /*who*/) override
-    {
-        Talk(SAY_AGGRO);
-        _JustEngagedWith();
-    }
+            void Reset() override
+            {
+                _Reset();
+                me->SetReactState(REACT_PASSIVE);
+                me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
+                me->SetImmuneToAll(true);
+            }

-    void JustSummoned(Creature* summoned) override
-    {
-        summons.Summon(summoned);
+            void JustEngagedWith(Unit* /*who*/) override
+            {
+                Talk(SAY_AGGRO);
+                _JustEngagedWith();
+            }

-        summoned->SetFaction(FACTION_MONSTER_2);
-        summoned->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
-        summoned->CastSpell(summoned, SPELL_POISON, true, 0, 0, me->GetGUID());
-    }
+            void JustSummoned(Creature* summoned) override
+            {
+                summons.Summon(summoned);

-    void DoAction(int32 action) override
-    {
-        switch (action)
-        {
-            case ACTION_PREPARE_BROGGOK:
-                me->SetInCombatWithZone();
-                instance->SetBossState(DATA_BROGGOK, IN_PROGRESS);
-                break;
-            case ACTION_ACTIVATE_BROGGOK:
-                scheduler.Schedule(10s, [this](TaskContext context)
-                {
-                    DoCastVictim(SPELL_SLIME_SPRAY);
-                    context.Repeat(7s, 12s);
-                }).Schedule(5s, [this](TaskContext context)
-                {
-                    DoCastRandomTarget(SPELL_POISON_BOLT);
-                    context.Repeat(6s, 11s);
-                }).Schedule(7s, [this](TaskContext context)
+                summoned->SetFaction(FACTION_MONSTER_2);
+                summoned->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+                summoned->CastSpell(summoned, SPELL_POISON, true, 0, 0, me->GetGUID());
+            }
+
+            void DoAction(int32 action) override
+            {
+                switch (action)
                 {
-                    DoCastSelf(SPELL_POISON_CLOUD);
-                    context.Repeat(20s);
-                });
-
-                me->SetReactState(REACT_AGGRESSIVE);
-                me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
-                me->SetImmuneToAll(false);
-                break;
+                    case ACTION_PREPARE_BROGGOK:
+                        me->SetInCombatWithZone();
+                        instance->SetBossState(DATA_BROGGOK, IN_PROGRESS);
+                        DoCastSelf(SPELL_SUMMON_INCOMBAT_TRIGGER);
+                        break;
+                    case ACTION_ACTIVATE_BROGGOK:
+                        scheduler.Schedule(10s, [this](TaskContext context)
+                        {
+                            DoCastVictim(SPELL_SLIME_SPRAY);
+                            context.Repeat(7s, 12s);
+                        }).Schedule(5s, [this](TaskContext context)
+                        {
+                            DoCastRandomTarget(SPELL_POISON_BOLT);
+                            context.Repeat(6s, 11s);
+                        }).Schedule(7s, [this](TaskContext context)
+                        {
+                            DoCastSelf(SPELL_POISON_CLOUD);
+                            context.Repeat(20s);
+                        });
+
+                        me->SetReactState(REACT_AGGRESSIVE);
+                        me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
+                        me->SetImmuneToAll(false);
+                        break;
+                }
+            }
+        };
+
+        CreatureAI* GetAI(Creature* creature) const override
+        {
+            return GetBloodFurnaceAI<boss_broggokAI>(creature);
         }
-    }
 };

 class go_broggok_lever : public GameObjectScript
@@ -94,22 +108,35 @@ class go_broggok_lever : public GameObjectScript
 public:
     go_broggok_lever() : GameObjectScript("go_broggok_lever") {}

-    bool OnGossipHello(Player* /*player*/, GameObject* go) override
+    struct go_broggok_leverAI : public GameObjectAI
     {
-        if (InstanceScript* instance = go->GetInstanceScript())
+        go_broggok_leverAI(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
+
+        InstanceScript* instance;
+
+        bool GossipHello(Player* /*player*/, bool /*reportUse*/) override
         {
-            if (instance->GetBossState(DATA_BROGGOK) == NOT_STARTED)
+            if (instance->GetBossState(DATA_BROGGOK) != DONE && instance->GetBossState(DATA_BROGGOK) != IN_PROGRESS)
             {
                 if (Creature* broggok = instance->GetCreature(DATA_BROGGOK))
                 {
+                    instance->SetBossState(DATA_BROGGOK, IN_PROGRESS);
                     instance->SetData(DATA_BROGGOK, IN_PROGRESS);
                     broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
                 }
             }
+
+            me->UseDoorOrButton();
+            //me->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE | GO_FLAG_IN_USE);
+            //me->SetGoState(GO_STATE_ACTIVE);
+
+            return true;
         }
+    };

-        go->UseDoorOrButton();
-        return false;
+    GameObjectAI* GetAI(GameObject* go) const override
+    {
+        return new go_broggok_leverAI(go);
     }
 };

@@ -142,7 +169,8 @@ class spell_broggok_poison_cloud : public AuraScript

 void AddSC_boss_broggok()
 {
-    RegisterBloodFurnaceCreatureAI(boss_broggok);
+    //RegisterBloodFurnaceCreatureAI(boss_broggok);
+    new boss_broggok();
     new go_broggok_lever();
     RegisterSpellScript(spell_broggok_poison_cloud);
 }
Gultask commented 1 year ago

It must be something on your side since we've been running with that PR for almost a month now without any issues

LeFroid commented 1 year ago

You're probably right, I wish there was a known cause. None of the other instances I've tested have any issues like this at all. I'll close this issue, if anyone else experiences the same they can open a new one.