當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.HandCards方法代碼示例

本文整理匯總了C#中Sanguosha.Core.Players.Player.HandCards方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.HandCards方法的具體用法?C# Player.HandCards怎麽用?C# Player.HandCards使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sanguosha.Core.Players.Player的用法示例。


在下文中一共展示了Player.HandCards方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Run

 public void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     Game.CurrentGame.DrawCards(owner, 1);
     Game.CurrentGame.SyncImmutableCardsAll(owner.HandCards());
     Game.CurrentGame.ShowHandCards(owner, owner.HandCards());
     var result = from card in owner.HandCards() select card.SuitColor;
     if (result.Distinct().Count() == 1)
     {
         Game.CurrentGame.ForcePlayerDiscard(eventArgs.Source, (p, i) => { return 1 - i; }, false);
     }
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:11,代碼來源:ZhiYu.cs

示例2: KuiWeiDiscard

 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);
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:16,代碼來源:KuiWei.cs

示例3: Run

 void Run(Player owner, GameEvent gameEvent, GameEventArgs args)
 {
     while (owner.HandCards().Count > 0 && owner.DelayedTools().Count > 0)
     {
         List<List<Card>> answer;
         List<DeckPlace> sourceDeck = new List<DeckPlace>();
         sourceDeck.Add(new DeckPlace(owner, DeckType.DelayedTools));
         sourceDeck.Add(new DeckPlace(owner, DeckType.Hand));
         AdditionalCardChoiceOptions options = new AdditionalCardChoiceOptions();
         options.IsCancellable = true;
         if (owner.AskForCardChoice(new CardChoicePrompt("XiuLuo", owner),
             sourceDeck,
             new List<string>() { "XLJinNang", "XLShouPai" },
             new List<int>() { 1, 1 },
             new XiuLuoVerifier(),
             out answer,
             options))
         {
             NotifySkillUse();
             Game.CurrentGame.HandleCardDiscard(owner, answer[1]);
             Game.CurrentGame.HandleCardDiscard(owner, answer[0]);
         }
         else break;
     }
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:25,代碼來源:XiuLuo.cs

示例4: Process

        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 });
            }
        }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:31,代碼來源:ShunChai.cs

示例5: TianMingProcess

 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;
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:33,代碼來源:TianMing.cs

示例6: OnJudgeBegin

 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();
     }
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:30,代碼來源:GuiDao.cs

示例7: Process

        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]);

            }
        }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:44,代碼來源:GuoHeChaiQiao2.cs

示例8: canTrigger

 bool canTrigger(Player p, GameEvent e, GameEventArgs a)
 {
     if (e == GameEvent.CardsLost)
     {
         if (!a.Cards.Any(c => c.HistoryPlace1.DeckType == DeckType.Hand))
             return false;
     }
     if (e == GameEvent.CardsAcquired)
     {
         if (!a.Cards.Any(c => c.Place.DeckType == DeckType.Hand))
             return false;
     }
     if (e == GameEvent.AfterHealthChanged && p.Health - (a as HealthChangedEventArgs).Delta < 0)
         return false;
     return (Game.CurrentGame.CurrentPhaseEventIndex == 3 || Game.CurrentGame.CurrentPhase != TurnPhase.Discard) && p.HandCards().Count < p.LostHealth;
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:16,代碼來源:ShangShi.cs

示例9: Run

 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     int drawCount = Owner.LostHealth;
     Game.CurrentGame.DrawCards(Owner, drawCount);
     drawCount = Math.Min(Owner.HandCards().Count, drawCount);
     while (drawCount > 0)
     {
         ISkill skill;
         List<Card> cards;
         List<Player> players;
         if (Owner.AskForCardUsage(new CardUsagePrompt("MiJi", drawCount), new MiJiVerifier(drawCount), out skill, out cards, out players))
         {
             drawCount -= cards.Count;
             Game.CurrentGame.HandleCardTransferToHand(Owner, players[0], cards);
         }
         else
         {
             drawCount = 0;
         }
     }
 }
開發者ID:shonwang,項目名稱:sgs,代碼行數:21,代碼來源:MiJi.cs

示例10: Run

        void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            var args = eventArgs as DamageEventArgs;
            int damage = args.Magnitude;
            while (damage-- > 0)
            {
                if (!AskForSkillUse())
                    break;

                Game.CurrentGame.DrawCards(Owner, 1);

                ISkill skill;
                List<Card> cards;
                List<Player> players;
                if (!Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("QuanJi"), new QuanJiVerifier(), out skill, out cards, out players))
                {
                    cards = new List<Card>();
                    cards.Add(Owner.HandCards().First());
                }
                Game.CurrentGame.HandleCardTransfer(Owner, Owner, QuanDeck, cards);
            }
        }
開發者ID:h1398123,項目名稱:sgs,代碼行數:22,代碼來源:QuanJi.cs

示例11: VerifyPlayer

 protected override bool VerifyPlayer(Player source, Player player)
 {
     return player != source && player.HandCards().Count + player.Equipments().Count > 0;
 }
開發者ID:h1398123,項目名稱:sgs,代碼行數:4,代碼來源:YinLing.cs

示例12: SelectACardFrom

        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;
        }
開發者ID:h1398123,項目名稱:sgs,代碼行數:31,代碼來源:Game.Procedures.cs

示例13: VerifyPlayer

 protected override bool VerifyPlayer(Player source, Player player)
 {
     return Math.Max(player.Health, 0) != player.HandCards().Count && source[SongCiTarget[player]] == 0;
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:4,代碼來源:SongCi.cs

示例14: Run

 void Run(Player p, GameEvent e, GameEventArgs a)
 {
     Game.CurrentGame.DrawCards(p, p.LostHealth - p.HandCards().Count);
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:4,代碼來源:ShangShi.cs

示例15: AdditionalVerify

 protected override bool? AdditionalVerify(Player source, List<Card> cards, List<Player> players)
 {
     if (source[MiZhaoUsed] != 0 || source.HandCards().Count == 0) return false;
     return true;
 }
開發者ID:RagingBigFemaleBird,項目名稱:sgs,代碼行數:5,代碼來源:MiZhao.cs


注:本文中的Sanguosha.Core.Players.Player.HandCards方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。