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,111 +1,113 @@
using System.Collections.Generic;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Spells.Seventh
{
public class MassDispelSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Mass Dispel", "Vas An Ort",
263,
9002,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.BlackPearl,
Reagent.SulfurousAsh
);
public class MassDispelSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Mass Dispel", "Vas An Ort",
263,
9002,
Reagent.Garlic,
Reagent.MandrakeRoot,
Reagent.BlackPearl,
Reagent.SulfurousAsh
);
public override SpellCircle Circle => SpellCircle.Seventh;
public MassDispelSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public MassDispelSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override SpellCircle Circle => SpellCircle.Seventh;
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target( IPoint3D p )
{
if ( !Caster.CanSee( p ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( CheckSequence() )
{
SpellHelper.Turn( Caster, p );
public void Target(IPoint3D p)
{
if (!Caster.CanSee(p))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (CheckSequence())
{
SpellHelper.Turn(Caster, p);
SpellHelper.GetSurfaceTop( ref p );
SpellHelper.GetSurfaceTop(ref p);
List<Mobile> targets = new List<Mobile>();
List<Mobile> targets = new List<Mobile>();
Map map = Caster.Map;
Map map = Caster.Map;
if ( map != null )
{
IPooledEnumerable<BaseCreature> eable = map.GetMobilesInRange<BaseCreature>( new Point3D( p ), 8 );
if (map != null)
{
IPooledEnumerable<BaseCreature> eable = map.GetMobilesInRange<BaseCreature>(new Point3D(p), 8);
foreach ( BaseCreature m in eable )
if ( m.IsDispellable && Caster.CanBeHarmful( m, false ) )
targets.Add( m );
foreach (BaseCreature m in eable)
if (m.IsDispellable && Caster.CanBeHarmful(m, false))
targets.Add(m);
eable.Free();
}
eable.Free();
}
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = targets[i];
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
BaseCreature bc = m as BaseCreature;
BaseCreature bc = m as BaseCreature;
if ( bc == null )
continue;
if (bc == null)
continue;
double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100;
double dispelChance =
(50.0 + 100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty) / (bc.DispelFocus * 2)) / 100;
if ( dispelChance > Utility.RandomDouble() )
{
Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
Effects.PlaySound( m, m.Map, 0x201 );
if (dispelChance > Utility.RandomDouble())
{
Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration),
0x3728, 8, 20, 5042);
Effects.PlaySound(m, m.Map, 0x201);
m.Delete();
}
else
{
Caster.DoHarmful( m );
m.Delete();
}
else
{
Caster.DoHarmful(m);
m.FixedEffect( 0x3779, 10, 20 );
}
}
}
m.FixedEffect(0x3779, 10, 20);
}
}
}
FinishSequence();
}
FinishSequence();
}
private class InternalTarget : Target
{
private MassDispelSpell m_Owner;
private class InternalTarget : Target
{
private MassDispelSpell m_Owner;
public InternalTarget( MassDispelSpell owner ) : base( Core.ML ? 10 : 12, true, TargetFlags.None )
{
m_Owner = owner;
}
public InternalTarget(MassDispelSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D p = o as IPoint3D;
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if ( p != null )
m_Owner.Target( p );
}
if (p != null)
m_Owner.Target(p);
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}