コード例 #1
0
ファイル: MiJi.cs プロジェクト: h1398123/sgs
 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);
     }
 }
コード例 #2
0
ファイル: DaWu.cs プロジェクト: pxoylngx/sgs
 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     List<Card> originalCards = new List<Card>(Game.CurrentGame.Decks[Owner, QiXing.QiXingDeck]);
     int qxCount = Game.CurrentGame.Decks[Owner, QiXing.QiXingDeck].Count;
     // hack the cards to owner's hand. do not trigger anything
     CardsMovement move = new CardsMovement();
     move.Cards = new List<Card>(Game.CurrentGame.Decks[Owner, QiXing.QiXingDeck]);
     move.To = new DeckPlace(Owner, DeckType.Hand);
     move.Helper.IsFakedMove = true;
     Game.CurrentGame.MoveCards(move);
     if (Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("DaWu"), new DaWuVerifier(originalCards), out skill, out cards, out players))
     {
         NotifySkillUse(players);
         foreach (var mark in players)
         {
             mark[DaWuMark] = 1;
         }
         dawuTargets = players;
         foreach (Card cc in cards) originalCards.Remove(cc);
         Game.CurrentGame.HandleCardDiscard(null, cards);
     }
     move.Cards = new List<Card>(originalCards);
     move.To = new DeckPlace(Owner, QiXing.QiXingDeck);
     Game.CurrentGame.MoveCards(move);
 }
コード例 #3
0
ファイル: FanKui.cs プロジェクト: kissgoodbye/sgs
        public void OnAfterDamageInflicted(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            NotifySkillUse(new List<Player>() { eventArgs.Source });
            List<DeckPlace> deck = new List<DeckPlace>();
            deck.Add(new DeckPlace(eventArgs.Source, DeckType.Hand));
            deck.Add(new DeckPlace(eventArgs.Source, DeckType.Equipment));
            List<int> max = new List<int>() { 1 };
            List<List<Card>> result;
            List<string> deckname = new List<string>() {"FanKui choice"};
            Card theCard;

            int windowId = 0;
            if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("FanKui", eventArgs.Source), deck, deckname, max, new RequireOneCardChoiceVerifier(), out result, new List<bool>() { false }, ref windowId))
            {

                Trace.TraceInformation("Invalid choice for FanKui");
                theCard = Game.CurrentGame.Decks[eventArgs.Source, DeckType.Hand]
                    .Concat(Game.CurrentGame.Decks[eventArgs.Source, DeckType.Equipment]).First();
            }
            else
            {
                theCard = result[0][0];
            }
            List<Card> cards = new List<Card>();
            cards.Add(theCard);
            Game.CurrentGame.HandleCardTransferToHand(eventArgs.Source, owner, cards);
        }
コード例 #4
0
ファイル: XiaoJi.cs プロジェクト: RagingBigFemaleBird/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 (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);
                     }
                 }
             }
         }
     }
 }
コード例 #5
0
ファイル: JiLei.cs プロジェクト: kingling/sgs
 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     int answer = 0;
     List<OptionPrompt> JiLeiQuestion = new List<OptionPrompt>();
     JiLeiQuestion.Add(new OptionPrompt("JiBen"));
     JiLeiQuestion.Add(new OptionPrompt("JinNang"));
     JiLeiQuestion.Add(new OptionPrompt("ZhuangBei"));
     JiLeiQuestion.Add(Prompt.NoChoice);
     if (Game.CurrentGame.UiProxies[Owner].AskForMultipleChoice(
         new MultipleChoicePrompt("JiLei", eventArgs.Source), JiLeiQuestion, out answer))
     {
         Trace.Assert(answer >= 0 && answer <= 3);
         if (answer != 3)
         {
             NotifySkillUse(new List<Player>());
             eventArgs.Source[JiLeiInEffect] = 1;
             JiLeiImplementation trigger = new JiLeiImplementation(eventArgs.Source, answer);
             Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanDiscardCard, trigger);
             Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanUseCard, trigger);
             Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanPlayCard, trigger);
             JiLeiRemoval trigger2 = new JiLeiRemoval(eventArgs.Source, trigger);
             Game.CurrentGame.RegisterTrigger(GameEvent.PhaseEndEvents[TurnPhase.End], trigger2);
             Game.CurrentGame.NotificationProxy.NotifyLogEvent(new LogEvent("JiLei", eventArgs.Source, JiLeiQuestion[answer]), new List<Player>() { Owner, eventArgs.Source });
         }
     }
 }
コード例 #6
0
ファイル: ZhiChi.cs プロジェクト: RagingBigFemaleBird/sgs
 public override void Run(GameEvent gameEvent, GameEventArgs eventArgs)
 {
     if (eventArgs.Targets[0] != Owner ||
         !(eventArgs.ReadonlyCard.Type.IsCardCategory(CardCategory.ImmediateTool) || eventArgs.ReadonlyCard.Type is Sha))
         return;
     throw new TriggerResultException(TriggerResult.End);
 }
コード例 #7
0
ファイル: QiLinGong.cs プロジェクト: kissgoodbye/sgs
 protected void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     var equipDeck = Game.CurrentGame.Decks[eventArgs.Targets[0], DeckType.Equipment];
     Card c;
     if (equipDeck.Count(s => (s.Type is DefensiveHorse) || (s.Type is OffensiveHorse)) > 1)
     {
         int answer = 0;
         Game.CurrentGame.UiProxies[Owner].AskForMultipleChoice(new MultipleChoicePrompt("QiLinGong", this), new List<String> { Prompt.MultipleChoiceOptionPrefix + "JiaYiZuoJi", Prompt.MultipleChoiceOptionPrefix + "JianYiZuoJi" },
             out answer);
         if (answer == 1)
         {
             var results = from equip in equipDeck where equip.Type is OffensiveHorse select equip;
             Trace.Assert(results.Count() == 1);
             c = results.First();
         }
         else
         {
             Trace.Assert(answer == 0);
             var results = from equip in equipDeck where equip.Type is DefensiveHorse select equip;
             Trace.Assert(results.Count() == 1);
             c = results.First();
         }
     }
     else
     {
         var results = from equip in equipDeck where (equip.Type is DefensiveHorse) || (equip.Type is OffensiveHorse) select equip;
         Trace.Assert(results.Count() == 1);
         c = results.First();
     }
     Game.CurrentGame.HandleCardDiscard(eventArgs.Targets[0], new List<Card>() { c });
 }
コード例 #8
0
ファイル: HaoShi.cs プロジェクト: maplegh/sgs
 protected void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     List<Card> cards;
     List<Player> players;
     ISkill skill;
     int halfHC = Game.CurrentGame.Decks[owner, DeckType.Hand].Count / 2;
     if (!Game.CurrentGame.UiProxies[owner].AskForCardUsage(new CardUsagePrompt("HaoShi"), new HaoShiVerifier(halfHC), out skill, out cards, out players))
     {
         cards = new List<Card>();
         cards.AddRange(Game.CurrentGame.Decks[owner, DeckType.Hand].GetRange(0, halfHC));
         int minHC = int.MaxValue;
         Player p = null;
         foreach (var pl in Game.CurrentGame.AlivePlayers)
         {
             int count = Game.CurrentGame.Decks[owner, DeckType.Hand].Count;
             if (pl != owner && count < minHC)
             {
                 p = pl;
                 minHC = count;
             }
         }
         players = new List<Player>() { p };
     }
     Game.CurrentGame.HandleCardTransferToHand(owner, players[0], cards);
 }
コード例 #9
0
ファイル: TuXi2.cs プロジェクト: RagingBigFemaleBird/sgs
        void GetTheirCards(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            ISkill skill;
            List<Card> cards;
            List<Player> players;
            if (Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("TuXi2"), new TuXiVerifier(), out skill, out cards, out players))
            {
                Game.CurrentGame.SortByOrderOfComputation(Game.CurrentGame.CurrentPlayer, players);
                NotifySkillUse(players);
                var p = players[0];
                List<List<Card>> answer;
                if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("TuXi"), new List<DeckPlace>() { new DeckPlace(p, DeckType.Hand) },
                    new List<string>() { "TuXi" }, new List<int>() { 1 }, new RequireOneCardChoiceVerifier(true), out answer))
                {
                    answer = new List<List<Card>>();
                    answer.Add(Game.CurrentGame.PickDefaultCardsFrom(new List<DeckPlace>() { new DeckPlace(p, DeckType.Hand) }));
                }
                CardsMovement move = new CardsMovement();
                move.Cards = new List<Card>(answer[0]);
                move.To = new DeckPlace(Owner, DeckType.Hand);

                Game.CurrentGame.MoveCards(move);
                Owner[Player.DealAdjustment]--;
            }
        }
コード例 #10
0
ファイル: ChengXiang.cs プロジェクト: RagingBigFemaleBird/sgs
        void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            DeckType daXiangDeck = DeckType.Register("DaXiang");

            CardsMovement move = new CardsMovement();
            move.Cards = new List<Card>();
            for (int i = 0; i < 4; i++)
            {
                Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
                Card c = Game.CurrentGame.DrawCard();
                move.Cards.Add(c);
            }
            move.To = new DeckPlace(null, daXiangDeck);
            Game.CurrentGame.MoveCards(move);
            List<List<Card>> answer;
            if (Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("ChengXiang", Owner),
                    new List<DeckPlace>() { new DeckPlace(null, daXiangDeck) },
                    new List<string>() { "AcquiredCards" },
                    new List<int>() { 4 },
                    new DaXiangVerifier(Game.CurrentGame.Decks[null, daXiangDeck]),
                    out answer,
                    null,
                    CardChoiceCallback.GenericCardChoiceCallback))
            {
                Game.CurrentGame.HandleCardTransferToHand(null, Owner, answer[0]);
            }

            foreach (var c in Game.CurrentGame.Decks[null, daXiangDeck])
            {
                c.Log.SkillAction = this;
                c.Log.GameAction = GameAction.PlaceIntoDiscard;
            }
            Game.CurrentGame.PlaceIntoDiscard(null, new List<Card>(Game.CurrentGame.Decks[null, daXiangDeck]));
        }
コード例 #11
0
ファイル: YingHun.cs プロジェクト: kissgoodbye/sgs
 protected void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
 {
     int x = owner.MaxHealth - owner.Health;
     int answer = 0;
     Game.CurrentGame.UiProxies[owner].AskForMultipleChoice(new MultipleChoicePrompt("YingHun"), new List<string>() { "YingHun1", "YingHun2" }, out answer);
     if (answer == 0)
     {
         Game.CurrentGame.DrawCards(players[0], x);
         Game.CurrentGame.ForcePlayerDiscard(players[0],
                         (p, i) =>
                         {
                             return 1 - i;
                         },
                         true);
     }
     else
     {
         Game.CurrentGame.DrawCards(players[0], 1);
         Game.CurrentGame.ForcePlayerDiscard(players[0],
                         (p, i) =>
                         {
                             return x - i;
                         },
                         true);
     }
 }
コード例 #12
0
ファイル: FenXin.cs プロジェクト: RagingBigFemaleBird/sgs
        void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            Owner[FenXinUsed] = 1;
            Player target = eventArgs.Targets[0];

            Card role1 = Game.CurrentGame.Decks[Owner, RoleGame.RoleDeckType][0];
            Card role2 = Game.CurrentGame.Decks[target, RoleGame.RoleDeckType][0];
            Game.CurrentGame.SyncCard(target, ref role1);
            Game.CurrentGame.SyncCard(Owner, ref role2);

            List<CardsMovement> moves = new List<CardsMovement>();
            CardsMovement move1 = new CardsMovement();
            move1.Cards = new List<Card>() { role1 };
            move1.To = new DeckPlace(target, RoleGame.RoleDeckType);
            moves.Add(move1);

            CardsMovement move2 = new CardsMovement();
            move2.Cards = new List<Card>() { role2 };
            move2.To = new DeckPlace(Owner, RoleGame.RoleDeckType);
            moves.Add(move2);

            Game.CurrentGame.MoveCards(moves);

            var role = role2.Type as RoleCardHandler;
            if (role != null)
            {
                Owner.Role = role.Role;
            }
            role = role1.Type as RoleCardHandler;
            if (role != null)
            {
                target.Role = role.Role;
            }
            GameDelays.Delay(GameDelays.RoleDistribute);
        }
コード例 #13
0
ファイル: QiaoBian.cs プロジェクト: kingling/sgs
 protected void Draw(Player player, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
 {
     Game.CurrentGame.SortByOrderOfComputation(Game.CurrentGame.CurrentPlayer, players);
     StagingDeckType QiaoBianDeck = new StagingDeckType("QiaoBian");
     CardsMovement move = new CardsMovement();
     move.Helper.IsFakedMove = true;
     foreach (Player p in players)
     {
         if (p.HandCards().Count == 0) continue;
         List<List<Card>> answer;
         var places = new List<DeckPlace>() { new DeckPlace(p, DeckType.Hand) };
         if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("QiaoBian", Owner), places,
             new List<string>() { "QiaoBian" }, new List<int>() { 1 }, new RequireOneCardChoiceVerifier(true), out answer))
         {
             answer = new List<List<Card>>();
             answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
         }
         move.Cards = answer[0];
         move.To = new DeckPlace(p, QiaoBianDeck);
         Game.CurrentGame.MoveCards(move, false, Core.Utils.GameDelayTypes.None);
         Game.CurrentGame.PlayerLostCard(p, answer[0]);
     }
     move.Cards.Clear();
     move.Helper.IsFakedMove = false;
     move.To = new DeckPlace(Owner, DeckType.Hand);
     foreach (Player p in players)
     {
         move.Cards.AddRange(Game.CurrentGame.Decks[p, QiaoBianDeck]);
     }
     cards = new List<Card>(move.Cards);
     Game.CurrentGame.MoveCards(move);
     Game.CurrentGame.PlayerAcquiredCard(Owner, cards);
     Game.CurrentGame.NotificationProxy.NotifyActionComplete();
 }
コード例 #14
0
ファイル: LiuLi.cs プロジェクト: RagingBigFemaleBird/sgs
        public void OnPlayerIsCardTarget(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            if (!(eventArgs.ReadonlyCard.Type is Sha) || Game.CurrentGame.AlivePlayers.Count <= 2 && eventArgs.Source != owner)
            {
                return;
            }
            ISkill skill;
            List<Card> cards;
            List<Player> players;
            if (Game.CurrentGame.UiProxies[owner].AskForCardUsage(new CardUsagePrompt("LiuLi"), new LiuLiVerifier(eventArgs.Source), out skill, out cards, out players))
            {
                NotifySkillUse(players);
                Game.CurrentGame.HandleCardDiscard(owner, cards);
                int index = eventArgs.Targets.IndexOf(owner);
                eventArgs.Targets.Remove(owner);

                GameEventArgs newArgs = new GameEventArgs();
                newArgs.Source = eventArgs.Source;
                newArgs.UiTargets = players;
                newArgs.Targets = players;
                newArgs.Card = eventArgs.Card;
                newArgs.ReadonlyCard = eventArgs.ReadonlyCard;
                newArgs.InResponseTo = eventArgs.InResponseTo;
                Game.CurrentGame.Emit(GameEvent.CardUsageTargetConfirming, newArgs);

                eventArgs.Targets.Insert(index, newArgs.Targets[0]);
            }
        }
コード例 #15
0
ファイル: JuXiang.cs プロジェクト: RagingBigFemaleBird/sgs
 void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     var args = eventArgs as DiscardCardEventArgs;
     if (args.Source == null || args.Source == Owner || args.Reason != DiscardReason.Use)
     {
         return;
     }
     List<Card> cardsToProcess = new List<Card>(eventArgs.Cards);
     foreach (Card c in cardsToProcess)
     {
         if (c.Type is NanManRuQin)
         {
             ActionLog log = new ActionLog();
             log.GameAction = GameAction.None;
             log.SkillAction = this;
             log.Source = Owner;
             log.CardAction = c;
             Game.CurrentGame.NotificationProxy.NotifySkillUse(log);
             List<Card> cc = new List<Card>();
             cc.Add(c);
             Game.CurrentGame.HandleCardTransferToHand(null, Owner, cc);
             eventArgs.Cards.Remove(c);
         }
     }
 }
コード例 #16
0
ファイル: MengJin.cs プロジェクト: pxoylngx/sgs
        protected void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            Player dest = eventArgs.Targets[0];
            IUiProxy ui = Game.CurrentGame.UiProxies[Owner];
            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("MengJin");
            List<int> resultDeckMax = new List<int>();
            resultDeckMax.Add(1);
            List<List<Card>> answer;

            if (!ui.AskForCardChoice(new CardChoicePrompt("MengJin"), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(), out answer))
            {
                Trace.TraceInformation("Player {0} Invalid answer", Owner);
                answer = new List<List<Card>>();
                answer.Add(new List<Card>());
                var collection = Game.CurrentGame.Decks[dest, DeckType.Hand].Concat
                                 (Game.CurrentGame.Decks[dest, DeckType.DelayedTools].Concat
                                 (Game.CurrentGame.Decks[dest, DeckType.Equipment]));
                answer[0].Add(collection.First());
            }
            Card theCard = answer[0][0];
            Game.CurrentGame.SyncCardAll(ref theCard);
            Trace.Assert(answer.Count == 1 && answer[0].Count == 1);

            Game.CurrentGame.HandleCardDiscard(dest, new List<Card>() { theCard });
        }
コード例 #17
0
ファイル: XuanFeng.cs プロジェクト: h1398123/sgs
 bool canTrigger(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     if (gameEvent == GameEvent.CardsLost)
     {
         foreach (Card card in eventArgs.Cards)
         {
             if (card.HistoryPlace1.Player == Owner && card.HistoryPlace1.DeckType == DeckType.Equipment)
             {
                 return true;
             }
         }
         return false;
     }
     else if (gameEvent == GameEvent.CardsEnteredDiscardDeck)
     {
         if (!(Game.CurrentGame.PhasesOwner == Owner && Game.CurrentGame.CurrentPhase == TurnPhase.Discard && Owner[XuanFengUsed] == 0))
         {
             return false;
         }
         if (eventArgs.Cards != null)
         {
             Owner[XuanFengUsable] += eventArgs.Cards.Count;
         }
         return Owner[XuanFengUsable] >= 2;
     }
     return true;
 }
コード例 #18
0
ファイル: ZaiQi.cs プロジェクト: RagingBigFemaleBird/sgs
        void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            DeckType HuoShouDeck = DeckType.Register("HuoShou");

            CardsMovement move = new CardsMovement();
            move.Cards = new List<Card>();
            int toDraw = Owner.LostHealth;
            for (int i = 0; i < toDraw; i++)
            {
                Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
                Card c = Game.CurrentGame.DrawCard();
                move.Cards.Add(c);
            }
            move.To = new DeckPlace(null, HuoShouDeck);
            Game.CurrentGame.MoveCards(move);
            List<Card> toDiscard = new List<Card>();
            foreach (var c in move.Cards)
            {
                if (c.Suit == SuitType.Heart)
                {
                    toDiscard.Add(c);
                    Game.CurrentGame.RecoverHealth(Owner, Owner, 1);
                }
            }
            Game.CurrentGame.HandleCardDiscard(null, toDiscard);
            Game.CurrentGame.HandleCardTransferToHand(null, Owner, Game.CurrentGame.Decks[null, HuoShouDeck]);
            Game.CurrentGame.CurrentPhaseEventIndex++;
            throw new TriggerResultException(TriggerResult.End);
        }
コード例 #19
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++;
     }
 }
コード例 #20
0
ファイル: QiXing.cs プロジェクト: pxoylngx/sgs
 void GameStart(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     // hack the cards to owner's hand. do not trigger anything
     List<Card> additionalCards = new List<Card>();
     for (int i = 0; i < 7; i++)
     {
         Game.CurrentGame.SyncImmutableCard(Owner, Game.CurrentGame.PeekCard(0));
         Card c = Game.CurrentGame.DrawCard();
         additionalCards.Add(c);
     }
     CardsMovement move = new CardsMovement();
     move.Cards = new List<Card>(additionalCards);
     move.To = new DeckPlace(Owner, DeckType.Hand);
     move.Helper.IsFakedMove = true;
     Game.CurrentGame.MoveCards(move);
     if (!Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("QiXing"), new QiXingVerifier(7), out skill, out cards, out players))
     {
         cards = new List<Card>();
         cards.AddRange(Game.CurrentGame.Decks[Owner, DeckType.Hand].GetRange(0, 7));
     }
     move.Cards = new List<Card>(cards);
     move.To = new DeckPlace(Owner, QiXingDeck);
     move.Helper.IsFakedMove = true;
     Game.CurrentGame.MoveCards(move);
 }
コード例 #21
0
ファイル: JiangChi.cs プロジェクト: RagingBigFemaleBird/sgs
 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);
 }
コード例 #22
0
ファイル: QingLongYanYueDao.cs プロジェクト: maplegh/sgs
 protected void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (!Game.CurrentGame.PlayerCanBeTargeted(Owner, new List<Player>() { eventArgs.Targets[0] }, new CompositeCard() { Type = new Sha() }))
     {
         return;
     }
     while (true)
     {
         if (Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("QingLongYanYueDao"),
         new SingleCardUsageVerifier((c) => { return c.Type is Sha; }, true),
         out skill, out cards, out players))
         {
             try
             {
                 Owner[Sha.NumberOfShaUsed]--;
                 NotifySkillUse(new List<Player>());
                 GameEventArgs args = new GameEventArgs();
                 args.Source = eventArgs.Source;
                 args.Targets = eventArgs.Targets;
                 args.Skill = skill;
                 args.Cards = cards;
                 Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
             }
             catch (TriggerResultException e)
             {
                 Trace.Assert(e.Status == TriggerResult.Retry);
                 continue;
             }
         }
         break;
     }
 }
コード例 #23
0
ファイル: LieRen.cs プロジェクト: RagingBigFemaleBird/sgs
        protected void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
        {
            var result = Game.CurrentGame.PinDian(owner, eventArgs.Targets[0], this);
            if (result == true && Game.CurrentGame.Decks[eventArgs.Targets[0], DeckType.Hand].Count + Game.CurrentGame.Decks[eventArgs.Targets[0], DeckType.Equipment].Count > 0)
            {
                var dest = eventArgs.Targets[0];
                List<DeckPlace> places = new List<DeckPlace>();
                places.Add(new DeckPlace(dest, DeckType.Hand));
                places.Add(new DeckPlace(dest, DeckType.Equipment));
                List<string> resultDeckPlace = new List<string>();
                resultDeckPlace.Add("LieRen");
                List<int> resultDeckMax = new List<int>();
                resultDeckMax.Add(1);
                List<List<Card>> answer;
                if (!Game.CurrentGame.UiProxies[owner].AskForCardChoice(new CardChoicePrompt("LieRen", dest, owner), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(true), out answer))
                {
                    Trace.TraceInformation("Player {0} Invalid answer", owner.Id);
                    answer = new List<List<Card>>();
                    answer.Add(new List<Card>());
                    var collection = Game.CurrentGame.Decks[dest, DeckType.Hand].Concat
                                     (Game.CurrentGame.Decks[dest, DeckType.DelayedTools].Concat
                                     (Game.CurrentGame.Decks[dest, DeckType.Equipment]));
                    answer[0].Add(collection.First());
                }
                Card theCard = answer[0][0];
                Game.CurrentGame.SyncCardAll(ref theCard);
                Trace.Assert(answer.Count == 1 && answer[0].Count == 1);

                Game.CurrentGame.HandleCardTransferToHand(dest, owner, new List<Card>() { theCard });
            }
        }
コード例 #24
0
ファイル: GangLie.cs プロジェクト: kissgoodbye/sgs
 public void OnAfterDamageInflicted(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ReadOnlyCard c = Game.CurrentGame.Judge(owner, this);
     if (c.Suit != SuitType.Heart)
     {
         NotifySkillUse(new List<Player>() { eventArgs.Source });
         List<DeckPlace> deck = new List<DeckPlace>();
         GangLieVerifier ver = new GangLieVerifier();
         ISkill skill;
         List<Card> cards;
         List<Player> players;
         if (!Game.CurrentGame.UiProxies[eventArgs.Source].AskForCardUsage(new CardUsagePrompt("GangLie", Owner), ver, out skill, out cards, out players))
         {
             Game.CurrentGame.DoDamage(owner, eventArgs.Source, 1, DamageElement.None, null, null);
         }
         else
         {
             Game.CurrentGame.HandleCardDiscard(eventArgs.Source, cards);
         }
     }
     else
     {
         Trace.TraceInformation("Judgement fail");
     }
 }
コード例 #25
0
ファイル: TuXi.cs プロジェクト: pxoylngx/sgs
 void GetTheirCards(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     if (Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("TuXi"), new TuXiVerifier(), out skill, out cards, out players))
     {
         NotifySkillUse(players);
         Game.CurrentGame.EnterAtomicContext();
         foreach (Player p in players)
         {
             List<List<Card>> answer;
             if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("TuXi"), new List<DeckPlace>() { new DeckPlace(p, DeckType.Hand) },
                 new List<string>() { "TuXi" }, new List<int>() { 1 }, new RequireOneCardChoiceVerifier(), out answer))
             {
                 answer = new List<List<Card>>();
                 answer.Add(new List<Card>());
                 answer[0].Add(Game.CurrentGame.Decks[p, DeckType.Hand][0]);
             }
             Game.CurrentGame.HandleCardTransferToHand(p, Owner, answer[0]);
         }
         Game.CurrentGame.ExitAtomicContext();
         Game.CurrentGame.CurrentPhaseEventIndex++;
         throw new TriggerResultException(TriggerResult.End);
     }
 }
コード例 #26
0
ファイル: XiuLuo.cs プロジェクト: RagingBigFemaleBird/sgs
 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;
     }
 }
コード例 #27
0
ファイル: FuHun.cs プロジェクト: kingling/sgs
 void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     DeckType FuHunDeck = new DeckType("FuHun");
     CardsMovement move = new CardsMovement();
     move.Cards = new List<Card>();
     int toDraw = 2;
     for (int i = 0; i < toDraw; i++)
     {
         Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
         Card c = Game.CurrentGame.DrawCard();
         c.Log.SkillAction = this;
         c.Log.Source = owner;
         move.Cards.Add(c);
         Game.CurrentGame.NotificationProxy.NotifyShowCard(null, c);
     }
     move.To = new DeckPlace(null, FuHunDeck);
     var result = from c in move.Cards select c.SuitColor;
     bool success = result.Distinct().Count() == toDraw;
     if (success) FuHunEffect = 0;
     else FuHunEffect = 1;
     NotifySkillUse();
     Game.CurrentGame.MoveCards(move, false, Core.Utils.GameDelayTypes.Draw);
     Game.CurrentGame.HandleCardTransferToHand(null, owner, Game.CurrentGame.Decks[null, FuHunDeck]);
     if (success)
     {
         Trigger tri = new RemoveShengPao(owner, fhWuSheng, fhPaoXiao);
         Game.CurrentGame.PlayerAcquireAdditionalSkill(owner, fhWuSheng, HeroTag);
         Game.CurrentGame.PlayerAcquireAdditionalSkill(owner, fhPaoXiao, HeroTag);
         Game.CurrentGame.RegisterTrigger(GameEvent.PhasePostEnd, tri);
     }
     Game.CurrentGame.CurrentPhaseEventIndex++;
     throw new TriggerResultException(TriggerResult.End);
 }
コード例 #28
0
ファイル: QiaoBian.cs プロジェクト: pxoylngx/sgs
        protected void Move(Player player, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
        {
            Game.CurrentGame.HandleCardDiscard(player, cards);
            Player source = players[0];
            Player dest = players[1];
            List<DeckPlace> places = new List<DeckPlace>();
            places.Add(new DeckPlace(source, DeckType.Equipment));
            places.Add(new DeckPlace(source, DeckType.DelayedTools));
            places.Add(new DeckPlace(dest, DeckType.Equipment));
            places.Add(new DeckPlace(dest, DeckType.DelayedTools));
            List<string> resultDeckPlace = new List<string>();
            resultDeckPlace.Add("QiaoBian");
            List<int> resultDeckMax = new List<int>();
            resultDeckMax.Add(1);
            List<List<Card>> answer;
            if (Game.CurrentGame.UiProxies[player].AskForCardChoice(new CardChoicePrompt("QiaoBian"), places, resultDeckPlace, resultDeckMax, new QiaoBianMoveVerifier(source, dest), out answer))
            {
                Card theCard = answer[0][0];
                DeckType targetDeck = theCard.Place.DeckType;
                if (theCard.Place.Player == source)
                {
                    Game.CurrentGame.HandleCardTransfer(source, dest, targetDeck, new List<Card>() { theCard });
                }
                else
                {
                    Game.CurrentGame.HandleCardTransfer(dest, source, targetDeck, new List<Card>() { theCard });
                }

            }

            Game.CurrentGame.CurrentPhase++;
            Game.CurrentGame.CurrentPhaseEventIndex = 2;
            throw new TriggerResultException(TriggerResult.End);
        }
コード例 #29
0
ファイル: HanBingJian.cs プロジェクト: pxoylngx/sgs
 protected void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
 {
     Player dest = eventArgs.Targets[0];
     for (int i = 0; i < 2 && Game.CurrentGame.Decks[dest, DeckType.Hand].Concat(Game.CurrentGame.Decks[dest, DeckType.Equipment]).Count() > 0; i++)
     {
         IUiProxy ui = Game.CurrentGame.UiProxies[Owner];
         if (Owner.IsDead) return;
         List<DeckPlace> places = new List<DeckPlace>();
         places.Add(new DeckPlace(dest, DeckType.Hand));
         places.Add(new DeckPlace(dest, DeckType.Equipment));
         List<string> resultDeckPlace = new List<string>();
         resultDeckPlace.Add("HanBing");
         List<int> resultDeckMax = new List<int>();
         resultDeckMax.Add(1);
         List<List<Card>> answer;
         if (!ui.AskForCardChoice(new CardChoicePrompt("HanBing"), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(), out answer))
         {
             Trace.TraceInformation("Player {0} Invalid answer", Owner.Id);
             answer = new List<List<Card>>();
             answer.Add(new List<Card>());
             var collection = Game.CurrentGame.Decks[dest, DeckType.Hand].Concat
                              (Game.CurrentGame.Decks[dest, DeckType.Equipment]);
             answer[0].Add(collection.First());
         }
         Trace.Assert(answer.Count == 1 && answer[0].Count == 1);
         Game.CurrentGame.HandleCardDiscard(dest, answer[0]);
     }
     throw new TriggerResultException(TriggerResult.End);
 }
コード例 #30
0
ファイル: PaoXiao.cs プロジェクト: h1398123/sgs
 public override void Run(GameEvent gameEvent, GameEventArgs eventArgs)
 {
     if (eventArgs.Source == Owner)
     {
         throw new TriggerResultException(TriggerResult.Success);
     }
 }