Exemple #1
0
        public void Turn()
        {
            var isAdd = true;

            _isSuccessfullyDefended = true;
            var attackAction = ActivePlayer.Attack();

            AddAttackCards((attackAction).AttackCards);
            Table.TransferPossible = true;
            while (isAdd)
            {
                var defenderDecision = PassivePlayer.SelectPlayerAction();
                switch (defenderDecision.ActionType)
                {
                case ActionType.Defend:
                    Defend(defenderDecision as DefendAction);
                    break;

                case ActionType.Pass:
                    Pass();
                    return;

                case ActionType.Transfer:
                    Transfer(defenderDecision as TransferAction);
                    continue;
                }
                if (IsDefenderWon())
                {
                    return;
                }
                var attackerAction = ActivePlayer.SelectPlayerAction(isAttack: true);
                switch (attackerAction.ActionType)
                {
                case ActionType.Add:
                    AddAttackCards(((AddAction)attackerAction).AddedCards);
                    break;

                case ActionType.None:
                    isAdd = ActivePlayer.Id != NeighbourPlayer.Id && AddNeighbour(NeighbourPlayer);
                    break;
                }
            }
        }