コード例 #1
0
ファイル: HuoGong.cs プロジェクト: kissgoodbye/sgs
 protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard)
 {
     IUiProxy ui = Game.CurrentGame.UiProxies[dest];
     HuoGongCardChoiceVerifier v1 = new HuoGongCardChoiceVerifier();
     ISkill s;
     List<Player> p;
     List<Card> cards;
     if (dest.IsDead) return;
     if (!ui.AskForCardUsage(new CardUsagePrompt("HuoGong", source), v1, out s, out cards, out p))
     {
         Trace.TraceInformation("Player {0} Invalid answer", dest);
         cards = new List<Card>();
         if (Game.CurrentGame.Decks[dest, DeckType.Hand].Count == 0)
         {
             Trace.TraceError("HuoGong Cannot Show Card! This should NOT have happened!");
             return;
         }
         cards.Add(Game.CurrentGame.Decks[dest, DeckType.Hand][0]);
     }
     Trace.TraceInformation("Player {0} HuoGong showed {1}, ", dest.Id, cards[0].Suit);
     if (source.IsDead) return;
     ui = Game.CurrentGame.UiProxies[source];
     HuoGongCardMatchVerifier v2 = new HuoGongCardMatchVerifier(cards[0].Suit);
     v2.Owner = source;
     if (ui.AskForCardUsage(new CardUsagePrompt("HuoGong2", dest, cards[0].Suit), v2, out s, out cards, out p))
     {
         Game.CurrentGame.HandleCardDiscard(source, cards);
         Game.CurrentGame.DoDamage(source, dest, 1, DamageElement.Fire, card, readonlyCard);
     }
     else
     {
         Trace.TraceInformation("HuoGong aborted, failed to provide card");
     }
 }
コード例 #2
0
        protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard, GameEventArgs inResponseTo)
        {
            IPlayerProxy ui = Game.CurrentGame.UiProxies[dest];
            HuoGongCardChoiceVerifier v1 = new HuoGongCardChoiceVerifier();
            ISkill        s;
            List <Player> p;
            List <Card>   cards;

            if (dest.IsDead)
            {
                return;
            }
            if (!ui.AskForCardUsage(new CardUsagePrompt("HuoGong", source), v1, out s, out cards, out p))
            {
                Trace.TraceInformation("Player {0} Invalid answer", dest);
                cards = new List <Card>();
                if (Game.CurrentGame.Decks[dest, DeckType.Hand].Count == 0)
                {
                    Trace.TraceError("HuoGong Cannot Show Card! This should NOT have happened!");
                    return;
                }
                cards.Add(Game.CurrentGame.Decks[dest, DeckType.Hand][0]);
            }
            var theCard = cards[0];

            Game.CurrentGame.SyncCardAll(ref theCard);
            Trace.TraceInformation("Player {0} HuoGong showed {1}, ", dest.Id, theCard);
            Game.CurrentGame.NotificationProxy.NotifyShowCard(dest, theCard);
            if (source.IsDead)
            {
                return;
            }
            ui = Game.CurrentGame.UiProxies[source];
            HuoGongCardMatchVerifier v2 = new HuoGongCardMatchVerifier(theCard.Suit);

            Game.CurrentGame.HideHandCard(theCard);
            v2.Owner = source;
            if (ui.AskForCardUsage(new CardUsagePrompt("HuoGong2", dest, theCard.Suit), v2, out s, out cards, out p))
            {
                Game.CurrentGame.HandleCardDiscard(source, cards);
                Game.CurrentGame.DoDamage(source, dest, 1, DamageElement.Fire, card, readonlyCard);
            }
            else
            {
                Trace.TraceInformation("HuoGong aborted, failed to provide card");
            }
        }