Examples of searchLibrary()


Examples of mage.players.Player.searchLibrary()

            int newConvertedCost = sourcePermanent.getCounters().getCount("verse");
            FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, newConvertedCost));
            filter.add(new CardTypePredicate(CardType.CREATURE));
            TargetCardInLibrary target = new TargetCardInLibrary(filter);
            if (player.searchLibrary(target, game)) {
                for (UUID cardId : target.getTargets()) {
                    Card card = player.getLibrary().getCard(cardId, game);
                    if (card != null) {
                        player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
                    }
View Full Code Here

Examples of mage.players.Player.searchLibrary()

        Permanent permanent = (Permanent) game.getPermanentOrLKIBattlefield(source.getFirstTarget()); // if indestructible effect should work also
        if (permanent != null) {
            Player player = game.getPlayer(permanent.getControllerId());
            if (player.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", game)) {
                TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
                if (player.searchLibrary(target, game)) {
                    Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                    if (card != null)  {
                        player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
                    }
                }
View Full Code Here

Examples of mage.players.Player.searchLibrary()

                    amount++;
                }
            }
        }
        TargetCardInLibrary target = new TargetCardInLibrary(amount, new FilterLandCard("lands"));
        if (player.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                for (UUID cardId: (List<UUID>)target.getTargets()) {
                    Card card = player.getLibrary().getCard(cardId, game);
                    if (card != null) {
                        player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getControllerId(), true);
View Full Code Here

Examples of mage.players.Player.searchLibrary()

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
            if (player.searchLibrary(target, game)) {
                Cards cards = new CardsImpl();
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
                    cards.add(card);
                    if (MorbidCondition.getInstance().apply(game, source)
View Full Code Here

Examples of mage.players.Player.searchLibrary()

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getFirstTarget());
        if (player == null) {
            return false;
        }
        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){
View Full Code Here

Examples of mage.players.Player.searchLibrary()

        else
        {
            return true;
        }
        //If you do, search your library for an artifact card.
        if (sacrifice && controller.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                for (UUID cardId: target.getTargets()) {
                    Card card = controller.getLibrary().getCard(cardId, game);
                    if (card != null) {
                        //If that card's converted mana cost is less than or equal to the sacrificed artifact's converted mana cost, put it onto the battlefield.
View Full Code Here

Examples of mage.players.Player.searchLibrary()

    public boolean apply(Game game, Ability source) {
        Player opponent = game.getPlayer(source.getFirstTarget());
        Player player = game.getPlayer(source.getControllerId());
        if (player != null && opponent != null) {
            TargetCardInLibrary target = new TargetCardInLibrary(0, 3, new FilterCard("cards from opponents library to exile"));           
            if (player.searchLibrary(target, game, opponent.getId())) {
                List<UUID> targets = target.getTargets();
                for (UUID targetId : targets) {
                    Card card = opponent.getLibrary().remove(targetId, game);
                    if (card != null) {
                        player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY);
View Full Code Here

Examples of mage.players.Player.searchLibrary()

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

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

Examples of mage.players.Player.searchLibrary()

        int xValue = source.getManaCostsToPay().getX() + 1;
        FilterCard filter = new FilterCard("artifact card with converted mana cost " + xValue + " or less");
        filter.add(new CardTypePredicate(CardType.ARTIFACT));
        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

Examples of mage.players.Player.searchLibrary()

        Player opponent = game.getPlayer(source.getFirstTarget());
        Player player = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (player != null && opponent != null && sourcePermanent != null) {
            TargetCardInLibrary target = new TargetCardInLibrary();
            if (player.searchLibrary(target, game, opponent.getId())) {
                UUID targetId = target.getFirstTarget();
                Card card = opponent.getLibrary().remove(targetId, game);
                if (card != null) {
                    card.setFaceDown(true);
                    card.setControllerId(player.getId());
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.