DB/SAI: Fix quest Jormuttar is Soo Fat...

Scripts/Spells: Script spell Bear Flank Master

Closes #10484
This commit is contained in:
untaught authored and Nay committed 2013-08-09 12:55:26 +01:00
1 parent d39d9f8328
commit 92fdb7aed1
2 files changed
+86

No files matched your search

+57
View File
@@ -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();
}