Exemple #1
0
        public override bool Commit(GameEventArgs arg)
        {
            Owner[MingCeUsed] = 1;
            Game.CurrentGame.HandleCardTransferToHand(Owner, arg.Targets[0], arg.Cards);
            if (arg.Targets.Count == 1)
            {
                Game.CurrentGame.DrawCards(arg.Targets[0], 1);
                return(true);
            }
            int answer = 0;

            arg.Targets[0].AskForMultipleChoice(new MultipleChoicePrompt("MingCe"), new List <OptionPrompt>()
            {
                new OptionPrompt("MingCeSha", arg.Targets[1]), new OptionPrompt("MingCeMoPai")
            }, out answer);
            if (answer == 0)
            {
                Sha.UseDummyShaTo(arg.Targets[0], arg.Targets[1], new RegularSha(), new CardUsagePrompt("MingCe", arg.Targets[1]));
            }
            else
            {
                Game.CurrentGame.DrawCards(arg.Targets[0], 1);
            }
            return(true);
        }
        public override bool Commit(GameEventArgs arg)
        {
            Owner[MiZhaoUsed] = 1;
            Game.CurrentGame.HandleCardTransferToHand(Owner, arg.Targets[0], Owner.HandCards());
            List <Player> alivePlayers = Game.CurrentGame.AlivePlayers;

            if (!alivePlayers.Any(p => p.HandCards().Count > 0 && p != arg.Targets[0]))
            {
                return(true);
            }
            ISkill        skill;
            List <Card>   cards;
            List <Player> players;

            if (!Owner.AskForCardUsage(new CardUsagePrompt("MiZhao", arg.Targets[0]), new MiZhaoVerifier(arg.Targets[0]), out skill, out cards, out players))
            {
                players = new List <Player>();
                foreach (Player p in alivePlayers)
                {
                    if (p.HandCards().Count > 0 && p != arg.Targets[0])
                    {
                        players.Add(p);
                        break;
                    }
                }
            }
            Player pindianTarget = players[0];
            var    result = Game.CurrentGame.PinDian(arg.Targets[0], pindianTarget, this);
            Player winner, loser;

            if (result == null)
            {
                return(true);
            }
            if (result == true)
            {
                winner = arg.Targets[0]; loser = pindianTarget;
            }
            else
            {
                winner = pindianTarget; loser = arg.Targets[0];
            }
            if (!Game.CurrentGame.PlayerCanBeTargeted(winner, new List <Player>()
            {
                loser
            }, new CompositeCard()
            {
                Type = new Sha()
            }))
            {
                return(true);
            }
            winner[Sha.NumberOfShaUsed]--;
            Sha.UseDummyShaTo(winner, loser, new RegularSha(), new CardUsagePrompt("MingCe", loser), MiZhaoSha);
            return(true);
        }
        public override bool Commit(GameEventArgs arg)
        {
            Owner[MouZhuUsed] = 1;
            List <Card>   cards;
            List <Player> players;
            ISkill        skill;

            if (!arg.Targets[0].AskForCardUsage(new CardUsagePrompt("MouZhu", Owner), new MouZhuVerifier(), out skill, out cards, out players))
            {
                cards = Game.CurrentGame.PickDefaultCardsFrom(new List <DeckPlace>()
                {
                    new DeckPlace(arg.Targets[0], DeckType.Hand)
                });
            }
            Game.CurrentGame.HandleCardTransferToHand(arg.Targets[0], Owner, cards);
            if (Owner.HandCards().Count > arg.Targets[0].HandCards().Count)
            {
                int answer;
                arg.Targets[0].AskForMultipleChoice(new MultipleChoicePrompt("MouZhu"), new List <OptionPrompt>()
                {
                    new OptionPrompt("MouZhuSha", Owner), new OptionPrompt("MouZhuJueDou", Owner)
                }, out answer);
                if (answer == 0)
                {
                    Sha.UseDummyShaTo(arg.Targets[0], Owner, new RegularSha(), new CardUsagePrompt("MouZhu2", Owner));
                }
                else
                {
                    GameEventArgs args = new GameEventArgs();
                    args.Source  = arg.Targets[0];
                    args.Targets = new List <Player>();
                    args.Targets.Add(Owner);
                    args.Skill = new CardWrapper(arg.Targets[0], new JueDou());
                    args.Cards = new List <Card>();
                    Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
                }
            }
            return(true);
        }
        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 <Player> shaCheck                = Game.CurrentGame.AlivePlayers;

            shaCheck.Remove(Owner);
            bool canUseSha = Game.CurrentGame.PlayerCanBeTargeted(Owner, shaCheck, new Card()
            {
                Place = new DeckPlace(Owner, DeckType.None), Type = new Sha()
            });

            if (canUseSha)
            {
                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)
            {
                XueHenEffect = 0;
                NotifySkillUse();
                if (currentPlayerCardsCount == 0)
                {
                    return;
                }
                List <Card> toDiscard = new List <Card>();
                if (currentPlayerCardsCount <= choiceCount)
                {
                    toDiscard.AddRange(current.HandCards());
                    toDiscard.AddRange(current.Equipments());
                }
                else
                {
                    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));
                    }
                    toDiscard = choiceAnswer[0];
                }
                Game.CurrentGame.HandleCardDiscard(current, toDiscard);
            }
            else
            {
                XueHenEffect = 1;
                NotifySkillUse();
                Owner[Sha.NumberOfShaUsed]--;
                Sha.UseDummyShaTo(Owner, null, new RegularSha(), new CardUsagePrompt("XueHen"), XueHenSha);
            }
        }