コード例 #1
0
        /// <summary>
        /// Converts Electrum Pieces to Platinum Pieces, kepping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="ep">the source ElectrumPiece 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 ElectrumPiece ep)
        {
            var pp = (int)Math.Floor(ep.Count / 20.0);

            ep.Count = ep.Count % 20;
            return(new PlatinumPiece(pp));
        }
コード例 #2
0
        /// <summary>
        /// Converts Electrum Pieces to Gold Pieces, kegping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="ep">the source ElectrumPiece 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 ElectrumPiece ep)
        {
            var gp = (int)Math.Floor(ep.Count / 2.0);

            ep.Count = ep.Count % 2;
            return(new GoldPiece(gp));
        }
コード例 #3
0
 //Down To Silver
 /// <summary>
 /// Converts Electrum Pieces to Silver Pieces
 /// </summary>
 /// <param name="ep">the source ElectrumPiece object to be converted</param>
 /// <returns>the new SilverPiece object, containing an equivalent value of the source ElectrumPiece object</returns>
 public static SilverPiece ToSilverPieces(this ElectrumPiece ep)
 {
     return(new SilverPiece(ep.Count * 5));
 }
コード例 #4
0
 /// <summary>
 /// Converts Electrum Pieces to Copper Pieces
 /// </summary>
 /// <param name="ep">the source ElectrumPiece object to be converted</param>
 /// <returns>the new CopperPiece object, containing an equivalent value of the source ElectrumPiece object</returns>
 public static CopperPiece ToCopperPieces(this ElectrumPiece ep)
 {
     return(new CopperPiece(ep.Count * 50));
 }