Exemplo n.º 1
0
 public Player(MagicGame game, Deck deck)
 {
     game.Add(this);
     game.StartGame += StartGame;
     this.game = game;
     this.deck = deck;
     manaPool = new ManaPool();
 }
 public bool CanBePaidWith(ManaPool pool)
 {
     Dictionary<MTGColor, int> manaRemaining = pool.GetManaRemaining();
     return TryTakeMana(manaRemaining);
 }
        public bool TryPayWith(ManaPool pool)
        {
            Dictionary<MTGColor, int> manaRemaining = pool.GetManaRemaining();
            bool result = TryTakeMana(manaRemaining);

            if( result )
                pool.SetManaRemaining(manaRemaining);

            return result;
        }
        public void PayWith(ManaPool pool)
        {
            Dictionary<MTGColor, int> manaRemaining = pool.GetManaRemaining();
            if (!TryTakeMana(manaRemaining))
                throw new NotSupportedException("Can't afford this payment!");

            pool.SetManaRemaining(manaRemaining);
        }