mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Scripts/The Underbog: Added spawn groups for bosses and implemented boss state tracking
(cherry picked from commit e3ac84b929)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user