void Alchemist_OwnerChanged(object sender, OwnerChangedEventArgs e) { if (_CardsDiscardingEventHandler != null && e.OldOwner != null) { e.OldOwner.CardsDiscarding -= _CardsDiscardingEventHandler; _CardsDiscardingEventHandler = null; } if (e.NewOwner != null) { _CardsDiscardingEventHandler = new Player.CardsDiscardingEventHandler(player_CardsDiscarding); e.NewOwner.CardsDiscarding += _CardsDiscardingEventHandler; } }
void Alchemist_OwnerChanged(object sender, OwnerChangedEventArgs e) { if (_CardsDiscardingEventHandler != null && e.OldOwner != null) { e.OldOwner.CardsDiscarding -= _CardsDiscardingEventHandler; _CardsDiscardingEventHandler = null; } if (e.NewOwner != null) { _CardsDiscardingEventHandler = new Player.CardsDiscardingEventHandler(player_CardsDiscarding); e.NewOwner.CardsDiscarding += _CardsDiscardingEventHandler; } }
internal void player_Action(Player player, ref TurnStartedEventArgs e) { e.Player.Actions++; e.Player.AddCardInto(DeckLocation.InPlay, this._SetAsideCard); this._SetAsideCardInPlay = this._SetAsideCard; this._SetAsideCard = null; e.Player.PlayerMats[TypeClass.PrinceSetAside].Refresh(e.Player); e.Player.PlayCardInternal(this._SetAsideCardInPlay.LogicalCard, String.Format(" from {0}", this.Name)); _CardsDiscardingEventHandler = new Player.CardsDiscardingEventHandler(player_CardsDiscarding); e.Player.CardsDiscarding += _CardsDiscardingEventHandler; e.HandledBy.Add(this); }
internal void player_Action(Player player, ref TurnStartedEventArgs e) { e.Player.Actions++; e.Player.AddCardInto(DeckLocation.InPlay, this._SetAsideCard); this._SetAsideCardInPlay = this._SetAsideCard; this._SetAsideCard = null; e.Player.PlayerMats[TypeClass.PrinceSetAside].Refresh(e.Player); e.Player.PlayCardInternal(this._SetAsideCardInPlay.LogicalCard, String.Format(" from {0}", this.Name)); _CardsDiscardingEventHandler = new Player.CardsDiscardingEventHandler(player_CardsDiscarding); e.Player.CardsDiscarding += _CardsDiscardingEventHandler; e.HandledBy.Add(this); }
void player_CleanedUp(object sender, CleanedUpEventArgs e) { if (_CardsDiscardingEventHandler != null) ((Player)sender).CardsDiscarding -= _CardsDiscardingEventHandler; if (_CleanedUpEventHandler != null) ((Player)sender).CleanedUp -= _CleanedUpEventHandler; _CardsToTopDeck.Clear(); _CardsDiscardingEventHandler = null; _CleanedUpEventHandler = null; }
internal void player_Action(Player player, ref CleaningUpEventArgs e) { if (_CleaningUpEventHandlers.Count > 0) { player.CleaningUp -= _CleaningUpEventHandlers[0]; _CleaningUpEventHandlers.RemoveAt(0); } CardCollection allInPlayCards = this.GetSelectableCards(e); if (allInPlayCards.Count > 0) { int schemeChoices = (int)e.Actions[TypeClass.Scheme].Data; Choice choice = new Choice( String.Format("Select up to {0} Action {1} to place on top of your deck", schemeChoices, Utilities.StringUtility.Plural("card", schemeChoices, false)), this, allInPlayCards, player, false, true, 0, schemeChoices); ChoiceResult result = player.MakeChoice(choice); _CardsToTopDeck.Clear(); foreach (Card cardToMove in result.Cards) _CardsToTopDeck.Add(cardToMove); if (_CardsToTopDeck.Count > 0) { _CardsDiscardingEventHandler = new Player.CardsDiscardingEventHandler(player_CardsDiscarding); e.CurrentPlayer.CardsDiscarding += _CardsDiscardingEventHandler; _CleanedUpEventHandler = new Player.CleanedUpEventHandler(player_CleanedUp); e.CurrentPlayer.CleanedUp += _CleanedUpEventHandler; } } }