public static Coin operator -(Coin x, Coin y) { Coin newCoin = new Coin(x.Value); newCoin.Value -= y.Value; if (newCoin.Value < 0) newCoin.Value = 0; return newCoin; }
public static Coin operator +(Coin x, int y) { Coin newCoin = new Coin(x.Value); newCoin.Value += y; if (newCoin.Value < 0) newCoin.Value = 0; return newCoin; }
protected virtual void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!this.disposed) { // If disposing equals true, dispose all managed // and unmanaged resources. if (disposing) { // Dispose managed resources. _Coin = null; _Potion = null; } // Call the appropriate methods to clean up // unmanaged resources here. // If disposing is false, // only the following code is executed. // Note disposing has been done. disposed = true; } }
internal void Add(Currency currency) { _Coin += currency.Coin; _Potion += currency.Potion; }
public override void Play(Player player) { base.Play(player); Choice choiceTrash = new Choice("Choose any number of cards to trash", this, player.Hand, player, false, 0, player.Hand.Count); ChoiceResult resultTrash = player.MakeChoice(choiceTrash); player.Trash(player.RetrieveCardsFrom(DeckLocation.Hand, resultTrash.Cards)); Coin totalCoinCost = new Coin(); foreach (Card card in resultTrash.Cards) totalCoinCost += player._Game.ComputeCost(card).Coin; SupplyCollection gainableSupplies = player._Game.Table.Supplies.FindAll(supply => supply.CanGain() && supply.CurrentCost == new Cost(totalCoinCost)); Choice choice = new Choice("Gain a card", this, gainableSupplies, player, false); ChoiceResult result = player.MakeChoice(choice); if (result.Supply != null) player.Gain(result.Supply); }
public Currency(Currencies.Coin coin, Currencies.Potion potion) { _Coin.Value = coin.Value; _Potion.Value = potion.Value; }
public Coin(Coin value) : base(value.Value) { }