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,75 +1,72 @@
using System;
using System.Collections;
namespace Server.Items
{
/// <summary>
/// Attack faster as you swing with both weapons.
/// </summary>
public class DualWield : WeaponAbility
{
public static Hashtable Registry { get; } = new Hashtable();
/// <summary>
/// Attack faster as you swing with both weapons.
/// </summary>
public class DualWield : WeaponAbility
{
public static Hashtable Registry{ get; } = new Hashtable();
public DualWield()
{
}
public override int BaseMana => 30;
public override int BaseMana => 30;
public override bool CheckSkills(Mobile from)
{
if (GetSkill(from, SkillName.Ninjitsu) < 50.0)
{
from.SendLocalizedMessage(1063352,
"50"); // You need ~1_SKILL_REQUIREMENT~ Ninjitsu skill to perform that attack!
return false;
}
public override bool CheckSkills( Mobile from )
{
if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 )
{
from.SendLocalizedMessage( 1063352, "50" ); // You need ~1_SKILL_REQUIREMENT~ Ninjitsu skill to perform that attack!
return false;
}
return base.CheckSkills(from);
}
return base.CheckSkills( from );
}
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
if (!Validate(attacker) || !CheckMana(attacker, true))
return;
public override void OnHit( Mobile attacker, Mobile defender, int damage )
{
if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
return;
if (Registry.Contains(attacker))
{
DualWieldTimer existingtimer = (DualWieldTimer)Registry[attacker];
existingtimer.Stop();
Registry.Remove(attacker);
}
if ( Registry.Contains( attacker ) )
{
DualWieldTimer existingtimer = (DualWieldTimer)Registry[attacker];
existingtimer.Stop();
Registry.Remove( attacker );
}
ClearCurrentAbility(attacker);
ClearCurrentAbility( attacker );
attacker.SendLocalizedMessage(1063362); // You dually wield for increased speed!
attacker.SendLocalizedMessage( 1063362 ); // You dually wield for increased speed!
attacker.FixedParticles(0x3779, 1, 15, 0x7F6, 0x3E8, 3, EffectLayer.LeftHand);
attacker.FixedParticles( 0x3779, 1, 15, 0x7F6, 0x3E8, 3, EffectLayer.LeftHand );
Timer t = new DualWieldTimer(attacker,
(int)(20.0 + 3.0 * (attacker.Skills[SkillName.Ninjitsu].Value - 50.0) / 7.0)); //20-50 % increase
Timer t = new DualWieldTimer( attacker, (int)(20.0 + 3.0 * (attacker.Skills[SkillName.Ninjitsu].Value - 50.0) / 7.0) ); //20-50 % increase
t.Start();
Registry.Add(attacker, t);
}
t.Start();
Registry.Add( attacker, t );
}
public class DualWieldTimer : Timer
{
private Mobile m_Owner;
public class DualWieldTimer : Timer
{
private Mobile m_Owner;
public DualWieldTimer(Mobile owner, int bonusSwingSpeed)
: base(TimeSpan.FromSeconds(6.0))
{
m_Owner = owner;
BonusSwingSpeed = bonusSwingSpeed;
Priority = TimerPriority.FiftyMS;
}
public int BonusSwingSpeed { get; }
public int BonusSwingSpeed{ get; }
public DualWieldTimer( Mobile owner, int bonusSwingSpeed )
: base( TimeSpan.FromSeconds( 6.0 ) )
{
m_Owner = owner;
BonusSwingSpeed = bonusSwingSpeed;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
Registry.Remove( m_Owner );
}
}
}
}
protected override void OnTick()
{
Registry.Remove(m_Owner);
}
}
}
}