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

@ -7,16 +7,10 @@ namespace Server.Mobiles
public class PlagueBeast : BaseCreature, IDevourer
{
public override string CorpseName => "a plague beast corpse";
private int m_DevourTotal;
private int m_DevourGoal;
private bool m_HasMetalChest;
[CommandProperty( AccessLevel.GameMaster )]
public int TotalDevoured
{
get => m_DevourTotal;
set => m_DevourTotal = value;
}
public int TotalDevoured { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int DevourGoal
@ -26,7 +20,7 @@ namespace Server.Mobiles
}
[CommandProperty( AccessLevel.GameMaster )]
public bool HasMetalChest => m_HasMetalChest;
public bool HasMetalChest { get; private set; }
public override string DefaultName => "a plague beast";
@ -67,7 +61,7 @@ namespace Server.Mobiles
if ( Core.ML && Utility.RandomDouble() < 0.33 )
PackItem( Engines.Plants.Seed.RandomPeculiarSeed(4) );
m_DevourTotal = 0;
TotalDevoured = 0;
m_DevourGoal = Utility.RandomMinMax( 15, 25 ); // How many corpses must be devoured before a metal chest is awarded
}
@ -151,8 +145,8 @@ namespace Server.Mobiles
base.Serialize( writer );
writer.Write( (int) 1 );
writer.Write( m_HasMetalChest );
writer.Write( m_DevourTotal );
writer.Write( HasMetalChest );
writer.Write( TotalDevoured );
writer.Write( m_DevourGoal );
}
@ -165,8 +159,8 @@ namespace Server.Mobiles
{
case 1:
{
m_HasMetalChest = reader.ReadBool();
m_DevourTotal = reader.ReadInt();
HasMetalChest = reader.ReadBool();
TotalDevoured = reader.ReadInt();
m_DevourGoal = reader.ReadInt();
break;
}
@ -203,14 +197,14 @@ namespace Server.Mobiles
corpse.TurnToBones(); // Not bones yet, and we are a human body therefore we turn to bones.
IncreaseHits( (int)Math.Ceiling( (double)corpse.Owner.HitsMax * 0.75 ) );
m_DevourTotal++;
TotalDevoured++;
PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053033 ); // * The plague beast absorbs the fleshy remains of the corpse *
if ( !m_HasMetalChest && m_DevourTotal >= DevourGoal )
if ( !HasMetalChest && TotalDevoured >= DevourGoal )
{
PackItem( new MetalChest() );
m_HasMetalChest = true;
HasMetalChest = true;
}
return true;

View file

@ -9,14 +9,8 @@ namespace Server.Mobiles
public override string CorpseName => "a plague beast lord corpse";
public override Poison PoisonImmune => Poison.Lethal;
private Mobile m_OpenedBy;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile OpenedBy
{
get => m_OpenedBy;
set => m_OpenedBy = value;
}
public Mobile OpenedBy { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool IsBleeding
@ -80,7 +74,7 @@ namespace Server.Mobiles
{
if ( IsAccessibleTo( from ) )
{
if ( m_OpenedBy != null && Backpack != null )
if ( OpenedBy != null && Backpack != null )
Backpack.DisplayTo( from );
else
PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1071917, from.NetState ); // * You attempt to tear open the amorphous flesh, but it resists *
@ -105,8 +99,8 @@ namespace Server.Mobiles
public override void OnDelete()
{
if ( m_OpenedBy?.Holding is PlagueBeastInnard )
m_OpenedBy.Holding.Delete();
if ( OpenedBy?.Holding is PlagueBeastInnard )
OpenedBy.Holding.Delete();
if ( Backpack != null )
{
@ -190,7 +184,7 @@ namespace Server.Mobiles
if ( !InRange( check, 2 ) )
PrivateOverheadMessage( MessageType.Label, 0x3B2, 500446, check.NetState ); // That is too far away.
else if ( m_OpenedBy != null && m_OpenedBy != check )
else if ( OpenedBy != null && OpenedBy != check )
PrivateOverheadMessage( MessageType.Label, 0x3B2, 500365, check.NetState ); // That is being used by someone else
else if ( Frozen )
return true;
@ -200,9 +194,9 @@ namespace Server.Mobiles
public virtual void Carve( Mobile from, Item item )
{
if ( m_OpenedBy == null && IsAccessibleTo( from ) )
if ( OpenedBy == null && IsAccessibleTo( from ) )
{
m_OpenedBy = from;
OpenedBy = from;
if ( m_Timer == null )
m_Timer = new DecayTimer( this );
@ -243,7 +237,7 @@ namespace Server.Mobiles
Frozen = false;
Blessed = false;
if ( m_OpenedBy == null )
if ( OpenedBy == null )
Hue = 0;
}
@ -257,7 +251,7 @@ namespace Server.Mobiles
writer.WriteEncodedInt( 0 ); // version
writer.Write( m_OpenedBy );
writer.Write( OpenedBy );
if ( m_Timer != null )
{
@ -275,7 +269,7 @@ namespace Server.Mobiles
int version = reader.ReadEncodedInt();
m_OpenedBy = reader.ReadMobile();
OpenedBy = reader.ReadMobile();
if ( reader.ReadBool() )
{
@ -293,12 +287,10 @@ namespace Server.Mobiles
private class DecayTimer : Timer
{
private PlagueBeastLord m_Lord;
private int m_Count;
private int m_Deadline;
public int Count => m_Count;
public int Count { get; private set; }
public int Deadline => m_Deadline;
public int Deadline { get; private set; }
public DecayTimer( PlagueBeastLord lord ) : this( lord, 0, 120 )
{
@ -307,8 +299,8 @@ namespace Server.Mobiles
public DecayTimer( PlagueBeastLord lord, int count, int deadline ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ) )
{
m_Lord = lord;
m_Count = count;
m_Deadline = deadline;
Count = count;
Deadline = deadline;
}
protected override void OnTick()
@ -319,22 +311,22 @@ namespace Server.Mobiles
return;
}
if ( m_Count + 15 == m_Deadline )
if ( Count + 15 == Deadline )
{
if ( m_Lord.OpenedBy != null )
m_Lord.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071921 ); // * The plague beast begins to bubble and dissolve! *
m_Lord.PlaySound( 0x103 );
}
else if ( m_Count + 10 == m_Deadline )
else if ( Count + 10 == Deadline )
{
m_Lord.PlaySound( 0x21 );
}
else if ( m_Count + 5 == m_Deadline )
else if ( Count + 5 == Deadline )
{
m_Lord.PlaySound( 0x1C2 );
}
else if ( m_Count == m_Deadline )
else if ( Count == Deadline )
{
m_Lord.Unfreeze();
@ -343,15 +335,15 @@ namespace Server.Mobiles
Stop();
}
else if ( m_Count % 15 == 0 )
else if ( Count % 15 == 0 )
m_Lord.PlaySound( 0x1BF );
m_Count++;
Count++;
}
public void StartDissolving()
{
m_Deadline = Math.Min( m_Count + 60, m_Deadline );
Deadline = Math.Min( Count + 60, Deadline );
}
}
}

View file

@ -7,22 +7,12 @@ namespace Server.Mobiles
public class PlagueSpawn : BaseCreature
{
public override string CorpseName => "a plague spawn corpse";
private Mobile m_Owner;
private DateTime m_ExpireTime;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner
{
get => m_Owner;
set => m_Owner = value;
}
public Mobile Owner { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public DateTime ExpireTime
{
get => m_ExpireTime;
set => m_ExpireTime = value;
}
public DateTime ExpireTime { get; set; }
[Constructible]
public PlagueSpawn() : this( null )
@ -48,7 +38,7 @@ namespace Server.Mobiles
public override void OnThink()
{
if ( m_Owner != null && ( DateTime.UtcNow >= m_ExpireTime || m_Owner.Deleted || Map != m_Owner.Map || !InRange( m_Owner, 16 ) ) )
if ( Owner != null && ( DateTime.UtcNow >= ExpireTime || Owner.Deleted || Map != Owner.Map || !InRange( Owner, 16 ) ) )
{
PlaySound( GetIdleSound() );
Delete();
@ -63,8 +53,8 @@ namespace Server.Mobiles
public PlagueSpawn( Mobile owner ) : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
m_Owner = owner;
m_ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 );
Owner = owner;
ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 );
Hue = Utility.Random( 0x11, 15 );