ModernUO/Projects/UOContent/Spells/Second/RemoveTrap.cs
Kamron Batman 4f9714818d
fix: Fixes skill requirements and cleans up magery spells (#870)
* Preps damage stacking for mysticism, necromancy fixes, and spellweaving
* Removes extra LINQ allocations
* Fixes skill requirements for magery spells.
2021-12-05 09:40:57 -08:00

61 lines
1.7 KiB
C#

using Server.Items;
namespace Server.Spells.Second
{
public class RemoveTrapSpell : MagerySpell, ISpellTargetingItem
{
private static readonly SpellInfo _info = new(
"Remove Trap",
"An Jux",
212,
9001,
Reagent.Bloodmoss,
Reagent.SulfurousAsh
);
public RemoveTrapSpell(Mobile caster, Item scroll = null) : base(caster, scroll, _info)
{
}
public override SpellCircle Circle => SpellCircle.Second;
public void Target(Item item)
{
if (item is not TrappableContainer cont)
{
Caster.SendLocalizedMessage(502373); // That doesn't appear to be trapped
}
else if (cont.TrapType != TrapType.None && cont.TrapType != TrapType.MagicTrap)
{
DoFizzle();
}
else if (CheckSequence())
{
SpellHelper.Turn(Caster, item);
var loc = item.GetWorldLocation();
Effects.SendLocationParticles(
EffectItem.Create(loc, item.Map, EffectItem.DefaultDuration),
0x376A,
9,
32,
5015
);
Effects.PlaySound(loc, item.Map, 0x1F0);
cont.TrapType = TrapType.None;
cont.TrapPower = 0;
cont.TrapLevel = 0;
}
FinishSequence();
}
public override void OnCast()
{
Caster.Target = new SpellTargetItem(this, range: Core.ML ? 10 : 12);
Caster.SendLocalizedMessage(502368);
}
}
}