Package mage.cards

Examples of mage.cards.Cards


            }
            if (!card.getCardType().contains(CardType.CREATURE) && !card.getCardType().contains(CardType.LAND)) {
                player.gainLife(2, game);
            }

            Cards cards = new CardsImpl();
            cards.add(card);
            player.revealCards("Druidic Satchel", cards, game);
            return true;
        }
        return false;
    }
View Full Code Here


            int payLife = controller.getAmount(0, controller.getLife(),"Pay how many life?", game);
            if (payLife > 0) {
                controller.loseLife(payLife, game);
                game.informPlayers(new StringBuilder(sourceCard.getName()).append(": ").append(controller.getName()).append(" pays ").append(payLife).append(" life").toString());

                Cards cardsInHand = new CardsImpl();
                cardsInHand.addAll(targetPlayer.getHand());

                int count = Math.min(cardsInHand.size(), payLife);

                TargetCard target = new TargetCard(count, Zone.HAND, new FilterCard());
                Cards revealedCards = new CardsImpl();

                if (targetPlayer.chooseTarget(Outcome.Discard, cardsInHand, target, source, game)) {
                    List<UUID> targets = target.getTargets();
                    for (UUID targetId : targets) {
                        Card card = game.getCard(targetId);
                        if (card != null) {
                            revealedCards.add(card);
                        }
                    }
                }

                TargetCard targetInHand = new TargetCard(Zone.HAND, new FilterCard("card to exile"));

                if (!revealedCards.isEmpty()) {
                    targetPlayer.revealCards(sourceCard.getName(), revealedCards, game);
                    controller.chooseTarget(Outcome.Exile, revealedCards, targetInHand, source, game);
                    Card card = revealedCards.get(targetInHand.getFirstTarget(), game);
                    if (card != null) {
                        controller.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.HAND);
                    }
                }
                return true;
View Full Code Here

        if (player == null || sourcePermanent == null) {
            return false;
        }
        if (player.getLibrary().size() > 0) {
            Card card = player.getLibrary().getFromTop(game);
            Cards cards = new CardsImpl(card);
            player.revealCards(sourcePermanent.getName(), cards, game);

            if (card != null) {
                game.addEffect(new BoostSourceEffect(card.getManaCost().convertedManaCost(), 0, Duration.EndOfTurn), source);
                return true;
View Full Code Here

        MageObject sourceObject = game.getObject(source.getSourceId());
        if (controller != null && sourceObject != null) {
            boolean topCardRevealed = controller.isTopCardRevealed();
            controller.setTopCardRevealed(false);
            // get cards from top
            Cards cards = new CardsImpl();
            int count = Math.min(controller.getLibrary().size(), 5);
            if (count > 0) {
                cards.addAll(controller.getLibrary().getTopCards(game, count));
                controller.lookAtCards(sourceObject.getLogName(), cards, game);
                // pick cards going to graveyard
                TargetCard target = new TargetCard(0,5, Zone.LIBRARY, new FilterCard("cards to put into your graveyard"));
                if (controller.choose(Outcome.Detriment, cards, target, game)) {
                    for (UUID cardId : (List<UUID>)target.getTargets()) {
                        Card card = cards.get(cardId, game);
                        if (card != null) {
                            cards.remove(card);
                            controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                        }
                    }
                }
                // The rest goes back to library in any order
                if (cards.size() > 0) {
                    game.informPlayers(controller.getName() + " puts " + cards.size() + " card" + (cards.size() ==1 ? "":"s"+ " back to his or her library");
                    target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on your library (last chosen will be on top)"));
                    while (controller.isInGame() && cards.size() > 1) {
                        controller.choose(Outcome.Neutral, cards, target, game);
                        Card card = cards.get(target.getFirstTarget(), game);
                        if (card != null) {
                            cards.remove(card);
                            card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                        }
                        target.clearChosen();
                    }
                    if (cards.size() == 1) {
                        Card card = cards.get(cards.iterator().next(), game);
                        card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                    }
                }
            }
            controller.setTopCardRevealed(topCardRevealed);
View Full Code Here

        }
        Permanent faceDownCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
        if (faceDownCreature != null) {
            Permanent copyFaceDown = faceDownCreature.copy();
            copyFaceDown.setFaceDown(false);
            Cards cards = new CardsImpl();
            cards.add(copyFaceDown);
            player.lookAtCards("face down card - " + mageObject.getLogName(), cards, game);
        } else {
            return false;
        }
        return true;
View Full Code Here

        if (permanent != null && controller != null) {
            Player owner = game.getPlayer(permanent.getOwnerId());
            if (owner != null) {
                int plains = game.getBattlefield().countAll(new FilterPermanent("Plains", "Plains you control"), source.getControllerId(), game);
                int xValue = Math.min(plains, owner.getLibrary().size());
                Cards cards = new CardsImpl();
                Deque<UUID> cardIds = new LinkedList<>();
                for (int i = 0; i < xValue; i++) {
                    Card card = owner.getLibrary().removeFromTop(game);
                    cards.add(card);
                    cardIds.push(card.getId());
                }
                // return cards back to library
                permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                game.informPlayers(new StringBuilder(controller.getName())
                        .append(" puts ").append(permanent.getName())
                        .append(" beneath the top ").append(xValue)
                        .append(" cards of ").append(owner.getName()).append("'s library").toString());
                while(!cardIds.isEmpty()) {
                    UUID cardId = cardIds.poll();
                    Card card = cards.get(cardId, game);
                    if (card != null) {
                        card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                    }
                }
                return true;
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            while (player.chooseUse(Outcome.Benefit, choiceText, game)) {
                Cards cards = player.getSideboard();
                if(cards.isEmpty()) {
                    game.informPlayer(player, "You have no cards outside the game.");
                    break;
                }

                Set<Card> filtered = cards.getCards(filter, game);
                if (filtered.isEmpty()) {
                    game.informPlayer(player, "You have no " + filter.getMessage() + " outside the game.");
                    break;
                }

                Cards filteredCards = new CardsImpl();
                for (Card card : filtered) {
                    filteredCards.add(card.getId());
                }

                TargetCard target = new TargetCard(Zone.PICK, filter);
                if (player.choose(Outcome.Benefit, filteredCards, target, game)) {
                    Card card = player.getSideboard().get(target.getFirstTarget(), game);
                    if (card != null) {

                        card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                        Cards revealCard = new CardsImpl();
                        revealCard.add(card);
                        player.revealCards("Living Wish", revealCard, game);
                        break;
                    }
                }
            }
View Full Code Here

        return new JaceMindseekerEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Cards cards = new CardsImpl();
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player != null) {
            // putting cards to grave shouldn't end the game, so getting minimun available
            int cardsCount = Math.min(5, player.getLibrary().size());
            for (int i = 0; i < cardsCount; i++) {
                Card card = player.getLibrary().removeFromTop(game);
                if (card != null) {
                    card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false);
                    if (filter.match(card, game)) {
                        cards.add(card);
                    }
                }
                else {
                    throw new IllegalArgumentException("couldn't get card from library");
                }
            }
        }

        // cast an instant or sorcery for free
        // TODO: Check if card can also be cast if it doesn't end in the graveyard due to other active effects (LevelX2 08.07.2013).
        if (cards.size() > 0) {
            Player controller = game.getPlayer(source.getControllerId());
            if (controller != null) {
                TargetCard target = new TargetCard(Zone.PICK, filter);
                target.setNotTarget(true);
                if (controller.chooseUse(outcome, "Cast an instant or sorcery card from among them for free?", game)
                        && controller.choose(outcome, cards, target, game)) {                 
                    Card card = cards.get(target.getFirstTarget(), game);
                    if (card != null) {
                        controller.cast(card.getSpellAbility(), game, true);
                    }
                }
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            while (player.chooseUse(Outcome.Benefit, choiceText, game)) {
                Cards cards = player.getSideboard();
                if(cards.isEmpty()) {
                    game.informPlayer(player, "You have no cards outside the game.");
                    break;
                }

                Set<Card> filtered = cards.getCards(filter, game);
                if (filtered.isEmpty()) {
                    game.informPlayer(player, "You have no " + filter.getMessage() + " outside the game.");
                    break;
                }

                Cards filteredCards = new CardsImpl();
                for (Card card : filtered) {
                    filteredCards.add(card.getId());
                }

                TargetCard target = new TargetCard(Zone.PICK, filter);
                if (player.choose(Outcome.Benefit, filteredCards, target, game)) {
                    Card card = player.getSideboard().get(target.getFirstTarget(), game);
                    if (card != null) {

                        card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                        Cards revealCard = new CardsImpl();
                        revealCard.add(card);
                        player.revealCards("Cunning Wish", revealCard, game);
                        break;
                    }
                }
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            while (player.chooseUse(Outcome.Benefit, choiceText, game)) {
                Cards cards = player.getSideboard();
                if(cards.isEmpty()) {
                    game.informPlayer(player, "You have no cards outside the game.");
                    break;
                }

                Set<Card> filtered = cards.getCards(filter, game);
                if (filtered.isEmpty()) {
                    game.informPlayer(player, "You have no " + filter.getMessage() + " outside the game.");
                    break;
                }

                Cards filteredCards = new CardsImpl();
                for (Card card : filtered) {
                    filteredCards.add(card.getId());
                }

                TargetCard target = new TargetCard(Zone.PICK, filter);
                if (player.choose(Outcome.Benefit, filteredCards, target, game)) {
                    Card card = player.getSideboard().get(target.getFirstTarget(), game);
                    if (card != null) {

                        card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                        Cards revealCard = new CardsImpl();
                        revealCard.add(card);
                        player.revealCards("Burning Wish", revealCard, game);
                        break;
                    }
                }
            }
View Full Code Here

TOP

Related Classes of mage.cards.Cards

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.