public override VerifierResult Verify(Player source, ICard card, List<Player> targets, bool isLooseVerify)
 {
     // @todo: LooseVerify has not been defined.
     if (targets != null && targets.Count != 0 &&
         (targets.Count > 1 || DelayedToolConflicting(targets[0]) || targets[0] == source))
     {
         return VerifierResult.Fail;
     }
     if (targets == null || targets.Count == 0)
     {
         return VerifierResult.Partial;
     }
     Player dest = targets[0];
     var args = new AdjustmentEventArgs();
     args.Source = source;
     args.Targets = new List<Player>() { dest };
     args.Card = card;
     args.AdjustmentAmount = 0;
     Game.CurrentGame.Emit(GameEvent.CardRangeModifier, args);
     if (Game.CurrentGame.DistanceTo(source, dest) > 1 + args.AdjustmentAmount)
     {
         return VerifierResult.Fail;
     }
     return VerifierResult.Success;
 }
Beispiel #2
0
 protected override bool ShunChaiAdditionalCheck(Player source, Player dest, ICard card)
 {
     var args = new AdjustmentEventArgs();
     args.Source = source;
     args.Targets = new List<Player>() { dest };
     args.Card = card;
     args.AdjustmentAmount = 0;
     Game.CurrentGame.Emit(GameEvent.CardRangeModifier, args);
     if (Game.CurrentGame.DistanceTo(source, dest) > 1)
     {
         return false;
     }
     return true;
 }
Beispiel #3
0
 public override void Run(GameEvent gameEvent, GameEventArgs eventArgs)
 {
     Player currentPlayer = Game.CurrentGame.CurrentPlayer;
     Trace.TraceInformation("Player {0} discard stage.", currentPlayer.Id);
     var args = new AdjustmentEventArgs();
     args.Source = eventArgs.Source;
     args.AdjustmentAmount = 0;
     Game.CurrentGame.Emit(GameEvent.PlayerHandCardCapacityAdjustment, args);
     Game.CurrentGame.ForcePlayerDiscard(currentPlayer,
         (p, d) =>
         {
             int i = Game.CurrentGame.Decks[p, DeckType.Hand].Count - p.Health - args.AdjustmentAmount;
             if (i < 0) i = 0;
             return i;
         },
         false);
 }
Beispiel #4
0
        public virtual int DistanceTo(Player from, Player to)
        {
            int distRight = from[Player.RangeMinus], distLeft = from[Player.RangeMinus];
            Player p = from;
            while (p != to)
            {
                p = NextAlivePlayer(p);
                distRight++;
            }
            distRight += to[Player.RangePlus];
            p = from;
            while (p != to)
            {
                p = PreviousAlivePlayer(p);
                distLeft++;
            }
            distLeft += to[Player.RangePlus];

            var args = new AdjustmentEventArgs();
            args.Source = from;
            args.Targets = new List<Player>() { to };
            args.AdjustmentAmount = 0;
            Game.CurrentGame.Emit(GameEvent.PlayerDistanceAdjustment, args);
            distLeft += args.AdjustmentAmount;
            distRight += args.AdjustmentAmount;

            return distRight > distLeft ? distLeft : distRight;
        }