diff options
3 files changed, 123 insertions, 117 deletions
diff --git a/sql/updates/world/3.3.5/2021_06_09_00_world.sql b/sql/updates/world/3.3.5/2021_06_09_00_world.sql new file mode 100644 index 00000000000..0afeb670929 --- /dev/null +++ b/sql/updates/world/3.3.5/2021_06_09_00_world.sql @@ -0,0 +1,20 @@ +-- +UPDATE `creature_template` SET `speed_walk` = 1, `scale` = 1 WHERE `entry` IN (17990,20189); +UPDATE `creature_template` SET `speed_walk` = 1, `speed_run` = 1.57143 WHERE `entry` = 20169; + +DELETE FROM `creature_text` WHERE `CreatureID` = 17770; +INSERT INTO `creature_text` (`CreatureID`,`GroupID`,`ID`,`Text`,`Type`,`Language`,`Probability`,`Emote`,`Duration`,`Sound`,`BroadcastTextId`,`TextRange`,`comment`) VALUES +(17770,0,0,"Hungarfen roars in pain. ",16,0,100,15,0,0,16594,0,"Hungarfen EMOTE_ROARS"); + +DELETE FROM `spell_scripts` WHERE `id` = 34874; +INSERT INTO `spell_scripts` (`id`,`effIndex`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`,`Comment`) VALUES +(34874,0,0,18,0,0,0,0,0,0,0,"Despawn Underbog Mushrooms - On Effect Hit (Script Effect) - Target - Despawn"); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 13 AND `SourceEntry` = 34874; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,34874,0,0,31,0,3,17990,0,0,0,0,"","Group 0: Spell 'Despawn Underbog Mushrooms' (Effect 0) targets creature 'Underbog Mushroom'"); + +-- Needed to prevent spell hit everything including boss and mushrooms, temp solution +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 13 AND `SourceEntry` = 34168; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,1,34168,0,0,31,0,3,17990,0,0,0,0,"","Group 0: Spell 'Spore Cloud' (Effect 0) targets creature 'Underbog Mushroom'"); diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp index 7846ec41524..5ae8fc35626 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp @@ -15,166 +15,150 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Hungarfen -SD%Complete: 95 -SDComment: Need confirmation if spell data are same in both modes. Summons should have faster rate in heroic -SDCategory: Coilfang Resevoir, Underbog -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellAuras.h" #include "the_underbog.h" -enum Spells +enum HungarfenTexts { - SPELL_FOUL_SPORES = 31673, - SPELL_ACID_GEYSER = 38739, + EMOTE_ROARS = 0 +}; - SPELL_SPORE_CLOUD = 34168, - SPELL_PUTRID_MUSHROOM = 31690, - SPELL_GROW = 31698 +enum HungarfenSpells +{ + SPELL_FOUL_SPORES = 31673, + SPELL_SUMMON_UNDERBOG_MUSHROOM = 31692, + SPELL_PUTRID_MUSHROOM_PRIMER = 31693, + SPELL_DESPAWN_UNDERBOG_MUSHROOMS = 34874, + SPELL_ACID_GEYSER = 38739, + + SPELL_SPORE_CLOUD = 34168, + SPELL_PUTRID_MUSHROOM = 31690, + SPELL_SHRINK = 31691, + SPELL_GROW = 31698 }; -class boss_hungarfen : public CreatureScript +struct boss_hungarfen : public ScriptedAI { -public: - boss_hungarfen() : CreatureScript("boss_hungarfen") { } + boss_hungarfen(Creature* creature) : ScriptedAI(creature), _roared(false) { } - CreatureAI* GetAI(Creature* creature) const override + void Reset() override { - return GetTheUnderbogAI<boss_hungarfenAI>(creature); + _scheduler.CancelAll(); + _roared = false; + me->SetReactState(REACT_AGGRESSIVE); } - struct boss_hungarfenAI : public ScriptedAI + void JustEngagedWith(Unit* /*who*/) override { - boss_hungarfenAI(Creature* creature) : ScriptedAI(creature) + _scheduler.Schedule(IsHeroic() ? 2500ms : 5s, [this](TaskContext task) { - Initialize(); - } + /// @todo cast here SPELL_PUTRID_MUSHROOM_PRIMER and do it in spell script + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) + target->CastSpell(target, SPELL_SUMMON_UNDERBOG_MUSHROOM, true); + task.Repeat(IsHeroic() ? 2500ms : 10s); + }); - void Initialize() + if (IsHeroic()) { - Root = false; - Mushroom_Timer = 5000; // 1 mushroom after 5s, then one per 10s. This should be different in heroic mode - AcidGeyser_Timer = 10000; - } - - bool Root; - uint32 Mushroom_Timer; - uint32 AcidGeyser_Timer; - - void Reset() override - { - Initialize(); - } - - void JustEngagedWith(Unit* /*who*/) override - { - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - if (!HealthAbovePct(20)) - { - if (!Root) - { - DoCast(me, SPELL_FOUL_SPORES); - Root = true; - } - } - - if (Mushroom_Timer <= diff) - { - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) - me->SummonCreature(17990, target->GetPositionX() + (rand32() % 8), target->GetPositionY() + (rand32() % 8), target->GetPositionZ(), float(rand32() % 5), TEMPSUMMON_TIMED_DESPAWN, 22s); - else - me->SummonCreature(17990, me->GetPositionX() + (rand32() % 8), me->GetPositionY() + (rand32() % 8), me->GetPositionZ(), float(rand32() % 5), TEMPSUMMON_TIMED_DESPAWN, 22s); - - Mushroom_Timer = 10000; - } else Mushroom_Timer -= diff; - - if (AcidGeyser_Timer <= diff) + _scheduler.Schedule(3s, 5s, [this](TaskContext task) { if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) DoCast(target, SPELL_ACID_GEYSER); - AcidGeyser_Timer = 10000 + rand32() % 7500; - } else AcidGeyser_Timer -= diff; - - DoMeleeAttackIfReady(); + task.Repeat(10s, 15s); + }); } - }; - -}; + } -class npc_underbog_mushroom : public CreatureScript -{ -public: - npc_underbog_mushroom() : CreatureScript("npc_underbog_mushroom") { } + void EnterEvadeMode(EvadeReason why) override + { + DoCastSelf(SPELL_DESPAWN_UNDERBOG_MUSHROOMS, true); + ScriptedAI::EnterEvadeMode(why); + } - CreatureAI* GetAI(Creature* creature) const override + void JustDied(Unit* /*killer*/) override { - return GetTheUnderbogAI<npc_underbog_mushroomAI>(creature); + DoCastSelf(SPELL_DESPAWN_UNDERBOG_MUSHROOMS, true); } - struct npc_underbog_mushroomAI : public ScriptedAI + void UpdateAI(uint32 diff) override { - npc_underbog_mushroomAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - } + if (!UpdateVictim()) + return; - void Initialize() + _scheduler.Update(diff, [this] { - Stop = false; - Grow_Timer = 0; - Shrink_Timer = 20000; - } - - bool Stop; - uint32 Grow_Timer; - uint32 Shrink_Timer; + DoMeleeAttackIfReady(); + }); - void Reset() override + if (!HealthAbovePct(20) && !_roared) { - Initialize(); + Talk(EMOTE_ROARS); + _roared = true; + me->SetReactState(REACT_PASSIVE); - DoCast(me, SPELL_PUTRID_MUSHROOM, true); - DoCast(me, SPELL_SPORE_CLOUD, true); + _scheduler.Schedule(2s, [this](TaskContext /*task*/) + { + DoCastSelf(SPELL_FOUL_SPORES); + me->SetReactState(REACT_AGGRESSIVE); + }); } + } - void MoveInLineOfSight(Unit* /*who*/) override { } +private: + TaskScheduler _scheduler; + bool _roared; +}; - void AttackStart(Unit* /*who*/) override { } +struct npc_underbog_mushroom : public ScriptedAI +{ + npc_underbog_mushroom(Creature* creature) : ScriptedAI(creature) { } - void JustEngagedWith(Unit* /*who*/) override { } + void InitializeAI() override + { + _counter = RAND(8, 9, 10); + me->SetReactState(REACT_PASSIVE); + DoCastSelf(SPELL_SHRINK); + DoCastSelf(SPELL_PUTRID_MUSHROOM); - void UpdateAI(uint32 diff) override + _scheduler.Schedule(1s, [this](TaskContext task) { - if (Stop) - return; - - if (Grow_Timer <= diff) + DoCastSelf(SPELL_GROW); + + // It's random(sniffs), makes them grow to different size. We need here count of stacks + // and not task repeat counter because first stack is applied not when task is repeated + Aura* growAura = me->GetAura(SPELL_GROW); + if (growAura && growAura->GetStackAmount() != _counter) + task.Repeat(2s); + else { - DoCast(me, SPELL_GROW); - Grow_Timer = 3000; - } else Grow_Timer -= diff; + task.Schedule(1s, [this](TaskContext task) + { + DoCastSelf(SPELL_SPORE_CLOUD); + + task.Schedule(4s, [this](TaskContext /*task*/) + { + me->RemoveAurasDueToSpell(SPELL_GROW); + me->DespawnOrUnsummon(4s); + }); + }); + } + }); + } - if (Shrink_Timer <= diff) - { - me->RemoveAurasDueToSpell(SPELL_GROW); - Stop = true; - } else Shrink_Timer -= diff; - } - }; + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); + } +private: + TaskScheduler _scheduler; + uint32 _counter; }; void AddSC_boss_hungarfen() { - new boss_hungarfen(); - new npc_underbog_mushroom(); + RegisterTheUnderbogCreatureAI(boss_hungarfen); + RegisterTheUnderbogCreatureAI(npc_underbog_mushroom); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h index a671d1c5fd0..05540c79992 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h +++ b/src/server/scripts/Outland/CoilfangReservoir/TheUnderbog/the_underbog.h @@ -28,4 +28,6 @@ inline AI* GetTheUnderbogAI(T* obj) return GetInstanceAI<AI>(obj, TheUndebogScriptName); } +#define RegisterTheUnderbogCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetTheUnderbogAI) + #endif // the_underbog_h__ |