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

@ -3,150 +3,150 @@ using System.Collections;
namespace Server.Spells.Bushido
{
public class Confidence : SamuraiSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Confidence", null,
-1,
9002
);
public class Confidence : SamuraiSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Confidence", null,
-1,
9002
);
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds( 0.25 );
private static Hashtable m_Table = new Hashtable();
public override double RequiredSkill => 25.0;
public override int RequiredMana => 10;
private static Hashtable m_RegenTable = new Hashtable();
public Confidence( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public Confidence(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public override void OnBeginCast()
{
base.OnBeginCast();
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(0.25);
Caster.FixedEffect( 0x37C4, 10, 7, 4, 3 );
}
public override double RequiredSkill => 25.0;
public override int RequiredMana => 10;
public override void OnCast()
{
if ( CheckSequence() )
{
Caster.SendLocalizedMessage( 1063115 ); // You exude confidence.
public override void OnBeginCast()
{
base.OnBeginCast();
Caster.FixedParticles( 0x375A, 1, 17, 0x7DA, 0x960, 0x3, EffectLayer.Waist );
Caster.PlaySound( 0x51A );
Caster.FixedEffect(0x37C4, 10, 7, 4, 3);
}
OnCastSuccessful( Caster );
public override void OnCast()
{
if (CheckSequence())
{
Caster.SendLocalizedMessage(1063115); // You exude confidence.
BeginConfidence( Caster );
BeginRegenerating( Caster );
}
Caster.FixedParticles(0x375A, 1, 17, 0x7DA, 0x960, 0x3, EffectLayer.Waist);
Caster.PlaySound(0x51A);
FinishSequence();
}
OnCastSuccessful(Caster);
private static Hashtable m_Table = new Hashtable();
BeginConfidence(Caster);
BeginRegenerating(Caster);
}
public static bool IsConfident( Mobile m )
{
return m_Table.Contains( m );
}
FinishSequence();
}
public static void BeginConfidence( Mobile m )
{
Timer t = (Timer)m_Table[m];
public static bool IsConfident(Mobile m)
{
return m_Table.Contains(m);
}
t?.Stop();
public static void BeginConfidence(Mobile m)
{
Timer t = (Timer)m_Table[m];
t = new InternalTimer( m );
t?.Stop();
m_Table[m] = t;
t = new InternalTimer(m);
t.Start();
}
m_Table[m] = t;
public static void EndConfidence( Mobile m )
{
Timer t = (Timer)m_Table[m];
t.Start();
}
t?.Stop();
public static void EndConfidence(Mobile m)
{
Timer t = (Timer)m_Table[m];
m_Table.Remove( m );
t?.Stop();
OnEffectEnd( m, typeof( Confidence ) );
}
m_Table.Remove(m);
private class InternalTimer : Timer
{
private Mobile m_Mobile;
OnEffectEnd(m, typeof(Confidence));
}
public InternalTimer( Mobile m ) : base( TimeSpan.FromSeconds( 15.0 ) )
{
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
public static bool IsRegenerating(Mobile m)
{
return m_RegenTable.Contains(m);
}
protected override void OnTick()
{
EndConfidence( m_Mobile );
m_Mobile.SendLocalizedMessage( 1063116 ); // Your confidence wanes.
}
}
public static void BeginRegenerating(Mobile m)
{
Timer t = (Timer)m_RegenTable[m];
private static Hashtable m_RegenTable = new Hashtable();
t?.Stop();
public static bool IsRegenerating( Mobile m )
{
return m_RegenTable.Contains( m );
}
t = new RegenTimer(m);
public static void BeginRegenerating( Mobile m )
{
Timer t = (Timer)m_RegenTable[m];
m_RegenTable[m] = t;
t?.Stop();
t.Start();
}
t = new RegenTimer( m );
public static void StopRegenerating(Mobile m)
{
Timer t = (Timer)m_RegenTable[m];
m_RegenTable[m] = t;
t?.Stop();
t.Start();
}
m_RegenTable.Remove(m);
}
public static void StopRegenerating( Mobile m )
{
Timer t = (Timer)m_RegenTable[m];
private class InternalTimer : Timer
{
private Mobile m_Mobile;
t?.Stop();
public InternalTimer(Mobile m) : base(TimeSpan.FromSeconds(15.0))
{
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
m_RegenTable.Remove( m );
}
protected override void OnTick()
{
EndConfidence(m_Mobile);
m_Mobile.SendLocalizedMessage(1063116); // Your confidence wanes.
}
}
private class RegenTimer : Timer
{
private Mobile m_Mobile;
private int m_Ticks;
private int m_Hits;
private class RegenTimer : Timer
{
private int m_Hits;
private Mobile m_Mobile;
private int m_Ticks;
public RegenTimer( Mobile m ) : base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ) )
{
m_Mobile = m;
m_Hits = 15 + (m.Skills.Bushido.Fixed * m.Skills.Bushido.Fixed / 57600);
Priority = TimerPriority.TwoFiftyMS;
}
public RegenTimer(Mobile m) : base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
{
m_Mobile = m;
m_Hits = 15 + m.Skills.Bushido.Fixed * m.Skills.Bushido.Fixed / 57600;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()
{
++m_Ticks;
protected override void OnTick()
{
++m_Ticks;
if ( m_Ticks >= 5 )
{
m_Mobile.Hits += (m_Hits - (m_Hits * 4 / 5));
StopRegenerating( m_Mobile );
}
if (m_Ticks >= 5)
{
m_Mobile.Hits += m_Hits - m_Hits * 4 / 5;
StopRegenerating(m_Mobile);
}
m_Mobile.Hits += (m_Hits / 5);
}
}
}
}
m_Mobile.Hits += m_Hits / 5;
}
}
}
}

View file

@ -4,108 +4,108 @@ using Server.Items;
namespace Server.Spells.Bushido
{
public class CounterAttack : SamuraiSpell
{
private static SpellInfo m_Info = new SpellInfo(
"CounterAttack", null,
-1,
9002
);
public class CounterAttack : SamuraiSpell
{
private static SpellInfo m_Info = new SpellInfo(
"CounterAttack", null,
-1,
9002
);
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds( 0.25 );
private static Hashtable m_Table = new Hashtable();
public override double RequiredSkill => 40.0;
public override int RequiredMana => 5;
public CounterAttack(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
}
public override bool CheckCast()
{
if ( !base.CheckCast() )
return false;
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(0.25);
if ( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseShield != null )
return true;
public override double RequiredSkill => 40.0;
public override int RequiredMana => 5;
if ( Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon != null )
return true;
public override bool CheckCast()
{
if (!base.CheckCast())
return false;
if ( Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon != null )
return true;
if (Caster.FindItemOnLayer(Layer.TwoHanded) as BaseShield != null)
return true;
Caster.SendLocalizedMessage( 1062944 ); // You must have a weapon or a shield equipped to use this ability!
return false;
}
if (Caster.FindItemOnLayer(Layer.OneHanded) as BaseWeapon != null)
return true;
public CounterAttack( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
if (Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon != null)
return true;
public override void OnBeginCast()
{
base.OnBeginCast();
Caster.SendLocalizedMessage(1062944); // You must have a weapon or a shield equipped to use this ability!
return false;
}
Caster.FixedEffect( 0x37C4, 10, 7, 4, 3 );
}
public override void OnBeginCast()
{
base.OnBeginCast();
public override void OnCast()
{
if ( CheckSequence() )
{
Caster.SendLocalizedMessage( 1063118 ); // You prepare to respond immediately to the next blocked blow.
Caster.FixedEffect(0x37C4, 10, 7, 4, 3);
}
OnCastSuccessful( Caster );
public override void OnCast()
{
if (CheckSequence())
{
Caster.SendLocalizedMessage(1063118); // You prepare to respond immediately to the next blocked blow.
StartCountering( Caster );
}
OnCastSuccessful(Caster);
FinishSequence();
}
StartCountering(Caster);
}
private static Hashtable m_Table = new Hashtable();
FinishSequence();
}
public static bool IsCountering( Mobile m )
{
return m_Table.Contains( m );
}
public static bool IsCountering(Mobile m)
{
return m_Table.Contains(m);
}
public static void StartCountering( Mobile m )
{
Timer t = (Timer)m_Table[m];
public static void StartCountering(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
t?.Stop();
t = new InternalTimer( m );
t = new InternalTimer(m);
m_Table[m] = t;
m_Table[m] = t;
t.Start();
}
t.Start();
}
public static void StopCountering( Mobile m )
{
Timer t = (Timer)m_Table[m];
public static void StopCountering(Mobile m)
{
Timer t = (Timer)m_Table[m];
t?.Stop();
t?.Stop();
m_Table.Remove( m );
m_Table.Remove(m);
OnEffectEnd( m, typeof( CounterAttack ) );
}
OnEffectEnd(m, typeof(CounterAttack));
}
private class InternalTimer : Timer
{
private Mobile m_Mobile;
private class InternalTimer : Timer
{
private Mobile m_Mobile;
public InternalTimer( Mobile m ) : base( TimeSpan.FromSeconds( 30.0 ) )
{
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
public InternalTimer(Mobile m) : base(TimeSpan.FromSeconds(30.0))
{
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()
{
StopCountering( m_Mobile );
m_Mobile.SendLocalizedMessage( 1063119 ); // You return to your normal stance.
}
}
}
}
protected override void OnTick()
{
StopCountering(m_Mobile);
m_Mobile.SendLocalizedMessage(1063119); // You return to your normal stance.
}
}
}
}

View file

@ -4,219 +4,223 @@ using Server.Items;
namespace Server.Spells.Bushido
{
public class Evasion : SamuraiSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Evasion", null,
-1,
9002
);
public class Evasion : SamuraiSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Evasion", null,
-1,
9002
);
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds( 0.25 );
private static Hashtable m_Table = new Hashtable();
public override double RequiredSkill => 60.0;
public override int RequiredMana => 10;
public Evasion(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override bool CheckCast()
{
if ( VerifyCast( Caster, true ) )
return base.CheckCast();
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(0.25);
return false;
}
public override double RequiredSkill => 60.0;
public override int RequiredMana => 10;
public static bool VerifyCast( Mobile Caster, bool messages )
{
if ( Caster == null ) // Sanity
return false;
public override bool CheckCast()
{
if (VerifyCast(Caster, true))
return base.CheckCast();
BaseWeapon weap = Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;
return false;
}
if ( weap == null )
weap = Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
public static bool VerifyCast(Mobile Caster, bool messages)
{
if (Caster == null) // Sanity
return false;
if ( weap != null ) {
if ( Core.ML && Caster.Skills[weap.Skill].Base < 50 ) {
if ( messages ) {
Caster.SendLocalizedMessage( 1076206 ); // Your skill with your equipped weapon must be 50 or higher to use Evasion.
}
return false;
}
} else if ( !( Caster.FindItemOnLayer( Layer.TwoHanded ) is BaseShield ) ) {
if ( messages ) {
Caster.SendLocalizedMessage( 1062944 ); // You must have a weapon or a shield equipped to use this ability!
}
return false;
}
BaseWeapon weap = Caster.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
if ( !Caster.CanBeginAction( typeof( Evasion ) ) ) {
if ( messages ) {
Caster.SendLocalizedMessage( 501789 ); // You must wait before trying again.
}
return false;
}
if (weap == null)
weap = Caster.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
return true;
}
if (weap != null)
{
if (Core.ML && Caster.Skills[weap.Skill].Base < 50)
{
if (messages)
Caster.SendLocalizedMessage(
1076206); // Your skill with your equipped weapon must be 50 or higher to use Evasion.
return false;
}
}
else if (!(Caster.FindItemOnLayer(Layer.TwoHanded) is BaseShield))
{
if (messages)
Caster.SendLocalizedMessage(1062944); // You must have a weapon or a shield equipped to use this ability!
return false;
}
public static bool CheckSpellEvasion( Mobile defender )
{
BaseWeapon weap = defender.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;
if (!Caster.CanBeginAction(typeof(Evasion)))
{
if (messages) Caster.SendLocalizedMessage(501789); // You must wait before trying again.
return false;
}
if ( weap == null )
weap = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
return true;
}
if ( Core.ML ) {
if ( defender.Spell != null && defender.Spell.IsCasting ) {
return false;
}
public static bool CheckSpellEvasion(Mobile defender)
{
BaseWeapon weap = defender.FindItemOnLayer(Layer.OneHanded) as BaseWeapon;
if ( weap != null ) {
if ( defender.Skills[weap.Skill].Base < 50 ) {
return false;
}
} else if ( !( defender.FindItemOnLayer( Layer.TwoHanded ) is BaseShield ) ) {
return false;
}
}
if (weap == null)
weap = defender.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon;
if ( IsEvading( defender ) && BaseWeapon.CheckParry( defender ) ) {
defender.Emote( "*evades*" ); // Yes. Eew. Blame OSI.
defender.FixedEffect( 0x37B9, 10, 16 );
return true;
}
if (Core.ML)
{
if (defender.Spell != null && defender.Spell.IsCasting) return false;
return false;
}
if (weap != null)
{
if (defender.Skills[weap.Skill].Base < 50) return false;
}
else if (!(defender.FindItemOnLayer(Layer.TwoHanded) is BaseShield))
{
return false;
}
}
public Evasion( Mobile caster, Item scroll )
: base( caster, scroll, m_Info )
{
}
if (IsEvading(defender) && BaseWeapon.CheckParry(defender))
{
defender.Emote("*evades*"); // Yes. Eew. Blame OSI.
defender.FixedEffect(0x37B9, 10, 16);
return true;
}
public override void OnBeginCast()
{
base.OnBeginCast();
return false;
}
Caster.FixedEffect( 0x37C4, 10, 7, 4, 3 );
}
public override void OnBeginCast()
{
base.OnBeginCast();
public override void OnCast()
{
if ( CheckSequence() )
{
Caster.SendLocalizedMessage( 1063120 ); // You feel that you might be able to deflect any attack!
Caster.FixedParticles( 0x376A, 1, 20, 0x7F5, 0x960, 3, EffectLayer.Waist );
Caster.PlaySound( 0x51B );
Caster.FixedEffect(0x37C4, 10, 7, 4, 3);
}
OnCastSuccessful( Caster );
public override void OnCast()
{
if (CheckSequence())
{
Caster.SendLocalizedMessage(1063120); // You feel that you might be able to deflect any attack!
Caster.FixedParticles(0x376A, 1, 20, 0x7F5, 0x960, 3, EffectLayer.Waist);
Caster.PlaySound(0x51B);
BeginEvasion( Caster );
OnCastSuccessful(Caster);
Caster.BeginAction( typeof( Evasion ) );
Timer.DelayCall( TimeSpan.FromSeconds( 20.0 ), delegate { Caster.EndAction( typeof( Evasion ) ); } );
}
BeginEvasion(Caster);
FinishSequence();
}
Caster.BeginAction(typeof(Evasion));
Timer.DelayCall(TimeSpan.FromSeconds(20.0), delegate { Caster.EndAction(typeof(Evasion)); });
}
private static Hashtable m_Table = new Hashtable();
FinishSequence();
}
public static bool IsEvading( Mobile m )
{
return m_Table.Contains( m );
}
public static bool IsEvading(Mobile m)
{
return m_Table.Contains(m);
}
public static TimeSpan GetEvadeDuration( Mobile m )
{
public static TimeSpan GetEvadeDuration(Mobile m)
{
/* Evasion duration now scales with Bushido skill
*
* If the player has higher than GM Bushido, and GM Tactics and Anatomy, they get a 1 second bonus
* Evasion duration range:
* o 3-6 seconds w/o tactics/anatomy
* o 6-7 seconds w/ GM+ Bushido and GM tactics/anatomy
*/
/* Evasion duration now scales with Bushido skill
*
* If the player has higher than GM Bushido, and GM Tactics and Anatomy, they get a 1 second bonus
* Evasion duration range:
* o 3-6 seconds w/o tactics/anatomy
* o 6-7 seconds w/ GM+ Bushido and GM tactics/anatomy
*/
if (!Core.ML)
return TimeSpan.FromSeconds(8.0);
if ( !Core.ML )
return TimeSpan.FromSeconds( 8.0 );
double seconds = 3;
double seconds = 3;
if (m.Skills.Bushido.Value > 60)
seconds += (m.Skills.Bushido.Value - 60) / 20;
if ( m.Skills.Bushido.Value > 60 )
seconds += (m.Skills.Bushido.Value - 60) / 20;
if (m.Skills.Anatomy.Value >= 100.0 && m.Skills.Tactics.Value >= 100.0 && m.Skills.Bushido.Value > 100.0
) //Bushido being HIGHER than 100 for bonus is intended
seconds++;
if ( m.Skills.Anatomy.Value >= 100.0 && m.Skills.Tactics.Value >= 100.0 && m.Skills.Bushido.Value > 100.0 ) //Bushido being HIGHER than 100 for bonus is intended
seconds++;
return TimeSpan.FromSeconds((int)seconds);
}
return TimeSpan.FromSeconds( (int)seconds );
}
public static double GetParryScalar(Mobile m)
{
/* Evasion modifier to parry now scales with Bushido skill
*
* If the player has higher than GM Bushido, and at least GM Tactics and Anatomy, they get a bonus to their evasion modifier (10% bonus to the evasion modifier to parry NOT 10% to the final parry chance)
*
* Bonus modifier to parry range: (these are the ranges for the evasion modifier)
* o 16-40% bonus w/o tactics/anatomy
* o 42-50% bonus w/ GM+ bushido and GM tactics/anatomy
*/
public static double GetParryScalar( Mobile m )
{
/* Evasion modifier to parry now scales with Bushido skill
*
* If the player has higher than GM Bushido, and at least GM Tactics and Anatomy, they get a bonus to their evasion modifier (10% bonus to the evasion modifier to parry NOT 10% to the final parry chance)
*
* Bonus modifier to parry range: (these are the ranges for the evasion modifier)
* o 16-40% bonus w/o tactics/anatomy
* o 42-50% bonus w/ GM+ bushido and GM tactics/anatomy
*/
if (!Core.ML)
return 1.5;
if ( !Core.ML )
return 1.5;
double bonus = 0;
double bonus = 0;
if (m.Skills.Bushido.Value >= 60)
bonus += (m.Skills.Bushido.Value - 60) * .004 + 0.16;
if ( m.Skills.Bushido.Value >= 60 )
bonus += ( ( ( m.Skills.Bushido.Value - 60 ) * .004 ) + 0.16 );
if (m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 && m.Skills.Bushido.Value > 100
) //Bushido being HIGHER than 100 for bonus is intended
bonus += 0.10;
if ( m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 && m.Skills.Bushido.Value > 100 ) //Bushido being HIGHER than 100 for bonus is intended
bonus += 0.10;
return 1.0 + bonus;
}
return 1.0 + bonus;
}
public static void BeginEvasion(Mobile m)
{
Timer t = (Timer)m_Table[m];
public static void BeginEvasion( Mobile m )
{
Timer t = (Timer)m_Table[m];
t?.Stop();
t?.Stop();
t = new InternalTimer(m, GetEvadeDuration(m));
t = new InternalTimer( m, GetEvadeDuration( m ) );
m_Table[m] = t;
m_Table[m] = t;
t.Start();
}
t.Start();
}
public static void EndEvasion(Mobile m)
{
Timer t = (Timer)m_Table[m];
public static void EndEvasion( Mobile m )
{
Timer t = (Timer)m_Table[m];
t?.Stop();
t?.Stop();
m_Table.Remove(m);
m_Table.Remove( m );
OnEffectEnd(m, typeof(Evasion));
}
OnEffectEnd( m, typeof( Evasion ) );
}
private class InternalTimer : Timer
{
private Mobile m_Mobile;
private class InternalTimer : Timer
{
private Mobile m_Mobile;
public InternalTimer(Mobile m, TimeSpan delay)
: base(delay)
{
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
public InternalTimer( Mobile m, TimeSpan delay )
: base( delay )
{
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()
{
EndEvasion( m_Mobile );
m_Mobile.SendLocalizedMessage( 1063121 ); // You no longer feel that you could deflect any attack.
}
}
}
}
protected override void OnTick()
{
EndEvasion(m_Mobile);
m_Mobile.SendLocalizedMessage(1063121); // You no longer feel that you could deflect any attack.
}
}
}
}

View file

@ -3,181 +3,177 @@ using System.Collections;
namespace Server.Spells.Bushido
{
public class HonorableExecution : SamuraiMove
{
public HonorableExecution()
{
}
public class HonorableExecution : SamuraiMove
{
private static Hashtable m_Table = new Hashtable();
public override int BaseMana => 0;
public override double RequiredSkill => 25.0;
public override int BaseMana => 0;
public override double RequiredSkill => 25.0;
public override TextDefinition AbilityMessage => new TextDefinition( 1063122 ); // You better kill your enemy with your next hit or you'll be rather sorry...
public override TextDefinition AbilityMessage =>
new TextDefinition(1063122); // You better kill your enemy with your next hit or you'll be rather sorry...
public override double GetDamageScalar( Mobile attacker, Mobile defender )
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
public override double GetDamageScalar(Mobile attacker, Mobile defender)
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
// TODO: 20 -> Perfection
return 1.0 + (bushido * 20) / 10000;
}
// TODO: 20 -> Perfection
return 1.0 + bushido * 20 / 10000;
}
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;
ClearCurrentMove( attacker );
ClearCurrentMove(attacker);
HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;
HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;
if ( info != null )
{
info.Clear();
if (info != null)
{
info.Clear();
info.m_Timer?.Stop();
}
info.m_Timer?.Stop();
}
if ( !defender.Alive )
{
attacker.FixedParticles( 0x373A, 1, 17, 0x7E2, EffectLayer.Waist );
if (!defender.Alive)
{
attacker.FixedParticles(0x373A, 1, 17, 0x7E2, EffectLayer.Waist);
double bushido = attacker.Skills[SkillName.Bushido].Value;
double bushido = attacker.Skills[SkillName.Bushido].Value;
attacker.Hits += 20 + (int)((bushido * bushido) / 480.0);
attacker.Hits += 20 + (int)(bushido * bushido / 480.0);
int swingBonus = Math.Max( 1, (int)((bushido * bushido) / 720.0) );
int swingBonus = Math.Max(1, (int)(bushido * bushido / 720.0));
info = new HonorableExecutionInfo( attacker, swingBonus );
info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 20.0 ), new TimerStateCallback( EndEffect ), info );
info = new HonorableExecutionInfo(attacker, swingBonus);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(EndEffect), info);
m_Table[attacker] = info;
}
else
{
ArrayList mods = new ArrayList();
m_Table[attacker] = info;
}
else
{
ArrayList mods = new ArrayList();
mods.Add( new ResistanceMod( ResistanceType.Physical, -40 ) );
mods.Add( new ResistanceMod( ResistanceType.Fire, -40 ) );
mods.Add( new ResistanceMod( ResistanceType.Cold, -40 ) );
mods.Add( new ResistanceMod( ResistanceType.Poison, -40 ) );
mods.Add( new ResistanceMod( ResistanceType.Energy, -40 ) );
mods.Add(new ResistanceMod(ResistanceType.Physical, -40));
mods.Add(new ResistanceMod(ResistanceType.Fire, -40));
mods.Add(new ResistanceMod(ResistanceType.Cold, -40));
mods.Add(new ResistanceMod(ResistanceType.Poison, -40));
mods.Add(new ResistanceMod(ResistanceType.Energy, -40));
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
double resSpells = attacker.Skills[SkillName.MagicResist].Value;
if ( resSpells > 0.0 )
mods.Add( new DefaultSkillMod( SkillName.MagicResist, true, -resSpells ) );
if (resSpells > 0.0)
mods.Add(new DefaultSkillMod(SkillName.MagicResist, true, -resSpells));
info = new HonorableExecutionInfo( attacker, mods );
info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 7.0 ), new TimerStateCallback( EndEffect ), info );
info = new HonorableExecutionInfo(attacker, mods);
info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerStateCallback(EndEffect), info);
m_Table[attacker] = info;
}
m_Table[attacker] = info;
}
CheckGain( attacker );
}
CheckGain(attacker);
}
public static int GetSwingBonus(Mobile target)
{
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
private static Hashtable m_Table = new Hashtable();
if (info == null)
return 0;
public static int GetSwingBonus( Mobile target )
{
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
return info.m_SwingBonus;
}
if ( info == null )
return 0;
public static bool IsUnderPenalty(Mobile target)
{
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
return info.m_SwingBonus;
}
if (info == null)
return false;
public static bool IsUnderPenalty( Mobile target )
{
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
return info.m_Penalty;
}
if ( info == null )
return false;
public static void RemovePenalty(Mobile target)
{
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
return info.m_Penalty;
}
if (info == null || !info.m_Penalty)
return;
public static void RemovePenalty( Mobile target )
{
HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;
info.Clear();
if ( info == null || !info.m_Penalty )
return;
info.m_Timer?.Stop();
info.Clear();
m_Table.Remove(target);
}
info.m_Timer?.Stop();
public void EndEffect(object state)
{
HonorableExecutionInfo info = (HonorableExecutionInfo)state;
m_Table.Remove( target );
}
RemovePenalty(info.m_Mobile);
}
private class HonorableExecutionInfo
{
public Mobile m_Mobile;
public int m_SwingBonus;
public ArrayList m_Mods;
public bool m_Penalty;
public Timer m_Timer;
private class HonorableExecutionInfo
{
public Mobile m_Mobile;
public ArrayList m_Mods;
public bool m_Penalty;
public int m_SwingBonus;
public Timer m_Timer;
public HonorableExecutionInfo( Mobile from, int swingBonus ) : this( from, swingBonus, null, false )
{
}
public HonorableExecutionInfo(Mobile from, int swingBonus) : this(from, swingBonus, null, false)
{
}
public HonorableExecutionInfo( Mobile from, ArrayList mods ) : this( from, 0, mods, true )
{
}
public HonorableExecutionInfo(Mobile from, ArrayList mods) : this(from, 0, mods, true)
{
}
public HonorableExecutionInfo( Mobile from, int swingBonus, ArrayList mods, bool penalty )
{
m_Mobile = from;
m_SwingBonus = swingBonus;
m_Mods = mods;
m_Penalty = penalty;
public HonorableExecutionInfo(Mobile from, int swingBonus, ArrayList mods, bool penalty)
{
m_Mobile = from;
m_SwingBonus = swingBonus;
m_Mods = mods;
m_Penalty = penalty;
Apply();
}
Apply();
}
public void Apply()
{
if ( m_Mods == null )
return;
public void Apply()
{
if (m_Mods == null)
return;
for ( int i = 0; i < m_Mods.Count; ++i )
{
object mod = m_Mods[i];
for (int i = 0; i < m_Mods.Count; ++i)
{
object mod = m_Mods[i];
if ( mod is ResistanceMod )
m_Mobile.AddResistanceMod( (ResistanceMod) mod );
else if ( mod is SkillMod )
m_Mobile.AddSkillMod( (SkillMod) mod );
}
}
if (mod is ResistanceMod)
m_Mobile.AddResistanceMod((ResistanceMod)mod);
else if (mod is SkillMod)
m_Mobile.AddSkillMod((SkillMod)mod);
}
}
public void Clear()
{
if ( m_Mods == null )
return;
public void Clear()
{
if (m_Mods == null)
return;
for ( int i = 0; i < m_Mods.Count; ++i )
{
object mod = m_Mods[i];
for (int i = 0; i < m_Mods.Count; ++i)
{
object mod = m_Mods[i];
if ( mod is ResistanceMod )
m_Mobile.RemoveResistanceMod( (ResistanceMod) mod );
else if ( mod is SkillMod )
m_Mobile.RemoveSkillMod( (SkillMod) mod );
}
}
}
public void EndEffect( object state )
{
HonorableExecutionInfo info = (HonorableExecutionInfo)state;
RemovePenalty( info.m_Mobile );
}
}
}
if (mod is ResistanceMod)
m_Mobile.RemoveResistanceMod((ResistanceMod)mod);
else if (mod is SkillMod)
m_Mobile.RemoveSkillMod((SkillMod)mod);
}
}
}
}
}

View file

@ -2,69 +2,68 @@ using Server.Mobiles;
namespace Server.Spells.Bushido
{
public class LightningStrike : SamuraiMove
{
public LightningStrike()
{
}
public class LightningStrike : SamuraiMove
{
public override int BaseMana => 5;
public override double RequiredSkill => 50.0;
public override int BaseMana => 5;
public override double RequiredSkill => 50.0;
public override TextDefinition AbilityMessage => new TextDefinition(1063167); // You prepare to strike quickly.
public override TextDefinition AbilityMessage => new TextDefinition( 1063167 ); // You prepare to strike quickly.
public override bool DelayedContext => true;
public override bool DelayedContext => true;
public override bool ValidatesDuringHit => false;
public override int GetAccuracyBonus( Mobile attacker )
{
return 50;
}
public override int GetAccuracyBonus(Mobile attacker)
{
return 50;
}
public override bool Validate(Mobile from)
{
bool isValid=base.Validate(from);
if (isValid)
{
PlayerMobile ThePlayer = from as PlayerMobile;
ThePlayer.ExecutesLightningStrike = BaseMana;
}
return isValid;
}
public override bool Validate(Mobile from)
{
bool isValid = base.Validate(from);
if (isValid)
{
PlayerMobile ThePlayer = from as PlayerMobile;
ThePlayer.ExecutesLightningStrike = BaseMana;
}
public override bool IgnoreArmor( Mobile attacker )
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
double criticalChance = (bushido * bushido) / 72000.0;
return ( criticalChance >= Utility.RandomDouble() );
}
return isValid;
}
public override bool OnBeforeSwing( Mobile attacker, Mobile defender )
{
/* no mana drain before actual hit */
bool enoughMana = CheckMana(attacker, false);
return Validate(attacker);
}
public override bool IgnoreArmor(Mobile attacker)
{
double bushido = attacker.Skills[SkillName.Bushido].Value;
double criticalChance = bushido * bushido / 72000.0;
return criticalChance >= Utility.RandomDouble();
}
public override bool ValidatesDuringHit => false;
public override bool OnBeforeSwing(Mobile attacker, Mobile defender)
{
/* no mana drain before actual hit */
bool enoughMana = CheckMana(attacker, false);
return Validate(attacker);
}
public override void OnHit( Mobile attacker, Mobile defender, int damage )
{
ClearCurrentMove(attacker);
if (CheckMana(attacker, true))
{
attacker.SendLocalizedMessage(1063168); // You attack with lightning precision!
defender.SendLocalizedMessage(1063169); // Your opponent's quick strike causes extra damage!
defender.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist);
defender.PlaySound(0x51D);
CheckGain(attacker);
SetContext(attacker);
}
}
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
ClearCurrentMove(attacker);
if (CheckMana(attacker, true))
{
attacker.SendLocalizedMessage(1063168); // You attack with lightning precision!
defender.SendLocalizedMessage(1063169); // Your opponent's quick strike causes extra damage!
defender.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist);
defender.PlaySound(0x51D);
CheckGain(attacker);
SetContext(attacker);
}
}
public override void OnClearMove( Mobile attacker )
{
PlayerMobile ThePlayer = attacker as PlayerMobile; // this can be deletet if the PlayerMobile parts are moved to Server.Mobile
ThePlayer.ExecutesLightningStrike = 0;
}
}
}
public override void OnClearMove(Mobile attacker)
{
PlayerMobile
ThePlayer =
attacker as PlayerMobile; // this can be deletet if the PlayerMobile parts are moved to Server.Mobile
ThePlayer.ExecutesLightningStrike = 0;
}
}
}

View file

@ -3,71 +3,68 @@ using Server.Items;
namespace Server.Spells.Bushido
{
public class MomentumStrike : SamuraiMove
{
public MomentumStrike()
{
}
public class MomentumStrike : SamuraiMove
{
public override int BaseMana => 10;
public override double RequiredSkill => 70.0;
public override int BaseMana => 10;
public override double RequiredSkill => 70.0;
public override TextDefinition AbilityMessage =>
new TextDefinition(1070757); // You prepare to strike two enemies with one blow.
public override TextDefinition AbilityMessage => new TextDefinition( 1070757 ); // You prepare to strike two enemies with one blow.
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
if (!Validate(attacker) || !CheckMana(attacker, false))
return;
public override void OnHit( Mobile attacker, Mobile defender, int damage )
{
if ( !Validate( attacker ) || !CheckMana( attacker, false ) )
return;
ClearCurrentMove(attacker);
ClearCurrentMove( attacker );
BaseWeapon weapon = attacker.Weapon as BaseWeapon;
BaseWeapon weapon = attacker.Weapon as BaseWeapon;
List<Mobile> targets = new List<Mobile>();
List<Mobile> targets = new List<Mobile>();
foreach (Mobile m in attacker.GetMobilesInRange(weapon.MaxRange))
{
if (m == defender)
continue;
foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) )
{
if ( m == defender )
continue;
if (m.Combatant != attacker)
continue;
if ( m.Combatant != attacker )
continue;
targets.Add(m);
}
targets.Add( m );
}
if (targets.Count > 0)
{
if (!CheckMana(attacker, true))
return;
if ( targets.Count > 0 )
{
if ( !CheckMana( attacker, true ) )
return;
Mobile target = targets[Utility.Random(targets.Count)];
Mobile target = targets[Utility.Random( targets.Count )];
double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0;
double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0;
if (!defender.Alive)
damageBonus *= 1.5;
if ( !defender.Alive )
damageBonus *= 1.5;
attacker.SendLocalizedMessage(1063171); // You transfer the momentum of your weapon into another enemy!
target.SendLocalizedMessage(1063172); // You were hit by the momentum of a Samurai's weapon!
attacker.SendLocalizedMessage( 1063171 ); // You transfer the momentum of your weapon into another enemy!
target.SendLocalizedMessage( 1063172 ); // You were hit by the momentum of a Samurai's weapon!
target.FixedParticles(0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist);
target.FixedParticles( 0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist );
attacker.PlaySound(0x510);
attacker.PlaySound( 0x510 );
weapon.OnSwing(attacker, target, damageBonus);
weapon.OnSwing( attacker, target, damageBonus );
CheckGain(attacker);
}
else
{
attacker.SendLocalizedMessage(1063123); // There are no valid targets to attack!
}
}
CheckGain( attacker );
}
else
{
attacker.SendLocalizedMessage( 1063123 ); // There are no valid targets to attack!
}
}
public override void CheckGain( Mobile m )
{
m.CheckSkill( MoveSkill, RequiredSkill, 120.0 );
}
}
}
public override void CheckGain(Mobile m)
{
m.CheckSkill(MoveSkill, RequiredSkill, 120.0);
}
}
}

View file

@ -1,12 +1,12 @@
namespace Server.Spells
{
public class SamuraiMove : SpecialMove
{
public override SkillName MoveSkill => SkillName.Bushido;
public class SamuraiMove : SpecialMove
{
public override SkillName MoveSkill => SkillName.Bushido;
public override void CheckGain( Mobile m )
{
m.CheckSkill( MoveSkill, RequiredSkill - 12.5, RequiredSkill + 37.5 ); //Per five on friday 02/16/07
}
}
}
public override void CheckGain(Mobile m)
{
m.CheckSkill(MoveSkill, RequiredSkill - 12.5, RequiredSkill + 37.5); //Per five on friday 02/16/07
}
}
}

View file

@ -1,128 +1,132 @@
using System;
using Server.Network;
using Server.Mobiles;
using Server.Network;
namespace Server.Spells.Bushido
{
public abstract class SamuraiSpell : Spell
{
public abstract double RequiredSkill{ get; }
public abstract int RequiredMana{ get; }
public abstract class SamuraiSpell : Spell
{
public SamuraiSpell(Mobile caster, Item scroll, SpellInfo info) : base(caster, scroll, info)
{
}
public override SkillName CastSkill => SkillName.Bushido;
public override SkillName DamageSkill => SkillName.Bushido;
public abstract double RequiredSkill{ get; }
public abstract int RequiredMana{ get; }
public override bool ClearHandsOnCast => false;
public override bool BlocksMovement => false;
public override bool ShowHandMovement => false;
public override SkillName CastSkill => SkillName.Bushido;
public override SkillName DamageSkill => SkillName.Bushido;
//public override int CastDelayBase => 1;
public override double CastDelayFastScalar => 0;
public override bool ClearHandsOnCast => false;
public override bool BlocksMovement => false;
public override bool ShowHandMovement => false;
public override int CastRecoveryBase => 7;
//public override int CastDelayBase => 1;
public override double CastDelayFastScalar => 0;
public SamuraiSpell( Mobile caster, Item scroll, SpellInfo info ) : base( caster, scroll, info )
{
}
public override int CastRecoveryBase => 7;
public static bool CheckExpansion( Mobile from )
{
if ( !( from is PlayerMobile ) )
return true;
public static bool CheckExpansion(Mobile from)
{
if (!(from is PlayerMobile))
return true;
if ( from.NetState == null )
return false;
if (from.NetState == null)
return false;
return from.NetState.SupportsExpansion( Expansion.SE );
}
return from.NetState.SupportsExpansion(Expansion.SE);
}
public override bool CheckCast()
{
int mana = ScaleMana ( RequiredMana );
public override bool CheckCast()
{
int mana = ScaleMana(RequiredMana);
if ( !base.CheckCast() )
return false;
if (!base.CheckCast())
return false;
if ( !CheckExpansion( Caster ) )
{
Caster.SendLocalizedMessage( 1063456 ); // You must upgrade to Samurai Empire in order to use that ability.
return false;
}
if (!CheckExpansion(Caster))
{
Caster.SendLocalizedMessage(1063456); // You must upgrade to Samurai Empire in order to use that ability.
return false;
}
if ( Caster.Skills[CastSkill].Value < RequiredSkill )
{
string args = $"{RequiredSkill.ToString("F1")}\t{CastSkill.ToString()}\t ";
Caster.SendLocalizedMessage( 1063013, args ); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
return false;
}
if (Caster.Skills[CastSkill].Value < RequiredSkill)
{
string args = $"{RequiredSkill.ToString("F1")}\t{CastSkill.ToString()}\t ";
Caster.SendLocalizedMessage(1063013,
args); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
return false;
}
if ( Caster.Mana < mana )
{
Caster.SendLocalizedMessage( 1060174, mana.ToString() ); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(1060174,
mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
return true;
}
return true;
}
public override bool CheckFizzle()
{
int mana = ScaleMana( RequiredMana );
public override bool CheckFizzle()
{
int mana = ScaleMana(RequiredMana);
if ( Caster.Skills[CastSkill].Value < RequiredSkill )
{
Caster.SendLocalizedMessage( 1070768, RequiredSkill.ToString( "F1" ) ); // You need ~1_SKILL_REQUIREMENT~ Bushido skill to perform that attack!
return false;
}
if (Caster.Skills[CastSkill].Value < RequiredSkill)
{
Caster.SendLocalizedMessage(1070768,
RequiredSkill.ToString("F1")); // You need ~1_SKILL_REQUIREMENT~ Bushido skill to perform that attack!
return false;
}
if ( Caster.Mana < mana )
{
Caster.SendLocalizedMessage( 1060174, mana.ToString() ); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(1060174,
mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
if ( !base.CheckFizzle() )
return false;
if (!base.CheckFizzle())
return false;
Caster.Mana -= mana;
Caster.Mana -= mana;
return true;
}
return true;
}
public override void GetCastSkills( out double min, out double max )
{
min = RequiredSkill - 12.5; //per 5 on friday, 2/16/07
max = RequiredSkill + 37.5;
}
public override void GetCastSkills(out double min, out double max)
{
min = RequiredSkill - 12.5; //per 5 on friday, 2/16/07
max = RequiredSkill + 37.5;
}
public override int GetMana()
{
return 0;
}
public override int GetMana()
{
return 0;
}
public virtual void OnCastSuccessful( Mobile caster )
{
if ( Evasion.IsEvading( caster ) )
Evasion.EndEvasion( caster );
public virtual void OnCastSuccessful(Mobile caster)
{
if (Evasion.IsEvading(caster))
Evasion.EndEvasion(caster);
if ( Confidence.IsConfident( caster ) )
Confidence.EndConfidence( caster );
if (Confidence.IsConfident(caster))
Confidence.EndConfidence(caster);
if ( CounterAttack.IsCountering( caster ) )
CounterAttack.StopCountering( caster );
if (CounterAttack.IsCountering(caster))
CounterAttack.StopCountering(caster);
int spellID = SpellRegistry.GetRegistryNumber( this );
int spellID = SpellRegistry.GetRegistryNumber(this);
if ( spellID > 0 )
caster.Send( new ToggleSpecialAbility( spellID + 1, true ) );
}
if (spellID > 0)
caster.Send(new ToggleSpecialAbility(spellID + 1, true));
}
public static void OnEffectEnd( Mobile caster, Type type )
{
int spellID = SpellRegistry.GetRegistryNumber( type );
public static void OnEffectEnd(Mobile caster, Type type)
{
int spellID = SpellRegistry.GetRegistryNumber(type);
if ( spellID > 0 )
caster.Send( new ToggleSpecialAbility( spellID + 1, false ) );
}
}
}
if (spellID > 0)
caster.Send(new ToggleSpecialAbility(spellID + 1, false));
}
}
}