コード例 #1
0
            private void DiscardChosenAttachment(IGame game, IEffectHandle handle, IPlayer player, IAttachableInPlay attachment)
            {
                if (attachment.AttachedTo == null)
                {
                    handle.Cancel(string.Format("Could not discard '{1}', it was not attached to anything", attachment.Title));
                    return;
                }

                attachment.AttachedTo.RemoveAttachment(attachment);

                if (attachment.Card is IObjectiveCard)
                {
                    game.StagingArea.EncounterDeck.Discard(new List<IEncounterCard> { attachment.Card as IObjectiveCard });
                }
                else if (attachment.Card is IPlayerCard)
                {
                    player.Deck.Discard(new List<IPlayerCard> { attachment.Card as IPlayerCard });
                }
                else
                {
                    handle.Cancel(string.Format("'{0}' could not be discarded because it is not a valid attachment controlled by {1}", attachment.Title, player.Name));
                    return;
                }

                handle.Resolve(string.Format("{0} chose to have '{1}' discarded by the shadow effect of '{2}'", player.Name, attachment.Title, CardSource.Title));
            }
コード例 #2
0
        public void RemoveAttachment(IAttachableInPlay attachment)
        {
            if (attachment == null)
            {
                throw new ArgumentNullException("attachment");
            }

            if (!attachments.ContainsKey(attachment.StateId))
            {
                return;
            }

            attachments.Remove(attachment.StateId);
        }
コード例 #3
0
        public void RemoveDeckAttachment(IAttachableInPlay attachment)
        {
            if (attachment == null)
            {
                throw new ArgumentNullException("attachment");
            }

            if (!deckAttachments.Contains(attachment))
            {
                return;
            }

            deckAttachments.Remove(attachment);
        }
コード例 #4
0
            private void DiscardOneAttachmentFromDefendingCharacter(IGame game, IEffectHandle handle, IPlayer player, IAttachableInPlay attachment)
            {
                attachment.AttachedTo.RemoveAttachment(attachment);

                if (attachment.Card is IObjectiveCard)
                {
                    game.StagingArea.EncounterDeck.Discard(new List<IEncounterCard> { attachment.Card as IObjectiveCard });
                }
                else if (attachment.Card is IPlayerCard)
                {
                    player.Deck.Discard(new List<IPlayerCard> { attachment.Card as IPlayerCard });
                }
                else
                {
                    handle.Cancel(string.Format("Could not discard '{0}' because it was not a valid attachment controlled by {1}", attachment.Title, player.Name));
                    return;
                }

                handle.Resolve(string.Format("{0} chose to have '{1}' discarded", player.Name, attachment.Title));
            }
コード例 #5
0
            public override IEffectHandle GetHandle(IGame game)
            {
                IAttachableInPlay attachment = null;

                foreach (var player in game.Players)
                {
                    attachment = player.CardsInPlay.OfType <IAttachableInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault();
                    if (attachment != null)
                    {
                        break;
                    }
                }

                if (attachment == null || attachment.AttachedTo == null)
                {
                    return(base.GetHandle(game));
                }

                var resourceful = attachment.AttachedTo as ICharacterInPlay;

                if (resourceful == null)
                {
                    return(base.GetHandle(game));
                }

                var controller = resourceful.GetController(game);

                if (controller == null)
                {
                    return(base.GetHandle(game));
                }

                var builder =
                    new ChoiceBuilder(string.Format("You may pay 2 resources from {0}'s resource pool to allow them to ready as normal", resourceful.Title), game, controller)
                    .Question(string.Format("{0}, do you want to pay 2 resources from {1}'s resource pool?", controller.Name, resourceful.Title))
                    .Answer(string.Format("Yes, I want to pay 2 resources from {0}'s resource pool", resourceful.Title), true, (source, handle, item) => PayResourcesToReadyAttachedCharacter(source, handle, controller, resourceful))
                    .LastAnswer(string.Format("No, I do not want to pay 2 resources from {0}'s resource pool", resourceful.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to pay 2 resources from {1}'s resource pool (2)", controller.Name, resourceful.Title, CardSource.Title)));

                return(new EffectHandle(this, builder.ToChoice()));
            }
コード例 #6
0
            private void DiscardOneAttachmentFromDefendingCharacter(IGame game, IEffectHandle handle, IPlayer player, IAttachableInPlay attachment)
            {
                attachment.AttachedTo.RemoveAttachment(attachment);

                if (attachment.Card is IObjectiveCard)
                {
                    game.StagingArea.EncounterDeck.Discard(new List <IEncounterCard> {
                        attachment.Card as IObjectiveCard
                    });
                }
                else if (attachment.Card is IPlayerCard)
                {
                    player.Deck.Discard(new List <IPlayerCard> {
                        attachment.Card as IPlayerCard
                    });
                }
                else
                {
                    handle.Cancel(string.Format("Could not discard '{0}' because it was not a valid attachment controlled by {1}", attachment.Title, player.Name));
                    return;
                }

                handle.Resolve(string.Format("{0} chose to have '{1}' discarded", player.Name, attachment.Title));
            }
コード例 #7
0
ファイル: Player.cs プロジェクト: bossaia/alexandrialibrary
        public void RemoveDeckAttachment(IAttachableInPlay attachment)
        {
            if (attachment == null)
                throw new ArgumentNullException("attachment");

            if (!deckAttachments.Contains(attachment))
                return;

            deckAttachments.Remove(attachment);
        }
コード例 #8
0
            private void DiscardChosenAttachment(IGame game, IEffectHandle handle, IPlayer player, IAttachableInPlay attachment)
            {
                if (attachment.AttachedTo == null)
                {
                    handle.Cancel(string.Format("Could not discard '{1}', it was not attached to anything", attachment.Title));
                    return;
                }

                attachment.AttachedTo.RemoveAttachment(attachment);

                if (attachment.Card is IObjectiveCard)
                {
                    game.StagingArea.EncounterDeck.Discard(new List <IEncounterCard> {
                        attachment.Card as IObjectiveCard
                    });
                }
                else if (attachment.Card is IPlayerCard)
                {
                    player.Deck.Discard(new List <IPlayerCard> {
                        attachment.Card as IPlayerCard
                    });
                }
                else
                {
                    handle.Cancel(string.Format("'{0}' could not be discarded because it is not a valid attachment controlled by {1}", attachment.Title, player.Name));
                    return;
                }

                handle.Resolve(string.Format("{0} chose to have '{1}' discarded by the shadow effect of '{2}'", player.Name, attachment.Title, CardSource.Title));
            }