예제 #1
0
 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     var args = eventArgs as DiscardCardEventArgs;
     if (Game.CurrentGame.CurrentPlayer == Owner || args.Source == null || args.Source == Owner || (args.Reason != DiscardReason.Discard))
     {
         return;
     }
     var cardsToProcess = new List<Card>(
                          from c in eventArgs.Cards
                          where c.Type.BaseCategory() == CardCategory.Equipment && (c.Place.DeckType == DeckType.Hand || c.Place.DeckType == DeckType.Equipment)
                          select c);
     if (cardsToProcess.Count() > 0)
     {
         CardsMovement temp = new CardsMovement();
         temp.Cards = new List<Card>(cardsToProcess);
         temp.To = new DeckPlace(null, DeckType.Discard);
         foreach (Card cc in cardsToProcess)
         {
             cc.PlaceOverride = new DeckPlace(null, DeckType.Discard);
         }
         Game.CurrentGame.NotificationProxy.NotifyCardMovement(new List<CardsMovement>() { temp });
     }
     else return;
     List<OptionPrompt> prompts = new List<OptionPrompt>();
     if (cardsToProcess.Count > 1)
     {
         prompts.Add(OptionPrompt.NoChoice);
         prompts.Add(new OptionPrompt("YinLiQuanBu"));
         prompts.Add(new OptionPrompt("YinLiBuFen"));
     }
     else prompts.AddRange(OptionPrompt.YesNoChoices);
     int choiceIndex = 0;
     Owner.AskForMultipleChoice(new MultipleChoicePrompt(Prompt.SkillUseYewNoPrompt, this), prompts, out choiceIndex);
     if (choiceIndex == 0) return;
     if (choiceIndex == 1) NotifySkillUse();
     foreach (var c in cardsToProcess)
     {
         var prompt = new MultipleChoicePrompt("YinLi", c);
         int answer = 0;
         if (choiceIndex == 1 || Owner.AskForMultipleChoice(prompt, Prompt.YesNoChoices, out answer) && answer == 1)
         {
             if (choiceIndex == 2) NotifySkillUse();
             c.Log = new ActionLog();
             c.Log.SkillAction = this;
             CardsMovement temp = new CardsMovement();
             temp.Cards.Add(c);
             temp.To = new DeckPlace(null, YinLiDeck);
             c.PlaceOverride = new DeckPlace(null, DeckType.Discard);
             Game.CurrentGame.NotificationProxy.NotifyCardMovement(new List<CardsMovement>() { temp });
             c.Log = new ActionLog();
             Game.CurrentGame.HandleCardTransferToHand(c.Owner, Owner, new List<Card>() { c }, new MovementHelper() { IsFakedMove = true, AlwaysShowLog = true });
             eventArgs.Cards.Remove(c);
         }
     }
 }
예제 #2
0
 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 (Owner.LostHealth == 0)
             {
                 if (AskForSkillUse())
                 {
                     Game.CurrentGame.DrawCards(Owner, 2);
                 }
             }
             else
             {
                 int answer;
                 if (Owner.AskForMultipleChoice(new MultipleChoicePrompt("XiaoJi"), new List<OptionPrompt>() { OptionPrompt.NoChoice, new OptionPrompt("MoPai"), new OptionPrompt("HuiFu") }, out answer))
                 {
                     NotifySkillUse(new List<Player>());
                     if (answer == 1)
                     {
                         Game.CurrentGame.DrawCards(Owner, 2);
                     }
                     if (answer == 2)
                     {
                         Game.CurrentGame.RecoverHealth(Owner, Owner, 1);
                     }
                 }
             }
         }
     }
 }
예제 #3
0
 public void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     Trigger tri = new Trigger();
     int answer = 0;
     List<OptionPrompt> JiangChiQuestion = new List<OptionPrompt>();
     JiangChiQuestion.Add(Prompt.NoChoice);
     JiangChiQuestion.Add(new OptionPrompt("JiangChi1"));
     JiangChiQuestion.Add(new OptionPrompt("JiangChi2"));
     owner.AskForMultipleChoice(new MultipleChoicePrompt("JiangChi"), JiangChiQuestion, out answer);
     if (answer == 0)
     {
         return;
     }
     NotifySkillUse(new List<Player>());
     if (answer == 1)
     {
         owner[Player.DealAdjustment]++;
         tri = new JiangChi1(owner);
         Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanUseCard, tri);
         Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanPlayCard, tri);
     }
     else
     {
         owner[Sha.AdditionalShaUsable]++;
         owner[Player.DealAdjustment]--;
         tri = new JiangChi2(owner);
         Game.CurrentGame.RegisterTrigger(Sha.PlayerShaTargetValidation, tri);
     }
     Trigger triRemoval = new JiangChiRemoval(owner, tri, answer == 1);
     Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, triRemoval);
 }
예제 #4
0
파일: LuoYing.cs 프로젝트: pxoylngx/sgs
 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     var args = eventArgs as DiscardCardEventArgs;
     if (args.Source == null || args.Source == Owner || (args.Reason != DiscardReason.Discard && args.Reason != DiscardReason.Judge))
     {
         return;
     }
     int answer = 0;
     var cardsToProcess = new List<Card>(
                          from c in eventArgs.Cards
                          where c.Suit == SuitType.Club
                          select c);
     if (cardsToProcess.Count() > 0)
     {
         CardsMovement temp = new CardsMovement();
         temp.Cards = new List<Card>(cardsToProcess);
         temp.To = new DeckPlace(null, DeckType.Discard);
         Game.CurrentGame.NotificationProxy.NotifyCardMovement(new List<CardsMovement>() { temp });
         foreach (Card cc in cardsToProcess)
         {
             cc.PlaceOverride = new DeckPlace(null, DeckType.Discard);
         }
     }
     foreach (var c in cardsToProcess)
     {
         var prompt = new MultipleChoicePrompt("LuoYing", c);
         if (Owner.AskForMultipleChoice(prompt, Prompt.YesNoChoices, out answer) && answer == 1)
         {
             NotifySkillUse();
             Game.CurrentGame.HandleCardTransferToHand(null, Owner, new List<Card>() { c });
             eventArgs.Cards.Remove(c);
         }
     }
 }
예제 #5
0
 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);
     }
 }
예제 #6
0
파일: ZhenLie.cs 프로젝트: kingling/sgs
 void OnJudgeBegin(Player player, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     Card c = Game.CurrentGame.Decks[eventArgs.Source, DeckType.JudgeResult].Last();
     int answer = 0;
     player.AskForMultipleChoice(new MultipleChoicePrompt("ZhenLie", c.Suit, c.Rank), OptionPrompt.YesNoChoices, out answer);
     if (answer == 1)
     {
         NotifySkillUse(new List<Player>());
         Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
         Card c1 = Game.CurrentGame.DrawCard();
         new GuiCai().ReplaceJudgementCard(player, eventArgs.Source, c1, this);
     }
 }
예제 #7
0
파일: XuanFeng.cs 프로젝트: pxoylngx/sgs
        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);
                            }

                        }
                    }
                }
            }
        }
예제 #8
0
 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     int answer;
     if (Owner.AskForMultipleChoice(new MultipleChoicePrompt("ManYi"), OptionPrompt.YesNoChoices, out answer) && answer == 1)
     {
         NotifySkillUse();
         GameEventArgs args = new GameEventArgs();
         args.Source = Owner;
         args.Targets = new List<Player>();
         args.Skill = new CardWrapper(Owner, new NanManRuQin(), false);
         args.Cards = new List<Card>();
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
     }
 }
예제 #9
0
파일: EnYuan.cs 프로젝트: h1398123/sgs
 public void En(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     foreach (Player source in enSources)
     {
         int answer = 0;
         Owner.AskForMultipleChoice(new MultipleChoicePrompt("EnYuan", source), OptionPrompt.YesNoChoices, out answer);
         if (answer == 1)
         {
             Owner[EnYuanEffect] = 0;
             NotifySkillUse();
             Game.CurrentGame.DrawCards(source, 1);
         }
     }
 }
예제 #10
0
        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]);

            }
        }
예제 #11
0
파일: XueHen.cs 프로젝트: h1398123/sgs
 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);
     }
 }
예제 #12
0
파일: MouKui.cs 프로젝트: kingling/sgs
 void Run1(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     MultipleChoicePrompt prompt;
     List<OptionPrompt> options = new List<OptionPrompt>();
     OptionPrompt option1 = new OptionPrompt("MouKuiMoPai");
     int i = 0;
     foreach (var target in eventArgs.Targets)
     {
         options.Clear();
         options.Add(OptionPrompt.NoChoice);
         options.Add(option1);
         options.Add(new OptionPrompt("MouKuiQiZhi", target));
         bool isNaked = target.HandCards().Count + target.Equipments().Count == 0;
         prompt = isNaked ? new MultipleChoicePrompt("MouKuiDrawCardOnly") : new MultipleChoicePrompt("MouKui");
         int answer = 0;
         Owner.AskForMultipleChoice(prompt, isNaked ? OptionPrompt.YesNoChoices : options, out answer);
         if (answer == 0) { i++; continue; }
         MouKuiEffect = 0;
         NotifySkillUse();
         if (answer == 1)
         {
             Game.CurrentGame.DrawCards(Owner, 1);
         }
         else
         {
             Card theCard = Game.CurrentGame.SelectACardFrom(target, Owner, new CardChoicePrompt("MouKui", target, Owner), "QiPaiDui");
             Game.CurrentGame.HandleCardDiscard(target, new List<Card>() { theCard });
         }
         eventArgs.ReadonlyCard[MouKuiCheck[target]] |= (1 << i);
         i++;
     }
 }