Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

@ -187,9 +187,7 @@ namespace Server.Spells
m.CheckSkill( MoveSkill, RequiredSkill, RequiredSkill + 37.5 );
}
private static Dictionary<Mobile, SpecialMove> m_Table = new Dictionary<Mobile, SpecialMove>();
public static Dictionary<Mobile, SpecialMove> Table => m_Table;
public static Dictionary<Mobile, SpecialMove> Table { get; } = new Dictionary<Mobile, SpecialMove>();
public static void ClearAllMoves( Mobile m )
{
@ -215,7 +213,7 @@ namespace Server.Spells
return null;
}
m_Table.TryGetValue( m, out SpecialMove move );
Table.TryGetValue( m, out SpecialMove move );
if ( move != null && move.ValidatesDuringHit && !move.Validate( m ) )
{
@ -251,7 +249,7 @@ namespace Server.Spells
{
WeaponAbility.ClearCurrentAbility( m );
m_Table[m] = move;
Table[m] = move;
move.OnUse( m );
@ -268,7 +266,7 @@ namespace Server.Spells
public static void ClearCurrentMove( Mobile m )
{
m_Table.TryGetValue( m, out SpecialMove move );
Table.TryGetValue( m, out SpecialMove move );
if ( move != null )
{
@ -280,7 +278,7 @@ namespace Server.Spells
m.Send( new ToggleSpecialAbility( moveID + 1, false ) );
}
m_Table.Remove( m );
Table.Remove( m );
}
public SpecialMove()
@ -341,16 +339,14 @@ namespace Server.Spells
public class SpecialMoveContext
{
private Timer m_Timer;
private Type m_Type;
public Timer Timer { get; }
public Timer Timer => m_Timer;
public Type Type => m_Type;
public Type Type { get; }
public SpecialMoveContext( Timer timer, Type type )
{
m_Timer = timer;
m_Type = type;
Timer = timer;
Type = type;
}
}
}

View file

@ -14,22 +14,18 @@ namespace Server.Spells
{
public abstract class Spell : ISpell
{
private Mobile m_Caster;
private Item m_Scroll;
private SpellInfo m_Info;
private SpellState m_State;
private long m_StartCastTime;
public SpellState State { get; set; }
public SpellState State{ get => m_State;
set => m_State = value;
}
public Mobile Caster => m_Caster;
public SpellInfo Info => m_Info;
public string Name => m_Info.Name;
public string Mantra => m_Info.Mantra;
public Type[] Reagents => m_Info.Reagents;
public Item Scroll => m_Scroll;
public long StartCastTime => m_StartCastTime;
public Mobile Caster { get; }
public SpellInfo Info { get; }
public string Name => Info.Name;
public string Mantra => Info.Mantra;
public Type[] Reagents => Info.Reagents;
public Item Scroll { get; }
public long StartCastTime { get; private set; }
private static TimeSpan NextSpellDelay = TimeSpan.FromSeconds( 0.75 );
private static TimeSpan AnimateDelay = TimeSpan.FromSeconds( 1.5 );
@ -96,14 +92,14 @@ namespace Server.Spells
public void HarmfulSpell( Mobile m )
{
(m as BaseCreature)?.OnHarmfulSpell( m_Caster );
(m as BaseCreature)?.OnHarmfulSpell( Caster );
}
public Spell( Mobile caster, Item scroll, SpellInfo info )
{
m_Caster = caster;
m_Scroll = scroll;
m_Info = info;
Caster = caster;
Scroll = scroll;
Info = info;
}
public virtual int GetNewAosDamage( int bonus, int dice, int sides, Mobile singleTarget )
@ -126,14 +122,14 @@ namespace Server.Spells
int damage = Utility.Dice( dice, sides, bonus ) * 100;
int damageBonus = 0;
int inscribeSkill = GetInscribeFixed( m_Caster );
int inscribeSkill = GetInscribeFixed( Caster );
int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;
damageBonus += inscribeBonus;
int intBonus = Caster.Int / 10;
damageBonus += intBonus;
int sdiBonus = AosAttributes.GetValue( m_Caster, AosAttribute.SpellDamage );
int sdiBonus = AosAttributes.GetValue( Caster, AosAttribute.SpellDamage );
// PvP spell damage increase cap of 15% from an item<65>s magic property
if ( playerVsPlayer && sdiBonus > 15 )
sdiBonus = 15;
@ -147,7 +143,7 @@ namespace Server.Spells
damage = AOS.Scale( damage, 100 + damageBonus );
int evalSkill = GetDamageFixed( m_Caster );
int evalSkill = GetDamageFixed( Caster );
int evalScale = 30 + ((9 * evalSkill) / 100);
damage = AOS.Scale( damage, evalScale );
@ -157,7 +153,7 @@ namespace Server.Spells
return damage / 100;
}
public virtual bool IsCasting => m_State == SpellState.Casting;
public virtual bool IsCasting => State == SpellState.Casting;
public virtual void OnCasterHurt()
{
@ -167,7 +163,7 @@ namespace Server.Spells
if ( IsCasting )
{
object o = ProtectionSpell.Registry[m_Caster];
object o = ProtectionSpell.Registry[Caster];
bool disturb = true;
if ( o is double )
@ -195,7 +191,7 @@ namespace Server.Spells
{
if ( IsCasting && BlocksMovement )
{
m_Caster.SendLocalizedMessage( 500111 ); // You are frozen and can not move.
Caster.SendLocalizedMessage( 500111 ); // You are frozen and can not move.
return false;
}
@ -212,7 +208,7 @@ namespace Server.Spells
public virtual bool OnCasterUsingObject( object o )
{
if ( m_State == SpellState.Sequencing )
if ( State == SpellState.Sequencing )
Disturb( DisturbType.UseRequest );
return true;
@ -220,26 +216,26 @@ namespace Server.Spells
public virtual bool OnCastInTown( Region r )
{
return m_Info.AllowTown;
return Info.AllowTown;
}
public virtual bool ConsumeReagents()
{
if ( m_Scroll != null || !m_Caster.Player )
if ( Scroll != null || !Caster.Player )
return true;
if ( AosAttributes.GetValue( m_Caster, AosAttribute.LowerRegCost ) > Utility.Random( 100 ) )
if ( AosAttributes.GetValue( Caster, AosAttribute.LowerRegCost ) > Utility.Random( 100 ) )
return true;
if ( Engines.ConPVP.DuelContext.IsFreeConsume( m_Caster ) )
if ( Engines.ConPVP.DuelContext.IsFreeConsume( Caster ) )
return true;
Container pack = m_Caster.Backpack;
Container pack = Caster.Backpack;
if ( pack == null )
return false;
if ( pack.ConsumeTotal( m_Info.Reagents, m_Info.Amounts ) == -1 )
if ( pack.ConsumeTotal( Info.Reagents, Info.Amounts ) == -1 )
return true;
return false;
@ -286,7 +282,7 @@ namespace Server.Spells
if ( !Core.AOS ) //EvalInt stuff for AoS is handled elsewhere
{
double casterEI = m_Caster.Skills[DamageSkill].Value;
double casterEI = Caster.Skills[DamageSkill].Value;
double targetRS = target.Skills[SkillName.MagicResist].Value;
/*
@ -302,20 +298,20 @@ namespace Server.Spells
scalar = (1.0 + ((casterEI - targetRS) / 200.0));
// magery damage bonus, -25% at 0 skill, +0% at 100 skill, +5% at 120 skill
scalar += (m_Caster.Skills[CastSkill].Value - 100.0) / 400.0;
scalar += (Caster.Skills[CastSkill].Value - 100.0) / 400.0;
if ( !target.Player && !target.Body.IsHuman /*&& !Core.AOS*/ )
scalar *= 2.0; // Double magery damage to monsters/animals if not AOS
}
(target as BaseCreature)?.AlterDamageScalarFrom( m_Caster, ref scalar );
(target as BaseCreature)?.AlterDamageScalarFrom( Caster, ref scalar );
(m_Caster as BaseCreature)?.AlterDamageScalarTo( target, ref scalar );
(Caster as BaseCreature)?.AlterDamageScalarTo( target, ref scalar );
if ( Core.SE )
scalar *= GetSlayerDamageScalar( target );
target.Region.SpellDamageScalar( m_Caster, target, ref scalar );
target.Region.SpellDamageScalar( Caster, target, ref scalar );
if ( Evasion.CheckSpellEvasion( target ) ) //Only single target spells an be evaded
scalar = 0;
@ -325,7 +321,7 @@ namespace Server.Spells
public virtual double GetSlayerDamageScalar( Mobile defender )
{
Spellbook atkBook = Spellbook.FindEquippedSpellbook( m_Caster );
Spellbook atkBook = Spellbook.FindEquippedSpellbook( Caster );
double scalar = 1.0;
if ( atkBook != null )
@ -359,7 +355,7 @@ namespace Server.Spells
SlayerEntry defSlayer = SlayerGroup.GetEntryByName( defISlayer.Slayer );
SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName( defISlayer.Slayer2 );
if ( defSlayer != null && defSlayer.Group.OppositionSuperSlays( m_Caster ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( m_Caster ) )
if ( defSlayer != null && defSlayer.Group.OppositionSuperSlays( Caster ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( Caster ) )
scalar = 2.0;
}
@ -368,16 +364,16 @@ namespace Server.Spells
public virtual void DoFizzle()
{
m_Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502632 ); // The spell fizzles.
Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502632 ); // The spell fizzles.
if ( m_Caster.Player )
if ( Caster.Player )
{
if ( Core.AOS )
m_Caster.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist );
Caster.FixedParticles( 0x3735, 1, 30, 9503, EffectLayer.Waist );
else
m_Caster.FixedEffect( 0x3735, 6, 30 );
Caster.FixedEffect( 0x3735, 6, 30 );
m_Caster.PlaySound( 0x5C );
Caster.PlaySound( 0x5C );
}
}
@ -391,7 +387,7 @@ namespace Server.Spells
public virtual bool CheckDisturb( DisturbType type, bool firstCircle, bool resistable )
{
if ( resistable && m_Scroll is BaseWand )
if ( resistable && Scroll is BaseWand )
return false;
return true;
@ -402,13 +398,13 @@ namespace Server.Spells
if ( !CheckDisturb( type, firstCircle, resistable ) )
return;
if ( m_State == SpellState.Casting )
if ( State == SpellState.Casting )
{
if ( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First )
return;
m_State = SpellState.None;
m_Caster.Spell = null;
State = SpellState.None;
Caster.Spell = null;
OnDisturb( type, true );
@ -416,38 +412,38 @@ namespace Server.Spells
m_AnimTimer?.Stop();
if ( Core.AOS && m_Caster.Player && type == DisturbType.Hurt )
if ( Core.AOS && Caster.Player && type == DisturbType.Hurt )
DoHurtFizzle();
m_Caster.NextSpellTime = Core.TickCount + (int)GetDisturbRecovery().TotalMilliseconds;
Caster.NextSpellTime = Core.TickCount + (int)GetDisturbRecovery().TotalMilliseconds;
}
else if ( m_State == SpellState.Sequencing )
else if ( State == SpellState.Sequencing )
{
if ( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First )
return;
m_State = SpellState.None;
m_Caster.Spell = null;
State = SpellState.None;
Caster.Spell = null;
OnDisturb( type, false );
Target.Cancel( m_Caster );
Target.Cancel( Caster );
if ( Core.AOS && m_Caster.Player && type == DisturbType.Hurt )
if ( Core.AOS && Caster.Player && type == DisturbType.Hurt )
DoHurtFizzle();
}
}
public virtual void DoHurtFizzle()
{
m_Caster.FixedEffect( 0x3735, 6, 30 );
m_Caster.PlaySound( 0x5C );
Caster.FixedEffect( 0x3735, 6, 30 );
Caster.PlaySound( 0x5C );
}
public virtual void OnDisturb( DisturbType type, bool message )
{
if ( message )
m_Caster.SendLocalizedMessage( 500641 ); // Your concentration is disturbed, thus ruining thy spell.
Caster.SendLocalizedMessage( 500641 ); // Your concentration is disturbed, thus ruining thy spell.
}
public virtual bool CheckCast()
@ -457,75 +453,75 @@ namespace Server.Spells
public virtual void SayMantra()
{
if ( m_Scroll is BaseWand )
if ( Scroll is BaseWand )
return;
if ( m_Info.Mantra != null && m_Info.Mantra.Length > 0 && m_Caster.Player )
m_Caster.PublicOverheadMessage( MessageType.Spell, m_Caster.SpeechHue, true, m_Info.Mantra, false );
if ( Info.Mantra != null && Info.Mantra.Length > 0 && Caster.Player )
Caster.PublicOverheadMessage( MessageType.Spell, Caster.SpeechHue, true, Info.Mantra, false );
}
public virtual bool BlockedByHorrificBeast => true;
public virtual bool BlockedByAnimalForm => true;
public virtual bool BlocksMovement => true;
public virtual bool CheckNextSpellTime => !(m_Scroll is BaseWand);
public virtual bool CheckNextSpellTime => !(Scroll is BaseWand);
public bool Cast()
{
m_StartCastTime = Core.TickCount;
StartCastTime = Core.TickCount;
if ( Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing )
((Spell)m_Caster.Spell).Disturb( DisturbType.NewCast );
if ( Core.AOS && Caster.Spell is Spell && ((Spell)Caster.Spell).State == SpellState.Sequencing )
((Spell)Caster.Spell).Disturb( DisturbType.NewCast );
if ( !m_Caster.CheckAlive() )
if ( !Caster.CheckAlive() )
{
return false;
}
if ( m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting )
if ( Scroll is BaseWand && Caster.Spell != null && Caster.Spell.IsCasting )
{
m_Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen.
Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen.
}
else if ( m_Caster.Spell != null && m_Caster.Spell.IsCasting )
else if ( Caster.Spell != null && Caster.Spell.IsCasting )
{
m_Caster.SendLocalizedMessage( 502642 ); // You are already casting a spell.
Caster.SendLocalizedMessage( 502642 ); // You are already casting a spell.
}
else if ( BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation( m_Caster, typeof( HorrificBeastSpell ) ) || ( BlockedByAnimalForm && AnimalForm.UnderTransformation( m_Caster ) ))
else if ( BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation( Caster, typeof( HorrificBeastSpell ) ) || ( BlockedByAnimalForm && AnimalForm.UnderTransformation( Caster ) ))
{
m_Caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form.
Caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form.
}
else if ( !(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen) )
else if ( !(Scroll is BaseWand) && (Caster.Paralyzed || Caster.Frozen) )
{
m_Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen.
Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen.
}
else if (CheckNextSpellTime && Core.TickCount - m_Caster.NextSpellTime < 0)
else if (CheckNextSpellTime && Core.TickCount - Caster.NextSpellTime < 0)
{
m_Caster.SendLocalizedMessage( 502644 ); // You have not yet recovered from casting a spell.
Caster.SendLocalizedMessage( 502644 ); // You have not yet recovered from casting a spell.
}
else if ( m_Caster is PlayerMobile && ( (PlayerMobile) m_Caster ).PeacedUntil > DateTime.UtcNow )
else if ( Caster is PlayerMobile && ( (PlayerMobile) Caster ).PeacedUntil > DateTime.UtcNow )
{
m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
}
#region Dueling
else if ( (m_Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) )
else if ( (Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)Caster).DuelContext.AllowSpellCast( Caster, this ) )
{
}
#endregion
else if ( m_Caster.Mana >= ScaleMana( GetMana() ) )
else if ( Caster.Mana >= ScaleMana( GetMana() ) )
{
if ( m_Caster.Spell == null && m_Caster.CheckSpellCast( this ) && CheckCast() && m_Caster.Region.OnBeginSpellCast( m_Caster, this ) )
if ( Caster.Spell == null && Caster.CheckSpellCast( this ) && CheckCast() && Caster.Region.OnBeginSpellCast( Caster, this ) )
{
m_State = SpellState.Casting;
m_Caster.Spell = this;
State = SpellState.Casting;
Caster.Spell = this;
if ( !( m_Scroll is BaseWand ) && RevealOnCast )
m_Caster.RevealingAction();
if ( !( Scroll is BaseWand ) && RevealOnCast )
Caster.RevealingAction();
SayMantra();
TimeSpan castDelay = GetCastDelay();
if ( ShowHandMovement && ( m_Caster.Body.IsHuman || ( m_Caster.Player && m_Caster.Body.IsMonster ) ) )
if ( ShowHandMovement && ( Caster.Body.IsHuman || ( Caster.Player && Caster.Body.IsMonster ) ) )
{
int count = (int)Math.Ceiling( castDelay.TotalSeconds / AnimateDelay.TotalSeconds );
@ -535,18 +531,18 @@ namespace Server.Spells
m_AnimTimer.Start();
}
if ( m_Info.LeftHandEffect > 0 )
Caster.FixedParticles( 0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand );
if ( Info.LeftHandEffect > 0 )
Caster.FixedParticles( 0, 10, 5, Info.LeftHandEffect, EffectLayer.LeftHand );
if ( m_Info.RightHandEffect > 0 )
Caster.FixedParticles( 0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand );
if ( Info.RightHandEffect > 0 )
Caster.FixedParticles( 0, 10, 5, Info.RightHandEffect, EffectLayer.RightHand );
}
if ( ClearHandsOnCast )
m_Caster.ClearHands();
Caster.ClearHands();
if ( Core.ML )
WeaponAbility.ClearCurrentAbility( m_Caster );
WeaponAbility.ClearCurrentAbility( Caster );
m_CastTimer = new CastTimer( this, castDelay );
//m_CastTimer.Start();
@ -566,7 +562,7 @@ namespace Server.Spells
}
else
{
m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana
Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana
}
return false;
@ -585,7 +581,7 @@ namespace Server.Spells
public virtual bool CheckFizzle()
{
if ( m_Scroll is BaseWand )
if ( Scroll is BaseWand )
return true;
double minSkill, maxSkill;
@ -608,7 +604,7 @@ namespace Server.Spells
scalar = 1.0;
// Lower Mana Cost = 40%
int lmc = AosAttributes.GetValue( m_Caster, AosAttribute.LowerManaCost );
int lmc = AosAttributes.GetValue( Caster, AosAttribute.LowerManaCost );
if ( lmc > 40 )
lmc = 40;
@ -622,7 +618,7 @@ namespace Server.Spells
if ( Core.AOS )
return TimeSpan.Zero;
double delay = 1.0 - Math.Sqrt((Core.TickCount - m_StartCastTime) / 1000.0 / GetCastDelay().TotalSeconds);
double delay = 1.0 - Math.Sqrt((Core.TickCount - StartCastTime) / 1000.0 / GetCastDelay().TotalSeconds);
if ( delay < 0.2 )
delay = 0.2;
@ -640,9 +636,9 @@ namespace Server.Spells
if ( !Core.AOS )
return NextSpellDelay;
int fcr = AosAttributes.GetValue( m_Caster, AosAttribute.CastRecovery );
int fcr = AosAttributes.GetValue( Caster, AosAttribute.CastRecovery );
fcr -= ThunderstormSpell.GetCastRecoveryMalus( m_Caster );
fcr -= ThunderstormSpell.GetCastRecoveryMalus( Caster );
int fcrDelay = -(CastRecoveryFastScalar * fcr);
@ -667,7 +663,7 @@ namespace Server.Spells
public virtual TimeSpan GetCastDelay()
{
if ( m_Scroll is BaseWand )
if ( Scroll is BaseWand )
return Core.ML ? CastDelayBase : TimeSpan.Zero; // TODO: Should FC apply to wands?
// Faster casting cap of 2 (if not using the protection spell)
@ -676,19 +672,19 @@ namespace Server.Spells
// Paladins with magery of 70.0 or above are subject to a faster casting cap of 2
int fcMax = 4;
if ( CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy || ( CastSkill == SkillName.Chivalry && m_Caster.Skills[SkillName.Magery].Value >= 70.0 ) )
if ( CastSkill == SkillName.Magery || CastSkill == SkillName.Necromancy || ( CastSkill == SkillName.Chivalry && Caster.Skills[SkillName.Magery].Value >= 70.0 ) )
fcMax = 2;
int fc = AosAttributes.GetValue( m_Caster, AosAttribute.CastSpeed );
int fc = AosAttributes.GetValue( Caster, AosAttribute.CastSpeed );
if ( fc > fcMax )
fc = fcMax;
if ( ProtectionSpell.Registry.Contains( m_Caster ) )
if ( ProtectionSpell.Registry.Contains( Caster ) )
fc -= 2;
if ( EssenceOfWindSpell.IsDebuffed( m_Caster ) )
fc -= EssenceOfWindSpell.GetFCMalus( m_Caster );
if ( EssenceOfWindSpell.IsDebuffed( Caster ) )
fc -= EssenceOfWindSpell.GetFCMalus( Caster );
TimeSpan baseDelay = CastDelayBase;
@ -706,10 +702,10 @@ namespace Server.Spells
public virtual void FinishSequence()
{
m_State = SpellState.None;
State = SpellState.None;
if ( m_Caster.Spell == this )
m_Caster.Spell = null;
if ( Caster.Spell == this )
Caster.Spell = null;
}
public virtual int ComputeKarmaAward()
@ -721,59 +717,59 @@ namespace Server.Spells
{
int mana = ScaleMana( GetMana() );
if ( m_Caster.Deleted || !m_Caster.Alive || m_Caster.Spell != this || m_State != SpellState.Sequencing )
if ( Caster.Deleted || !Caster.Alive || Caster.Spell != this || State != SpellState.Sequencing )
{
DoFizzle();
}
else if ( m_Scroll != null && !(m_Scroll is Runebook) && (m_Scroll.Amount <= 0 || m_Scroll.Deleted || m_Scroll.RootParent != m_Caster || (m_Scroll is BaseWand && (((BaseWand)m_Scroll).Charges <= 0 || m_Scroll.Parent != m_Caster))) )
else if ( Scroll != null && !(Scroll is Runebook) && (Scroll.Amount <= 0 || Scroll.Deleted || Scroll.RootParent != Caster || (Scroll is BaseWand && (((BaseWand)Scroll).Charges <= 0 || Scroll.Parent != Caster))) )
{
DoFizzle();
}
else if ( !ConsumeReagents() )
{
m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502630 ); // More reagents are needed for this spell.
Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502630 ); // More reagents are needed for this spell.
}
else if ( m_Caster.Mana < mana )
else if ( Caster.Mana < mana )
{
m_Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana for this spell.
Caster.LocalOverheadMessage( MessageType.Regular, 0x22, 502625 ); // Insufficient mana for this spell.
}
else if ( Core.AOS && (m_Caster.Frozen || m_Caster.Paralyzed) )
else if ( Core.AOS && (Caster.Frozen || Caster.Paralyzed) )
{
m_Caster.SendLocalizedMessage( 502646 ); // You cannot cast a spell while frozen.
Caster.SendLocalizedMessage( 502646 ); // You cannot cast a spell while frozen.
DoFizzle();
}
else if ( m_Caster is PlayerMobile && ((PlayerMobile) m_Caster).PeacedUntil > DateTime.UtcNow )
else if ( Caster is PlayerMobile && ((PlayerMobile) Caster).PeacedUntil > DateTime.UtcNow )
{
m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
DoFizzle();
}
else if ( CheckFizzle() )
{
m_Caster.Mana -= mana;
Caster.Mana -= mana;
if ( m_Scroll is SpellScroll )
m_Scroll.Consume();
else if ( m_Scroll is BaseWand )
if ( Scroll is SpellScroll )
Scroll.Consume();
else if ( Scroll is BaseWand )
{
((BaseWand)m_Scroll).ConsumeCharge( m_Caster );
m_Caster.RevealingAction();
((BaseWand)Scroll).ConsumeCharge( Caster );
Caster.RevealingAction();
}
if ( m_Scroll is BaseWand )
if ( Scroll is BaseWand )
{
bool m = m_Scroll.Movable;
bool m = Scroll.Movable;
m_Scroll.Movable = false;
Scroll.Movable = false;
if ( ClearHandsOnCast )
m_Caster.ClearHands();
Caster.ClearHands();
m_Scroll.Movable = m;
Scroll.Movable = m;
}
else
{
if ( ClearHandsOnCast )
m_Caster.ClearHands();
Caster.ClearHands();
}
int karma = ComputeKarmaAward();
@ -781,17 +777,17 @@ namespace Server.Spells
if ( karma != 0 )
Misc.Titles.AwardKarma( Caster, karma, true );
if ( TransformationSpellHelper.UnderTransformation( m_Caster, typeof( VampiricEmbraceSpell ) ) )
if ( TransformationSpellHelper.UnderTransformation( Caster, typeof( VampiricEmbraceSpell ) ) )
{
bool garlic = false;
for ( int i = 0; !garlic && i < m_Info.Reagents.Length; ++i )
garlic = ( m_Info.Reagents[i] == Reagent.Garlic );
for ( int i = 0; !garlic && i < Info.Reagents.Length; ++i )
garlic = ( Info.Reagents[i] == Reagent.Garlic );
if ( garlic )
{
m_Caster.SendLocalizedMessage( 1061651 ); // The garlic burns you!
AOS.Damage( m_Caster, Utility.RandomMinMax( 17, 23 ), 100, 0, 0, 0, 0 );
Caster.SendLocalizedMessage( 1061651 ); // The garlic burns you!
AOS.Damage( Caster, Utility.RandomMinMax( 17, 23 ), 100, 0, 0, 0, 0 );
}
}
@ -814,7 +810,7 @@ namespace Server.Spells
{
if ( !target.Alive && !allowDead )
{
m_Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that!
Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that!
return false;
}
@ -830,7 +826,7 @@ namespace Server.Spells
{
if ( !target.Alive )
{
m_Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that!
Caster.SendLocalizedMessage( 501857 ); // This spell won't work on that!
return false;
}
@ -855,16 +851,16 @@ namespace Server.Spells
protected override void OnTick()
{
if ( m_Spell.State != SpellState.Casting || m_Spell.m_Caster.Spell != m_Spell )
if ( m_Spell.State != SpellState.Casting || m_Spell.Caster.Spell != m_Spell )
{
Stop();
return;
}
if ( !m_Spell.Caster.Mounted && m_Spell.m_Info.Action >= 0 )
if ( !m_Spell.Caster.Mounted && m_Spell.Info.Action >= 0 )
{
if ( m_Spell.Caster.Body.IsHuman )
m_Spell.Caster.Animate( m_Spell.m_Info.Action, 7, 1, true, false, 0 );
m_Spell.Caster.Animate( m_Spell.Info.Action, 7, 1, true, false, 0 );
else if ( m_Spell.Caster.Player && m_Spell.Caster.Body.IsMonster )
m_Spell.Caster.Animate( 12, 7, 1, true, false, 0 );
}
@ -887,25 +883,25 @@ namespace Server.Spells
protected override void OnTick()
{
if ( m_Spell?.m_Caster == null )
if ( m_Spell?.Caster == null )
{
return;
}
if ( m_Spell.m_State == SpellState.Casting && m_Spell.m_Caster.Spell == m_Spell )
if ( m_Spell.State == SpellState.Casting && m_Spell.Caster.Spell == m_Spell )
{
m_Spell.m_State = SpellState.Sequencing;
m_Spell.State = SpellState.Sequencing;
m_Spell.m_CastTimer = null;
m_Spell.m_Caster.OnSpellCast( m_Spell );
m_Spell.m_Caster.Region?.OnSpellCast( m_Spell.m_Caster, m_Spell );
m_Spell.m_Caster.NextSpellTime = Core.TickCount + (int)m_Spell.GetCastRecovery().TotalMilliseconds; // Spell.NextSpellDelay;
m_Spell.Caster.OnSpellCast( m_Spell );
m_Spell.Caster.Region?.OnSpellCast( m_Spell.Caster, m_Spell );
m_Spell.Caster.NextSpellTime = Core.TickCount + (int)m_Spell.GetCastRecovery().TotalMilliseconds; // Spell.NextSpellDelay;
Target originalTarget = m_Spell.m_Caster.Target;
Target originalTarget = m_Spell.Caster.Target;
m_Spell.OnCast();
if ( m_Spell.m_Caster.Player && m_Spell.m_Caster.Target != originalTarget && m_Spell.Caster.Target != null )
m_Spell.m_Caster.Target.BeginTimeout( m_Spell.m_Caster, TimeSpan.FromSeconds( 30.0 ) );
if ( m_Spell.Caster.Player && m_Spell.Caster.Target != originalTarget && m_Spell.Caster.Target != null )
m_Spell.Caster.Target.BeginTimeout( m_Spell.Caster, TimeSpan.FromSeconds( 30.0 ) );
m_Spell.m_CastTimer = null;
}

View file

@ -278,13 +278,7 @@ namespace Server.Spells
return TimeSpan.FromSeconds( caster.Skills[SkillName.Magery].Value * 1.2 );
}
private static bool m_DisableSkillCheck;
public static bool DisableSkillCheck
{
get => m_DisableSkillCheck;
set => m_DisableSkillCheck = value;
}
public static bool DisableSkillCheck { get; set; }
public static double GetOffsetScalar( Mobile caster, Mobile target, bool curse )
{
@ -307,7 +301,7 @@ namespace Server.Spells
{
if ( Core.AOS )
{
if ( !m_DisableSkillCheck )
if ( !DisableSkillCheck )
{
caster.CheckSkill( SkillName.EvalInt, 0.0, 120.0 );
@ -1387,22 +1381,20 @@ namespace Server.Spells
public class TransformContext
{
private Timer m_Timer;
private List<ResistanceMod> m_Mods;
private Type m_Type;
private ITransformationSpell m_Spell;
public Timer Timer { get; }
public Timer Timer => m_Timer;
public List<ResistanceMod> Mods => m_Mods;
public Type Type => m_Type;
public ITransformationSpell Spell => m_Spell;
public List<ResistanceMod> Mods { get; }
public Type Type { get; }
public ITransformationSpell Spell { get; }
public TransformContext( Timer timer, List<ResistanceMod> mods, Type type, ITransformationSpell spell )
{
m_Timer = timer;
m_Mods = mods;
m_Type = type;
m_Spell = spell;
Timer = timer;
Mods = mods;
Type = type;
Spell = spell;
}
}

View file

@ -4,14 +4,6 @@ namespace Server.Spells
{
public class SpellInfo
{
private string m_Name;
private string m_Mantra;
private Type[] m_Reagents;
private int[] m_Amounts;
private int m_Action;
private bool m_AllowTown;
private int m_LeftHandEffect, m_RightHandEffect;
public SpellInfo( string name, string mantra, params Type[] regs ) : this( name, mantra, 16, 0, 0, true, regs )
{
}
@ -38,44 +30,35 @@ namespace Server.Spells
public SpellInfo( string name, string mantra, int action, int leftHandEffect, int rightHandEffect, bool allowTown, params Type[] regs )
{
m_Name = name;
m_Mantra = mantra;
m_Action = action;
m_Reagents = regs;
m_AllowTown = allowTown;
Name = name;
Mantra = mantra;
Action = action;
Reagents = regs;
AllowTown = allowTown;
m_LeftHandEffect = leftHandEffect;
m_RightHandEffect = rightHandEffect;
LeftHandEffect = leftHandEffect;
RightHandEffect = rightHandEffect;
m_Amounts = new int[regs.Length];
Amounts = new int[regs.Length];
for ( int i = 0; i < regs.Length; ++i )
m_Amounts[i] = 1;
Amounts[i] = 1;
}
public int Action{ get => m_Action;
set => m_Action = value;
}
public bool AllowTown{ get => m_AllowTown;
set => m_AllowTown = value;
}
public int[] Amounts{ get => m_Amounts;
set => m_Amounts = value;
}
public string Mantra{ get => m_Mantra;
set => m_Mantra = value;
}
public string Name{ get => m_Name;
set => m_Name = value;
}
public Type[] Reagents{ get => m_Reagents;
set => m_Reagents = value;
}
public int LeftHandEffect{ get => m_LeftHandEffect;
set => m_LeftHandEffect = value;
}
public int RightHandEffect{ get => m_RightHandEffect;
set => m_RightHandEffect = value;
}
public int Action { get; set; }
public bool AllowTown { get; set; }
public int[] Amounts { get; set; }
public string Mantra { get; set; }
public string Name { get; set; }
public Type[] Reagents { get; set; }
public int LeftHandEffect { get; set; }
public int RightHandEffect { get; set; }
}
}

View file

@ -37,8 +37,7 @@ namespace Server.Spells
private static Dictionary<Type, int> m_IDsFromTypes = new Dictionary<Type, int>( m_Types.Length );
private static Dictionary<int, SpecialMove> m_SpecialMoves = new Dictionary<int, SpecialMove>();
public static Dictionary<int, SpecialMove> SpecialMoves => m_SpecialMoves;
public static Dictionary<int, SpecialMove> SpecialMoves { get; } = new Dictionary<int, SpecialMove>();
public static int GetRegistryNumber( ISpell s )
{
@ -84,7 +83,7 @@ namespace Server.Spells
}
if ( spm != null )
m_SpecialMoves.Add( spellID, spm );
SpecialMoves.Add( spellID, spm );
}
}
@ -95,10 +94,10 @@ namespace Server.Spells
Type t = m_Types[spellID];
if ( t == null || !t.IsSubclassOf( typeof( SpecialMove ) ) || !m_SpecialMoves.ContainsKey( spellID ) )
if ( t == null || !t.IsSubclassOf( typeof( SpecialMove ) ) || !SpecialMoves.ContainsKey( spellID ) )
return null;
return m_SpecialMoves[spellID];
return SpecialMoves[spellID];
}
private static object[] m_Params = new object[2];

View file

@ -58,20 +58,14 @@ namespace Server.Spells.First
public class FoodInfo
{
private Type m_Type;
private string m_Name;
public Type Type { get; set; }
public Type Type{ get => m_Type;
set => m_Type = value;
}
public string Name{ get => m_Name;
set => m_Name = value;
}
public string Name { get; set; }
public FoodInfo( Type type, string name )
{
m_Type = type;
m_Name = name;
Type = type;
Name = name;
}
public Item Create()
@ -80,7 +74,7 @@ namespace Server.Spells.First
try
{
item = (Item)Activator.CreateInstance( m_Type );
item = (Item)Activator.CreateInstance( Type );
}
catch
{

View file

@ -26,13 +26,11 @@ namespace Server.Spells.Necromancy
{
}
private static Hashtable m_Table = new Hashtable();
public static Hashtable Table => m_Table;
public static Hashtable Table { get; } = new Hashtable();
public override bool CheckCast()
{
BaseCreature check = (BaseCreature)m_Table[Caster];
BaseCreature check = (BaseCreature)Table[Caster];
if ( check != null && !check.Deleted )
{
@ -48,41 +46,38 @@ namespace Server.Spells.Necromancy
if ( CheckSequence() )
{
Caster.CloseGump( typeof( SummonFamiliarGump ) );
Caster.SendGump( new SummonFamiliarGump( Caster, m_Entries, this ) );
Caster.SendGump( new SummonFamiliarGump( Caster, Entries, this ) );
}
FinishSequence();
}
private static SummonFamiliarEntry[] m_Entries = {
new SummonFamiliarEntry( typeof( HordeMinionFamiliar ), 1060146, 30.0, 30.0 ), // Horde Minion
new SummonFamiliarEntry( typeof( ShadowWispFamiliar ), 1060142, 50.0, 50.0 ), // Shadow Wisp
new SummonFamiliarEntry( typeof( DarkWolfFamiliar ), 1060143, 60.0, 60.0 ), // Dark Wolf
new SummonFamiliarEntry( typeof( DeathAdder ), 1060145, 80.0, 80.0 ), // Death Adder
new SummonFamiliarEntry( typeof( VampireBatFamiliar ), 1060144, 100.0, 100.0 ) // Vampire Bat
};
public static SummonFamiliarEntry[] Entries => m_Entries;
public static SummonFamiliarEntry[] Entries { get; } =
{
new SummonFamiliarEntry( typeof( HordeMinionFamiliar ), 1060146, 30.0, 30.0 ), // Horde Minion
new SummonFamiliarEntry( typeof( ShadowWispFamiliar ), 1060142, 50.0, 50.0 ), // Shadow Wisp
new SummonFamiliarEntry( typeof( DarkWolfFamiliar ), 1060143, 60.0, 60.0 ), // Dark Wolf
new SummonFamiliarEntry( typeof( DeathAdder ), 1060145, 80.0, 80.0 ), // Death Adder
new SummonFamiliarEntry( typeof( VampireBatFamiliar ), 1060144, 100.0, 100.0 ) // Vampire Bat
};
}
public class SummonFamiliarEntry
{
private Type m_Type;
private object m_Name;
private double m_ReqNecromancy;
private double m_ReqSpiritSpeak;
public Type Type { get; }
public Type Type => m_Type;
public object Name => m_Name;
public double ReqNecromancy => m_ReqNecromancy;
public double ReqSpiritSpeak => m_ReqSpiritSpeak;
public object Name { get; }
public double ReqNecromancy { get; }
public double ReqSpiritSpeak { get; }
public SummonFamiliarEntry( Type type, object name, double reqNecromancy, double reqSpiritSpeak )
{
m_Type = type;
m_Name = name;
m_ReqNecromancy = reqNecromancy;
m_ReqSpiritSpeak = reqSpiritSpeak;
Type = type;
Name = name;
ReqNecromancy = reqNecromancy;
ReqSpiritSpeak = reqSpiritSpeak;
}
}

View file

@ -126,7 +126,7 @@ namespace Server.Spells.Ninjitsu
if (GetLastAnimalForm(Caster) == -1 || !skipGump)
{
Caster.CloseGump(typeof(AnimalFormGump));
Caster.SendGump(new AnimalFormGump(Caster, m_Entries, this));
Caster.SendGump(new AnimalFormGump(Caster, Entries, this));
}
else
{
@ -177,10 +177,10 @@ namespace Server.Spells.Ninjitsu
public static MorphResult Morph(Mobile m, int entryID)
{
if (entryID < 0 || entryID >= m_Entries.Length)
if (entryID < 0 || entryID >= Entries.Length)
return MorphResult.Fail;
AnimalFormEntry entry = m_Entries[entryID];
AnimalFormEntry entry = Entries[entryID];
m_LastAnimalForms[m] = entryID; //On OSI, it's the last /attempted/ one not the last succeeded one
@ -320,30 +320,29 @@ namespace Server.Spells.Ninjitsu
public class AnimalFormEntry
{
private Type m_Type;
private TextDefinition m_Name;
private int m_ItemID;
private int m_Hue;
private int m_Tooltip;
private double m_ReqSkill;
private int m_BodyMod;
private int m_HueModMin;
private int m_HueModMax;
private bool m_StealthBonus;
private bool m_SpeedBoost;
private bool m_StealingBonus;
public Type Type => m_Type;
public TextDefinition Name => m_Name;
public int ItemID => m_ItemID;
public int Hue => m_Hue;
public int Tooltip => m_Tooltip;
public double ReqSkill => m_ReqSkill;
public int BodyMod => m_BodyMod;
public Type Type { get; }
public TextDefinition Name { get; }
public int ItemID { get; }
public int Hue { get; }
public int Tooltip { get; }
public double ReqSkill { get; }
public int BodyMod { get; }
public int HueMod => Utility.RandomMinMax( m_HueModMin, m_HueModMax );
public bool StealthBonus => m_StealthBonus;
public bool SpeedBoost => m_SpeedBoost;
public bool StealingBonus => m_StealingBonus;
public bool StealthBonus { get; }
public bool SpeedBoost { get; }
public bool StealingBonus { get; }
/*
private AnimalFormCallback m_TransformCallback;
private AnimalFormCallback m_UntransformCallback;
@ -352,41 +351,40 @@ namespace Server.Spells.Ninjitsu
public AnimalFormEntry(Type type, TextDefinition name, int itemID, int hue, int tooltip, double reqSkill, int bodyMod, int hueModMin, int hueModMax, bool stealthBonus, bool speedBoost, bool stealingBonus)
{
m_Type = type;
m_Name = name;
m_ItemID = itemID;
m_Hue = hue;
m_Tooltip = tooltip;
m_ReqSkill = reqSkill;
m_BodyMod = bodyMod;
Type = type;
Name = name;
ItemID = itemID;
Hue = hue;
Tooltip = tooltip;
ReqSkill = reqSkill;
BodyMod = bodyMod;
m_HueModMin = hueModMin;
m_HueModMax = hueModMax;
m_StealthBonus = stealthBonus;
m_SpeedBoost = speedBoost;
m_StealingBonus = stealingBonus;
StealthBonus = stealthBonus;
SpeedBoost = speedBoost;
StealingBonus = stealingBonus;
}
}
private static AnimalFormEntry[] m_Entries = {
new AnimalFormEntry( typeof( Kirin ), 1029632, 9632, 0, 1070811, 100.0, 0x84, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( Unicorn ), 1018214, 9678, 0, 1070812, 100.0, 0x7A, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( BakeKitsune ), 1030083, 10083, 0, 1070810, 82.5, 0xF6, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( GreyWolf ), 1028482, 9681, 2309, 1070810, 82.5, 0x19, 0x8FD, 0x90E, false, true, false ),
new AnimalFormEntry( typeof( Llama ), 1028438, 8438, 0, 1070809, 70.0, 0xDC, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( ForestOstard ), 1018273, 8503, 2212, 1070809, 70.0, 0xDB, 0x899, 0x8B0, false, true, false ),
new AnimalFormEntry( typeof( BullFrog ), 1028496, 8496, 2003, 1070807, 50.0, 0x51, 0x7D1, 0x7D6, false, false, false ),
new AnimalFormEntry( typeof( GiantSerpent ), 1018114, 9663, 2009, 1070808, 50.0, 0x15, 0x7D1, 0x7E2, false, false, false ),
new AnimalFormEntry( typeof( Dog ), 1018280, 8476, 2309, 1070806, 40.0, 0xD9, 0x8FD, 0x90E, false, false, false ),
new AnimalFormEntry( typeof( Cat ), 1018264, 8475, 2309, 1070806, 40.0, 0xC9, 0x8FD, 0x90E, false, false, false ),
new AnimalFormEntry( typeof( Rat ), 1018294, 8483, 2309, 1070805, 20.0, 0xEE, 0x8FD, 0x90E, true, false, false ),
new AnimalFormEntry( typeof( Rabbit ), 1028485, 8485, 2309, 1070805, 20.0, 0xCD, 0x8FD, 0x90E, true, false, false ),
new AnimalFormEntry( typeof( Squirrel ), 1031671, 11671, 0, 0, 20.0, 0x116, 0, 0, false, false, false ),
new AnimalFormEntry( typeof( Ferret ), 1031672, 11672, 0, 1075220, 40.0, 0x117, 0, 0, false, false, true ),
new AnimalFormEntry( typeof( CuSidhe ), 1031670, 11670, 0, 1075221, 60.0, 0x115, 0, 0, false, false, false ),
new AnimalFormEntry( typeof( Reptalon ), 1075202, 11669, 0, 1075222, 90.0, 0x114, 0, 0, false, false, false ),
};
public static AnimalFormEntry[] Entries => m_Entries;
public static AnimalFormEntry[] Entries { get; } =
{
new AnimalFormEntry( typeof( Kirin ), 1029632, 9632, 0, 1070811, 100.0, 0x84, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( Unicorn ), 1018214, 9678, 0, 1070812, 100.0, 0x7A, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( BakeKitsune ), 1030083, 10083, 0, 1070810, 82.5, 0xF6, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( GreyWolf ), 1028482, 9681, 2309, 1070810, 82.5, 0x19, 0x8FD, 0x90E, false, true, false ),
new AnimalFormEntry( typeof( Llama ), 1028438, 8438, 0, 1070809, 70.0, 0xDC, 0, 0, false, true, false ),
new AnimalFormEntry( typeof( ForestOstard ), 1018273, 8503, 2212, 1070809, 70.0, 0xDB, 0x899, 0x8B0, false, true, false ),
new AnimalFormEntry( typeof( BullFrog ), 1028496, 8496, 2003, 1070807, 50.0, 0x51, 0x7D1, 0x7D6, false, false, false ),
new AnimalFormEntry( typeof( GiantSerpent ), 1018114, 9663, 2009, 1070808, 50.0, 0x15, 0x7D1, 0x7E2, false, false, false ),
new AnimalFormEntry( typeof( Dog ), 1018280, 8476, 2309, 1070806, 40.0, 0xD9, 0x8FD, 0x90E, false, false, false ),
new AnimalFormEntry( typeof( Cat ), 1018264, 8475, 2309, 1070806, 40.0, 0xC9, 0x8FD, 0x90E, false, false, false ),
new AnimalFormEntry( typeof( Rat ), 1018294, 8483, 2309, 1070805, 20.0, 0xEE, 0x8FD, 0x90E, true, false, false ),
new AnimalFormEntry( typeof( Rabbit ), 1028485, 8485, 2309, 1070805, 20.0, 0xCD, 0x8FD, 0x90E, true, false, false ),
new AnimalFormEntry( typeof( Squirrel ), 1031671, 11671, 0, 0, 20.0, 0x116, 0, 0, false, false, false ),
new AnimalFormEntry( typeof( Ferret ), 1031672, 11672, 0, 1075220, 40.0, 0x117, 0, 0, false, false, true ),
new AnimalFormEntry( typeof( CuSidhe ), 1031670, 11670, 0, 1075221, 60.0, 0x115, 0, 0, false, false, false ),
new AnimalFormEntry( typeof( Reptalon ), 1075202, 11669, 0, 1075222, 90.0, 0x114, 0, 0, false, false, false ),
};
public class AnimalFormGump : Gump
{
@ -462,7 +460,7 @@ namespace Server.Spells.Ninjitsu
{
int entryID = info.ButtonID - 1;
if (entryID < 0 || entryID >= m_Entries.Length)
if (entryID < 0 || entryID >= AnimalForm.Entries.Length)
return;
int mana = m_Spell.ScaleMana(m_Spell.RequiredMana);
@ -501,25 +499,23 @@ namespace Server.Spells.Ninjitsu
public class AnimalFormContext
{
private Timer m_Timer;
private SkillMod m_Mod;
private bool m_SpeedBoost;
private Type m_Type;
private SkillMod m_StealingMod;
public Timer Timer { get; }
public Timer Timer => m_Timer;
public SkillMod Mod => m_Mod;
public bool SpeedBoost => m_SpeedBoost;
public Type Type => m_Type;
public SkillMod StealingMod => m_StealingMod;
public SkillMod Mod { get; }
public bool SpeedBoost { get; }
public Type Type { get; }
public SkillMod StealingMod { get; }
public AnimalFormContext(Timer timer, SkillMod mod, bool speedBoost, Type type, SkillMod stealingMod)
{
m_Timer = timer;
m_Mod = mod;
m_SpeedBoost = speedBoost;
m_Type = type;
m_StealingMod = stealingMod;
Timer = timer;
Mod = mod;
SpeedBoost = speedBoost;
Type = type;
StealingMod = stealingMod;
}
}

View file

@ -5,8 +5,7 @@ namespace Server.Spells.Second
{
public class ProtectionSpell : MagerySpell
{
private static Hashtable m_Registry = new Hashtable();
public static Hashtable Registry => m_Registry;
public static Hashtable Registry { get; } = new Hashtable();
private static SpellInfo m_Info = new SpellInfo(
"Protection", "Uus Sanct",
@ -28,7 +27,7 @@ namespace Server.Spells.Second
if ( Core.AOS )
return true;
if ( m_Registry.ContainsKey( Caster ) )
if ( Registry.ContainsKey( Caster ) )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
return false;
@ -122,7 +121,7 @@ namespace Server.Spells.Second
}
else
{
if ( m_Registry.ContainsKey( Caster ) )
if ( Registry.ContainsKey( Caster ) )
{
Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
}

View file

@ -65,24 +65,22 @@ namespace Server.Spells.Spellweaving
private class EssenceOfWindInfo
{
private Mobile m_Defender;
private int m_FCMalus;
private int m_SSIMalus;
private ExpireTimer m_Timer;
public Mobile Defender { get; }
public Mobile Defender => m_Defender;
public int FCMalus => m_FCMalus;
public int SSIMalus => m_SSIMalus;
public ExpireTimer Timer => m_Timer;
public int FCMalus { get; }
public int SSIMalus { get; }
public ExpireTimer Timer { get; }
public EssenceOfWindInfo( Mobile defender, int fcMalus, int ssiMalus, TimeSpan duration )
{
m_Defender = defender;
m_FCMalus = fcMalus;
m_SSIMalus = ssiMalus;
Defender = defender;
FCMalus = fcMalus;
SSIMalus = ssiMalus;
m_Timer = new ExpireTimer( m_Defender, duration );
m_Timer.Start();
Timer = new ExpireTimer( Defender, duration );
Timer.Start();
}
}

View file

@ -157,15 +157,13 @@ namespace Server.Spells.Spellweaving
{
private Mobile m_Mobile;
private GiftOfLifeSpell m_Spell;
public GiftOfLifeSpell Spell => m_Spell;
public GiftOfLifeSpell Spell { get; }
public ExpireTimer( Mobile m, TimeSpan delay, GiftOfLifeSpell spell )
: base( delay )
{
m_Mobile = m;
m_Spell = spell;
Spell = spell;
}
protected override void OnTick()

View file

@ -6,14 +6,8 @@ namespace Server.Items
{
public override int LabelNumber => 1032629; // Arcane Focus
private int m_StrengthBonus;
[CommandProperty( AccessLevel.GameMaster )]
public int StrengthBonus
{
get => m_StrengthBonus;
set => m_StrengthBonus = value;
}
public int StrengthBonus { get; set; }
[Constructible]
public ArcaneFocus()
@ -30,7 +24,7 @@ namespace Server.Items
public ArcaneFocus( TimeSpan lifeSpan, int strengthBonus ) : base( 0x3155, lifeSpan )
{
LootType = LootType.Blessed;
m_StrengthBonus = strengthBonus;
StrengthBonus = strengthBonus;
}
public ArcaneFocus( Serial serial ) : base( serial )
@ -41,7 +35,7 @@ namespace Server.Items
{
base.GetProperties( list );
list.Add( 1060485, m_StrengthBonus.ToString() ); // strength bonus ~1_val~
list.Add( 1060485, StrengthBonus.ToString() ); // strength bonus ~1_val~
}
public override TextDefinition InvalidTransferMessage => 1073480; // Your arcane focus disappears.
@ -52,7 +46,7 @@ namespace Server.Items
base.Serialize( writer );
writer.Write( (int)0 );
writer.Write( m_StrengthBonus );
writer.Write( StrengthBonus );
}
public override void Deserialize( GenericReader reader )
@ -60,7 +54,7 @@ namespace Server.Items
base.Deserialize( reader );
int version = reader.ReadInt();
m_StrengthBonus = reader.ReadInt();
StrengthBonus = reader.ReadInt();
}
}
}

View file

@ -4,23 +4,11 @@ namespace Server.Items
{
public class TransientItem : Item
{
private TimeSpan m_LifeSpan;
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan LifeSpan { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan LifeSpan
{
get => m_LifeSpan;
set => m_LifeSpan = value;
}
private DateTime m_CreationTime;
[CommandProperty( AccessLevel.GameMaster )]
public DateTime CreationTime
{
get => m_CreationTime;
set => m_CreationTime = value;
}
public DateTime CreationTime { get; set; }
private Timer m_Timer;
@ -48,7 +36,7 @@ namespace Server.Items
public virtual void SendTimeRemainingMessage( Mobile to )
{
to.SendLocalizedMessage( 1072516,
$"{Name ?? $"#{LabelNumber}"}\t{(int) m_LifeSpan.TotalSeconds}"); // ~1_name~ will expire in ~2_val~ seconds!
$"{Name ?? $"#{LabelNumber}"}\t{(int) LifeSpan.TotalSeconds}"); // ~1_name~ will expire in ~2_val~ seconds!
}
public override void OnDelete()
@ -60,7 +48,7 @@ namespace Server.Items
public virtual void CheckExpiry()
{
if ( (m_CreationTime + m_LifeSpan) < DateTime.UtcNow )
if ( (CreationTime + LifeSpan) < DateTime.UtcNow )
Expire( RootParent as Mobile );
else
InvalidateProperties();
@ -70,8 +58,8 @@ namespace Server.Items
public TransientItem( int itemID, TimeSpan lifeSpan )
: base( itemID )
{
m_CreationTime = DateTime.UtcNow;
m_LifeSpan = lifeSpan;
CreationTime = DateTime.UtcNow;
LifeSpan = lifeSpan;
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), CheckExpiry );
}
@ -85,7 +73,7 @@ namespace Server.Items
{
base.GetProperties( list );
TimeSpan remaining = ((m_CreationTime + m_LifeSpan) - DateTime.UtcNow);
TimeSpan remaining = ((CreationTime + LifeSpan) - DateTime.UtcNow);
list.Add( 1072517, ((int)remaining.TotalSeconds).ToString() ); // Lifespan: ~1_val~ seconds
}
@ -95,8 +83,8 @@ namespace Server.Items
base.Serialize( writer );
writer.Write( (int)0 );
writer.Write( m_LifeSpan );
writer.Write( m_CreationTime );
writer.Write( LifeSpan );
writer.Write( CreationTime );
}
public override void Deserialize( GenericReader reader )
@ -104,8 +92,8 @@ namespace Server.Items
base.Deserialize( reader );
int version = reader.ReadInt();
m_LifeSpan = reader.ReadTimeSpan();
m_CreationTime = reader.ReadDateTime();
LifeSpan = reader.ReadTimeSpan();
CreationTime = reader.ReadDateTime();
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), CheckExpiry );
}