#region Arthea License /*********************************************************************** * Arthea MUD by R. Jennings (2007) http://arthea.googlecode.com/ * * By using this code you comply with the Artistic and GPLv2 Licenses. * ***********************************************************************/ #endregion using System; using System.Text; using Arthea.Connections.Players; using Arthea.Creation; using Arthea.Environment; using Arthea.Interfaces; namespace Arthea.Races { /// <summary> /// Implementation of a player race. /// </summary> public abstract class PlayerRace : Race, CustomEditType { #region [rgn] Fields (2) private PlayerStats bonuses = new PlayerStats(); private Type favouredClass; #endregion [rgn] #region [rgn] Constructors (2) /// <summary> /// Initializes a new instance of the <see cref="PlayerRace"/> class. /// </summary> /// <param name="name">The name.</param> public PlayerRace(string name) : base(name) { } /// <summary> /// Initializes a new instance of the <see cref="PlayerRace"/> class. /// </summary> public PlayerRace() { } #endregion [rgn] #region [rgn] Properties (2) /// <summary> /// Gets or sets the favoured class. /// </summary> /// <value>The favoured class.</value> public Type FavouredClass { get { return favouredClass; } set { favouredClass = value; } } /// <summary> /// Gets or sets the stat bonus. /// </summary> /// <value>The stat bonus.</value> public PlayerStats StatBonus { get { return bonuses; } set { bonuses = value; } } #endregion [rgn] #region [rgn] Methods (3) // [rgn] Public Methods (3) /// <summary> /// Customs the edit. /// </summary> /// <param name="player">The player.</param> /// <param name="editer">Editer information.</param> /// <param name="argument">The argument.</param> public override void CustomEdit(Player player, OlcField editer, String argument) { Race race = Lists.Races.FindPlayerRaceName(argument); if (race == null) { player.WriteLine("No such player race."); return; } editer.Set(race); player.WriteLine("Race set to {0}.", race.Name); } /// <summary> /// Returns a description string of a race. /// </summary> /// <param name="detailed">A flag that this should return a detailed string.</param> /// <returns></returns> public string ToString(int detailed) { StringBuilder buf = new StringBuilder(); buf.AppendFormat("Name: {0}", Name); buf.AppendLine(); buf.AppendFormat("Description: {0}", Description); buf.AppendLine(); buf.AppendFormat("Size: {0}", Size); buf.AppendLine(); buf.AppendFormat("Favoured Class: {0}", FavouredClass.Name); buf.AppendLine(); buf.AppendFormat("Stat Bonuses: {0}", StatBonus); buf.AppendLine(); return buf.ToString(); } /// <summary> /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>. /// </summary> /// <returns> /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>. /// </returns> public override string ToString() { return Name; } #endregion [rgn] } }