예제 #1
0
 async Task IFluxxEvent.KeepersExchangedAsync(KeeperPlayer keeperFrom, KeeperPlayer keeperTo)
 {
     await _finalKeeperProcesses.ProcessExchangeKeepersAsync(keeperFrom, keeperTo);
 }
예제 #2
0
        protected override async Task ComputerTurnAsync()
        {
            if (Test !.NoAnimations == false)
            {
                await Delay !.DelaySeconds(.5);
            }
            if (OtherTurn > 0)
            {
                if (_gameContainer.IsFirstPlayRandom())
                {
                    await _playProcesses.PlayRandomCardAsync(ComputerAI.FirstRandomPlayed(_gameContainer));

                    return;
                }
                if (_gameContainer !.CurrentAction != null && _gameContainer.CurrentAction.Deck == EnumActionMain.Taxation)
                {
                    await _giveTaxationProcesses.GiveCardsForTaxationAsync(ComputerAI.CardsForTaxation(_gameContainer));

                    return;
                }
                int cardsNeeded = SingleInfo !.KeeperList.Count - SaveRoot !.KeeperLimit;
                if (cardsNeeded > 0 && SaveRoot.KeeperLimit > -1)
                {
                    await _discardProcesses.DiscardKeepersAsync(ComputerAI.DiscardKeepers(_gameContainer, cardsNeeded));

                    return;
                }
                cardsNeeded = SingleInfo.MainHandList.Count - SaveRoot.HandLimit;
                if (cardsNeeded <= 0)
                {
                    throw new BasicBlankException("Since keepers are not being discarded and no cards are being discarded; there are no limits that still needs to be obeyed");
                }
                if (SaveRoot.HandLimit > -1)
                {
                    await _discardProcesses.DiscardFromHandAsync(ComputerAI.CardsToDiscardFromHand(_gameContainer, cardsNeeded));

                    return;
                }
            }
            if (_delegates.CurrentScreen == null)
            {
                throw new BasicBlankException("Nobody is figuring out screen used.  Rethink");
            }
            EnumActionScreen screen = _delegates.CurrentScreen.Invoke();

            if (screen == EnumActionScreen.KeeperScreen)
            {
                if (_gameContainer !.CurrentAction !.Deck == EnumActionMain.TrashAKeeper || _gameContainer.CurrentAction.Deck == EnumActionMain.StealAKeeper)
                {
                    bool isTrashed  = _gameContainer.CurrentAction.Deck == EnumActionMain.TrashAKeeper;
                    var  thisKeeper = ComputerAI.KeeperToStealTrash(_gameContainer, isTrashed);
                    _keeperContainer.ShowSelectedKeepers(new CustomBasicList <KeeperPlayer> {
                        thisKeeper
                    });
                    await _finalKeeperProcesses.ProcessTrashStealKeeperAsync(thisKeeper, isTrashed);

                    return;
                }
                if (_gameContainer.CurrentAction.Deck == EnumActionMain.ExchangeKeepers)
                {
                    var keeperTuple = ComputerAI.ExchangeKeepers(_gameContainer);
                    _keeperContainer.ShowSelectedKeepers(new CustomBasicList <KeeperPlayer> {
                        keeperTuple.Item1, keeperTuple.Item2
                    });
                    await _finalKeeperProcesses.ProcessExchangeKeepersAsync(keeperTuple.Item1, keeperTuple.Item2);

                    return;
                }
                throw new BasicBlankException("The scroll keepers should not be visible for computer player.  Rethink");
            }
            int deck;
            int selectedIndex;
            CustomBasicList <int> tempList;

            if (screen == EnumActionScreen.ActionScreen)
            {
                switch (_gameContainer !.CurrentAction !.Deck)
                {