示例#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 SwitchActiveAndOpponentPlayers()
        {
            var activePlayerMock   = new Mock <IPlayer>();
            var opponentPlayerMock = new Mock <IPlayer>();

            (IPlayer activePlayer, IPlayer opponentPlayer)
                = _operations.SwitchActiveAndOpponentPlayers(activePlayerMock.Object, opponentPlayerMock.Object);

            Assert.AreNotEqual(activePlayerMock.Object, activePlayer);
            Assert.AreNotEqual(opponentPlayerMock.Object, opponentPlayer);
        }