Example #1
0
        /// <summary>
        /// Converts Silver Pieces to Platinum Pieces, kepping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="sp">the source SilverPiece 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 SilverPiece sp)
        {
            var pp = (int)Math.Floor(sp.Count / 100.0);

            sp.Count = sp.Count % 100;
            return(new PlatinumPiece(pp));
        }
Example #2
0
        /// <summary>
        /// Converts Silver Pieces to Electrum Pieces, keeping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="sp">the source SilverPiece object. Will be mutated to include the remainder of non-converted value.</param>
        /// <returns>the new ElectrumPiece object, containing an equivalent value of the source CopperPiece object, sans the incompatible remainder of the conversion.</returns>
        public static ElectrumPiece ToElectrumPieces(this SilverPiece sp)
        {
            var ep = (int)Math.Floor(sp.Count / 5.0);

            sp.Count = sp.Count % 5;
            return(new ElectrumPiece(ep));
        }
Example #3
0
        /// <summary>
        /// Converts Silver Pieces to Gold Pieces, kegping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="sp">the source SilverPiece object. Will be mutated to include the remainder of non-converted value.</param>
        /// <returns>the new GoldPiece object, containing an equivalent value of the source CopperPiece object, sans the incompatible remainder of the conversion.</returns>
        public static GoldPiece ToGoldPieces(this SilverPiece sp)
        {
            var gp = (int)Math.Floor(sp.Count / 10.0);

            sp.Count = sp.Count % 10;
            return(new GoldPiece(gp));
        }
Example #4
0
 //Down to Copper
 /// <summary>
 /// Converts Silver Pieces to Copper Pieces
 /// </summary>
 /// <param name="sp">the source SilverPiece object to be converted</param>
 /// <returns>the new CopperPiece object, containing an equivalent value of the source SilverPiece object</returns>
 public static CopperPiece ToCopperPieces(this SilverPiece sp)
 {
     return(new CopperPiece(sp.Count * 10));
 }