Exemplo n.º 1
0
        public void ShowHandCards(Player p, List <Card> cards)
        {
            if (cards.Count == 0)
            {
                return;
            }
            NotificationProxy.NotifyShowCardsStart(p, cards);
            Dictionary <Player, int> answers;

            GlobalProxy.AskForMultipleChoice(new MultipleChoicePrompt("ShowCards", p), new List <OptionPrompt>()
            {
                OptionPrompt.YesChoice
            }, AlivePlayers, out answers);
            NotificationProxy.NotifyShowCardsEnd();
            foreach (Card c in cards)
            {
                Game.CurrentGame.HideHandCard(c);
            }
        }
Exemplo n.º 2
0
        public bool?PinDianReturnCards(Player from, Player to, out Card c1, out Card c2, ISkill skill, out bool c1Taken, out bool c2Taken)
        {
            NotificationProxy.NotifyLogEvent(new LogEvent("PinDianStart", from, to), new List <Player>()
            {
                from, to
            }, false);
            NotificationProxy.NotifyPinDianStart(from, to, skill);
            Dictionary <Player, ISkill>         aSkill;
            Dictionary <Player, List <Card> >   aCards;
            Dictionary <Player, List <Player> > aPlayers;

            GlobalProxy.AskForMultipleCardUsage(new CardUsagePrompt("PinDian"), new PinDianVerifier(), new List <Player>()
            {
                from, to
            }, out aSkill, out aCards, out aPlayers);
            Card card1, card2;

            if (!aCards.ContainsKey(from) || aCards[from].Count == 0)
            {
                card1 = Decks[from, DeckType.Hand][0];
                SyncImmutableCardAll(card1);
            }
            else
            {
                card1 = aCards[from][0];
            }
            if (!aCards.ContainsKey(to) || aCards[to].Count == 0)
            {
                card2 = Decks[to, DeckType.Hand][0];
                SyncImmutableCardAll(card2);
            }
            else
            {
                card2 = aCards[to][0];
            }
            c1 = card1;
            c2 = card2;
            NotificationProxy.NotifyPinDianEnd(c1, c2);
            NotificationProxy.NotifyLogEvent(new LogEvent("PinDianCard", from, c1), new List <Player>()
            {
                from, to
            }, false, false);
            NotificationProxy.NotifyLogEvent(new LogEvent("PinDianCard", to, c2), new List <Player>()
            {
                from, to
            }, false, false);
            NotificationProxy.NotifyLogEvent(new LogEvent("PinDianResult", from, to, new LogEventArg(c1.Rank > c2.Rank ? "Win" : "notWin")), new List <Player>()
            {
                from, to
            }, false);
            bool?ret = null;

            if (card1.Rank > card2.Rank)
            {
                ret = true;
            }
            if (card1.Rank < card2.Rank)
            {
                ret = false;
            }
            var arg = new PinDianCompleteEventArgs();

            arg.Source  = from;
            arg.Targets = new List <Player>()
            {
                to
            };
            arg.Cards = new List <Card>()
            {
                c1, c2
            };
            arg.CardsResult = new List <bool>()
            {
                false, false
            };
            arg.PinDianResult = ret;
            Emit(GameEvent.PinDianComplete, arg);
            c1Taken = arg.CardsResult[0];
            c2Taken = arg.CardsResult[1];
            return(ret);
        }