Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,87 +1,84 @@
using System;
using Server.Targeting;
using Server.Items;
using Server.Misc;
using Server.Targeting;
namespace Server.Spells.Fifth
{
public class DispelFieldSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Dispel Field", "An Grav",
206,
9002,
Reagent.BlackPearl,
Reagent.SpidersSilk,
Reagent.SulfurousAsh,
Reagent.Garlic
);
public class DispelFieldSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Dispel Field", "An Grav",
206,
9002,
Reagent.BlackPearl,
Reagent.SpidersSilk,
Reagent.SulfurousAsh,
Reagent.Garlic
);
public override SpellCircle Circle => SpellCircle.Fifth;
public DispelFieldSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public DispelFieldSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override SpellCircle Circle => SpellCircle.Fifth;
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target( Item item )
{
Type t = item.GetType();
public void Target(Item item)
{
Type t = item.GetType();
if ( !Caster.CanSee( item ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( !t.IsDefined( typeof( DispellableFieldAttribute ), false ) )
{
Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
}
else if ( item is Moongate && !((Moongate)item).Dispellable )
{
Caster.SendLocalizedMessage( 1005047 ); // That magic is too chaotic
}
else if ( CheckSequence() )
{
SpellHelper.Turn( Caster, item );
if (!Caster.CanSee(item))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (!t.IsDefined(typeof(DispellableFieldAttribute), false))
{
Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
}
else if (item is Moongate && !((Moongate)item).Dispellable)
{
Caster.SendLocalizedMessage(1005047); // That magic is too chaotic
}
else if (CheckSequence())
{
SpellHelper.Turn(Caster, item);
Effects.SendLocationParticles( EffectItem.Create( item.Location, item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 20, 5042 );
Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x201 );
Effects.SendLocationParticles(EffectItem.Create(item.Location, item.Map, EffectItem.DefaultDuration), 0x376A,
9, 20, 5042);
Effects.PlaySound(item.GetWorldLocation(), item.Map, 0x201);
item.Delete();
}
item.Delete();
}
FinishSequence();
}
FinishSequence();
}
private class InternalTarget : Target
{
private DispelFieldSpell m_Owner;
private class InternalTarget : Target
{
private DispelFieldSpell m_Owner;
public InternalTarget( DispelFieldSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.None )
{
m_Owner = owner;
}
public InternalTarget(DispelFieldSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
if ( o is Item )
{
m_Owner.Target( (Item)o );
}
else
{
m_Owner.Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
}
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Item)
m_Owner.Target((Item)o);
else
m_Owner.Caster.SendLocalizedMessage(1005049); // That cannot be dispelled.
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}