Package mage.target

Examples of mage.target.TargetCard


                        if (card != null) {
                            cards.add(card);
                        }
                    }
                }
                TargetCard target = new TargetCard(Zone.BATTLEFIELD, new FilterCard("order to put on the top of library (last choosen will be the top most)"));
                while (player.isInGame() && cards.size() > 1) {
                    player.choose(Outcome.Neutral, cards, target, game);
                    Card card = cards.get(target.getFirstTarget(), game);
                    if (card != null) {
                        cards.remove(card);
                        Permanent permanent = game.getPermanent(card.getId());
                        if (permanent != null) {
                            toLibrary.add(permanent);
                        }
                    }
                    target.clearChosen();
                }
                if (cards.size() == 1) {
                    Card card = cards.get(cards.iterator().next(), game);
                    Permanent permanent = game.getPermanent(card.getId());
                    if (permanent != null) {
                        toLibrary.add(permanent);
                    }
                }
                // move all permanents to lib at the same time
                for(Permanent permanent: toLibrary) {
                    player.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, true, false);
                }
                // cards to bottom
                cards.clear();
                toLibrary.clear();
                for (Permanent permanent: permanentsToBottom) {
                    if (permanent instanceof PermanentToken) {
                        toLibrary.add(permanent);
                    } else {
                        Card card = game.getCard(permanent.getId());
                        if (card != null) {
                            cards.add(card);
                        }
                    }
                }
                target = new TargetCard(Zone.BATTLEFIELD, new FilterCard("order to put on bottom of library (last choosen will be bottommost card)"));
                while (player.isInGame() && cards.size() > 1) {
                    player.choose(Outcome.Neutral, cards, target, game);
                    Card card = cards.get(target.getFirstTarget(), game);
                    if (card != null) {
                        cards.remove(card);
                        Permanent permanent = game.getPermanent(card.getId());
                        if (permanent != null) {
                            toLibrary.add(permanent);
                        }
                    }
                    target.clearChosen();
                }
                if (cards.size() == 1) {
                    Card card = cards.get(cards.iterator().next(), game);
                    Permanent permanent = game.getPermanent(card.getId());
                    if (permanent != null) {                   
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.power = new MageInt(3);
        this.toughness = new MageInt(3);

        // When Warden of the Eye enters the battlefield, return target noncreature, nonland card from your graveyard to your hand.
        Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect());
        ability.addTarget(new TargetCard(Zone.GRAVEYARD, filter));
        this.addAbility(ability);
    }
View Full Code Here

            Card cardToCopy;
            if(cards.size() == 1){
                cardToCopy = cards.getCards(game).iterator().next();
            }
            else{
                TargetCard target = new TargetCard(1, Zone.EXILED, new FilterCard("card to copy"));
                controller.choose(Outcome.Copy, cards, target, game);
                cardToCopy = cards.get(target.getFirstTarget(), game);
            }
            if(cardToCopy != null){
                Card copy = game.copyCard(cardToCopy, source, source.getControllerId());
                if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", game)) {
                    return controller.cast(copy.getSpellAbility(), game, true);
View Full Code Here

        Cards revealedCards = new CardsImpl();
        if (numberOfFaeries > 0 && targetPlayer.getHand().size() > numberOfFaeries) {
            Cards cardsInHand = new CardsImpl(Zone.PICK);
            cardsInHand.addAll(targetPlayer.getHand());

            TargetCard target = new TargetCard(numberOfFaeries, Zone.PICK, new FilterCard());

            if (targetPlayer.choose(Outcome.Discard, cardsInHand, target, game)) {
                List<UUID> targets = target.getTargets();
                for (UUID targetId : targets) {
                    Card card = game.getCard(targetId);
                    if (card != null) {
                        revealedCards.add(card);
                    }
                }
            }           
        } else {
            revealedCards.addAll(targetPlayer.getHand());
        }
       
        TargetCard targetInHand = new TargetCard(Zone.PICK, new FilterCard("card to discard"));

        if (!revealedCards.isEmpty()) {
            targetPlayer.revealCards("Thieving Sprite", revealedCards, game);
            Card card = null;
            if(revealedCards.size() > 1) {
                controller.choose(Outcome.Discard, revealedCards, targetInHand, game);
                card = revealedCards.get(targetInHand.getFirstTarget(), game);
            } else {
                card = revealedCards.getRandom(game);
            }
           
            if (card != null) {
View Full Code Here

                }
            }

            if (!cards.isEmpty()) {
                player.revealCards("Satyr Wayfinder", cards, game);
                TargetCard target = new TargetCard(Zone.PICK, filterPutInHand);
                if (properCardFound && player.choose(Outcome.DrawCard, cards, target, game)) {
                    Card card = game.getCard(target.getFirstTarget());
                    if (card != null) {
                        cards.remove(card);
                        player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        player.drawCards(2, game);
        if (player.getHand().size() > 0) {
            TargetCard target = new TargetCard(Zone.HAND, filter);
            player.choose(Outcome.Detriment, player.getHand(), target, game);
            Card card = player.getHand().get(target.getFirstTarget(), game);
            if (card != null) {
                player.removeFromHand(card, game);
                card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                player.shuffleLibrary(game);
                return true;
View Full Code Here

            }

            if (cards.size() > 0) {
                controller.lookAtCards("Sultai Soothsayer", cards, game);

                TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put in your hand"));
                if (controller.choose(Outcome.Benefit, cards, target, game)) {
                    Card card = cards.get(target.getFirstTarget(), game);
                    if (card != null) {
                        card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                        cards.remove(card);
                    }
                }
View Full Code Here

        return false;
    }
   
    private void chooseCardInHandAndPutOnTopOfLibrary(Game game, Ability source, Player you, Player targetPlayer) {
        if (targetPlayer.getHand().size() > 0) {
            TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of library (last chosen will be on top)"));
            if (you.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
                Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
                if (card != null) {
                    targetPlayer.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, true, false);
                }
            }
        }
View Full Code Here

                }
            }

            if (!cards.isEmpty()) {
                controller.revealCards(sourceObject.getLogName(), cards, game);
                TargetCard target = new TargetCard(Zone.LIBRARY, filterPutInHand);
                if (properCardFound && controller.choose(Outcome.DrawCard, cards, target, game)) {
                    Card card = game.getCard(target.getFirstTarget());
                    if (card != null) {
                        controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                        cards.remove(card);
                    }
View Full Code Here

TOP

Related Classes of mage.target.TargetCard

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.