Package mage.players

Examples of mage.players.Player.searchLibrary()


        }
        FilterPermanentCard filter = new FilterPermanentCard("permanent card with converted mana cost X or less");
        //Set the mana cost one higher to 'emulate' a less than or equal to comparison.
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
        TargetCardInLibrary target = new TargetCardInLibrary(filter);
        if (controller.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
                    controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
                }
View Full Code Here


                    target = new TargetCardInLibrary(2, new FilterCard());
                }
                else {
                    target = new TargetCardInLibrary();
                }
                if (player.searchLibrary(target, game)) {
                    if (target.getTargets().size() > 0) {
                        for (UUID cardId: (List<UUID>)target.getTargets()) {
                            Card card = player.getLibrary().remove(cardId, game);
                            if (card != null) {
                                card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
View Full Code Here

                    }
                }
               
                // search cards in Library
                TargetCardInLibrary targetCardsLibrary = new TargetCardInLibrary(0, Integer.MAX_VALUE, filterNamedCards);
                controller.searchLibrary(targetCardsLibrary, game, targetPlayer.getId());
                for(UUID cardId:  targetCardsLibrary.getTargets()) {
                    Card card = game.getCard(cardId);
                    if (card != null) {
                        controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY);
                    }
View Full Code Here

                if (player.chooseUse(Outcome.PutCreatureInPlay, sb.toString(), game)) {
                    FilterCreatureCard filter = new FilterCreatureCard("creature card named" + creatureName);
                    filter.add(new NamePredicate(creatureName));
                    TargetCardInLibrary target = new TargetCardInLibrary(filter);

                    if (player.searchLibrary(target, game)) {
                        Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                        if (card != null) {
                            chosenCards.add(card);
                        }
                    }
View Full Code Here

        FilterArtifactCard filter = new FilterArtifactCard(new StringBuilder("artifact card with converted mana cost ").append(cmc).append(" or less").toString());
        filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, cmc + 1));
        TargetCardInLibrary target = new TargetCardInLibrary(filter);

        if (player.searchLibrary(target, game)) {
            Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
            if (card != null) {
                player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
            }
            player.shuffleLibrary(game);
View Full Code Here

        if (player == null) {
            return false;
        }

        TargetCardInLibrary target = new TargetCardInLibrary();
        if (player.searchLibrary(target, game)) {
            Card card = player.getLibrary().remove(target.getFirstTarget(), game);
            if (card != null) {
                card.moveToZone(Zone.EXILED, source.getSourceId(), game, false);
                player.shuffleLibrary(game);
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
        Player player = game.getPlayer(source.getControllerId());
        if (player.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Cards revealed = new CardsImpl();
                for (UUID cardId: target.getTargets()) {
                    Card card = player.getLibrary().getCard(cardId, game);
                    revealed.add(card);
View Full Code Here

        filter.add(new ColorPredicate(ObjectColor.GREEN));
        filter.add(new CardTypePredicate(CardType.CREATURE));
       
        filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue));
        TargetCardInLibrary target = new TargetCardInLibrary(filter);
        if (player.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
                    player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
                }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        if (you != null) {
            if (you.searchLibrary(target, game)) {
                UUID exileZone = CardUtil.getCardExileZoneId(game, source);
                if (target.getTargets().size() > 0) {
                    for (UUID cardId : target.getTargets()) {
                        Card card = you.getLibrary().getCard(cardId, game);
                        if (card != null) {
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            TargetCardInLibrary target = new TargetCardInLibrary(filter);
            target.setNotTarget(true);
            controller.searchLibrary(target, game);
            Card targetCard = game.getCard(target.getFirstTarget());
            if (targetCard != null) {
                controller.putOntoBattlefieldWithInfo(targetCard, game, Zone.LIBRARY, source.getSourceId());
            }
            controller.shuffleLibrary(game);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.