Package mage.cards

Examples of mage.cards.Cards


    @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);
View Full Code Here


        }

        int xValue;
        xValue = source.getManaCostsToPay().getX();

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

        TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put into your hand"));
        if (player.choose(Outcome.DrawCard, cards, target, game)) {
            Card card = cards.get(target.getFirstTarget(), game);
            if (card != null) {
                cards.remove(card);
                card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                game.informPlayers(sourceObject.getName() + ": " + player.getName() + " puts a card into his or her hand");
            }
        }

        target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library"));
        if (cards.size() > 0) {
            game.informPlayers(new StringBuilder(sourceObject.getName()).append(": ")
                    .append(player.getName()).append(" puts ")
                    .append(cards.size() == 1 ? "a":cards.size())
                    .append(" card").append(cards.size() > 1 ? "s":"")
                    .append(" on the bottom of his or her library").toString());
        }
        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);
                card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
            }
            target.clearChosen();
        }
        if (cards.size() == 1) {
            Card card = cards.get(cards.iterator().next(), game);
            card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
        }

        return true;
    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        Player targetPlayer = game.getPlayer(source.getFirstTarget());
        Card sourceCard = game.getCard(source.getSourceId());
        if (controller != null && targetPlayer != null && sourceCard != null) {
            Cards cardsInHand = new CardsImpl();
            cardsInHand.addAll(targetPlayer.getHand());

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

            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);
                    }
                }
            }

            int cardsToDiscard = Math.min(revealedCards.size(), 2);
            TargetCard targetInHand = new TargetCard(cardsToDiscard, cardsToDiscard, Zone.HAND, new FilterCard("card to discard"));

            if (!revealedCards.isEmpty()) {
                targetPlayer.revealCards("Noggin Whack", revealedCards, game);
                controller.chooseTarget(Outcome.Exile, revealedCards, targetInHand, source, game);
                for (UUID cardId : (List<UUID>) targetInHand.getTargets()) {
                    Card card = game.getCard(cardId);
                    if (card != null) {
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
       
        if (player == null || sourceCard == null) {
            return false;
        }
        Cards cards = new CardsImpl();
        while (player.getLibrary().size() > 0) {
            Card card = player.getLibrary().removeFromTop(game);
            if (card != null) {
                cards.add(card);
                if(card.getCardType().contains(CardType.LAND)){
                    if(card.getSubtype().contains("Mountain")){
                        isMountain = true;
                    }
                    break;
                }
            }
            else{
                break;
            }
        }
        player.revealCards(sourceCard.getName(), cards, game);
        int damage = cards.size();
        if(isMountain == true){
            damage *= 2;
        }
       
        Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
View Full Code Here

            if (owner != null && controller != null) {
                // Put target creature on the bottom of its owner's library.
                owner.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD, false, true);
               
                // That creature's controller reveals cards from the top of his or her library until he or she reveals a creature card.
                Cards cards = new CardsImpl();
                while (controller.getLibrary().size() > 0) {
                    Card card = controller.getLibrary().removeFromTop(game);
                    if (card != null) {
                        if (card.getCardType().contains(CardType.CREATURE)) {
                            // The player puts that card onto the battlefield
                            controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
                            break;
                        }
                        else {
                            cards.add(card);
                        }
                    }
                }
                controller.revealCards("Proteus Staff", cards, game);
               
                // and the rest on the bottom of his or her library in any order.
                while (cards.size() > 0 && controller.isInGame()) {
                    if (cards.size() == 1) {
                        Card card = cards.get(cards.iterator().next(), game);
                        if (card != null) {
                            controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
                            cards.remove(card);
                        }                   
                    }
                    else {
                        TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to put on bottom of your library (last chosen will be on bottom)"));
                        controller.choose(Outcome.Neutral, cards, target, game);
                        Card card = cards.get(target.getFirstTarget(), game);
                        if (card != null) {
                            controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
                            cards.remove(card);
                        }
                    }
                }
                return true;
            }
View Full Code Here

        Permanent permanent = game.getPermanent(source.getSourceId());
        if (permanent == null) {
            permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
        }
        if (player != null && permanent != null) {
            Cards cards = new CardsImpl();
            while (player.getLibrary().size() > 0) {
                Card card = player.getLibrary().getFromTop(game);
                cards.add(card);
                if (card.getCardType().contains(CardType.LAND)) {
                    card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
                } else {
                    break;
                }
View Full Code Here

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

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

            if (cards.size() > 0) {
                player.lookAtCards("Forbidden Alchemy", cards, game);

                TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put in your hand"));
                if (player.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);
                    }
                }

                for (Card card : cards.getCards(game)) {
                    card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
                }
            }
            return true;
        }
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (player != null && sourcePermanent != null) {           
            if (player.getLibrary().size() > 0) {
                Card card = player.getLibrary().getFromTop(game);
                Cards cards = new CardsImpl();
                cards.add(card);
                player.lookAtCards(sourcePermanent.getName(), cards, game);
                if (player.chooseUse(Outcome.DrawCard, "Do you wish to reveal the card at the top of the library?", game)) {
                    player.revealCards(sourcePermanent.getName(), cards, game);
                    if (filter.match(card, game)) {
                        return new TransformSourceEffect(true, true).apply(game, source);
View Full Code Here

            return false;
        }

        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            Cards cards = new CardsImpl();
            cards.add(card);
            controller.lookAtCards("top card of library - " + controller.getName(), cards, game);
            game.informPlayers(controller.getName() + " looks at the top card of his or her library");
        } else {
            return false;
        }
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 player = game.getPlayer(faceDownCreature.getControllerId());
            controller.lookAtCards("face down card - " + mageObject.getLogName(), cards, game);
            if (player != null) {
                game.informPlayers(controller.getName() + " looks at a face down creature of " + player.getName());
            }
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.