Scripts/The Underbog: Added spawn groups for bosses and implemented boss state tracking

(cherry picked from commit e3ac84b929)
This commit is contained in:
Shauren
2022-09-25 23:10:09 +02:00
parent fd88a15f4c
commit cfdc0a75f9
5 changed files with 74 additions and 33 deletions

View File

@@ -0,0 +1,21 @@
DELETE FROM `spawn_group_template` WHERE `groupId` BETWEEN 279 AND 282;
INSERT INTO `spawn_group_template` (`groupId`,`groupName`,`groupFlags`) VALUES
(279,'Coilfang: The Underbog - Hungarfen',4),
(280,'Coilfang: The Underbog - Ghaz''an',4),
(281,'Coilfang: The Underbog - Swamplord Musel''ek',4),
(282,'Coilfang: The Underbog - The Black Stalker',4);
DELETE FROM `instance_spawn_groups` WHERE `spawnGroupId` BETWEEN 279 AND 282;
INSERT INTO `instance_spawn_groups` (`instanceMapId`,`bossStateId`,`bossStates`,`spawnGroupId`,`flags`) VALUES
(546,0,23,279,1),
(546,1,23,280,1),
(546,2,23,281,1),
(546,3,23,282,1);
DELETE FROM `spawn_group` WHERE `groupId` BETWEEN 279 AND 282;
INSERT INTO `spawn_group` (`groupId`,`spawnType`,`spawnId`) VALUES
(279,0,56111),
(280,0,101722),
(281,0,103431),
(281,0,103246),
(282,0,54337);

View File

@@ -39,19 +39,20 @@ enum HungarfenSpells
SPELL_GROW = 31698
};
struct boss_hungarfen : public ScriptedAI
struct boss_hungarfen : public BossAI
{
boss_hungarfen(Creature* creature) : ScriptedAI(creature), _roared(false) { }
boss_hungarfen(Creature* creature) : BossAI(creature, DATA_HUNGARFEN), _roared(false) { }
void Reset() override
{
_scheduler.CancelAll();
BossAI::Reset();
_roared = false;
me->SetReactState(REACT_AGGRESSIVE);
}
void JustEngagedWith(Unit* /*who*/) override
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
_scheduler.Schedule(IsHeroic() ? 2500ms : 5s, [this](TaskContext task)
{
/// @todo cast here SPELL_PUTRID_MUSHROOM_PRIMER and do it in spell script
@@ -74,12 +75,13 @@ struct boss_hungarfen : public ScriptedAI
void EnterEvadeMode(EvadeReason why) override
{
DoCastSelf(SPELL_DESPAWN_UNDERBOG_MUSHROOMS, true);
ScriptedAI::EnterEvadeMode(why);
BossAI::EnterEvadeMode(why);
}
void JustDied(Unit* /*killer*/) override
void JustDied(Unit* killer) override
{
DoCastSelf(SPELL_DESPAWN_UNDERBOG_MUSHROOMS, true);
BossAI::JustDied(killer);
}
void UpdateAI(uint32 diff) override

View File

@@ -61,18 +61,13 @@ enum Events
EVENT_SUMMON_SPORE_STRIDER
};
struct boss_the_black_stalker : public ScriptedAI
struct boss_the_black_stalker : public BossAI
{
boss_the_black_stalker(Creature* creature) : ScriptedAI(creature), _summons(creature) { }
boss_the_black_stalker(Creature* creature) : BossAI(creature, DATA_THE_BLACK_STALKER), _summons(creature) { }
void Reset() override
{
_events.Reset();
_summons.DespawnAll();
}
void JustEngagedWith(Unit* /*who*/) override
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
_events.ScheduleEvent(EVENT_LEASH_CHECK, 5s);
_events.ScheduleEvent(EVENT_LEVITATE, 8s, 18s);
_events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 0s, 3s);
@@ -81,19 +76,6 @@ struct boss_the_black_stalker : public ScriptedAI
_events.ScheduleEvent(EVENT_SUMMON_SPORE_STRIDER, 20s, 30s);
}
void JustSummoned(Creature* summon) override
{
_summons.Summon(summon);
if (me->IsEngaged())
DoZoneInCombat(summon);
}
void JustDied(Unit* /*killer*/) override
{
_summons.DespawnAll();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())

View File

@@ -31,15 +31,34 @@ class instance_the_underbog : public InstanceMapScript
public:
instance_the_underbog() : InstanceMapScript(TheUndebogScriptName, 546) { }
struct instance_the_underbog_InstanceMapScript : public InstanceScript
{
instance_the_underbog_InstanceMapScript(InstanceMap* map) : InstanceScript(map)
{
SetHeaders(TheUndebogDataHeader);
SetBossNumber(TheUnderbogBossCount);
}
void OnUnitDeath(Unit* unit) override
{
switch (unit->GetEntry())
{
case NPC_GHAZAN:
SetBossState(DATA_GHAZAN, DONE);
break;
case NPC_SWAMPLORD_MUSELEK:
SetBossState(DATA_SWAMPLORD_MUSELEK, DONE);
break;
default:
break;
}
}
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
return new instance_the_underbog_InstanceMapScript(map);
}
struct instance_the_underbog_InstanceMapScript : public InstanceScript
{
instance_the_underbog_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { }
};
};
void AddSC_instance_the_underbog()

View File

@@ -20,8 +20,25 @@
#include "CreatureAIImpl.h"
#define TheUndebogDataHeader "UBOG"
#define TheUndebogScriptName "instance_the_underbog"
constexpr uint32 TheUnderbogBossCount = 4;
enum TheUnderbogDataId
{
DATA_HUNGARFEN = 0,
DATA_GHAZAN = 1,
DATA_SWAMPLORD_MUSELEK = 2,
DATA_THE_BLACK_STALKER = 3
};
enum TheUnderbogCreatureId
{
NPC_GHAZAN = 18105,
NPC_SWAMPLORD_MUSELEK = 17826
};
template <class AI, class T>
inline AI* GetTheUnderbogAI(T* obj)
{