fix(Scripts/Spells): Linken's boomerang (#8179)

* fix(Scripts/Spells): Linken's boomerang

* Update rev_1633027575141830731.sql
This commit is contained in:
jestermaniac
2021-10-14 13:25:16 +02:00
committed by GitHub
parent 3894dfc897
commit d4c4608db8
2 changed files with 73 additions and 0 deletions

View File

@@ -4395,6 +4395,73 @@ public:
}
};
enum LinkenBoomerang
{
SPELL_DISARM = 15752,
SPELL_STUN = 15753,
CHANCE_TO_HIT = 3
};
class spell_item_linken_boomerang : public SpellScriptLoader
{
public:
spell_item_linken_boomerang() : SpellScriptLoader("spell_item_linken_boomerang") {}
class spell_item_linken_boomerang_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_linken_boomerang_SpellScript)
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({SPELL_DISARM, SPELL_STUN});
}
void OnEffectHitTargetDisarm(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
}
void OnEffectHitTargetStun(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
}
void OnEffectLaunchTargetDisarm(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (roll_chance_i(CHANCE_TO_HIT)) // 3% from wiki
{
GetCaster()->CastSpell(GetHitUnit(), SPELL_DISARM, true);
}
}
void OnEffectLaunchTargetStun(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (roll_chance_i(CHANCE_TO_HIT)) // 3% from wiki
{
GetCaster()->CastSpell(GetHitUnit(), SPELL_STUN, true);
}
}
void Register() override
{
OnEffectLaunchTarget += SpellEffectFn(spell_item_linken_boomerang_SpellScript::OnEffectLaunchTargetDisarm, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
OnEffectLaunchTarget += SpellEffectFn(spell_item_linken_boomerang_SpellScript::OnEffectLaunchTargetStun, EFFECT_2, SPELL_EFFECT_TRIGGER_SPELL);
OnEffectHitTarget += SpellEffectFn(spell_item_linken_boomerang_SpellScript::OnEffectHitTargetDisarm, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
OnEffectHitTarget += SpellEffectFn(spell_item_linken_boomerang_SpellScript::OnEffectHitTargetStun, EFFECT_2, SPELL_EFFECT_TRIGGER_SPELL);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_item_linken_boomerang_SpellScript();
}
};
void AddSC_item_spell_scripts()
{
// Ours
@@ -4504,4 +4571,5 @@ void AddSC_item_spell_scripts()
new spell_item_greatmothers_soulcatcher();
new spell_item_eggnog();
new spell_item_goblin_bomb();
new spell_item_linken_boomerang();
}