mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 17:19:07 +00:00
fix(Core/Spells): Sleep aura from Magic Dust should be removed if tar… (#12020)
* fix(Core/Spells): Sleep aura from Magic Dust should be removed if target is too high level. Fixes #11947 * Update.
This commit is contained in:
@@ -273,24 +273,28 @@ class spell_item_with_mount_speed : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
class spell_item_magic_dust : public AuraScript
|
||||
class spell_item_magic_dust : public SpellScript
|
||||
{
|
||||
PrepareAuraScript(spell_item_magic_dust);
|
||||
PrepareSpellScript(spell_item_magic_dust);
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
void HandlePreventAura(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (target->getLevel() >= 30)
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
uint8 chance = 100 - std::min<uint8>(100, target->getLevel() - 30 * urand(3, 10));
|
||||
if (!roll_chance_i(chance))
|
||||
PreventDefaultAction();
|
||||
if (target->getLevel() >= 30)
|
||||
{
|
||||
uint8 chance = 100 - std::min<uint8>(100, target->getLevel() - 30 * urand(3, 10));
|
||||
if (!roll_chance_i(chance))
|
||||
{
|
||||
PreventHitAura();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_item_magic_dust::OnApply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_item_magic_dust::HandlePreventAura, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user