Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -3,138 +3,139 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Seventh
|
||||
{
|
||||
public class ChainLightningSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Chain Lightning", "Vas Ort Grav",
|
||||
209,
|
||||
9022,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
public class ChainLightningSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Chain Lightning", "Vas Ort Grav",
|
||||
209,
|
||||
9022,
|
||||
false,
|
||||
Reagent.BlackPearl,
|
||||
Reagent.Bloodmoss,
|
||||
Reagent.MandrakeRoot,
|
||||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.Seventh;
|
||||
public ChainLightningSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public ChainLightningSpell( 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 bool DelayedDamage => true;
|
||||
|
||||
public override bool DelayedDamage => true;
|
||||
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 ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() )
|
||||
{
|
||||
SpellHelper.Turn( Caster, p );
|
||||
public void Target(IPoint3D p)
|
||||
{
|
||||
if (!Caster.CanSee(p))
|
||||
{
|
||||
Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
}
|
||||
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
|
||||
{
|
||||
SpellHelper.Turn(Caster, p);
|
||||
|
||||
if ( p is Item )
|
||||
p = ((Item)p).GetWorldLocation();
|
||||
if (p is Item)
|
||||
p = ((Item)p).GetWorldLocation();
|
||||
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
List<Mobile> targets = new List<Mobile>();
|
||||
|
||||
Map map = Caster.Map;
|
||||
Map map = Caster.Map;
|
||||
|
||||
bool playerVsPlayer = false;
|
||||
bool playerVsPlayer = false;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange( new Point3D( p ), 2 );
|
||||
if (map != null)
|
||||
{
|
||||
IPooledEnumerable<Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2);
|
||||
|
||||
foreach ( Mobile m in eable )
|
||||
{
|
||||
if ( Core.AOS && m == Caster )
|
||||
continue;
|
||||
foreach (Mobile m in eable)
|
||||
{
|
||||
if (Core.AOS && m == Caster)
|
||||
continue;
|
||||
|
||||
if ( SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) )
|
||||
{
|
||||
if ( Core.AOS && !Caster.InLOS( m ) )
|
||||
continue;
|
||||
if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
if (Core.AOS && !Caster.InLOS(m))
|
||||
continue;
|
||||
|
||||
targets.Add( m );
|
||||
targets.Add(m);
|
||||
|
||||
if ( m.Player )
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
}
|
||||
if (m.Player)
|
||||
playerVsPlayer = true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
double damage;
|
||||
double damage;
|
||||
|
||||
if ( Core.AOS )
|
||||
damage = GetNewAosDamage( 51, 1, 5, playerVsPlayer );
|
||||
else
|
||||
damage = Utility.Random( 27, 22 );
|
||||
if (Core.AOS)
|
||||
damage = GetNewAosDamage(51, 1, 5, playerVsPlayer);
|
||||
else
|
||||
damage = Utility.Random(27, 22);
|
||||
|
||||
if ( targets.Count > 0 )
|
||||
{
|
||||
if ( Core.AOS && targets.Count > 2 )
|
||||
damage = (damage * 2) / targets.Count;
|
||||
else if ( !Core.AOS )
|
||||
damage /= targets.Count;
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
if (Core.AOS && targets.Count > 2)
|
||||
damage = damage * 2 / targets.Count;
|
||||
else if (!Core.AOS)
|
||||
damage /= targets.Count;
|
||||
|
||||
double toDeal;
|
||||
for ( int i = 0; i < targets.Count; ++i )
|
||||
{
|
||||
toDeal = damage;
|
||||
Mobile m = targets[i];
|
||||
double toDeal;
|
||||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
toDeal = damage;
|
||||
Mobile m = targets[i];
|
||||
|
||||
if ( !Core.AOS && CheckResisted( m ) )
|
||||
{
|
||||
toDeal *= 0.5;
|
||||
if (!Core.AOS && CheckResisted(m))
|
||||
{
|
||||
toDeal *= 0.5;
|
||||
|
||||
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
|
||||
}
|
||||
toDeal *= GetDamageScalar( m );
|
||||
Caster.DoHarmful( m );
|
||||
SpellHelper.Damage( this, m, toDeal, 0, 0, 0, 0, 100 );
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
m.BoltEffect( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.PlaySound ( 0x29 );
|
||||
}
|
||||
}
|
||||
toDeal *= GetDamageScalar(m);
|
||||
Caster.DoHarmful(m);
|
||||
SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
m.BoltEffect(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Caster.PlaySound(0x29);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ChainLightningSpell m_Owner;
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
public InternalTarget( ChainLightningSpell owner ) : base( Core.ML ? 10 : 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private ChainLightningSpell m_Owner;
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
public InternalTarget(ChainLightningSpell owner) : base(Core.ML ? 10 : 12, true, TargetFlags.None)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
if ( p != null )
|
||||
m_Owner.Target( p );
|
||||
}
|
||||
protected override void OnTarget(Mobile from, object o)
|
||||
{
|
||||
IPoint3D p = o as IPoint3D;
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p != null)
|
||||
m_Owner.Target(p);
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish(Mobile from)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue