コード例 #1
0
    public override bool ChooseMomentOfInsightUse(Game game, Player choosingPlayer, out BoardChoices.MomentOfInsightInfo outMoIInfo)
    {
        ChoiceHandlerDelegator.Instance.TriggerChoice(this, choosingPlayer, new MoIInputHandler(choosingPlayer));
        waitForInput.WaitOne();

        outMoIInfo = new BoardChoices.MomentOfInsightInfo();

        bool notCancelled = true;

        if (passedParams == null)
        {
            notCancelled = false;
        }
        else if (passedParams.Length == 0)
        {
            outMoIInfo.Use = BoardChoices.MomentOfInsightInfo.MomentOfInsightUse.NotChosen;
        }
        else
        {
            outMoIInfo.Use = (BoardChoices.MomentOfInsightInfo.MomentOfInsightUse)passedParams[0];

            if (outMoIInfo.Use == BoardChoices.MomentOfInsightInfo.MomentOfInsightUse.Swap)
            {
                outMoIInfo.HandCard      = (Card)passedParams[1];
                outMoIInfo.SummationCard = (Card)passedParams[2];
            }
        }

        passedParams = null;

        return(notCancelled);
    }
コード例 #2
0
        public override bool ChooseMomentOfInsightUse(Game game, Player choosingPlayer, out BoardChoices.MomentOfInsightInfo outMoIInfo)
        {
            outMoIInfo = new BoardChoices.MomentOfInsightInfo();

            Random rand   = new Random();
            int    choice = rand.Next() % 2;

            // reveal
            if (choice == 0)
            {
                outMoIInfo.Use = BoardChoices.MomentOfInsightInfo.MomentOfInsightUse.Reveal;
            }
            // swap
            else
            {
                List <Card> handCards = choosingPlayer.Hand.SelectableCards;
                List <Card> sumCards  = choosingPlayer.SummationDeck.Cards;

                int handCardIdx = rand.Next() % handCards.Count;
                int sumCardIdx  = rand.Next() % sumCards.Count;

                outMoIInfo.Use           = BoardChoices.MomentOfInsightInfo.MomentOfInsightUse.Swap;
                outMoIInfo.HandCard      = handCards[handCardIdx];
                outMoIInfo.SummationCard = sumCards[sumCardIdx];
            }

            return(true);
        }