Package mage.players

Examples of mage.players.Library


    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null && controller.getLibrary().size() > 0) {
            Library library = controller.getLibrary();
            Card card = library.removeFromTop(game);
            if (card != null) {
                controller.moveCardToExileWithInfo(card, source.getSourceId(), "Chandra Pyromaster <this card may be played the turn it was exiled>", source.getSourceId(), game, Zone.LIBRARY);
                ContinuousEffect effect = new ChandraPyromasterCastFromExileEffect();
                effect.setTargetPointer(new FixedTarget(card.getId()));
                game.addEffect(effect, source);
View Full Code Here


        Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
        if (spell != null) {
            if (spell.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game)) {
                Player player = game.getPlayer(spell.getControllerId());
                if (player != null && player.getLibrary().size() > 0) {
                    Library library = player.getLibrary();
                    Card card;
                    do {
                        card = library.removeFromTop(game);
                        if (card != null) {
                            card.moveToExile(source.getSourceId(), "Possibility Storm Exile", source.getSourceId(), game);
                        }
                    } while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType()));

                    if (card != null && sharesType(card, spell.getCardType())) {
                        if(player.chooseUse(Outcome.PlayForFree, new StringBuilder("Cast ").append(card.getName()).append(" without paying cost?").toString(), game)) {
                            player.cast(card.getSpellAbility(), game, true);
                        }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        MageObject sourceObject = game.getObject(source.getSourceId());
        if (controller != null && controller.getLibrary().size() > 0) {
            CardsImpl cards = new CardsImpl();
            Library library = controller.getLibrary();
            Card card = null;
            do {
                card = library.removeFromTop(game);
                if (card != null) {
                    cards.add(card);
                }
            } while (library.size() > 0 && card != null && !filter.match(card, game));
            // reveal cards
            if (!cards.isEmpty()) {
                controller.revealCards(sourceObject.getLogName(), cards, game);
            }
            // put nonlegendary creature card to battlefield
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("Explosive Revelation", cards, game);
            }
            // the nonland card
View Full Code Here

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

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) {
            Library library = controller.getLibrary();
            Card card = library.removeFromTop(game);
            if (card != null) {
                String exileName = new StringBuilder(sourcePermanent.getName()).append(" <this card may be played the turn it was exiled>").toString();
                controller.moveCardToExileWithInfo(card, source.getSourceId(), exileName, source.getSourceId(), game, Zone.LIBRARY);
                ContinuousEffect effect = new PropheticFlamespeakerCastFromExileEffect();
                effect.setTargetPointer(new FixedTarget(card.getId()));
View Full Code Here

   
    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Library library = controller.getLibrary();
            List<Card> cards = new ArrayList<>();
            int count = Math.min(3, library.size());
            for (int i = 0; i < count; i++) {
                Card card = library.removeFromTop(game);
                if (card != null) {
                    cards.add(card);
                }
            }
            if (cards.size() > 0) {
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
        if (opponent != null && opponent.getLibrary().size() > 0) {
            Library library = opponent.getLibrary();
            Card card;
            do {
                card = library.removeFromTop(game);
                if (card != null) {
                    opponent.moveCardToExileWithInfo(card, source.getSourceId()"Stolen Goods", source.getSourceId(), game, Zone.LIBRARY);
                }
            } while (library.size() > 0 && card != null && card.getCardType().contains(CardType.LAND));

            if (card != null) {
                opponent.revealCards("Card to cast", new CardsImpl(card), game);
                ContinuousEffect effect = new StolenGoodsCastFromExileEffect();
                effect.setTargetPointer(new FixedTarget(card.getId()));
View Full Code Here

        Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget());
        if (permanent != null) {
            if (permanent.sacrifice(source.getSourceId(), game)) {
                Player permanentController = game.getPlayer(permanent.getControllerId());
                if (permanentController != null) {
                    Library library = permanentController.getLibrary();
                    if (library.size() > 0) {
                        Cards cards = new CardsImpl();
                        Card card = null;
                        boolean cardFound = false;
                        if (library.size() > 0) {
                            do {
                                card = library.removeFromTop(game);
                                cards.add(card);
                                if (filter.match(card, game)) {
                                    for (CardType cardType : permanent.getCardType()) {
                                        if (card.getCardType().contains(cardType)) {
                                            // a permanent card
                                            cardFound = true;
                                            break;
                                        }
                                    }
                                }
                            } while (!cardFound && library.size() > 0);
                            permanentController.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
                        }

                        if (cards.size() > 0) {
                            permanentController.revealCards("Reweave", cards, game);
                            if (cardFound && card != null) {
                                cards.remove(card);
                            }
                            library.addAll(cards.getCards(game), game);
                            permanentController.shuffleLibrary(game);
                        }
                    }
                    return true;
                }
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);
                    card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                }
            } while (library.size() > 0 && card != null && card.getCardType().contains(CardType.LAND));

            if (!cards.isEmpty()) {
                player.revealCards("Treasure Hunt", cards, 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.