Package mage.players

Examples of mage.players.Library


    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        MageObject sourceObject= game.getObject(source.getSourceId());
        if (player != null) {

            Library library = player.getLibrary();
            if (library.size() < 1) {
                return true;
            }
            CardsImpl cards = new CardsImpl();
            Card card;
            Filter filter = new FilterBasicLandCard();
            do {
                card = library.removeFromTop(game);
                if (card != null) {
                   
                    if (filter.match(card, game)) {
                        player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                    } else {
                        cards.add(card);
                    }
                }
            } while (library.size() > 0 && card != null && !filter.match(card, game));

            if (!cards.isEmpty()) {
                for (Card cardToGrave: cards.getCards(game)) {
                    player.moveCardToGraveyardWithInfo(cardToGrave, source.getSourceId(), game, Zone.LIBRARY);
                }
View Full Code Here


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null && player.getLibrary().size() > 0) {
            CardsImpl cards = new CardsImpl();
            Library library = player.getLibrary();
            Card card = null;
            do {
                card = library.removeFromTop(game);
                if (card != null) {
                    cards.add(card);
                }
            } while (library.size() > 0 && card != null && card.getCardType().contains(CardType.LAND));
            // reveal cards
            if (!cards.isEmpty()) {
                player.revealCards("Erratic Mutation", cards, game);
            }
            // the nonland card
View Full Code Here

        }

        if (permanent != null) {
            Player player = game.getPlayer(permanent.getControllerId());
            if (player != null) {
                Library library = player.getLibrary();
                if (library.size() > 0) {
                    Cards cards = new CardsImpl();
                    Card card = library.removeFromTop(game);
                    cards.add(card);
                    while (!card.getCardType().contains(CardType.CREATURE) && library.size() > 0) {
                        card = library.removeFromTop(game);
                        cards.add(card);
                    }

                    if (card.getCardType().contains(CardType.CREATURE)) {
                        card.putOntoBattlefield(game, Zone.PICK, source.getSourceId(), player.getId());
                    }

                    if (cards.size() > 0) {
                        player.revealCards("Polymorph", cards, game);
                        Set<Card> cardsToShuffle = cards.getCards(game);
                        cardsToShuffle.remove(card);
                        library.addAll(cardsToShuffle, game);
                    }
                }
                return true;
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getFirstTarget());
        if (player != null) {
            Library library = player.getLibrary();

            int amount = Math.min(player.getGraveyard().size(), library.size());
            for (int i = 0; i < amount; i++) {
                Card card = library.removeFromTop(game);
                if (card != null) {
                    card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
                }
            }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
        MageObject sourceObject = game.getObject(source.getSourceId());       
        if (sourceObject != null && opponent != null) {
            if (opponent.getLibrary().size() > 0) {
                Library library = opponent.getLibrary();
                Card card = library.getFromTop(game);
                if (card != null) {
                    opponent.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getLogName(), source.getSourceId(), game, Zone.LIBRARY);
                    ContinuousEffect effect = new OrnateKanzashiCastFromExileEffect(card.getId());
                    effect.setTargetPointer(new FixedTarget(card.getId()));
                    game.addEffect(effect, source);
View Full Code Here

        Card card = game.getCard(source.getSourceId());
        if (card != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
            Player owner = game.getPlayer(card.getOwnerId());
            if (card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true)) {
                // Move Sphinx to third position
                Library lib = game.getPlayer(source.getControllerId()).getLibrary();
                if (lib != null) {
                    Card card1 = lib.removeFromTop(game);
                    if (card1.getId().equals(source.getSourceId())) {
                        Card card2 = lib.removeFromTop(game);
                        Card card3 = lib.removeFromTop(game);
                        if (card1 != null) {
                            lib.putOnTop(card1, game);
                        }
                        if (card3 != null) {
                            lib.putOnTop(card3, game);
                        }
                        if (card2 != null) {
                            lib.putOnTop(card2, game);
                        }
                        return true;
                    }
                }
            }
View Full Code Here

TOP

Related Classes of mage.players.Library

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.