Пример #1
0
 public void HandleCardDiscard(Player p, List<Card> cards, DiscardReason reason = DiscardReason.Discard)
 {
     CardsMovement move = new CardsMovement();
     move.Cards = new List<Card>(cards);
     foreach (Card c in cards)
     {
         c.Log.Source = p;
         if (reason == DiscardReason.Discard)
             c.Log.GameAction = GameAction.Discard;
         else if (reason == DiscardReason.Play)
             c.Log.GameAction = GameAction.Play;
         else if (reason == DiscardReason.Use)
             c.Log.GameAction = GameAction.Use;
     }
     List<Card> backup = new List<Card>(move.Cards);
     move.To = new DeckPlace(null, DeckType.Discard);
     PlayerAboutToDiscardCard(p, move.Cards, reason);
     MoveCards(move);
     if (p != null)
     {
         PlayerLostCard(p, backup);
         PlayerDiscardedCard(p, backup, reason);
     }
 }
Пример #2
0
 public void PlayerDiscardedCard(Player p, List<Card> cards, DiscardReason reason)
 {
     try
     {
         var arg = new DiscardCardEventArgs();
         arg.Source = p;
         arg.Targets = null;
         arg.Cards = cards;
         arg.Reason = reason;
         Emit(GameEvent.CardsEnteredDiscardDeck, arg);
     }
     catch (TriggerResultException)
     {
         throw new NotImplementedException();
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransactionsDiscardedEventArgs"/> class.
 /// </summary>
 /// <param name="transaction">The transaction that have been discarded.</param>
 /// <param name="reason">The reason why the transaction have been discarded.</param>
 public TransactionsDiscardedEventArgs(IReadOnlyTransaction transaction, DiscardReason reason)
     : this(new[] { transaction }, reason)
 {
 }
Пример #4
0
 public void PlayerAboutToDiscardCard(Player p, List<Card> cards, DiscardReason reason)
 {
     SyncCardsAll(cards);
     try
     {
         var arg = new DiscardCardEventArgs();
         arg.Source = p;
         arg.Targets = null;
         arg.Cards = cards;
         arg.Reason = reason;
         Emit(GameEvent.CardsEnteringDiscardDeck, arg, true);
     }
     catch (TriggerResultException)
     {
         throw new NotImplementedException();
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransactionsDiscardedEventArgs"/> class.
 /// </summary>
 /// <param name="transactions">The transactions that have been discarded.</param>
 /// <param name="reason">The reason why the transactions have been discarded.</param>
 public TransactionsDiscardedEventArgs(IReadOnlyTransaction[] transactions, DiscardReason reason)
 {
     Transactions = transactions;
     Reason = reason;
 }