Scripts/Spells: Implement Putrid Mushroom Primer spell (#30914)
(cherry picked from commit da2adb613816217f207e06ee24c9a61cc6322f63)
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
--
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_hungarfen_putrid_mushroom_primer';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(31693, 'spell_hungarfen_putrid_mushroom_primer');
|
||||
@@ -15,9 +15,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Containers.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellScript.h"
|
||||
#include "the_underbog.h"
|
||||
|
||||
enum HungarfenTexts
|
||||
@@ -53,17 +55,15 @@ struct boss_hungarfen : public BossAI
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
_scheduler.Schedule(IsHeroic() ? 2500ms : 5s, [this](TaskContext& task)
|
||||
scheduler.Schedule(IsHeroic() ? 2500ms : 5s, [this](TaskContext& task)
|
||||
{
|
||||
/// @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);
|
||||
DoCastSelf(SPELL_PUTRID_MUSHROOM_PRIMER);
|
||||
task.Repeat(IsHeroic() ? 2500ms : 10s);
|
||||
});
|
||||
|
||||
if (IsHeroic())
|
||||
{
|
||||
_scheduler.Schedule(3s, 5s, [this](TaskContext& task)
|
||||
scheduler.Schedule(3s, 5s, [this](TaskContext& task)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
|
||||
DoCast(target, SPELL_ACID_GEYSER);
|
||||
@@ -89,7 +89,7 @@ struct boss_hungarfen : public BossAI
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_scheduler.Update(diff);
|
||||
scheduler.Update(diff);
|
||||
|
||||
if (!HealthAbovePct(20) && !_roared)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ struct boss_hungarfen : public BossAI
|
||||
_roared = true;
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
|
||||
_scheduler.Schedule(2s, [this](TaskContext const& /*task*/)
|
||||
scheduler.Schedule(2s, [this](TaskContext const& /*task*/)
|
||||
{
|
||||
DoCastSelf(SPELL_FOUL_SPORES);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
@@ -106,7 +106,6 @@ struct boss_hungarfen : public BossAI
|
||||
}
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
bool _roared;
|
||||
};
|
||||
|
||||
@@ -156,8 +155,40 @@ private:
|
||||
uint32 _counter;
|
||||
};
|
||||
|
||||
// 31693 - Putrid Mushroom Primer
|
||||
class spell_hungarfen_putrid_mushroom_primer : public SpellScript
|
||||
{
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_SUMMON_UNDERBOG_MUSHROOM });
|
||||
}
|
||||
|
||||
/// @todo: Check if something else should be done here
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_SUMMON_UNDERBOG_MUSHROOM, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hungarfen_putrid_mushroom_primer::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_hungarfen_putrid_mushroom_primer::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_hungarfen()
|
||||
{
|
||||
RegisterTheUnderbogCreatureAI(boss_hungarfen);
|
||||
RegisterTheUnderbogCreatureAI(npc_underbog_mushroom);
|
||||
RegisterSpellScript(spell_hungarfen_putrid_mushroom_primer);
|
||||
}
|
||||
|
||||
+13
-17
@@ -68,19 +68,19 @@ enum BlackStalkerPaths
|
||||
|
||||
struct boss_the_black_stalker : public BossAI
|
||||
{
|
||||
boss_the_black_stalker(Creature* creature) : BossAI(creature, DATA_THE_BLACK_STALKER), _summons(creature) { }
|
||||
boss_the_black_stalker(Creature* creature) : BossAI(creature, DATA_THE_BLACK_STALKER) { }
|
||||
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
scheduler.CancelAll();
|
||||
|
||||
_events.ScheduleEvent(EVENT_LEASH_CHECK, 5s);
|
||||
_events.ScheduleEvent(EVENT_LEVITATE, 8s, 18s);
|
||||
_events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 0s, 3s);
|
||||
_events.ScheduleEvent(EVENT_STATIC_CHARGE, 10s);
|
||||
events.ScheduleEvent(EVENT_LEASH_CHECK, 5s);
|
||||
events.ScheduleEvent(EVENT_LEVITATE, 8s, 18s);
|
||||
events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 0s, 3s);
|
||||
events.ScheduleEvent(EVENT_STATIC_CHARGE, 10s);
|
||||
if (IsHeroic())
|
||||
_events.ScheduleEvent(EVENT_SUMMON_SPORE_STRIDER, 20s, 30s);
|
||||
events.ScheduleEvent(EVENT_SUMMON_SPORE_STRIDER, 20s, 30s);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
@@ -88,12 +88,12 @@ struct boss_the_black_stalker : public BossAI
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
_events.Update(diff);
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = _events.ExecuteEvent())
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
@@ -106,25 +106,25 @@ struct boss_the_black_stalker : public BossAI
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
_events.Repeat(1s);
|
||||
events.Repeat(1s);
|
||||
break;
|
||||
}
|
||||
case EVENT_LEVITATE:
|
||||
DoCastSelf(SPELL_LEVITATE);
|
||||
_events.Repeat(18s, 24s);
|
||||
events.Repeat(18s, 24s);
|
||||
break;
|
||||
case EVENT_CHAIN_LIGHTNING:
|
||||
DoCastVictim(SPELL_CHAIN_LIGHTNING);
|
||||
_events.Repeat(6s, 12s);
|
||||
events.Repeat(6s, 12s);
|
||||
break;
|
||||
case EVENT_STATIC_CHARGE:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 30, true))
|
||||
DoCast(target, SPELL_STATIC_CHARGE);
|
||||
_events.Repeat(10s);
|
||||
events.Repeat(10s);
|
||||
break;
|
||||
case EVENT_SUMMON_SPORE_STRIDER:
|
||||
DoCastSelf(SPELL_SUMMON_SPORE_STRIDER_SCRIPT);
|
||||
_events.Repeat(15s, 25s);
|
||||
events.Repeat(15s, 25s);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -148,10 +148,6 @@ struct boss_the_black_stalker : public BossAI
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
SummonList _summons;
|
||||
};
|
||||
|
||||
// 31704 - Levitate
|
||||
|
||||
Reference in New Issue
Block a user