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,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));
}
}
}