mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-15 13:35:08 +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 (Unit* target = GetHitUnit())
|
||||||
if (target->getLevel() >= 30)
|
|
||||||
{
|
{
|
||||||
uint8 chance = 100 - std::min<uint8>(100, target->getLevel() - 30 * urand(3, 10));
|
if (target->getLevel() >= 30)
|
||||||
if (!roll_chance_i(chance))
|
{
|
||||||
PreventDefaultAction();
|
uint8 chance = 100 - std::min<uint8>(100, target->getLevel() - 30 * urand(3, 10));
|
||||||
|
if (!roll_chance_i(chance))
|
||||||
|
{
|
||||||
|
PreventHitAura();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register() override
|
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