Search in sources :

Example 21 with PlayFromNotOwnHandZoneTargetEffect

use of mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect in project mage by magefree.

the class ContainmentConstructEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card discardedCard = game.getCard(targetPointer.getFirst(game, source));
    Card containmentConstruct = game.getCard(source.getSourceId());
    if (discardedCard != null && containmentConstruct != null) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller.chooseUse(Outcome.Benefit, "Do you want to exile the discarded card?  You may play it this turn from exile.", source, game)) {
            UUID exileId = CardUtil.getExileZoneId(game, source);
            controller.moveCardsToExile(discardedCard, source, game, true, exileId, "Exiled by " + containmentConstruct.getIdName());
            PlayFromNotOwnHandZoneTargetEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Duration.EndOfTurn);
            effect.setTargetPointer(new FixedTarget(discardedCard.getId(), game));
            game.addEffect(effect, source);
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) PlayFromNotOwnHandZoneTargetEffect(mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect) UUID(java.util.UUID) Card(mage.cards.Card)

Aggregations

PlayFromNotOwnHandZoneTargetEffect (mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect)21 Player (mage.players.Player)19 FixedTarget (mage.target.targetpointer.FixedTarget)17 Card (mage.cards.Card)16 ContinuousEffect (mage.abilities.effects.ContinuousEffect)12 MageObject (mage.MageObject)9 UUID (java.util.UUID)5 FilterCard (mage.filter.FilterCard)4 TargetCardInLibrary (mage.target.common.TargetCardInLibrary)3 FixedTargets (mage.target.targetpointer.FixedTargets)3 Ability (mage.abilities.Ability)2 ConditionalAsThoughEffect (mage.abilities.decorator.ConditionalAsThoughEffect)2 CardsImpl (mage.cards.CardsImpl)2 FilterInstantOrSorceryCard (mage.filter.common.FilterInstantOrSorceryCard)2 FilterNonlandCard (mage.filter.common.FilterNonlandCard)2 Permanent (mage.game.permanent.Permanent)2 Spell (mage.game.stack.Spell)2 Target (mage.target.Target)2 TargetCard (mage.target.TargetCard)2 TargetCardInYourGraveyard (mage.target.common.TargetCardInYourGraveyard)2