Core/Spells: Fixed Magic Eater Food. Closes #2619

This commit is contained in:
Lopin
2011-08-19 13:34:05 +02:00
parent 2653ef3e94
commit ce7cc421f5
2 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
DELETE FROM `spell_script_names` WHERE `spell_id`=58886;
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`)
VALUES
(58886,'spell_magic_eater_food');

View File

@@ -1067,6 +1067,67 @@ class spell_item_ashbringer : public SpellScriptLoader
}
};
enum MagicEater
{
SPELL_WILD_MAGIC = 58891,
SPELL_WELL_FED_1 = 57288,
SPELL_WELL_FED_2 = 57139,
SPELL_WELL_FED_3 = 57111,
SPELL_WELL_FED_4 = 57286,
SPELL_WELL_FED_5 = 57291,
};
class spell_magic_eater_food : public SpellScriptLoader
{
public:
spell_magic_eater_food() : SpellScriptLoader("spell_magic_eater_food")
{
}
class spell_magic_eater_food_AuraScript : public AuraScript
{
PrepareAuraScript(spell_magic_eater_food_AuraScript);
void HandleTriggerSpell(AuraEffect const* aurEff)
{
PreventDefaultAction();
Unit* target = GetTarget();
switch (urand(0, 5))
{
case 0:
target->CastSpell(target, SPELL_WILD_MAGIC, true);
break;
case 1:
target->CastSpell(target, SPELL_WELL_FED_1, true);
break;
case 2:
target->CastSpell(target, SPELL_WELL_FED_2, true);
break;
case 3:
target->CastSpell(target, SPELL_WELL_FED_3, true);
break;
case 4:
target->CastSpell(target, SPELL_WELL_FED_4, true);
break;
case 5:
target->CastSpell(target, SPELL_WELL_FED_5, true);
break;
}
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_magic_eater_food_AuraScript::HandleTriggerSpell, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_magic_eater_food_AuraScript();
}
};
void AddSC_item_spell_scripts()
{
// 23074 Arcanite Dragonling
@@ -1098,4 +1159,5 @@ void AddSC_item_spell_scripts()
new spell_item_vanquished_clutches();
new spell_item_ashbringer();
new spell_magic_eater_food();
}