Package mage.target.common

Examples of mage.target.common.TargetCardInHand


        this.expansionSetCode = "CSP";

        this.color.setBlack(true);

        // You may exile two black cards from your hand rather than pay Soul Spike's mana cost.
        this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(2, filter))));
        // Soul Spike deals 4 damage to target creature or player and you gain 4 life.
        this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
        this.getSpellAbility().addEffect(new DamageTargetEffect(4));
        this.getSpellAbility().addEffect(new GainLifeEffect(4));
    }
View Full Code Here


        this.getSpellAbility().addEffect(effect);
        this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
        // Discard a land card: Put two charge counters on Lightning Storm. You may choose a new target for it. Any player may activate this ability but only if Lightning Storm is on the stack.
        SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.STACK,
                new LightningStormAddCounterEffect() ,
                new DiscardTargetCost(new TargetCardInHand(new FilterLandCard())));
        ability.setMayActivate(TargetController.ANY);
        ability.addEffect(new EmptyEffect("Any player may activate this ability but only if {this} is on the stack"));
        this.addAbility(ability);
    }
View Full Code Here

        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null){
            FilterCard filter = new FilterCard();
            filter.add(new SubtypePredicate("Aura"));
            filter.add(new AuraCardCanAttachToPermanentId(permanent.getId()));
            TargetCardInHand target = new TargetCardInHand(0, 1, filter);
            if (player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
                Card auraInHand = game.getCard(target.getFirstTarget());
                if (auraInHand != null) {
                    game.getState().setValue("attachTo:" + auraInHand.getId(), permanent);
                    if (player.putOntoBattlefieldWithInfo(auraInHand, game, Zone.HAND, source.getSourceId())) {
                        permanent.addAttachment(auraInHand.getId(), game);
                    }
View Full Code Here

        Player you = game.getPlayer(source.getControllerId());
        for (UUID playerId : you.getInRange()) {
            if (!playerId.equals(source.getControllerId())) {
                Player otherPlayer = game.getPlayer(playerId);
                if (otherPlayer != null && otherPlayer.getHand().size() > 0) {
                    TargetCardInHand target = new TargetCardInHand();
                    if (otherPlayer.choose(Outcome.Discard, target, source.getSourceId(), game)) {
                        Card card = game.getCard(target.getFirstTarget());
                        if (card != null) {
                            if (otherPlayer.discard(card, source, game)) {
                                amount += 1;
                                result = true;
                                target.clearChosen();
                            }
                        }
                    }
                }
            }
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            if (controller.getHand().size() > 0) {
                Card cardFromHand = null;
                if (controller.getHand().size() > 1) {
                    TargetCard target = new TargetCardInHand(new FilterCard());
                    if (controller.choose(outcome, controller.getHand(), target, game)) {
                        cardFromHand = game.getCard(target.getFirstTarget());
                    }
                } else {
                    cardFromHand = controller.getHand().getRandom(game);
                }
                if (cardFromHand == null) {
View Full Code Here

        this.expansionSetCode = "10E";
        this.subtype.add("Horror");
        this.color.setBlack(true);
        this.power = new MageInt(4);
        this.toughness = new MageInt(4);
        this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new DiscardTargetCost(new TargetCardInHand(new FilterCreatureCard("a creature card"))))));
    }
View Full Code Here

        // Whenever Horde Ambusher blocks, it deals 1 damage to you.
        this.addAbility(new BlocksTriggeredAbility(new DamageControllerEffect(1), false));
       
        // Morph - Reveal a red card in your hand.
        this.addAbility(new MorphAbility(this, new RevealTargetFromHandCost(new TargetCardInHand(filter))));
       
        // When Horde Ambusher is turned face up, target creature can't block this turn.
        Effect effect = new CantBlockTargetEffect(Duration.EndOfTurn);
        effect.setText("target creature can't block this turn");
        Ability ability = new TurnedFaceUpSourceTriggeredAbility(effect);
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        MageObject mageObject = game.getObject(source.getSourceId());
        if (player != null && mageObject != null) {
            Cost cost = new DiscardTargetCost(new TargetCardInHand(new FilterNonlandCard()));
            String message = "Discard a nonland card to search your library?";
            if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
                    && player.chooseUse(Outcome.Detriment, message, game)) {
                if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
                    Card card = game.getCard(cost.getTargets().getFirstTarget());
View Full Code Here

                    zone = Zone.GRAVEYARD;
                }
            }
        }
        if (card == null && player.chooseUse(Outcome.Neutral, "Search your Hand for an Aura card?", game)) {
            TargetCardInHand target = new TargetCardInHand(filter);
            if (player.choose(Outcome.PutCardInPlay, player.getHand(), target, game)) {
                card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    zone = Zone.HAND;
                }
            }
        }
        if (card == null) {
            TargetCardInLibrary target = new TargetCardInLibrary(filter);
            if (player.searchLibrary(target, game)) {
                card = game.getCard(target.getFirstTarget());
                if (card != null) {
                    zone = Zone.LIBRARY;
                }
            }
            player.shuffleLibrary(game);
View Full Code Here

        }
        return false;
    }

    private boolean putOnLibrary(Player player, Ability source, Game game) {
        TargetCardInHand target = new TargetCardInHand();
        player.chooseTarget(Outcome.ReturnToHand, target, source, game);
        Card card = player.getHand().get(target.getFirstTarget(), game);
        if (card != null) {
            player.getHand().remove(card);
            player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false);
        }
        return true;
View Full Code Here

TOP

Related Classes of mage.target.common.TargetCardInHand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.