/// <summary> /// Converts Gold Pieces to Platinum Pieces, kepping the remainder in the original CopperPiece object /// </summary> /// <param name="gp">the source GoldPiece object. Will be mutated to include the remainder of non-converted value.</param> /// <returns>the new PlatinumPiece object, containing an equivalent value of the source CopperPiece object, sans the incompatible remainder of the conversion.</returns> public static PlatinumPiece ToPlatinumPieces(this GoldPiece gp) { var pp = (int)Math.Floor(gp.Count / 10.0); gp.Count = gp.Count % 100; return(new PlatinumPiece(pp)); }
//Down to Electrum /// <summary> /// Converts Gold Pieces to Electrum Pieces /// </summary> /// <param name="gp">the source GoldPiece object to be converted</param> /// <returns>the new ElectrumPiece object, containing an equivalent value of the source GoldPiece object</returns> public static ElectrumPiece ToElectrumPieces(this GoldPiece gp) { return(new ElectrumPiece(gp.Count * 2)); }
/// <summary> /// Converts Gold Pieces to Silver Pieces /// </summary> /// <param name="gp">the source GoldPiece object to be converted</param> /// <returns>the new SilverPiece object, containing an equivalent value of the source GoldPiece object</returns> public static SilverPiece ToSilverPieces(this GoldPiece gp) { return(new SilverPiece(gp.Count * 10)); }
/// <summary> /// Converts Gold Pieces to Copper Pieces /// </summary> /// <param name="gp">the source GoldPiece object to be converted</param> /// <returns>the new CopperPiece object, containing an equivalent value of the source GoldPiece object</returns> public static CopperPiece ToCopperPieces(this GoldPiece gp) { return(new CopperPiece(gp.Count * 100)); }