Example #1
0
        /// <summary>
        /// Active player's continuously turn actions.
        /// </summary>
        /// <returns>Info about "Will the active player continue to play?"</returns>
        private bool ContinuouslyPlayerTurnActions()
        {
            if (!CheckPlayability())
            {
                (_activePlayer, _opponentPlayer) = _operations.SwitchActiveAndOpponentPlayers(_activePlayer, _opponentPlayer);

                return(false);
            }

            if (!AttackCardSelection(out ICard selectedAttackCard))
            {
                (_activePlayer, _opponentPlayer) = _operations.SwitchActiveAndOpponentPlayers(_activePlayer, _opponentPlayer);

                return(false);
            }

            _isGameContinuous = _operations.AttackTheOpponent(selectedAttackCard, _activePlayer, _opponentPlayer);

            _operations.RemoveUsedCardFromHand(_activePlayer.Hand, selectedAttackCard);

            if (_isGameContinuous)
            {
                return(true);
            }

            _io.YouWinMessage(_activePlayer, _opponentPlayer);

            return(false);
        }
        public void RemoveUsedCardFromHandTests()
        {
            var hand = new List <ICard>
            {
                new Card {
                    ManaCost = 1
                }, new Card {
                    ManaCost = 2
                },
                new Card {
                    ManaCost = 3
                }, new Card {
                    ManaCost = 4
                }
            };

            ICard usedCard = hand[2];

            _operations.RemoveUsedCardFromHand(hand, usedCard);

            Assert.AreEqual(3, hand.Count);
            Assert.AreNotEqual(true, hand.Any(card => card.ManaCost == 3));
        }