当前位置: 首页>>代码示例>>C#>>正文


C# Player.AskForCardUsage方法代码示例

本文整理汇总了C#中Sanguosha.Core.Players.Player.AskForCardUsage方法的典型用法代码示例。如果您正苦于以下问题:C# Player.AskForCardUsage方法的具体用法?C# Player.AskForCardUsage怎么用?C# Player.AskForCardUsage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sanguosha.Core.Players.Player的用法示例。


在下文中一共展示了Player.AskForCardUsage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            foreach (Card c in eventArgs.Cards)
            {
                if (c.HistoryPlace1.DeckType == DeckType.Equipment && c.HistoryPlace1.Player == Owner)
                {
                    if (AskForSkillUse())
                    {
                        NotifySkillUse(new List<Player>());
                        int answer = 0;
                        Owner.AskForMultipleChoice(new MultipleChoicePrompt("XuanFeng"), new List<OptionPrompt>() { new OptionPrompt("XuanFengChuSha"), new OptionPrompt("XuanFengShangHai") }, out answer);
                        if (answer == 0)
                        {
                            ISkill skill;
                            List<Card> cards;
                            List<Player> players;
                            if (Owner.AskForCardUsage(new CardUsagePrompt("XuanFeng1"), new XuanFeng1Verifier(),
                                out skill, out cards, out players))
                            {
                                try
                                {
                                    GameEventArgs args = new GameEventArgs();
                                    Owner[Sha.NumberOfShaUsed]--;
                                    args.Source = Owner;
                                    args.Targets = new List<Player>(players);
                                    args.Skill = new XuanFengShaComposerSkill();
                                    args.Cards = cards;
                                    Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
                                }
                                catch (TriggerResultException e)
                                {
                                    Trace.Assert(e.Status == TriggerResult.Retry);
                                    continue;
                                }
                            }
                        }
                        else
                        {
                            ISkill skill;
                            List<Card> cards;
                            List<Player> players;
                            if (Owner.AskForCardUsage(new CardUsagePrompt("XuanFeng2"), new XuanFeng2Verifier(), out skill, out cards, out players))
                            {
                                Game.CurrentGame.DoDamage(Owner, players[0], 1, DamageElement.None, null, null);
                            }

                        }
                    }
                }
            }
        }
开发者ID:pxoylngx,项目名称:sgs,代码行数:51,代码来源:XuanFeng.cs

示例2: Run

 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     var card = Game.CurrentGame.Judge(Owner, this, null, (judgeResultCard) => { return judgeResultCard.SuitColor == SuitColorType.Black; });
     if (card.SuitColor == SuitColorType.Black)
     {
         ISkill skill;
         List<Card> cards;
         List<Player> players;
         int toDraw = Owner.LostHealth;
         List<Card> remainingCards = new List<Card>();
         CardsMovement move = new CardsMovement();
         for (int i = 0; i < toDraw; i++)
         {
             Game.CurrentGame.SyncImmutableCard(Owner, Game.CurrentGame.PeekCard(0));
             Card c = Game.CurrentGame.DrawCard();
             move.Cards.Add(c);
             remainingCards.Add(c);
         }
         move.To = new DeckPlace(Owner, DeckType.Hand);
         move.Helper.IsFakedMove = true;
         Game.CurrentGame.MoveCards(move);
         if (!Owner.AskForCardUsage(new CardUsagePrompt("MiJi"), new MiJiVerifier(), out skill, out cards, out players))
         {
             players = new List<Player>() { Owner };
         }
         Game.CurrentGame.InsertBeforeDeal(null, remainingCards, new MovementHelper() { IsFakedMove = true });
         Game.CurrentGame.DrawCards(players[0], toDraw);
     }
 }
开发者ID:h1398123,项目名称:sgs,代码行数:29,代码来源:MiJi.cs

示例3: 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

示例4: Run

 protected void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (owner.AskForCardUsage(new CardUsagePrompt("MieJi", this), new MieJiVerifier(eventArgs.Targets[0], eventArgs.Card, eventArgs.Card.Type), out skill, out cards, out players))
     {
         NotifySkillUse(players);
         eventArgs.UiTargets.AddRange(players);
         eventArgs.Targets = eventArgs.Card.Type.ActualTargets(eventArgs.Source, eventArgs.UiTargets, eventArgs.Card);
     }
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:12,代码来源:MieJi.cs

示例5: StoreChun

 public void StoreChun(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (owner.AskForCardUsage(new CardUsagePrompt("ChunLao"), new ChunLaoStoreChunVerifier(), out skill, out cards, out players))
     {
         NotifySkillUse();
         CardsMovement move = new CardsMovement();
         move.Cards = cards;
         move.To = new DeckPlace(Owner, ChunDeck);
         Game.CurrentGame.MoveCards(move);
     }
 }
开发者ID:h1398123,项目名称:sgs,代码行数:14,代码来源:ChunLao.cs

示例6: Run

 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (Owner.AskForCardUsage(new CardUsagePrompt("HuWei"), new HuWeiVerifier(), out skill, out cards, out players))
     {
         NotifySkillUse();
         GameEventArgs args = new GameEventArgs();
         args.Source = Owner;
         args.Targets = players;
         args.Skill = new CardWrapper(Owner, new ShuiYanQiJun(), false);
         args.Cards = new List<Card>();
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
     }
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:16,代码来源:HuWei.cs

示例7: Run

 void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (owner.AskForCardUsage(new CardUsagePrompt("YuanHu", this), new YuanHuVerifier(), out skill, out cards, out players))
     {
         CardCategory type = cards[0].Type.Category;
         YuanHuEffect = effectMap[type];
         NotifySkillUse(players);
         Game.CurrentGame.HandleCardTransfer(owner, players[0], DeckType.Equipment, cards);
         switch (type)
         {
             case CardCategory.Weapon:
                 {
                     var result = from player in Game.CurrentGame.AlivePlayers where player != players[0] && Game.CurrentGame.DistanceTo(players[0], player) == 1 select player;
                     if (result.Count() == 0) break;
                     List<Card> nCards;
                     List<Player> nPlayers;
                     if (!owner.AskForCardUsage(new CardUsagePrompt("YuanHuQiZhi"), new YuanHuChoiceOnePlayer(players[0]), out skill, out nCards, out nPlayers))
                     {
                         nPlayers = new List<Player>();
                         nPlayers.Add(result.First());
                     }
                     if (nPlayers[0].HandCards().Count + nPlayers[0].DelayedTools().Count + nPlayers[0].Equipments().Count > 0)
                     {
                         var Card = Game.CurrentGame.SelectACardFrom(nPlayers[0], owner, new CardChoicePrompt("YuanHu", nPlayers[0], owner), "YuanHu", false, false);
                         Game.CurrentGame.HandleCardDiscard(nPlayers[0], new List<Card>() { Card });
                     }
                     break;
                 }
             case CardCategory.Armor:
                 {
                     Game.CurrentGame.DrawCards(players[0], 1);
                     break;
                 }
             case CardCategory.DefensiveHorse:
             case CardCategory.OffensiveHorse:
                 {
                     Game.CurrentGame.RecoverHealth(owner, players[0], 1);
                     break;
                 }
             default:
                 break;
         }
     }
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:47,代码来源:YuanHu.cs

示例8: UseDummyShaTo

 /// <summary>
 /// 某玩家对某玩家视为使用一张虚拟的杀,能被技能转化,影响选择的目标,如疠火,朱雀羽扇
 /// </summary>
 public static void UseDummyShaTo(Player source, Player target, CardHandler shaType, Prompt prompt, CardAttribute helper = null, bool notifyShaSound = true)
 {
     CompositeCard sha = new CompositeCard() { Type = shaType };
     var v1 = new DummyShaVerifier(target, shaType, helper);
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     Game.CurrentGame.Emit(GameEvent.PlayerIsAboutToUseCard, new PlayerIsAboutToUseOrPlayCardEventArgs() { Source = source, Verifier = v1 });
     source.AskForCardUsage(prompt, v1, out skill, out cards, out players);
     GameEventArgs args = new GameEventArgs();
     args.Source = source;
     args.Targets = new List<Player>(players);
     if (target != null) args.Targets.Add(target);
     args.Skill = skill == null ? new CardWrapper(source, shaType, notifyShaSound) : skill;
     args.Cards = cards;
     CompositeCard card = null;
     if (skill != null)
     {
         List<Card> dummyCards = new List<Card>() { new Card() { Type = shaType, Place = new DeckPlace(null, DeckType.None) } };
         (skill as CardTransformSkill).TryTransform(dummyCards, null, out card);
         //虚拟的杀是不能有子卡的。
         card.Subcards.Clear();
     }
     //在触发 CommitActionToTargets 的时候,只有在这里,args.Card才会被赋值,且为CompositeCard
     args.Card = card;
     if (args.Targets.Count == 0)
     {
         foreach (Player p in Game.CurrentGame.AlivePlayers)
         {
             if (p != source && v1.FastVerify(source, skill, cards, new List<Player>() { p }) != VerifierResult.Fail)
             {
                 args.Targets.Add(p);
                 break;
             }
         }
     }
     try
     {
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
     }
     catch (TriggerResultException)
     {
         //程序总是不应该执行到这里的
         Trace.Assert(false);
     }
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:49,代码来源:Sha.cs

示例9: Run

 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (Owner.AskForCardUsage(new CardUsagePrompt("ShiChou", this), new ShiChouVerifier(), out skill, out cards, out players))
     {
         NotifySkillUse(players);
         Owner[ShiChouUsed] = 1;
         players[0][ShiChouSource[Owner]] = 1;
         Game.CurrentGame.HandleCardTransferToHand(Owner, players[0], cards);
         players[0][ShiChouStatus] = 1;
         Trigger tri1 = new ShiChouProtect(Owner, players[0]);
         Trigger tri2 = new ShiChouDrawCards(players[0], Owner);
         Trigger tri3 = new ShiChouRemoval(players[0], Owner, tri1, tri2);
         Game.CurrentGame.RegisterTrigger(GameEvent.DamageInflicted, tri1);
         Game.CurrentGame.RegisterTrigger(GameEvent.DamageComputingFinished, tri2);
         Game.CurrentGame.RegisterTrigger(GameEvent.PlayerIsAboutToDie, tri3);
     }
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:20,代码来源:ShiChou.cs

示例10: SaveALife

 public void SaveALife(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     while (eventArgs.Targets[0].Health <= 0 && Game.CurrentGame.Decks[owner, ChunDeck].Count > 0 &&
         owner.AskForCardUsage(new CardUsagePrompt("ChunLaoSave"), new  ChuLaoVerifier(), out skill, out cards, out players))
     {
         NotifySkillUse(eventArgs.Targets);
         Card theCard = cards[0];
         Game.CurrentGame.HandleCardDiscard(owner, new List<Card>() { theCard });
         Game.CurrentGame.IsDying.Push(eventArgs.Targets[0]);
         GameEventArgs args = new GameEventArgs();
         args.Source = eventArgs.Targets[0];
         args.Targets = new List<Player>() { eventArgs.Targets[0] };
         args.Skill = new ChunLaoJiuCardTransformSkill();
         args.Cards = new List<Card>();
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
         Game.CurrentGame.IsDying.Pop();
     }
 }
开发者ID:h1398123,项目名称:sgs,代码行数:21,代码来源:ChunLao.cs

示例11: 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

示例12: Run

 void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
 {
     Card theCard = cards[0];
     Game.CurrentGame.HandleCardTransfer(owner, players[0], DeckType.Equipment, cards);
     switch (theCard.Type.Category)
     {
         case CardCategory.Weapon:
             {
                 var result = from player in Game.CurrentGame.AlivePlayers where player != players[0] && Game.CurrentGame.DistanceTo(players[0], player) == 1 select player;
                 if (result.Count() == 0) break;
                 ISkill skill;
                 List<Card> nCards;
                 List<Player> nPlayers;
                 if (!owner.AskForCardUsage(new CardUsagePrompt("YuanHuQiZhi"), new YuanHuChoiceOnePlayer(players[0]), out skill, out nCards, out nPlayers))
                 {
                     nPlayers = new List<Player>();
                     nPlayers.Add(result.First());
                 }
                 var Card = Game.CurrentGame.SelectACardFrom(nPlayers[0], owner, new CardChoicePrompt("YuanHu", nPlayers[0], owner), "YuanHu");
                 Game.CurrentGame.HandleCardDiscard(nPlayers[0], new List<Card>() { Card });
                 break;
             }
         case CardCategory.Armor:
             {
                 Game.CurrentGame.DrawCards(players[0], 1);
                 break;
             }
         case CardCategory.DefensiveHorse:
         case CardCategory.OffensiveHorse:
             {
                 Game.CurrentGame.RecoverHealth(owner, players[0], 1);
                 break;
             }
         default:
             break;
     }
 }
开发者ID:h1398123,项目名称:sgs,代码行数:37,代码来源:YuanHu.cs

示例13: Run

 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     Owner[FenYong.FenYongStatus] = 0;
     int answer = 0;
     Player current = Game.CurrentGame.CurrentPlayer;
     int choiceCount = Owner.LostHealth;
     int currentPlayerCardsCount = current.HandCards().Count + current.Equipments().Count();
     List<OptionPrompt> prompts = new List<OptionPrompt>();
     prompts.Add(new OptionPrompt("XueHenQiPai", current, choiceCount));
     prompts.Add(new OptionPrompt("XueHenSha"));
     Owner.AskForMultipleChoice(new MultipleChoicePrompt("XueHen"), prompts, out answer);
     if (answer == 0)
     {
         Owner[XueHenEffect] = 0;
         NotifySkillUse();
         if (currentPlayerCardsCount <= choiceCount)
         {
             List<Card> cards = new List<Card>();
             cards.AddRange(current.HandCards());
             cards.AddRange(current.Equipments());
             Game.CurrentGame.HandleCardDiscard(current, cards);
             return;
         }
         List<List<Card>> choiceAnswer;
         List<DeckPlace> sourcePlace = new List<DeckPlace>();
         sourcePlace.Add(new DeckPlace(current, DeckType.Hand));
         sourcePlace.Add(new DeckPlace(current, DeckType.Equipment));
         if (!Owner.AskForCardChoice(new CardChoicePrompt("XueHen", current, Owner),
             sourcePlace,
             new List<string>() { "QiPaiDui" },
             new List<int>() { choiceCount },
             new RequireCardsChoiceVerifier(choiceCount),
             out choiceAnswer,
             null,
             CardChoiceCallback.GenericCardChoiceCallback))
         {
             choiceAnswer = new List<List<Card>>();
             choiceAnswer.Add(Game.CurrentGame.PickDefaultCardsFrom(new List<DeckPlace>() { new DeckPlace(current, DeckType.Hand), new DeckPlace(current, DeckType.Equipment) }, choiceCount));
         }
         Game.CurrentGame.HandleCardDiscard(current, choiceAnswer[0]);
     }
     else
     {
         ISkill skill;
         List<Card> cards;
         List<Player> players;
         if (!Owner.AskForCardUsage(new CardUsagePrompt("XueHen"), new XueHenShaVerifier(), out skill, out cards, out players))
         {
             players = new List<Player>();
             List<Player> nPlayers = Game.CurrentGame.AlivePlayers;
             players.Add(nPlayers[0]);
         }
         Owner[XueHenEffect] = 1;
         NotifySkillUse(players);
         GameEventArgs args = new GameEventArgs();
         Owner[Sha.NumberOfShaUsed]--;
         args.Source = Owner;
         args.Targets = players;
         args.Skill = new CardWrapper(Owner, new RegularSha());
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
     }
 }
开发者ID:h1398123,项目名称:sgs,代码行数:62,代码来源:XueHen.cs

示例14: Run

 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (Owner.AskForCardUsage(new CardUsagePrompt("JunWei"), new JunWeiVerifier(), out skill, out cards, out players))
     {
         NotifySkillUse(players);
         Game.CurrentGame.HandleCardDiscard(Owner, cards);
         Player target = players[0];
         if (target.AskForCardUsage(new CardUsagePrompt("JunWeiShowCard"), new JunWeiShowCardVerifier(), out skill, out cards, out players))
         {
             Card temp = cards[0];
             Game.CurrentGame.NotificationProxy.NotifyShowCard(target, temp);
             if (!Owner.AskForCardUsage(new CardUsagePrompt("JunWeiGiveShan"), new JunWeiGiveShanVerifier(), out skill, out cards, out players))
             {
                 players = new List<Player>() { Owner };
             }
             Game.CurrentGame.SyncCardAll(ref temp);
             Game.CurrentGame.HandleCardTransferToHand(target, players[0], new List<Card>() { temp });
         }
         else
         {
             Game.CurrentGame.LoseHealth(target, 1);
             if (target.Equipments().Count == 0) return;
             GameDelays.Delay(GameDelayTypes.JunWei);
             List<List<Card>> answer;
             List<DeckPlace> sourceDecks = new List<DeckPlace>();
             sourceDecks.Add(new DeckPlace(target, DeckType.Equipment));
             if (!Owner.AskForCardChoice(new CardChoicePrompt("JunWeiChoice", target, Owner),
                 sourceDecks,
                 new List<string>() { "JunWei" },
                 new List<int>() { 1 },
                 new RequireOneCardChoiceVerifier(),
                 out answer))
             {
                 answer = new List<List<Card>>();
                 answer.Add(new List<Card>());
                 answer[0].Add(target.Equipments().First());
             }
             junweiTarget.Add(target);
             Game.CurrentGame.HandleCardTransfer(target, target, JunWeiDeck, answer[0]);
         }
     }
 }
开发者ID:h1398123,项目名称:sgs,代码行数:45,代码来源:JunWei.cs

示例15: Run

 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     bool shensu1 = gameEvent == GameEvent.PhaseOutEvents[TurnPhase.Start];
     CardUsagePrompt shensu1Prompt = new CardUsagePrompt("ShenSu1", this);
     CardUsagePrompt shensu2Prompt = new CardUsagePrompt("ShenSu2", this);
     if (Owner.AskForCardUsage(shensu1 ? shensu1Prompt : shensu2Prompt, new ShenSuVerifier(shensu1, verifier), out skill, out cards, out players))
     {
         NotifySkillUse();
         if (!shensu1) Game.CurrentGame.HandleCardDiscard(Owner, cards);
         GameEventArgs args = new GameEventArgs();
         Owner[Sha.NumberOfShaUsed]--;
         args.Source = Owner;
         args.Targets = players;
         args.Skill = skill == null ? new CardWrapper(Owner, new RegularSha(), false) : skill;
         args.Cards = new List<Card>();
         CardTransformSkill transformSkill = skill as CardTransformSkill;
         if (transformSkill != null)
         {
             CompositeCard card;
             transformSkill.TryTransform(new List<Card>() { new Card() { Type = new RegularSha(), Place = new DeckPlace(null, DeckType.None) } }, null, out card);
             card.Subcards.Clear();
             args.Card = card;
         }
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
         if (shensu1)
         {
             Game.CurrentGame.PhasesSkipped.Add(TurnPhase.Judge);
             Game.CurrentGame.PhasesSkipped.Add(TurnPhase.Draw);
         }
         else Game.CurrentGame.PhasesSkipped.Add(TurnPhase.Play);
     }
 }
开发者ID:shonwang,项目名称:sgs,代码行数:35,代码来源:ShenSu.cs


注:本文中的Sanguosha.Core.Players.Player.AskForCardUsage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。