Scripts/MC: Rework Shazzrah script and implement spell script

Closes #13317
This commit is contained in:
Intra
2014-10-18 22:57:30 +02:00
committed by joschiwald
parent 5ede64260c
commit 98e1e06830
2 changed files with 81 additions and 34 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `spell_id`=23138;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(23138, 'spell_shazzrah_gate_dummy');

View File

@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -16,33 +15,29 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Shazzrah
SD%Complete: 75
SDComment: Teleport NYI
SDCategory: Molten Core
EndScriptData */
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "molten_core.h"
enum Spells
{
SPELL_ARCANE_EXPLOSION = 19712,
SPELL_SHAZZRAH_CURSE = 19713,
SPELL_MAGIC_GROUNDING = 19714,
SPELL_COUNTERSPELL = 19715,
SPELL_ARCANE_EXPLOSION = 19712,
SPELL_SHAZZRAH_CURSE = 19713,
SPELL_MAGIC_GROUNDING = 19714,
SPELL_COUNTERSPELL = 19715,
SPELL_SHAZZRAH_GATE_DUMMY = 23138, // Teleports to and attacks a random target.
SPELL_SHAZZRAH_GATE = 23139,
};
enum Events
{
EVENT_ARCANE_EXPLOSION = 1,
EVENT_SHAZZRAH_CURSE = 2,
EVENT_MAGIC_GROUNDING = 3,
EVENT_COUNTERSPELL = 4,
EVENT_BLINK = 5,
EVENT_ARCANE_EXPLOSION = 1,
EVENT_ARCANE_EXPLOSION_TRIGGERED = 2,
EVENT_SHAZZRAH_CURSE = 3,
EVENT_MAGIC_GROUNDING = 4,
EVENT_COUNTERSPELL = 5,
EVENT_SHAZZRAH_GATE = 6,
};
class boss_shazzrah : public CreatureScript
@@ -52,9 +47,7 @@ class boss_shazzrah : public CreatureScript
struct boss_shazzrahAI : public BossAI
{
boss_shazzrahAI(Creature* creature) : BossAI(creature, BOSS_SHAZZRAH)
{
}
boss_shazzrahAI(Creature* creature) : BossAI(creature, BOSS_SHAZZRAH) { }
void EnterCombat(Unit* target) override
{
@@ -63,7 +56,7 @@ class boss_shazzrah : public CreatureScript
events.ScheduleEvent(EVENT_SHAZZRAH_CURSE, 10000);
events.ScheduleEvent(EVENT_MAGIC_GROUNDING, 24000);
events.ScheduleEvent(EVENT_COUNTERSPELL, 15000);
events.ScheduleEvent(EVENT_BLINK, 30000);
events.ScheduleEvent(EVENT_SHAZZRAH_GATE, 45000);
}
void UpdateAI(uint32 diff) override
@@ -82,10 +75,14 @@ class boss_shazzrah : public CreatureScript
{
case EVENT_ARCANE_EXPLOSION:
DoCastVictim(SPELL_ARCANE_EXPLOSION);
events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, urand(5000, 9000));
events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, urand(4000, 7000));
break;
// Triggered subsequent to using "Gate of Shazzrah".
case EVENT_ARCANE_EXPLOSION_TRIGGERED:
DoCastVictim(SPELL_ARCANE_EXPLOSION);
break;
case EVENT_SHAZZRAH_CURSE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -EVENT_SHAZZRAH_CURSE))
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_SHAZZRAH_CURSE))
DoCast(target, SPELL_SHAZZRAH_CURSE);
events.ScheduleEvent(EVENT_SHAZZRAH_CURSE, urand(25000, 30000));
break;
@@ -97,16 +94,12 @@ class boss_shazzrah : public CreatureScript
DoCastVictim(SPELL_COUNTERSPELL);
events.ScheduleEvent(EVENT_COUNTERSPELL, urand(16000, 20000));
break;
case EVENT_BLINK:
// Teleporting him to a random player and casting Arcane Explosion after that.
// Blink is not working cause of LoS System we need to do this hardcoded.
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
{
DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
DoCast(target, SPELL_ARCANE_EXPLOSION);
DoResetThreat();
}
events.ScheduleEvent(EVENT_BLINK, 45000);
case EVENT_SHAZZRAH_GATE:
DoResetThreat();
DoCastAOE(SPELL_SHAZZRAH_GATE_DUMMY);
events.ScheduleEvent(EVENT_ARCANE_EXPLOSION_TRIGGERED, 2000);
events.RescheduleEvent(EVENT_ARCANE_EXPLOSION, urand(3000, 6000));
events.ScheduleEvent(EVENT_SHAZZRAH_GATE, 45000);
break;
default:
break;
@@ -123,7 +116,58 @@ class boss_shazzrah : public CreatureScript
}
};
// 23138 - Gate of Shazzrah
class spell_shazzrah_gate_dummy : public SpellScriptLoader
{
public:
spell_shazzrah_gate_dummy() : SpellScriptLoader("spell_shazzrah_gate_dummy") { }
class spell_shazzrah_gate_dummy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_shazzrah_gate_dummy_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_SHAZZRAH_GATE))
return false;
return true;
}
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*/)
{
if (Unit* target = GetHitUnit())
{
target->CastSpell(GetCaster(), SPELL_SHAZZRAH_GATE, true);
if (Creature* creature = GetCaster()->ToCreature())
creature->AI()->AttackStart(target); // Attack the target which caster will teleport to.
}
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_shazzrah_gate_dummy_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_shazzrah_gate_dummy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_shazzrah_gate_dummy_SpellScript();
}
};
void AddSC_boss_shazzrah()
{
new boss_shazzrah();
new spell_shazzrah_gate_dummy();
}