diff options
author | untaught <untaught@trinity.contrib> | 2013-08-09 12:55:26 +0100 |
---|---|---|
committer | Nay <dnpd.dd@gmail.com> | 2013-08-09 12:55:26 +0100 |
commit | 92fdb7aed16d1d0869aaa6d93f82a5478a018ffc (patch) | |
tree | 7239a9ce46330f7fc2391b49b1dc941d99f47025 /src | |
parent | d39d9f8328d37919475a7b7338a324ef68f4d843 (diff) |
DB/SAI: Fix quest Jormuttar is Soo Fat...
Scripts/Spells: Script spell Bear Flank Master
Closes #10484
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 10cc62a8a91..fcf87e9bfac 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1785,6 +1785,62 @@ class spell_q12847_summon_soul_moveto_bunny : public SpellScriptLoader } }; +enum BearFlankMaster +{ + SPELL_BEAR_FLANK_MASTER = 56565, + SPELL_CREATE_BEAR_FLANK = 56566, + SPELL_BEAR_FLANK_FAIL = 56569 +}; + +class spell_q13011_bear_flank_master : public SpellScriptLoader +{ + public: + spell_q13011_bear_flank_master() : SpellScriptLoader("spell_q13011_bear_flank_master") { } + + class spell_q13011_bear_flank_master_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q13011_bear_flank_master_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_BEAR_FLANK_MASTER) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_BEAR_FLANK)) + return false; + return true; + } + + bool Load() OVERRIDE + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleScript(SpellEffIndex effIndex) + { + bool failed = RAND(0, 1); // 50% chance + Creature* creature = GetCaster()->ToCreature(); + if (Player* player = GetHitPlayer()) + { + if (failed) + { + player->CastSpell(creature, SPELL_BEAR_FLANK_FAIL); + creature->AI()->Talk(0, player->GetGUID()); + } + else + player->CastSpell(player, SPELL_CREATE_BEAR_FLANK); + } + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_q13011_bear_flank_master_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_q13011_bear_flank_master_SpellScript(); + } +}; + class spell_q13086_cannons_target : public SpellScriptLoader { public: @@ -1863,5 +1919,6 @@ void AddSC_quest_spell_scripts() new spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy(); new spell_q13291_q13292_q13239_q13261_armored_decoy_summon_skytalon(); new spell_q12847_summon_soul_moveto_bunny(); + new spell_q13011_bear_flank_master(); new spell_q13086_cannons_target(); } |