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


C# Triggers.GameEventArgs类代码示例

本文整理汇总了C#中Sanguosha.Core.Triggers.GameEventArgs的典型用法代码示例。如果您正苦于以下问题:C# GameEventArgs类的具体用法?C# GameEventArgs怎么用?C# GameEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Run

 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);
         }
     }
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:25,代码来源:JuXiang.cs

示例2: Run

 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);
 }
开发者ID:pxoylngx,项目名称:sgs,代码行数:29,代码来源:HanBingJian.cs

示例3: Process

 protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard, GameEventArgs inResponseTo)
 {
     DeckType wuguDeck = new DeckType("WuGu");
     DeckType wuguFakeDeck = new DeckType("WuGuFake");
     List<List<Card>> answer;
     if (!Game.CurrentGame.UiProxies[dest].AskForCardChoice(new CardChoicePrompt("WuGuFengDeng"),
             new List<DeckPlace>() { new DeckPlace(null, wuguFakeDeck) },
             new List<string>() { "WuGu" },
             new List<int>() { 1 },
             new WuGuCardChoiceVerifier(FakeMapping),
             out answer,
             new AdditionalCardChoiceOptions() { IsWuGu = true }))
     {
         Trace.TraceInformation("Invalid answer for WuGu, choosing for you");
         answer = new List<List<Card>>();
         answer.Add(new List<Card>());
         answer[0].Add(Game.CurrentGame.Decks[null, wuguDeck][0]);
     }
     else
     {
         if (!FakeMapping.ContainsKey(answer[0][0]) || FakeMapping[answer[0][0]] == null)
         {
             answer[0] = new List<Card>() { Game.CurrentGame.Decks[null, wuguDeck][0] };
         }
         var theCard = answer[0][0];
         answer[0] = new List<Card>() { FakeMapping[theCard] };
         FakeMapping[theCard] = null;
     }
     Game.CurrentGame.HandleCardTransferToHand(null, dest, answer[0], new MovementHelper() { IsWuGu = true });
 }
开发者ID:kingling,项目名称:sgs,代码行数:30,代码来源:WuGuFengDeng.cs

示例4: Commit

 public override bool Commit(GameEventArgs arg)
 {
     Owner[FenChengUsed] = 1;
     var toProcess = Game.CurrentGame.AlivePlayers;
     toProcess.Remove(Owner);
     foreach (Player target in toProcess)
     {
         ISkill skill;
         List<Card> cards;
         List<Player> players;
         if (target.IsDead) break;
         int answer = 0;
         if (answer == 0 && Math.Max(1, target.Equipments().Count) <= target.HandCards().Count &&
             Game.CurrentGame.UiProxies[target].AskForCardUsage(new CardUsagePrompt("FenCheng"), new FenChengVerifier(Math.Max(1, target.Equipments().Count)),
             out skill, out cards, out players))
         {
             Game.CurrentGame.HandleCardDiscard(target, cards);
         }
         else
         {
             Game.CurrentGame.DoDamage(null, target, 1, DamageElement.Fire, null, null);
         }
     }
     return true;
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:25,代码来源:FenCheng.cs

示例5: Activate

 public override void Activate(Player p, Card c)
 {
     while (true)
     {
         GameEventArgs args = new GameEventArgs();
         args.Source = null;
         args.Targets = new List<Player>() { p };
         args.Card = c;
         args.ReadonlyCard = new ReadOnlyCard(c);
         try
         {
             Game.CurrentGame.Emit(GameEvent.CardUsageBeforeEffected, args);
         }
         catch (TriggerResultException e)
         {
             Trace.Assert(e.Status == TriggerResult.End);
             break;
         }
         ReadOnlyCard result = Game.CurrentGame.Judge(p, null, c, (judgeResultCard) => { return judgeResultCard.Suit != SuitType.Heart; });
         if (result.Suit != SuitType.Heart)
         {
             var theTrigger = new LeBuSiShuTrigger() { Priority = int.MaxValue };
             theTrigger.Owner = p;
             Game.CurrentGame.RegisterTrigger(GameEvent.PhaseOutEvents[TurnPhase.Draw], theTrigger);
         }
         break;
     }
     CardsMovement move = new CardsMovement();
     move.Cards = new List<Card>();
     move.Cards.Add(c);
     move.To = new DeckPlace(null, DeckType.Discard);
     Game.CurrentGame.MoveCards(move);
 }
开发者ID:maplegh,项目名称:sgs,代码行数:33,代码来源:LeBuSiShu.cs

示例6: GetTheirCards

 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);
     }
 }
开发者ID:pxoylngx,项目名称:sgs,代码行数:26,代码来源:TuXi.cs

示例7: Validate

 public override VerifierResult Validate(GameEventArgs arg)
 {
     if (Owner[FanJianUsed] != 0)
     {
         return VerifierResult.Fail;
     }
     if (Game.CurrentGame.Decks[Owner, DeckType.Hand].Count == 0)
     {
         return VerifierResult.Fail;
     }
     if (arg.Cards != null && arg.Cards.Count != 0)
     {
         return VerifierResult.Fail;
     }
     if (arg.Targets != null && arg.Targets.Count > 1)
     {
         return VerifierResult.Fail;
     }
     if (arg.Targets == null || arg.Targets.Count == 0)
     {
         return VerifierResult.Partial;
     }
     if (arg.Targets != null && arg.Targets[0] == Owner)
     {
         return VerifierResult.Fail;
     }
     return VerifierResult.Success;
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:28,代码来源:FanJian.cs

示例8: Run1

 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++;
     }
 }
开发者ID:kingling,项目名称:sgs,代码行数:32,代码来源:MouKui.cs

示例9: Run

 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 });
 }
开发者ID:kissgoodbye,项目名称:sgs,代码行数:31,代码来源:QiLinGong.cs

示例10: Commit

 public override bool Commit(GameEventArgs arg)
 {
     Owner[ShenFenUsed] = 1;
     Owner[KuangBao.BaoNuMark] -= 6;
     var players = Game.CurrentGame.AlivePlayers;
     players.Remove(Owner);
     foreach (Player p in players)
     {
         Game.CurrentGame.DoDamage(Owner, p, 1, DamageElement.None, null, arg.ReadonlyCard);
     }
     foreach (Player p in players)
     {
         List<Card> toDiscard = new List<Card>();
         toDiscard.AddRange(p.Equipments());
         Game.CurrentGame.HandleCardDiscard(p, toDiscard);
         if (p.HandCards().Count() <= 4)
         {
             toDiscard.Clear();
             toDiscard.AddRange(p.HandCards());
             Game.CurrentGame.HandleCardDiscard(p, toDiscard);
         }
         else
         {
             Game.CurrentGame.ForcePlayerDiscard(p, (pl, d) => { return 4 - d; }, false);
         }
     }
     Owner.IsImprisoned = !Owner.IsImprisoned;
     return true;
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:29,代码来源:ShenFen.cs

示例11: Validate

 public override VerifierResult Validate(GameEventArgs arg)
 {
     if (Owner[LiHunUsed] != 0)
     {
         return VerifierResult.Fail;
     }
     if (Owner.HandCards().Count == 0)
     {
         return VerifierResult.Fail;
     }
     if (arg.Targets == null || arg.Targets.Count == 0)
     {
         return VerifierResult.Partial;
     }
     if (arg.Targets != null && arg.Targets.Count > 1)
     {
         return VerifierResult.Fail;
     }
     if (arg.Targets != null && (!arg.Targets[0].IsMale || arg.Targets[0].HandCards().Count == 0))
     {
         return VerifierResult.Fail;
     }
     List<Card> cards = arg.Cards;
     if (cards == null && cards.Count == 0)
     {
         return VerifierResult.Partial;
     }
     if (cards != null && cards.Count > 1)
     {
         return VerifierResult.Fail;
     }
     return VerifierResult.Success;
 }
开发者ID:h1398123,项目名称:sgs,代码行数:33,代码来源:LiHun.cs

示例12: Process

        protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard, GameEventArgs inResponseTo)
        {
            IUiProxy ui = Game.CurrentGame.UiProxies[source];
            if (source.IsDead) return;
            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:h1398123,项目名称:sgs,代码行数:30,代码来源:ShunChai.cs

示例13: Run

 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);
 }
开发者ID:RagingBigFemaleBird,项目名称:sgs,代码行数:7,代码来源:ZhiChi.cs

示例14: canTrigger

 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;
 }
开发者ID:h1398123,项目名称:sgs,代码行数:27,代码来源:XuanFeng.cs

示例15: Validate

 public override VerifierResult Validate(GameEventArgs arg)
 {
     PlayerAttribute HuangTianUsed = PlayerAttribute.Register("HuangTianUsed" + Master.Id, true);
     if (Owner[HuangTianUsed] != 0)
     {
         return VerifierResult.Fail;
     }
     if (arg.Targets != null && arg.Targets.Count > 0)
     {
         return VerifierResult.Fail;
     }
     List<Card> cards = arg.Cards;
     if (cards != null && cards.Count > 1)
     {
         return VerifierResult.Fail;
     }
     if (cards != null && cards.Count > 0 && !(cards[0].Type is Shan || cards[0].Type is ShanDian))
     {
         return VerifierResult.Fail;
     }
     if (cards == null || cards.Count == 0)
     {
         return VerifierResult.Partial;
     }
     return VerifierResult.Success;
 }
开发者ID:pxoylngx,项目名称:sgs,代码行数:26,代码来源:HuangTian.cs


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