Package mage.cards

Examples of mage.cards.Cards


    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
       
        if (player != null) {
            //Search your library and graveyard for five cards
            Cards allCards = new CardsImpl(Zone.PICK);
            Cards cards = new CardsImpl(Zone.PICK);
            allCards.addAll(player.getLibrary().getCardList());
            allCards.addAll(player.getGraveyard());
            int number = Math.min(5, allCards.size());
            TargetCard target = new TargetCard(number, number, Zone.PICK, new FilterCard());
           
            if (player.choose(Outcome.Benefit, allCards, target, game)){
                // exile the rest
                for(UUID uuid : allCards){
                    if(!target.getTargets().contains(uuid)){
                        Card card = game.getCard(uuid);
                        if(card != null){
                            card.moveToExile(null, "Doomsday", source.getSourceId(), game);
                        }     
                    }
                    else{
                        cards.add(uuid);
                    }
                   
                }
                //Put the chosen cards on top of your library in any order
                target = new TargetCard(Zone.PICK, new FilterCard("Card to put on top"));
                while (cards.size() > 1 && player.isInGame()) {
                    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, true);
                    }
                    target.clearChosen();
                }
                if (cards.size() == 1) {
                    Card card = cards.get(cards.iterator().next(), game);
                    card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                }
            }
           
            //You lose half your life, rounded up
View Full Code Here


            return false;
        }

        if (player.getLibrary().size() > 0) {
            Card card = player.getLibrary().getFromTop(game);
            Cards cards = new CardsImpl();
            cards.add(card);
            player.revealCards("Call of the Wild", cards, game);

            if (card != null) {
                if (card.getCardType().contains(CardType.CREATURE)) {
                    player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            int numCards = Math.min(10, player.getLibrary().size());
            if (numCards > 0) {
                Cards cards = new CardsImpl();
                for (int i = 0; i < numCards; i++) {
                    cards.add(player.getLibrary().removeFromTop(game));
                }
                TargetCard target = new TargetCard(0, numCards, Zone.LIBRARY, new FilterCard("cards to exile"));
                player.choose(Outcome.Exile, cards, target, game);
                for (UUID cardId : target.getTargets()) {
                    Card card = cards.get(cardId, game);
                    if (card != null) {
                        player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY);
                        cards.remove(card);
                    }
                }
                while (cards.size() > 1) {
                    target = new TargetCard(1, Zone.LIBRARY, new FilterCard("card to put on top of library (last put is first drawn)"));
                    player.choose(Outcome.Benefit, cards, target, game);
                    Card card = cards.get(target.getFirstTarget(), game);
                    player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
                    cards.remove(card);
                }
                if (cards.size() == 1) {
                    Card card = cards.get(cards.iterator().next(), game);
                    if (card != null) {
                        player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, true, false);
                    }
                }
            }
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        Card sourceCard = game.getCard(source.getSourceId());
        if (controller != null && sourceCard != null) {
            int cardsHand = controller.getHand().size();
            if (cardsHand > 0){
                Cards cards = new CardsImpl();
                for (UUID cardId: controller.getHand()) {
                    cards.add(game.getCard(cardId));
                }
                for (Card card: cards.getCards(game)) {
                    card.moveToExile(null, null, source.getSourceId(), game);
                }
                controller.drawCards(cardsHand, game);
            }
            game.informPlayers(new StringBuilder(sourceCard.getName()).append(": ").append(controller.getName()).append(" exiles hand and draws ").append(cardsHand).append(" card(s)").toString());
View Full Code Here

            Player targetPlayer = game.getPlayer(card.getOwnerId());
            if (targetPlayer != null) {
                FilterCard filter = new FilterCard("card named " + card.getName());
                filter.add(new NamePredicate(card.getName()));

                Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY);
                cardsInLibrary.addAll(targetPlayer.getLibrary().getCards(game));

                // cards in Graveyard
                int cardsCount = targetPlayer.getGraveyard().count(filter, game);
                if (cardsCount > 0) {
                    filter.setMessage("card named " + card.getName() + " in the graveyard of " + targetPlayer.getName());
                    TargetCardInGraveyard target = new TargetCardInGraveyard(0, cardsCount, filter);
                    if (player.choose(Outcome.Exile, targetPlayer.getGraveyard(), target, game)) {
                        List<UUID> targets = target.getTargets();
                        for (UUID targetId : targets) {
                            Card targetCard = targetPlayer.getGraveyard().get(targetId, game);
                            if (targetCard != null) {
                                player.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD);
                            }
                        }
                    }
                }

                // cards in Hand
                cardsCount = targetPlayer.getHand().count(filter, game);
                if (cardsCount > 0) {
                    filter.setMessage("card named " + card.getName() + " in the hand of " + targetPlayer.getName());
                    TargetCardInHand target = new TargetCardInHand(0, cardsCount, filter);
                    if (player.choose(Outcome.Exile, targetPlayer.getHand(), target, game)) {
                        List<UUID> targets = target.getTargets();
                        for (UUID targetId : targets) {
                            Card targetCard = targetPlayer.getHand().get(targetId, game);
                            if (targetCard != null) {
                                player.moveCardToExileWithInfo(targetCard, null, "", source.getSourceId(), game, Zone.HAND);                               
                            }
                        }
                    }
                } else {
                    player.lookAtCards(targetPlayer.getName() + " hand", targetPlayer.getHand(), game);
                }

                // cards in Library
                cardsCount = cardsInLibrary.count(filter, game);
                if (cardsCount > 0) {
                    filter.setMessage("card named " + card.getName() + " in the library of " + targetPlayer.getName());
                    TargetCardInLibrary target = new TargetCardInLibrary(0, cardsCount, filter);
                    if (player.searchLibrary(target, game, targetPlayer.getId())) {
                        List<UUID> targets = target.getTargets();
View Full Code Here

                filter.add(new CardTypePredicate(CardType.LAND));
            }
            else {
                filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
            }
            Cards cards = new CardsImpl();
            while (player.getLibrary().size() > 0) {
                Card card = player.getLibrary().removeFromTop(game);
                if (filter.match(card, source.getSourceId(), source.getControllerId(), game)) {
                    player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                    break;
                }
                cards.add(card);
            }
            player.revealCards("Abundance", cards, game);
            player.putCardsOnBottomOfLibrary(cards, game, source, true);
        }
        return true;
View Full Code Here

        }

        RealmsUnchartedTarget target = new RealmsUnchartedTarget();
        if (player.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Cards cards = new CardsImpl();
                for (UUID cardId : (List<UUID>) target.getTargets()) {
                    Card card = player.getLibrary().remove(cardId, game);
                    if (card != null) {
                        cards.add(card);
                    }
                }
                player.revealCards("Realms Uncharted", cards, game);

                CardsImpl cardsToKeep = new CardsImpl();
                if (cards.size() > 2) {
                    cardsToKeep.addAll(cards);

                    Player opponent = game.getPlayer(game.getOpponents(player.getId()).iterator().next());
                    TargetCard targetDiscard = new TargetCard(2, Zone.PICK, new FilterCard("cards to put in graveyard"));
                    if (opponent != null && opponent.choose(Outcome.Discard, cards, targetDiscard, game)) {
                        cardsToKeep.removeAll(targetDiscard.getTargets());
                        cards.removeAll(cardsToKeep);
                    }
                }

                for (UUID cardId : cards) {
                    Card card = game.getCard(cardId);
View Full Code Here

   
    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player != null) {
            Cards creatureCardsInHand = new CardsImpl(Zone.PICK);
            for (UUID cardId : player.getHand()) {
                Card card = player.getHand().get(cardId, game);
                if (filter.match(card, game)) {
                    creatureCardsInHand.add(card);
                }
            }
           
            if (!creatureCardsInHand.isEmpty()) {
                Card card = creatureCardsInHand.getRandom(game);
                if (card != null) {
                    player.discard(card, source, game);
                }
            }
           
View Full Code Here

        Player player = game.getPlayer(source.getControllerId());
        if (player == null) {
            return false;
        }

        Cards cards = new CardsImpl();

        Library library = player.getLibrary();
        int n = Math.min(3, library.size());
        for (int i = 0; i < n; i++) {
            cards.add(library.removeFromTop(game));
        }

        player.lookAtCards("Telling Time", cards, game);

        Card card = pickCard(game, player, cards, "card to put in your hand");
        if (card != null) {
            card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
        }

        card = pickCard(game, player, cards, "card to put on top of your library");
        if (card != null) {
            card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
        }

        if (!cards.isEmpty()) {
            card = cards.getRandom(game);
            card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
        }

        return true;
    }
View Full Code Here

            Card card = game.getCard(cardId);
            Card sourceCard = game.getCard(source.getSourceId());
            Player controller = game.getPlayer(source.getControllerId());
            if (controller != null && card != null && game.getState().getZone(cardId) == Zone.EXILED) {
                if (controller.chooseUse(outcome, "Reveal exiled card?", game)) {
                    Cards cards = new CardsImpl(card);
                    controller.lookAtCards("Exiled with " + sourceCard.getName(), cards, game);
                }
            }
        }
        return false;
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.