Example #1
0
        public static void OpponentDeckDiscard(string cardId)
        {
            OpponentDeckCount--;
            if (string.IsNullOrEmpty(cardId))
            {
                return;
            }

            var jousted = OpponentCards.FirstOrDefault(c => c.Id == cardId && c.Jousted);

            if (jousted != null)
            {
                OpponentCards.Remove(jousted);
            }

            var card = OpponentCards.FirstOrDefault(c => c.Id == cardId && c.WasDiscarded);

            if (card != null)
            {
                card.Count++;
            }
            else
            {
                card = GetCardFromId(cardId);
                card.WasDiscarded = true;
                OpponentCards.Add(card);
            }

            LogDeckChange(true, card, false);
        }
        public static void OpponentPlay(string id, int from, int turn)
        {
            OpponentHandCount--;

            if (id == "GAME_005")
            {
                OpponentHasCoin = false;
            }
            if (!string.IsNullOrEmpty(id))
            {
                //key: cardid, value: turn when returned to deck
                var wasReturnedToDeck = OpponentReturnedToDeck.Any(p => p.Key == id && p.Value <= OpponentHandAge[from - 1]);
                var stolen            = from != -1 &&
                                        (OpponentHandMarks[from - 1] == CardMark.Stolen || OpponentHandMarks[from - 1] == CardMark.Returned ||
                                         wasReturnedToDeck);
                var card = OpponentCards.FirstOrDefault(c => c.Id == id && c.IsStolen == stolen && !c.WasDiscarded);

                //card can't be marked stolen or returned, since it was returned to the deck
                if (wasReturnedToDeck && stolen &&
                    !(OpponentHandMarks[from - 1] == CardMark.Stolen || OpponentHandMarks[from - 1] == CardMark.Returned))
                {
                    OpponentReturnedToDeck.Remove(OpponentReturnedToDeck.First(p => p.Key == id && p.Value <= OpponentHandAge[from - 1]));
                }

                if (card != null)
                {
                    card.Count++;
                }
                else
                {
                    card          = GetCardFromId(id);
                    card.IsStolen = stolen;
                    OpponentCards.Add(card);
                }

                LogDeckChange(true, card, false);

                if (card.IsStolen)
                {
                    Logger.WriteLine("Opponent played stolen card from " + from, "Game");
                }
            }

            for (var i = from - 1; i < MaxHandSize - 1; i++)
            {
                OpponentHandAge[i]   = OpponentHandAge[i + 1];
                OpponentHandMarks[i] = OpponentHandMarks[i + 1];
                OpponentStolenCardsInformation[i] = OpponentStolenCardsInformation[i + 1];
            }

            OpponentHandAge[MaxHandSize - 1]   = -1;
            OpponentHandMarks[MaxHandSize - 1] = CardMark.None;
            OpponentStolenCardsInformation[MaxHandSize - 1] = null;


            LogOpponentHand();
        }
Example #3
0
        public static void OpponentJoustReveal(string cardId)
        {
            if (string.IsNullOrEmpty(cardId) || OpponentCards.Any(c => c.Id == cardId && c.Jousted))
            {
                return;
            }
            var card = GetCardFromId(cardId);

            card.Jousted = true;
            OpponentCards.Add(card);
        }
Example #4
0
        public static void OpponentSecretTriggered(string cardId)
        {
            if (string.IsNullOrEmpty(cardId))
            {
                return;
            }
            var card = OpponentCards.FirstOrDefault(c => c.Id == cardId && !c.WasDiscarded);

            if (card != null)
            {
                card.Count++;
            }
            else
            {
                card = GetCardFromId(cardId);
                OpponentCards.Add(card);
            }

            LogDeckChange(true, card, false);
        }