Exemple #1
0
 bool TianMingProcess(Player player)
 {
     int discardedCount = Math.Min(player.HandCards().Count + player.Equipments().Count, 2);
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     CardUsagePrompt prompt = new CardUsagePrompt("TianMing");
     CardUsagePrompt otherPrompt = new CardUsagePrompt("TianMingOther", discardedCount);
     CardUsagePrompt otherIsNakedPrompt = new CardUsagePrompt("TianMingOtherIsNaked");
     if (player.AskForCardUsage(player == Owner ? prompt : (discardedCount == 0 ? otherIsNakedPrompt : otherPrompt), new TianMingVerifier(discardedCount), out skill, out cards, out players))
     {
         if (player == Owner)
         {
             TianMingEffect = 0;
         }
         else if (player.IsMale)
         {
             TianMingEffect = 1;
         }
         else
         {
             TianMingEffect = 2;
         }
         NotifySkillUse();
         if (cards.Count > 0)
         {
             Game.CurrentGame.HandleCardDiscard(player, cards);
         }
         Game.CurrentGame.DrawCards(player, 2);
         return true;
     }
     return false;
 }
Exemple #2
0
        protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard, GameEventArgs inResponseTo)
        {
            IPlayerProxy ui = Game.CurrentGame.UiProxies[source];
            if (source.IsDead) return;
            if (dest.HandCards().Count + dest.Equipments().Count + dest.DelayedTools().Count == 0) return; // ShunChai -> WuXie(from target) -> WuXie(soemone else) -> target has no card
            List<DeckPlace> places = new List<DeckPlace>();
            places.Add(new DeckPlace(dest, DeckType.Hand));
            places.Add(new DeckPlace(dest, DeckType.Equipment));
            places.Add(new DeckPlace(dest, DeckType.DelayedTools));
            List<string> resultDeckPlace = new List<string>();
            resultDeckPlace.Add(ResultDeckName);
            List<int> resultDeckMax = new List<int>();
            resultDeckMax.Add(1);
            List<List<Card>> answer;
            if (!ui.AskForCardChoice(new CardChoicePrompt(ChoicePrompt), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(true), out answer))
            {
                Trace.TraceInformation("Player {0} Invalid answer", source.Id);
                answer = new List<List<Card>>();
                answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
            }
            Card theCard = answer[0][0];

            if (ShunChaiDest(source, dest).DeckType == DeckType.Discard)
            {
                Game.CurrentGame.HandleCardDiscard(dest, new List<Card>() { theCard });
            }
            else
            {
                Game.CurrentGame.HandleCardTransferToHand(dest, source, new List<Card>() { theCard });
            }
        }
Exemple #3
0
 void KuiWeiDiscard(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     Owner[KuiWeiStatus] = 0;
     int count = GetWeaponCount();
     if (count == 0 || Owner.HandCards().Count + Owner.Equipments().Count == 0) return;
     NotifySkillUse();
     if (count >= Owner.HandCards().Count + Owner.Equipments().Count)
     {
         List<Card> cards = new List<Card>();
         cards.AddRange(Owner.HandCards());
         cards.AddRange(Owner.Equipments());
         Game.CurrentGame.HandleCardDiscard(Owner, cards);
         return;
     }
     Game.CurrentGame.ForcePlayerDiscard(Owner, (p, d) => { return count - d; }, true);
 }
Exemple #4
0
 public void OnJudgeBegin(Player player, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     if (player.HandCards().Count == 0 && !player.Equipments().Any(card => card.SuitColor == SuitColorType.Black))
     {
         return;
     }
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     Card c = Game.CurrentGame.Decks[eventArgs.Source, DeckType.JudgeResult].Last();
     if (Game.CurrentGame.UiProxies[player].AskForCardUsage(new CardUsagePrompt("GuiDao", eventArgs.Source, c.Suit, c.Rank), new GuiDaoVerifier(), out skill, out cards, out players))
     {
         NotifySkillUse();
         Card theCard = cards[0];
         theCard.Log = new ActionLog();
         theCard.Log.Source = player;
         theCard.Log.SkillAction = this;
         theCard.Log.GameAction = GameAction.ReplaceJudge;
         Game.CurrentGame.EnterAtomicContext();
         List<Card> toDiscard = new List<Card>() {Game.CurrentGame.Decks[eventArgs.Source, DeckType.JudgeResult].Last()};
         CardsMovement move = new CardsMovement();
         move.Cards = new List<Card>();
         move.Cards.AddRange(cards);
         move.To = new DeckPlace(eventArgs.Source, DeckType.JudgeResult);
         Game.CurrentGame.MoveCards(move);
         Game.CurrentGame.PlayerLostCard(player, cards);
         Game.CurrentGame.HandleCardTransferToHand(null, player, toDiscard);
         Game.CurrentGame.ExitAtomicContext();
     }
 }
        protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard, GameEventArgs inResponseTo)
        {
            if (source.IsDead) return;
            if (dest.HandCards().Count + dest.Equipments().Count == 0) return; // ShunChai -> WuXie(from target) -> WuXie(soemone else) -> target has no card
            List<string> resultDeckPlace = new List<string>();
            resultDeckPlace.Add("GuoHeChaiQiao");
            List<int> resultDeckMax = new List<int>();
            resultDeckMax.Add(1);
            List<List<Card>> answer;
            bool doHandCard = true;
            if (dest.Equipments().Count != 0)
            {
                int result = 0;
                source.AskForMultipleChoice(new MultipleChoicePrompt("GuoHeChaiQiao2"), new List<OptionPrompt>() { new OptionPrompt("ShouPai"), new OptionPrompt("ZhuangBeiPai") }, out result);
                if (result == 1) doHandCard = false;
            }
            if (doHandCard)
            {
                Game.CurrentGame.SyncImmutableCards(source, Game.CurrentGame.Decks[dest, DeckType.Hand]);
                Game.CurrentGame.HandCardVisibility[source].Add(dest);
                var places = new List<DeckPlace>() { new DeckPlace(dest, DeckType.Hand) };
                if (!source.AskForCardChoice(new CardChoicePrompt("GuoHeChaiQiao2"), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(true), out answer))
                {
                    Trace.TraceInformation("Player {0} Invalid answer", source.Id);
                    answer = new List<List<Card>>();
                    answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
                }
                foreach (Card c in dest.HandCards()) Game.CurrentGame.HideHandCard(c);
                Game.CurrentGame.HandCardVisibility[source].Remove(dest);
                Game.CurrentGame.HandleCardDiscard(dest, answer[0]);
            }
            else
            {
                var places = new List<DeckPlace>() { new DeckPlace(dest, DeckType.Equipment) };
                if (!source.AskForCardChoice(new CardChoicePrompt("GuoHeChaiQiao2"), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(true), out answer))
                {
                    Trace.TraceInformation("Player {0} Invalid answer", source.Id);
                    answer = new List<List<Card>>();
                    answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
                }
                Game.CurrentGame.HandleCardDiscard(dest, answer[0]);

            }
        }
Exemple #6
0
 protected override bool VerifyPlayer(Player source, Player player)
 {
     return player != source && player.HandCards().Count + player.Equipments().Count > 0;
 }
Exemple #7
0
        public Card SelectACardFrom(Player from, Player ask, Prompt prompt, String resultdeckname, bool equipExcluded = false, bool delayedToolsExcluded = true, bool noReveal = false)
        {
            var deck = from.HandCards();
            if (!equipExcluded) deck = new List<Card>(deck.Concat(from.Equipments()));
            if (!delayedToolsExcluded) deck = new List<Card>(deck.Concat(from.DelayedTools()));
            if (deck.Count == 0) return null;
            List<DeckPlace> places = new List<DeckPlace>();
            places.Add(new DeckPlace(from, DeckType.Hand));
            if (!equipExcluded) places.Add(new DeckPlace(from, DeckType.Equipment));
            if (!delayedToolsExcluded) places.Add(new DeckPlace(from, DeckType.DelayedTools));
            List<List<Card>> answer;

            if (!ask.AskForCardChoice(prompt, places, new List<string>() { resultdeckname }, new List<int>() { 1 }, new RequireOneCardChoiceVerifier(noReveal), out answer))
            {
                Trace.TraceInformation("Player {0} Invalid answer", ask);
                answer = new List<List<Card>>();
                answer.Add(new List<Card>());
                answer[0].Add(deck.First());
            }
            Card theCard = answer[0][0];
            if (noReveal)
            {
                SyncCard(from, ref theCard);
            }
            else
            {
                SyncCardAll(ref theCard);
            }
            Trace.Assert(answer.Count == 1 && answer[0].Count == 1);
            return theCard;
        }