public static async Task PrepActionScreenAsync(this ActionContainer actionContainer, FluxxGameContainer gameContainer, FluxxDelegates delegates, ILoadActionProcesses loadAction)
        {
            actionContainer.Loads++;
            actionContainer.ActionFrameText           = "Action Card Information";
            actionContainer.ButtonChoosePlayerVisible = false;
            actionContainer.OtherHand.Visible         = false; //has to be proven true here too.
            actionContainer.ButtonChooseCardVisible   = false;
            if (delegates.LoadProperActionScreenAsync == null)
            {
                throw new BasicBlankException("Nobody is loading action screen.  Rethink");
            }
            actionContainer.CurrentDetail !.ResetCard();
            if (gameContainer.IsFirstPlayRandom() || gameContainer.CurrentAction == null)
            {
                actionContainer.ActionCategory = EnumActionCategory.FirstRandom; //take a risk.  if hidden bug, then rethink.
                loadAction.LoadFirstRandom();
                await delegates.LoadProperActionScreenAsync(actionContainer);

                return;
            }

            switch (gameContainer.CurrentAction !.Deck)
            {
예제 #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)
                {