Package mage.cards

Examples of mage.cards.Cards


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());

        Cards cards = new CardsImpl(Zone.PICK);
        int count = Math.min(player.getLibrary().size(), 7);
        for (int i = 0; i < count; i++) {
            Card card = player.getLibrary().removeFromTop(game);
            if (card != null) {
                cards.add(card);
            }
        }

        if (!cards.isEmpty()) {
            TargetCard target = new TargetCard(Zone.PICK,
                    new FilterCreatureCard(
                    "creature card to put on the battlefield"));
            if (player.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
                Card card = cards.get(target.getFirstTarget(), game);
                if (card != null) {
                    cards.remove(card);
                    card.putOntoBattlefield(game, Zone.PICK,
                            source.getSourceId(), source.getControllerId());
                }
            }
            if (cards.size() > 0) {
                TargetCard target2 = new TargetCard(Zone.PICK,
                        new FilterCard(
                        "card to put on the bottom of your library"));
                while (player.isInGame() && cards.size() > 1) {
                    player.choose(Outcome.Benefit, cards, target2,
                            game);
                    Card card = cards.get(target2.getFirstTarget(), game);
                    if (card != null) {
                        cards.remove(card);
                        player.getLibrary().putOnBottom(card, game);
                    }
                    target2.clearChosen();
                }
                Card card = cards.get(cards.iterator().next(), game);
                cards.remove(card);
                player.getLibrary().putOnBottom(card, game);
            }
        }

        return false;
View Full Code Here


            return false;
        }

        Card card = player.getLibrary().getFromTop(game);
        if (card != null) {
            Cards cards = new CardsImpl();
            cards.add(card);
            player.lookAtCards("Explorer's Scope", cards, game);
            if (card.getCardType().contains(CardType.LAND)) {
                String message = "Put " + card.getName() + " onto the battlefield tapped?";
                if (player.chooseUse(Outcome.PutLandInPlay, message, game)) {
                    if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId())) {
View Full Code Here

        if (card != null) {
            for (Ability ability : card.getAbilities()) {
                if (ability instanceof MiracleAbility) {
                    Player controller = game.getPlayer(ability.getControllerId());
                    if (controller != null) {
                        Cards cards = new CardsImpl();
                        cards.add(card);
                        controller.lookAtCards("Miracle", cards, game);
                        if (controller.chooseUse(Outcome.Benefit, "Reveal card to be able to use Miracle?", game)) {
                            controller.revealCards("Miracle", cards, game);
                            game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MIRACLE_CARD_REVEALED, card.getId(), card.getId(),controller.getId()));
                            break;
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getFirstTarget());
        if (player != null) {
            Cards hand = player.getHand();
            player.revealCards("Trapfinder's Trick", hand, game);
            Set<Card> cards = hand.getCards(game);
            for (Card card : cards) {
                if (card != null && card.hasSubtype("Trap")) {
                    player.discard(card, source, game);
                }
            }
View Full Code Here

        paid = false;
        Player player = game.getPlayer(controllerId);
        if (player != null) {
            Card card = player.getHand().get(ability.getSourceId(), game);
            if (card != null) {
                Cards cards = new CardsImpl(card);
                paid = true;
                player.revealCards("Reveal card cost", cards, game);
            }
        }
        return paid;
View Full Code Here


    @Override
    public void revealFaceDownCard(Card card, Game game) {
        if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.REVEAL_FACE_DOWN, this.getId(), game)) {
            Cards cards = new CardsImpl(card);
            this.revealCards(name, cards, game);
        }
    }
View Full Code Here

                        }
                    }
                    for (Ability ability: card.getAbilities()) {
                        if (ability instanceof ChancellorAbility) {
                            if (player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getName() + "?", this)) {
                                Cards cards = new CardsImpl();
                                cards.add(card);
                                player.revealCards("Revealed", cards, this);
                                ability.resolve(this);
                            }
                        }
                        if (ability instanceof GemstoneCavernsAbility) {
                            if (!playerId.equals(startingPlayerId)) {
                                if (player.chooseUse(Outcome.PutCardInPlay, "Do you wish to put " + card.getName() + " into play?", this)) {
                                    Cards cards = new CardsImpl();
                                    cards.add(card);
                                    player.revealCards("Revealed", cards, this);
                                    ability.resolve(this);
                                }
                            }
                        }
View Full Code Here

            FilterCard filter = new FilterCard("card with converted mana cost " + sourceCard.getManaCost().convertedManaCost());
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, sourceCard.getManaCost().convertedManaCost()));
            TargetCardInLibrary target = new TargetCardInLibrary(1, filter);
            if (player.searchLibrary(target, game)) {
                if (target.getTargets().size() > 0) {
                    Cards revealed = new CardsImpl();
                    for (UUID cardId : target.getTargets()) {
                        Card card = player.getLibrary().remove(cardId, game);
                        if (card != null) {
                            player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                            revealed.add(card);
                        }
                    }
                    player.revealCards("Search", revealed, game);
                }
            }
View Full Code Here

    public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
        if (targets.choose(Outcome.Benefit, controllerId, sourceId, game)) {
            convertedManaCosts = 0;
            numberCardsRevealed = 0;
            Player player = game.getPlayer(controllerId);
            Cards cards = new CardsImpl();
            for (UUID targetId: targets.get(0).getTargets()) {
                Card card = player.getHand().get(targetId, game);
                if (card == null)
                    return false;
                convertedManaCosts += card.getManaCost().convertedManaCost();
                numberCardsRevealed++;
                cards.add(card);               
                paid = true;
            }
            player.revealCards("card cost", cards, game); // this is not a boolean
            return paid;
        }
View Full Code Here

        MageObject sourceObject = game.getObject(source.getSourceId());
        Player player = game.getPlayer(source.getControllerId());
        if (player == null || sourceObject == null) {
            return false;
        }
        Cards revealed = new CardsImpl();
        Card creatureCard = null;
        Cards nonCreatureCards = new CardsImpl();
        //The first player may reveal cards from the top of his or her library
        while (creatureCard == null && player.getLibrary().size() > 0) {
            Card card = player.getLibrary().removeFromTop(game);
            revealed.add(card);
            // until he or she reveals a creature card.
            if (card.getCardType().contains(CardType.CREATURE)) {
                creatureCard = card;
            } else {
                nonCreatureCards.add(card);
            }
        }
        player.revealCards(sourceObject.getName(), revealed, game);

        //If he or she does, that player puts that card onto the battlefield
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.