diff options
| author | offl <11556157+offl@users.noreply.github.com> | 2021-05-27 19:05:47 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-27 19:05:47 +0300 |
| commit | 78bd609e8a37caa354c42ee6da798ab6c0bb3009 (patch) | |
| tree | d0b27de54e6a769f6ffa3bdd2ffa87fb67bdd422 /src/server/scripts/Northrend | |
| parent | f2f0aeb562dfc1a78b04d13a14e3c37a58367619 (diff) | |
Scripts/Quest: Rework cocooned creatures (#26554)
Diffstat (limited to 'src/server/scripts/Northrend')
| -rw-r--r-- | src/server/scripts/Northrend/zone_howling_fjord.cpp | 74 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/zone_zuldrak.cpp | 60 |
2 files changed, 105 insertions, 29 deletions
diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index d61b10aa404..5a1df8a9d0d 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -514,7 +514,11 @@ class spell_mindless_abomination_explosion_fx_master : public SpellScriptLoader } }; -enum SummonSpells +/*###### +## Quest 11296: Rivenwood Captives +######*/ + +enum RivenwoodCaptives { SPELL_SUMMON_BABY_RIVEN_WIDOWS = 43275, SPELL_SUMMON_DARKCLAW_BAT = 43276, @@ -527,11 +531,10 @@ enum SummonSpells SPELL_SUMMON_WINTERSKORN_WOODSMAN = 43283, SPELL_SUMMON_WINTERSKORN_TRIBESMAN = 43284, SPELL_SUMMON_WINTERSKORN_ORACLE = 43285, - SPELL_SUMMON_FREED_MIST_WHISPER_SCOUT = 43289, - NPC_MIST_WHISPER_SCOUT = 24211 + SPELL_SUMMON_FREED_MIST_WHISPER_SCOUT = 43289 }; -const uint32 rivenWidowCocoonVictims[11] = +uint32 const CocoonSummonSpells[11] = { SPELL_SUMMON_BABY_RIVEN_WIDOWS, SPELL_SUMMON_DARKCLAW_BAT, @@ -546,39 +549,51 @@ const uint32 rivenWidowCocoonVictims[11] = SPELL_SUMMON_WINTERSKORN_ORACLE }; -class npc_riven_widow_cocoon : public CreatureScript +// 43288 - Rivenwood Captives: Player Not On Quest +class spell_rivenwood_captives_not_on_quest : public SpellScript { -public: - npc_riven_widow_cocoon() : CreatureScript("npc_riven_widow_cocoon") { } + PrepareSpellScript(spell_rivenwood_captives_not_on_quest); - struct npc_riven_widow_cocoonAI : public ScriptedAI + bool Validate(SpellInfo const* /*spellInfo*/) override { - npc_riven_widow_cocoonAI(Creature* creature) : ScriptedAI(creature) { } + return ValidateSpellInfo(CocoonSummonSpells); + } - void Reset() override { } - void JustEngagedWith(Unit* /*who*/) override { } - void MoveInLineOfSight(Unit* /*who*/) override { } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetCaster(), Trinity::Containers::SelectRandomContainerElement(CocoonSummonSpells), true); + } - void JustDied(Unit* killer) override - { - if (!killer || killer->GetTypeId() != TYPEID_PLAYER) - return; + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_rivenwood_captives_not_on_quest::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; - Player* player = killer->ToPlayer(); +// 43287 - Rivenwood Captives: Player On Quest +class spell_rivenwood_captives_on_quest : public SpellScript +{ + PrepareSpellScript(spell_rivenwood_captives_on_quest); - if (roll_chance_i(20)) - { - player->CastSpell(me, SPELL_SUMMON_FREED_MIST_WHISPER_SCOUT, true); - player->KilledMonsterCredit(NPC_MIST_WHISPER_SCOUT); - } - else - player->CastSpell(me, rivenWidowCocoonVictims[urand(0, 10)], true); - } - }; + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo(CocoonSummonSpells) && ValidateSpellInfo({ SPELL_SUMMON_FREED_MIST_WHISPER_SCOUT }); + } - CreatureAI* GetAI(Creature* creature) const override + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + if (roll_chance_i(80)) + target->CastSpell(caster, Trinity::Containers::SelectRandomContainerElement(CocoonSummonSpells), true); + else + target->CastSpell(caster, SPELL_SUMMON_FREED_MIST_WHISPER_SCOUT, true); + } + + void Register() override { - return new npc_riven_widow_cocoonAI(creature); + OnEffectHitTarget += SpellEffectFn(spell_rivenwood_captives_on_quest::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -588,5 +603,6 @@ void AddSC_howling_fjord() RegisterCreatureAI(npc_daegarn); new npc_mindless_abomination(); new spell_mindless_abomination_explosion_fx_master(); - new npc_riven_widow_cocoon(); + RegisterSpellScript(spell_rivenwood_captives_not_on_quest); + RegisterSpellScript(spell_rivenwood_captives_on_quest); } diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index b0d846a8412..59bd5e678d6 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -1045,6 +1045,64 @@ class spell_drop_disguise : public SpellScript } }; +/*###### +## Quest 12606: Cocooned! +######*/ + +enum Cocooned +{ + SPELL_SUMMON_SCOURGED_CAPTIVE = 51597, + SPELL_SUMMON_CAPTIVE_FOOTMAN = 51599 +}; + +// 51596 - Cocooned: Player Not On Quest +class spell_cocooned_not_on_quest : public SpellScript +{ + PrepareSpellScript(spell_cocooned_not_on_quest); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SUMMON_SCOURGED_CAPTIVE }); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastSpell(GetCaster(), SPELL_SUMMON_SCOURGED_CAPTIVE, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_cocooned_not_on_quest::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 51598 - Cocooned: Player On Quest +class spell_cocooned_on_quest : public SpellScript +{ + PrepareSpellScript(spell_cocooned_on_quest); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_SUMMON_SCOURGED_CAPTIVE, SPELL_SUMMON_CAPTIVE_FOOTMAN }); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + if (roll_chance_i(66)) + target->CastSpell(caster, SPELL_SUMMON_SCOURGED_CAPTIVE, true); + else + target->CastSpell(caster, SPELL_SUMMON_CAPTIVE_FOOTMAN, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_cocooned_on_quest::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + void AddSC_zuldrak() { new npc_drakuru_shackles(); @@ -1063,4 +1121,6 @@ void AddSC_zuldrak() RegisterSpellScript(spell_scourge_disguise_instability); RegisterSpellScript(spell_scourge_disguise_expiring); RegisterSpellScript(spell_drop_disguise); + RegisterSpellScript(spell_cocooned_not_on_quest); + RegisterSpellScript(spell_cocooned_on_quest); } |
