using DominionBase.Cards; using DominionBase.Enums; using DominionBase.Piles; using System; using System.Collections.Generic; using System.Diagnostics.Contracts; namespace DominionBase.Players { public class BenefitsChangedEventArgs : EventArgs, IPlayerEventArgs { public IPlayer Player { get; } public int Actions { get; } public int OldActions { get; } public int Buys { get; } public int OldBuys { get; } public int Coffers { get; } public int OldCoffers { get; } public int Villagers { get; } public int OldVillagers { get; } public Currency Currency { get; } public Currency OldCurrency { get; } public BenefitsChangedEventArgs(IPlayer player, int? oldActions = null, int? oldBuys = null, int? oldCoffers = null, int? oldVillagers = null, Currency oldCurrency = null) { Contract.Requires(player != null, "player cannot be null"); Player = player; Actions = player.Actions; OldActions = oldActions ?? player.Actions; Buys = player.Buys; OldBuys = oldBuys ?? player.Buys; Coffers = player.Coffers; OldCoffers = oldCoffers ?? player.Coffers; Villagers = player.Villagers; OldVillagers = oldVillagers ?? player.Villagers; Currency = player.Currency; OldCurrency = (oldCurrency == (Currency)null ? player.Currency : oldCurrency); } } public class PhaseChangingEventArgs : EventArgs { public bool Cancelled { get; set; } = false; public PhaseEnum CurrentPhase { get; } public IPlayer CurrentPlayer { get; } public List HandledBy { get; } = new List(); public PhaseEnum NewPhase { get; } public Dictionary Resolvers { get; } = new Dictionary(); public PhaseChangingEventArgs(IPlayer player, PhaseEnum newPhase) { CurrentPlayer = player; if (player != null) CurrentPhase = player.Phase; NewPhase = newPhase; } } public delegate void PhaseChangingMethod(IPlayer player, ref PhaseChangingEventArgs phaseChangingEventArgs); public class PhaseChangingResolver { public IDisplayable Card { get; } public string Text { get; } public PhaseChangingMethod Method { get; } public bool IsRequired { get; } public PhaseChangingResolver(IDisplayable card, string text, PhaseChangingMethod method, bool isMandatory) { Card = card; Text = text; Method = method; IsRequired = isMandatory; } } public class PhaseChangedEventArgs : EventArgs { public IPlayer CurrentPlayer { get; } public PhaseEnum OldPhase { get; } public PhaseEnum NewPhase { get; } public Dictionary Resolvers { get; } = new Dictionary(); public List HandledBy { get; } = new List(); public PhaseChangedEventArgs(IPlayer player, PhaseEnum oldPhase) { CurrentPlayer = player; OldPhase = oldPhase; if (player != null) NewPhase = player.Phase; } } public delegate void PhaseChangedMethod(IPlayer player, ref PhaseChangedEventArgs phaseChangedEventArgs); public class PhaseChangedResolver { public IDisplayable Card { get; } public string Text { get; } public PhaseChangedMethod Method { get; } public bool IsRequired { get; } public PhaseChangedResolver(IDisplayable card, string text, PhaseChangedMethod method, bool isMandatory) { Card = card; Text = text; Method = method; IsRequired = isMandatory; } } public class PlayerModeChangedEventArgs : EventArgs { public IPlayer CurrentPlayer { get; } public PlayerMode OldPlayerMode { get; } public PlayerMode NewPlayerMode { get; } public PlayerModeChangedEventArgs(IPlayer player, PlayerMode oldPlayerMode) { CurrentPlayer = player; OldPlayerMode = oldPlayerMode; if (player != null) NewPlayerMode = player.PlayerMode; } } public class AttackedEventArgs : EventArgs { public IPlayer Attacker { get; } public Card AttackCard { get; } public bool Cancelled { get; set; } = false; public List HandledBy { get; } = new List(); public Dictionary Revealable { get; } = new Dictionary(); public AttackedEventArgs(IPlayer attacker, Card attackCard) { Attacker = attacker; AttackCard = attackCard; } } public delegate void AttackReveal(IPlayer player, ref AttackedEventArgs attackedEventArgs); public class AttackReaction { public Card Card { get; } public string Text { get; } public AttackReveal Method { get; } public AttackReaction(Card card, string text, AttackReveal method) { Card = card; Text = text; Method = method; } } public class BoonEventArgs : EventArgs, IPlayerEventArgs { public IPlayer Player { get; } public ItemCollection Boons { get; } = new ItemCollection(); public BoonAction BoonAction { get; } public BoonEventArgs(IPlayer player, BoonAction boonAction) { Player = player; BoonAction = boonAction; } public BoonEventArgs(IPlayer player, BoonAction boonAction, IBoon boon) : this(player, boonAction) { Boons.Add(boon); } public BoonEventArgs(IPlayer player, BoonAction boonAction, IEnumerable boons) : this(player, boonAction) { Boons.AddRange(boons); } } public class CardsDrawnEventArgs : EventArgs { public ItemCollection Cards { get; } = new ItemCollection(); public DeckPosition FromDeckPosition { get; } public int NumberToDraw { get; } public CardsDrawnEventArgs(IEnumerable cards, DeckPosition fromDeckPosition, int numberToDraw) { Cards.AddRange(cards); FromDeckPosition = fromDeckPosition; NumberToDraw = numberToDraw; } } public class CardsAddedToDeckEventArgs : EventArgs { public ItemCollection Cards { get; } public DeckPosition DeckPosition { get; } public CardsAddedToDeckEventArgs(ItemCollection cards, DeckPosition deckPosition) { Cards = cards; DeckPosition = deckPosition; } public CardsAddedToDeckEventArgs(IEnumerable cards, DeckPosition deckPosition) { Cards = new ItemCollection(cards); DeckPosition = deckPosition; } public CardsAddedToDeckEventArgs(Card card, DeckPosition deckPosition) { Cards = new ItemCollection { card }; DeckPosition = deckPosition; } } public class CardsAddedToHandEventArgs : EventArgs { public ItemCollection Cards { get; } public CardsAddedToHandEventArgs(ItemCollection cards) { Cards = cards; } public CardsAddedToHandEventArgs(IEnumerable cards) { Cards = new ItemCollection(cards); } public CardsAddedToHandEventArgs(Card card) { Cards = new ItemCollection { card }; } } public class CardsDiscardEventArgs : EventArgs { public bool Cancelled { get; set; } = false; public ItemCollection Cards { get; } public object Data { get; set; } public DeckLocation FromLocation { get; } public Type FromMatType { get; } public List HandledBy { get; } = new List(); public Dictionary, CardsDiscardResolver> Resolvers { get; } = new Dictionary, CardsDiscardResolver>(); public CardsDiscardEventArgs(DeckLocation fromLocation, ItemCollection cards) { FromLocation = fromLocation; Cards = cards; } public CardsDiscardEventArgs(DeckLocation fromLocation, Card card) : this(fromLocation, new ItemCollection { card }) { } public CardsDiscardEventArgs(DeckLocation fromLocation, Type fromMatType, ItemCollection cards) : this(fromLocation, cards) { FromMatType = fromMatType; } public CardsDiscardEventArgs(DeckLocation fromLocation, Type fromMatType, Card card) : this(fromLocation, card) { FromMatType = fromMatType; } public bool AddResolver(Type card, CardsDiscardResolver resolver) { return AddResolver(card, card, resolver); } public bool AddResolver(Type sourceCard, Type card, CardsDiscardResolver resolver) { var key = new Tuple(sourceCard, card); if (Resolvers.ContainsKey(key)) return false; Resolvers[key] = resolver; return true; } public CardsDiscardResolver GetResolver(Type card) { return GetResolver(card, card); } public CardsDiscardResolver GetResolver(Type sourceCard, Type card) { var key = new Tuple(sourceCard, card); return !Resolvers.ContainsKey(key) ? null : Resolvers[key]; } } public delegate void CardsDiscardMethod(IPlayer player, ref CardsDiscardEventArgs cardDiscardEventArgs); public class CardsDiscardResolver { public object Data { get; set; } public bool IsRequired { get; } public CardsDiscardMethod Method { get; } public IPlayer Player { get; } public IGameObject Source { get; } public string Text { get; } public CardsDiscardResolver(IPlayer player, IGameObject source, string text, CardsDiscardMethod method, bool isMandatory = false) { Player = player; Source = source; Text = text; Method = method; IsRequired = isMandatory; } } public class CardGainEventArgs : EventArgs, ICardEventArgs { public bool Bought { get; } public bool Cancelled { get; set; } = false; public Card Card { get; } public IGame Game { get; } public List HandledBy { get; } = new List(); public bool IsLostTrackOf { get; set; } = false; public DeckLocation Location { get; set; } public DeckPosition Position { get; set; } public Dictionary Resolvers { get; } = new Dictionary(); public IGameObject Source { get; } public CardGainEventArgs(IGame game, Card card, IGameObject source, DeckLocation location, DeckPosition position, bool bought) { Game = game; Card = card; Location = location; Position = position; Bought = bought; Source = source; } } public delegate void CardGainMethod(IPlayer player, ref CardGainEventArgs cardGainEventArgs); public class CardGainResolver { public bool IsRequired { get; } public CardGainMethod Method { get; } public string Operation { get; } public IPlayer Player { get; } public IGameObject Source { get; } public string Text { get; } public CardGainResolver(IPlayer player, IGameObject source, string operation, string text, CardGainMethod method, bool isRequired) { Player = player; Source = source; Operation = operation; Text = text; Method = method; IsRequired = isRequired; } } public class CardBuyEventArgs : EventArgs { public IBuyable From { get; } public ICost Card { get; } public IGame Game { get; } public bool Cancelled { get; set; } = false; public Dictionary Resolvers { get; } = new Dictionary(); public List HandledBy { get; } = new List(); public CardBuyEventArgs(IGame game, IBuyable from, ICost card) { Game = game; From = from; Card = card; } } public delegate void CardBuyMethod(IPlayer player, ref CardBuyEventArgs cardBuyEventArgs); public class CardBuyResolver { public bool IsRequired { get; } public CardBuyMethod Method { get; } public IPlayer Player { get; } public IGameObject Trigger { get; } public string Text { get; } public CardBuyResolver(IPlayer player, IGameObject trigger, string text, CardBuyMethod method, bool isRequired) { Player = player; Trigger = trigger; Text = text; Method = method; IsRequired = isRequired; } } public class CardPayEventArgs : EventArgs { public ICost Card { get; } public Currency AvailableCurrency { get; } public Currency Cost { get; set; } public Dictionary Resolvers { get; } = new Dictionary(); public List HandledBy { get; } = new List(); public CardPayEventArgs(ICost card, Currency availableCurrency, Currency cost, List handledBy = null) { Card = card; AvailableCurrency = availableCurrency; Cost = cost; if (handledBy != null) HandledBy.AddRange(handledBy); } } public delegate void CardPayMethod(IPlayer player, ref CardPayEventArgs cardPayEventArgs); public class CardPayResolver { public bool IsRequired { get; } public CardPayMethod Method { get; } public IPlayer Player { get; } public IGameObject Trigger { get; } public string Text { get; } public CardPayResolver(IPlayer player, IGameObject trigger, string text, CardPayMethod method, bool isRequired) { Player = player; Trigger = trigger; Text = text; Method = method; IsRequired = isRequired; } } public class CardFlippedOverEventArgs : EventArgs { public ICard Card { get; } public Facing OldFacing { get; } public Facing NewFacing { get; } public CardFlippedOverEventArgs(ICard card, Facing oldFacing, Facing newFacing) { Card = card; OldFacing = oldFacing; NewFacing = newFacing; } } public class CardReceivedEventArgs : EventArgs, ICardEventArgs { public IPlayer FromPlayer { get; } public Card Card { get; } public DeckLocation Location { get; } public DeckPosition Position { get; } public CardReceivedEventArgs(IPlayer fromPlayer, Card card, DeckLocation location, DeckPosition position) { FromPlayer = fromPlayer; Card = card; Location = location; Position = position; } } public class CardsLostEventArgs : EventArgs { public ItemCollection Cards { get; } public CardsLostEventArgs(ItemCollection cards) { Cards = cards; } } public class CardPlayingEventArgs : EventArgs, IPlayerEventArgs { public ItemCollection Cards { get; } public IPlayer Player { get; } public string Modifier { get; } public CardPlayingEventArgs(IPlayer player, Card card, string modifier) : this(player, new ItemCollection { card }, modifier) { } public CardPlayingEventArgs(IPlayer player, ItemCollection cards, string modifier) { Player = player; Cards = cards; Modifier = modifier; } } public class CardPutIntoPlayEventArgs : EventArgs, ICardEventArgs, IPlayerEventArgs { public Card Card { get; } public IPlayer Player { get; } public CardPutIntoPlayEventArgs(IPlayer player, Card card) { Player = player; Card = card; } } public class CardResolvingEventArgs : EventArgs, ICardEventArgs, IPlayerEventArgs { public bool Cancelled { get; } = false; public Card Card { get; } public List HandledBy { get; } = new List(); public IPlayer Player { get; } public Dictionary Resolvers { get; } = new Dictionary(); public CardResolvingEventArgs(IPlayer player, Card card) { Player = player; Card = card; } } public delegate void CardResolvingMethod(IPlayer player, ref CardResolvingEventArgs cardResolvingEventArgs); public class CardResolvingResolver { public bool IsRequired { get; } public CardResolvingMethod Method { get; } public IPlayer Player { get; } public IGameObject Source { get; } public string Text { get; } public CardResolvingResolver(IPlayer player, IGameObject source, string text, CardResolvingMethod method, bool isRequired) { Player = player; Source = source; Text = text; Method = method; IsRequired = isRequired; } } public class CardFollowingInstructionsEventArgs : EventArgs, ICardEventArgs, IPlayerEventArgs { public bool Cancelled { get; set; } = false; public Card Card { get; } public List HandledBy { get; } = new List(); public IPlayer Player { get; } public Dictionary Resolvers { get; } = new Dictionary(); public CardFollowingInstructionsEventArgs(IPlayer player, Card card) { Player = player; Card = card; } } public delegate void CardFollowingInstructionsMethod(IPlayer player, ref CardFollowingInstructionsEventArgs cardFollowingInstructionsEventArgs); public class CardFollowingInstructionsResolver { public bool IsRequired { get; } public CardFollowingInstructionsMethod Method { get; } public IGameObject Source { get; } public string Text { get; } public CardFollowingInstructionsResolver(IGameObject source, string text, CardFollowingInstructionsMethod method, bool isRequired) { Source = source; Text = text; Method = method; IsRequired = isRequired; } } public class CardPlayedEventArgs : EventArgs, IPlayerEventArgs { public ItemCollection Cards { get; } public List HandledBy { get; } = new List(); public IPlayer Player { get; } public Dictionary Resolvers { get; } = new Dictionary(); public CardPlayedEventArgs(IPlayer player, Card card) : this(player, new ItemCollection { card }) { } public CardPlayedEventArgs(IPlayer player, ItemCollection cards) { Player = player; Cards = cards; } } public delegate void CardPlayedMethod(IPlayer player, ref CardPlayedEventArgs cardPlayedEventArgs); public class CardPlayedResolver { public bool IsRequired { get; } public CardPlayedMethod Method { get; } public IPlayer Player { get; } public IGameObject Source { get; } public string Text { get; } public CardPlayedResolver(IPlayer player, IGameObject source, string text, CardPlayedMethod method, bool isRequired) { Player = player; Source = source; Text = text; Method = method; IsRequired = isRequired; } } public class CardUndoPlayingEventArgs : EventArgs, IPlayerEventArgs { public ItemCollection Cards { get; } public IPlayer Player { get; } public string Modifier { get; } public CardUndoPlayingEventArgs(IPlayer player, Card card, string modifier) : this(player, new ItemCollection { card }, modifier) { } public CardUndoPlayingEventArgs(IPlayer player, ItemCollection cards, string modifier) { Player = player; Cards = cards; Modifier = modifier; } } public class CardUndoPlayedEventArgs : EventArgs, IPlayerEventArgs { public ItemCollection Cards { get; } public IPlayer Player { get; } public CardUndoPlayedEventArgs(IPlayer player, Card card) : this(player, new ItemCollection { card }) { } public CardUndoPlayedEventArgs(IPlayer player, ItemCollection cards) { Player = player; Cards = cards; } } public class TokenPlayingEventArgs : EventArgs, IPlayerEventArgs { public TokenCollection Tokens { get; } public IPlayer Player { get; } public TokenPlayingEventArgs(IPlayer player, Token token) : this(player, new TokenCollection { token }) { } public TokenPlayingEventArgs(IPlayer player, TokenCollection tokens) { Player = player; Tokens = tokens; } } public class TokenPlayedEventArgs : EventArgs, IPlayerEventArgs { public TokenCollection Tokens { get; } public IPlayer Player { get; } public TokenPlayedEventArgs(IPlayer player, Token token) : this(player, new TokenCollection { token }) { } public TokenPlayedEventArgs(IPlayer player, TokenCollection tokens) { Player = player; Tokens = tokens; } } public class TrashEventArgs : EventArgs { public IPlayer CurrentPlayer { get; } public List HandledBy { get; } = new List(); public Dictionary Resolvers { get; } = new Dictionary(); public IGameObject Source { get; } public ItemCollection TrashedCards { get; } public TrashEventArgs(IPlayer player, IGameObject source, ItemCollection trashedCards) { CurrentPlayer = player; Source = source; TrashedCards = trashedCards == null ? null : new ItemCollection(trashedCards); } } public delegate void TrashMethod(IPlayer player, ref TrashEventArgs trashedEventArgs); public class TrashResolver { public IDisplayable Card { get; } public bool IsRequired { get; } public TrashMethod Method { get; } public IPlayer Player { get; } public string Text { get; } public TrashResolver(IPlayer player, IDisplayable card, string text, TrashMethod method, bool isRequired) { Player = player; Card = card; Text = text; Method = method; IsRequired = isRequired; } } public class CallEventArgs : EventArgs { public IPlayer CurrentPlayer { get; } public Card CalledCard { get; } public CallEventArgs(IPlayer player, Card calledCard) { CurrentPlayer = player; CalledCard = calledCard; } } public class TurnStartingEventArgs : EventArgs, IPlayerEventArgs { public IPlayer Player { get; } public IDisplayable GrantedBy { get; } public bool Cancelled { get; } = false; public TurnStartingEventArgs(IPlayer player, IDisplayable grantedBy = null) { Player = player; GrantedBy = grantedBy; } } public class TurnStartedEventArgs : EventArgs, IPlayerEventArgs { public IPlayer Player { get; } public Dictionary Resolvers { get; } = new Dictionary(); public List HandledBy { get; } = new List(); public TurnStartedEventArgs(IPlayer player) { Player = player; } public TurnStartedResolver GetResolver(string key) { return !Resolvers.ContainsKey(key) ? null : Resolvers[key]; } } public delegate void TurnStartedMethod(IPlayer player, ref TurnStartedEventArgs turnStartedEventArgs); public class TurnStartedResolver { public IPlayer Player { get; } public IDisplayable Card { get; } public string Text { get; } public TurnStartedMethod Method { get; } public bool IsRequired { get; } public object Data { get; } public TurnStartedResolver(IPlayer player, IDisplayable card, string text, TurnStartedMethod method, bool isRequired = false, object data = null) { Player = player; Card = card; Text = text; Method = method; IsRequired = isRequired; Data = data; } } public class DrawCardsEventArgs : EventArgs { public Visual.VisualPlayer Player { get; } public DeckPosition SourceDeckPosition { get; } public int Count { get; set; } public DeckLocation? DestinationDeck { get; } public Type DestinationType { get; } public DrawCardsEventArgs(IPlayer player, DeckPosition sourceDeckPosition, int count, DeckLocation destination) { Player = new Visual.VisualPlayer(player); SourceDeckPosition = sourceDeckPosition; Count = count; DestinationDeck = destination; } public DrawCardsEventArgs(IPlayer player, DeckPosition sourceDeckPosition, int count, Type destination) { Player = new Visual.VisualPlayer(player); SourceDeckPosition = sourceDeckPosition; Count = count; DestinationType = destination; } } public class ShuffleEventArgs : EventArgs, IPlayerEventArgs { public List HandledBy { get; } = new List(); public IPlayer Player { get; } public Dictionary Resolvers { get; } = new Dictionary(); public ItemCollection ShuffleCards { get; } = new ItemCollection(); public ShuffleEventArgs(IPlayer player, ItemCollection shuffleCards) { Player = player; ShuffleCards = shuffleCards; } } public delegate void ShuffleMethod(IPlayer player, ref ShuffleEventArgs eventArgs); public class ShuffleResolver { public bool IsRequired { get; } public ShuffleMethod Method { get; } public IPlayer Player { get; } public IGameObject Source { get; } public string Text { get; } public ShuffleResolver(IPlayer player, IGameObject source, string text, ShuffleMethod method, bool isRequired) { Player = player; Source = source; Text = text; Method = method; IsRequired = isRequired; } } public class TakeableEventArgs : EventArgs, IPlayerEventArgs { public IPlayer Player { get; } public ItemCollection Takeables { get; } = new ItemCollection(); public TakeableAction TakeableAction { get; } public TakeableEventArgs(IPlayer player, TakeableAction takeableAction) { Player = player; TakeableAction = takeableAction; } public TakeableEventArgs(IPlayer player, TakeableAction takeableAction, ITakeable takeable) : this(player, takeableAction) { Takeables.Add(takeable); } public TakeableEventArgs(IPlayer player, TakeableAction takeableAction, IEnumerable takeables) : this(player, takeableAction) { Takeables.AddRange(takeables); } } public class CleaningUpEventArgs : EventArgs { public bool Cancelled { get; set; } = false; public CardMovementCollection CardsMovements { get; } public IPlayer CurrentPlayer { get; } public Dictionary Resolvers { get; } = new Dictionary(); public CleaningUpEventArgs(IPlayer player, ref CardMovementCollection cardsMovements) { CurrentPlayer = player; CardsMovements = cardsMovements; } } public delegate void CleaningUpMethod(IPlayer player, ref CleaningUpEventArgs retrievingEventArgs); public class CleaningUpResolver { public ICardBase Card { get; } public string Text { get; } public CleaningUpMethod Method { get; } public bool IsRequired { get; } public object Data { get; set; } public CleaningUpResolver(ICardBase card, string text, CleaningUpMethod method, bool isRequired = false) { Card = card; Text = text; Method = method; IsRequired = isRequired; } } public class DrawNewHandEventArgs : EventArgs { public IPlayer CurrentPlayer { get; } public int DrawSize { get; set; } public Dictionary Resolvers { get; } = new Dictionary(); public List HandledBy { get; } = new List(); public DrawNewHandEventArgs(IPlayer player, int drawSize) { CurrentPlayer = player; DrawSize = drawSize; } } public delegate void DrawNewHandMethod(IPlayer player, ref DrawNewHandEventArgs drawNewHandEventArgs); public class DrawNewHandResolver { public ICardBase Card { get; } public object Data { get; set; } public bool IsRequired { get; } public DrawNewHandMethod Method { get; } public string Text { get; } public DrawNewHandResolver(ICardBase card, string text, DrawNewHandMethod method, bool isRequired = false) { Card = card; Text = text; Method = method; IsRequired = isRequired; } } public class CleanedUpEventArgs : EventArgs, IPlayerEventArgs { public IPlayer Player { get; } public Dictionary Resolvers { get; } = new Dictionary(); public List HandledBy { get; } = new List(); public CleanedUpEventArgs(IPlayer player) { Player = player; } } public delegate void CleanedUpMethod(IPlayer player, ref CleanedUpEventArgs cleanedUpEventArgs); public class CleanedUpResolver { public ICardBase Card { get; } public string Text { get; } public CleanedUpMethod Method { get; } public bool IsRequired { get; } public object Data { get; set; } public CleanedUpResolver(ICardBase card, string text, CleanedUpMethod method, bool isRequired = false) { Card = card; Text = text; Method = method; IsRequired = isRequired; } } public class TurnEndedEventArgs : EventArgs, IPlayerEventArgs { public IPlayer Player { get; } public IPlayer NextPlayer { get; set; } = null; public IDisplayable NextGrantedBy { get; set; } = null; public TurnEndedEventArgs(IPlayer player) { Player = player; } } public class BenefitReceiveVisualEventArgs : EventArgs { public PhaseEnum Phase { get; } public CardBenefit Benefit { get; } public Visual.VisualPlayer Player { get; } public BenefitReceiveVisualEventArgs(IPlayer player, CardBenefit cardBenefit) { Contract.Requires(player != null, "player cannot be null"); Player = new Visual.VisualPlayer(player); Benefit = cardBenefit; Phase = player.Phase; } } public class BenefitReceiveEventArgs : EventArgs, IPlayerEventArgs { public PhaseEnum Phase { get; } public CardBenefit Benefit { get; } public IPlayer Player { get; } public ICardBase CardSource { get; } public Token TokenSource { get; } public BenefitReceiveEventArgs(IPlayer player, ICardBase source, CardBenefit cardBenefit) : this(player, cardBenefit) { CardSource = source; } public BenefitReceiveEventArgs(IPlayer player, Token source, CardBenefit cardBenefit) : this(player, cardBenefit) { TokenSource = source; } private BenefitReceiveEventArgs(IPlayer player, CardBenefit cardBenefit) { Contract.Requires(player != null, "player cannot be null"); Contract.Requires(cardBenefit != null, "player cannot be null"); Player = player; Benefit = cardBenefit.Clone(); Phase = player.Phase; } } }