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

@ -9,16 +9,13 @@ namespace Server.Mobiles
public override string CorpseName => "a demon knight corpse";
public override bool IgnoreYoungProtection => Core.ML;
public static Type[] ArtifactRarity10 => m_ArtifactRarity10;
public static Type[] ArtifactRarity11 => m_ArtifactRarity11;
private static Type[] m_ArtifactRarity10 =
public static Type[] ArtifactRarity10 { get; } =
{
typeof( LegacyOfTheDreadLord ),
typeof( TheTaskmaster )
};
private static Type[] m_ArtifactRarity11 =
public static Type[] ArtifactRarity11 { get; } =
{
typeof( TheDragonSlayer ),
typeof( ArmorOfFortune ),
@ -58,18 +55,18 @@ namespace Server.Mobiles
if ( !Core.AOS )
return null;
int count = ( m_ArtifactRarity10.Length * 5 ) + ( m_ArtifactRarity11.Length * 4 );
int count = ( ArtifactRarity10.Length * 5 ) + ( ArtifactRarity11.Length * 4 );
int random = Utility.Random( count );
Type type;
if ( random < ( m_ArtifactRarity10.Length * 5 ) )
if ( random < ( ArtifactRarity10.Length * 5 ) )
{
type = m_ArtifactRarity10[random / 5];
type = ArtifactRarity10[random / 5];
}
else
{
random -= m_ArtifactRarity10.Length * 5;
type = m_ArtifactRarity11[random / 4];
random -= ArtifactRarity10.Length * 5;
type = ArtifactRarity11[random / 4];
}
return Loot.Construct( type );

View file

@ -6,8 +6,7 @@ namespace Server.Mobiles
public class BlackSolenQueen : BaseCreature
{
public override string CorpseName => "a solen queen corpse";
private bool m_BurstSac;
public bool BurstSac => m_BurstSac;
public bool BurstSac { get; private set; }
public override string DefaultName => "a black solen queen";
@ -100,7 +99,7 @@ namespace Server.Mobiles
if ( Hits < 50 )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" );
m_BurstSac = true;
BurstSac = true;
}
}
else if ( from != null && from != this && InRange( from, 1 ) )
@ -127,7 +126,7 @@ namespace Server.Mobiles
{
base.Serialize( writer );
writer.Write( (int) 1 );
writer.Write( m_BurstSac );
writer.Write( BurstSac );
}
public override void Deserialize( GenericReader reader )
@ -139,7 +138,7 @@ namespace Server.Mobiles
{
case 1:
{
m_BurstSac = reader.ReadBool();
BurstSac = reader.ReadBool();
break;
}
}

View file

@ -6,8 +6,7 @@ namespace Server.Mobiles
public class BlackSolenWarrior : BaseCreature
{
public override string CorpseName => "a solen warrior corpse";
private bool m_BurstSac;
public bool BurstSac => m_BurstSac;
public bool BurstSac { get; private set; }
public override string DefaultName => "a black solen warrior";
@ -101,7 +100,7 @@ namespace Server.Mobiles
if ( Hits < 50 )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" );
m_BurstSac = true;
BurstSac = true;
}
}
else if ( from != null && from != this && InRange( from, 1 ) )
@ -128,7 +127,7 @@ namespace Server.Mobiles
{
base.Serialize( writer );
writer.Write( (int) 1 );
writer.Write( m_BurstSac );
writer.Write( BurstSac );
}
public override void Deserialize( GenericReader reader )
@ -140,7 +139,7 @@ namespace Server.Mobiles
{
case 1:
{
m_BurstSac = reader.ReadBool();
BurstSac = reader.ReadBool();
break;
}
}

View file

@ -6,8 +6,7 @@ namespace Server.Mobiles
public class RedSolenQueen : BaseCreature
{
public override string CorpseName => "a solen queen corpse";
private bool m_BurstSac;
public bool BurstSac => m_BurstSac;
public bool BurstSac { get; private set; }
public override string DefaultName => "a red solen queen";
@ -100,7 +99,7 @@ namespace Server.Mobiles
if ( Hits < 50 )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" );
m_BurstSac = true;
BurstSac = true;
}
}
else if ( from != null && from != this && InRange( from, 1 ) )
@ -127,7 +126,7 @@ namespace Server.Mobiles
{
base.Serialize( writer );
writer.Write( (int) 1 );
writer.Write( m_BurstSac );
writer.Write( BurstSac );
}
public override void Deserialize( GenericReader reader )
@ -139,7 +138,7 @@ namespace Server.Mobiles
{
case 1:
{
m_BurstSac = reader.ReadBool();
BurstSac = reader.ReadBool();
break;
}
}

View file

@ -6,8 +6,7 @@ namespace Server.Mobiles
public class RedSolenWarrior : BaseCreature
{
public override string CorpseName => "a solen warrior corpse";
private bool m_BurstSac;
public bool BurstSac => m_BurstSac;
public bool BurstSac { get; private set; }
public override string DefaultName => "a red solen warrior";
@ -100,7 +99,7 @@ namespace Server.Mobiles
if ( Hits < 50 )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, true, "* The solen's acid sac is burst open! *" );
m_BurstSac = true;
BurstSac = true;
}
}
else if ( from != null && from != this && InRange( from, 1 ) )
@ -127,7 +126,7 @@ namespace Server.Mobiles
{
base.Serialize( writer );
writer.Write( (int) 1 );
writer.Write( m_BurstSac );
writer.Write( BurstSac );
}
public override void Deserialize( GenericReader reader )
@ -139,7 +138,7 @@ namespace Server.Mobiles
{
case 1:
{
m_BurstSac = reader.ReadBool();
BurstSac = reader.ReadBool();
break;
}
}

View file

@ -5,8 +5,8 @@ namespace Server.Mobiles
public class ExodusMinion : BaseCreature
{
public override string CorpseName => "a minion's corpse";
private bool m_FieldActive;
public bool FieldActive => m_FieldActive;
public bool FieldActive { get; private set; }
public bool CanUseField // TODO: an OSI bug prevents to verify this
=> Hits >= HitsMax * 9 / 10;
@ -53,7 +53,7 @@ namespace Server.Mobiles
case 2: PackItem( new ClockworkAssembly() ); break;
}
m_FieldActive = CanUseField;
FieldActive = CanUseField;
}
public override void GenerateLoot()
@ -93,13 +93,13 @@ namespace Server.Mobiles
public override void AlterMeleeDamageFrom( Mobile from, ref int damage )
{
if ( m_FieldActive )
if ( FieldActive )
damage = 0; // no melee damage when the field is up
}
public override void AlterSpellDamageFrom( Mobile from, ref int damage )
{
if ( !m_FieldActive )
if ( !FieldActive )
damage = 0; // no spell damage when the field is down
}
@ -110,14 +110,14 @@ namespace Server.Mobiles
SendEBolt( from );
}
if ( !m_FieldActive )
if ( !FieldActive )
{
// should there be an effect when spells nullifying is on?
FixedParticles( 0, 10, 0, 0x2522, EffectLayer.Waist );
}
else if ( m_FieldActive && !CanUseField )
else if ( FieldActive && !CanUseField )
{
m_FieldActive = false;
FieldActive = false;
// TODO: message and effect when field turns down; cannot be verified on OSI due to a bug
FixedParticles( 0x3735, 1, 30, 0x251F, EffectLayer.Waist );
@ -128,7 +128,7 @@ namespace Server.Mobiles
{
base.OnGotMeleeAttack( attacker );
if ( m_FieldActive )
if ( FieldActive )
{
FixedParticles( 0x376A, 20, 10, 0x2530, EffectLayer.Waist );
@ -148,15 +148,15 @@ namespace Server.Mobiles
base.OnThink();
// TODO: an OSI bug prevents to verify if the field can regenerate or not
if ( !m_FieldActive && !IsHurt() )
m_FieldActive = true;
if ( !FieldActive && !IsHurt() )
FieldActive = true;
}
public override bool Move( Direction d )
{
bool move = base.Move( d );
if ( move && m_FieldActive && Combatant != null )
if ( move && FieldActive && Combatant != null )
FixedParticles( 0, 10, 0, 0x2530, EffectLayer.Waist );
return move;
@ -185,7 +185,7 @@ namespace Server.Mobiles
base.Deserialize( reader );
int version = reader.ReadInt();
m_FieldActive = CanUseField;
FieldActive = CanUseField;
if ( Name == "Exodus Minion" )
Name = null;

View file

@ -5,8 +5,8 @@ namespace Server.Mobiles
public class ExodusOverseer : BaseCreature
{
public override string CorpseName => "an overseer's corpse";
private bool m_FieldActive;
public bool FieldActive => m_FieldActive;
public bool FieldActive { get; private set; }
public bool CanUseField // TODO: an OSI bug prevents to verify this
=> Hits >= HitsMax * 9 / 10;
@ -50,7 +50,7 @@ namespace Server.Mobiles
else
PackItem( new ArcaneGem() );
m_FieldActive = CanUseField;
FieldActive = CanUseField;
}
public override void GenerateLoot()
@ -89,13 +89,13 @@ namespace Server.Mobiles
public override void AlterMeleeDamageFrom( Mobile from, ref int damage )
{
if ( m_FieldActive )
if ( FieldActive )
damage = 0; // no melee damage when the field is up
}
public override void AlterSpellDamageFrom( Mobile caster, ref int damage )
{
if ( !m_FieldActive )
if ( !FieldActive )
damage = 0; // no spell damage when the field is down
}
@ -106,14 +106,14 @@ namespace Server.Mobiles
SendEBolt( from );
}
if ( !m_FieldActive )
if ( !FieldActive )
{
// should there be an effect when spells nullifying is on?
FixedParticles( 0, 10, 0, 0x2522, EffectLayer.Waist );
}
else if ( m_FieldActive && !CanUseField )
else if ( FieldActive && !CanUseField )
{
m_FieldActive = false;
FieldActive = false;
// TODO: message and effect when field turns down; cannot be verified on OSI due to a bug
FixedParticles( 0x3735, 1, 30, 0x251F, EffectLayer.Waist );
@ -124,7 +124,7 @@ namespace Server.Mobiles
{
base.OnGotMeleeAttack( attacker );
if ( m_FieldActive )
if ( FieldActive )
{
FixedParticles( 0x376A, 20, 10, 0x2530, EffectLayer.Waist );
@ -144,15 +144,15 @@ namespace Server.Mobiles
base.OnThink();
// TODO: an OSI bug prevents to verify if the field can regenerate or not
if ( !m_FieldActive && !IsHurt() )
m_FieldActive = true;
if ( !FieldActive && !IsHurt() )
FieldActive = true;
}
public override bool Move( Direction d )
{
bool move = base.Move( d );
if ( move && m_FieldActive && Combatant != null )
if ( move && FieldActive && Combatant != null )
FixedParticles( 0, 10, 0, 0x2530, EffectLayer.Waist );
return move;
@ -181,7 +181,7 @@ namespace Server.Mobiles
base.Deserialize( reader );
int version = reader.ReadInt();
m_FieldActive = CanUseField;
FieldActive = CanUseField;
if ( Name == "Exodus Overseer" )
Name = null;

View file

@ -316,16 +316,11 @@ namespace Server.Mobiles
public class StainedOoze : Item
{
private bool m_Corrosive;
private Timer m_Timer;
private int m_Ticks;
[CommandProperty( AccessLevel.GameMaster )]
public bool Corrosive
{
get => m_Corrosive;
set => m_Corrosive = value;
}
public bool Corrosive { get; set; }
[Constructible]
public StainedOoze()
@ -340,7 +335,7 @@ namespace Server.Mobiles
Movable = false;
Hue = 0x95;
m_Corrosive = corrosive;
Corrosive = corrosive;
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), OnTick );
m_Ticks = 0;
}
@ -387,7 +382,7 @@ namespace Server.Mobiles
public void Damage( Mobile m )
{
if ( m_Corrosive )
if ( Corrosive )
{
List<Item> items = m.Items;
bool damaged = false;
@ -422,7 +417,7 @@ namespace Server.Mobiles
writer.Write( (int) 0 ); // version
writer.Write( m_Corrosive );
writer.Write( Corrosive );
}
public override void Deserialize( GenericReader reader )
@ -431,7 +426,7 @@ namespace Server.Mobiles
int version = reader.ReadInt();
m_Corrosive = reader.ReadBool();
Corrosive = reader.ReadBool();
m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), OnTick );
m_Ticks = ( ItemID == 0x122A ) ? 0 : 30;

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

View file

@ -6,13 +6,8 @@ namespace Server.Mobiles
public class Leviathan : BaseCreature
{
public override string CorpseName => "a leviathan corpse";
private Mobile m_Fisher;
public Mobile Fisher
{
get => m_Fisher;
set => m_Fisher = value;
}
public Mobile Fisher { get; set; }
public override string DefaultName => "a leviathan";
@ -24,7 +19,7 @@ namespace Server.Mobiles
[Constructible]
public Leviathan( Mobile fisher ) : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
m_Fisher = fisher;
Fisher = fisher;
// May not be OSI accurate; mostly copied from krakens
Body = 77;
@ -110,9 +105,8 @@ namespace Server.Mobiles
int version = reader.ReadInt();
}
public static Type[] Artifacts => m_Artifacts;
private static Type[] m_Artifacts = {
public static Type[] Artifacts { get; } =
{
// Decorations
typeof( CandelabraOfSouls ),
typeof( GhostShipAnchor ),
@ -142,7 +136,7 @@ namespace Server.Mobiles
public static void GiveArtifactTo( Mobile m )
{
Item item = Loot.Construct( m_Artifacts );
Item item = Loot.Construct( Artifacts );
if ( item == null )
return;
@ -162,8 +156,8 @@ namespace Server.Mobiles
{
GiveArtifactTo( mob );
if ( mob == m_Fisher )
m_Fisher = null;
if ( mob == Fisher )
Fisher = null;
}
}
@ -171,10 +165,10 @@ namespace Server.Mobiles
{
base.OnDeath( c );
if ( m_Fisher != null && 25 > Utility.Random( 100 ) )
GiveArtifactTo( m_Fisher );
if ( Fisher != null && 25 > Utility.Random( 100 ) )
GiveArtifactTo( Fisher );
m_Fisher = null;
Fisher = null;
}
}
}