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

@ -4,129 +4,130 @@ using Server.Targeting;
namespace Server.Spells.Fourth
{
public class ManaDrainSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Mana Drain", "Ort Rel",
215,
9031,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public class ManaDrainSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Mana Drain", "Ort Rel",
215,
9031,
Reagent.BlackPearl,
Reagent.MandrakeRoot,
Reagent.SpidersSilk
);
public override SpellCircle Circle => SpellCircle.Fourth;
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public ManaDrainSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public ManaDrainSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override SpellCircle Circle => SpellCircle.Fourth;
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
private void AosDelay_Callback( object state )
{
object[] states = (object[])state;
private void AosDelay_Callback(object state)
{
object[] states = (object[])state;
Mobile m = (Mobile)states[0];
int mana = (int)states[1];
Mobile m = (Mobile)states[0];
int mana = (int)states[1];
if ( m.Alive && !m.IsDeadBondedPet )
{
m.Mana += mana;
if (m.Alive && !m.IsDeadBondedPet)
{
m.Mana += mana;
m.FixedEffect( 0x3779, 10, 25 );
m.PlaySound( 0x28E );
}
m.FixedEffect(0x3779, 10, 25);
m.PlaySound(0x28E);
}
m_Table.Remove( m );
}
m_Table.Remove(m);
}
public void Target( Mobile m )
{
if ( !Caster.CanSee( m ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( CheckHSequence( m ) )
{
SpellHelper.Turn( Caster, m );
public void Target(Mobile m)
{
if (!Caster.CanSee(m))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (CheckHSequence(m))
{
SpellHelper.Turn(Caster, m);
SpellHelper.CheckReflect( (int)Circle, Caster, ref m );
SpellHelper.CheckReflect((int)Circle, Caster, ref m);
m.Spell?.OnCasterHurt();
m.Spell?.OnCasterHurt();
m.Paralyzed = false;
m.Paralyzed = false;
if ( Core.AOS )
{
int toDrain = 40 + (int)(GetDamageSkill( Caster ) - GetResistSkill( m ));
if (Core.AOS)
{
int toDrain = 40 + (int)(GetDamageSkill(Caster) - GetResistSkill(m));
if ( toDrain < 0 )
toDrain = 0;
else if ( toDrain > m.Mana )
toDrain = m.Mana;
if (toDrain < 0)
toDrain = 0;
else if (toDrain > m.Mana)
toDrain = m.Mana;
if ( m_Table.ContainsKey( m ) )
toDrain = 0;
if (m_Table.ContainsKey(m))
toDrain = 0;
m.FixedParticles( 0x3789, 10, 25, 5032, EffectLayer.Head );
m.PlaySound( 0x1F8 );
m.FixedParticles(0x3789, 10, 25, 5032, EffectLayer.Head);
m.PlaySound(0x1F8);
if ( toDrain > 0 )
{
m.Mana -= toDrain;
if (toDrain > 0)
{
m.Mana -= toDrain;
m_Table[m] = Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( AosDelay_Callback ), new object[]{ m, toDrain } );
}
}
else
{
if ( CheckResisted( m ) )
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
else if ( m.Mana >= 100 )
m.Mana -= Utility.Random( 1, 100 );
else
m.Mana -= Utility.Random( 1, m.Mana );
m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(AosDelay_Callback),
new object[] { m, toDrain });
}
}
else
{
if (CheckResisted(m))
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
else if (m.Mana >= 100)
m.Mana -= Utility.Random(1, 100);
else
m.Mana -= Utility.Random(1, m.Mana);
m.FixedParticles( 0x374A, 10, 15, 5032, EffectLayer.Head );
m.PlaySound( 0x1F8 );
}
m.FixedParticles(0x374A, 10, 15, 5032, EffectLayer.Head);
m.PlaySound(0x1F8);
}
HarmfulSpell( m );
}
HarmfulSpell(m);
}
FinishSequence();
}
FinishSequence();
}
public override double GetResistPercent( Mobile target )
{
return 99.0;
}
public override double GetResistPercent(Mobile target)
{
return 99.0;
}
private class InternalTarget : Target
{
private ManaDrainSpell m_Owner;
private class InternalTarget : Target
{
private ManaDrainSpell m_Owner;
public InternalTarget( ManaDrainSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.Harmful )
{
m_Owner = owner;
}
public InternalTarget(ManaDrainSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
if ( o is Mobile )
m_Owner.Target( (Mobile)o );
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile)
m_Owner.Target((Mobile)o);
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}