Package mage.players

Examples of mage.players.Player.searchLibrary()


    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            if (player.searchLibrary(target, game)) {
                if (target.getTargets().size() > 0) {
                    for (UUID cardId: target.getTargets()) {
                        Card card = player.getLibrary().remove(cardId, game);
                        if (card != null){
                            card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false);
View Full Code Here


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

        if (player.searchLibrary(target, game)) {
            for (UUID cardId : target.getTargets()) {
                Card card = player.getLibrary().getCard(cardId, game);
                if (card != null) {
                    if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId())) {
                        Permanent permanent = game.getPermanent(card.getId());
View Full Code Here


            cardsCount = cardsInLibrary.count(filter, game);
            if (cardsCount > 0) {
                TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
                if (player.searchLibrary(target, game)) {
                    for (UUID cardId: target.getTargets()) {
                        Card card = player.getLibrary().remove(cardId, game);
                        if (card != null){
                            card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                            game.informPlayers(sourceCard.getName()+": " + player.getName() + " chose " + card.getName() );
View Full Code Here

                        filter.add(Predicates.not(new NamePredicate(attachment.getName())));
                    }
                }

                TargetCardInLibrary targetCard = new TargetCardInLibrary(filter);
                if (player.searchLibrary(targetCard, game)) {
                    Card card = game.getCard(targetCard.getFirstTarget());
                    if (card != null) {
                        this.setTargetPointer(new FixedTarget(targetPlayer.getId()));
                        game.getState().setValue("attachTo:" + card.getId(), targetPlayer.getId());
                        player.shuffleLibrary(game);
View Full Code Here

        Player controller = game.getPlayer(source.getControllerId());
        if (controller == null) {
            return false;
        }
        boolean result = false;
        if (controller.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                for (UUID cardId: (List<UUID>)target.getTargets()) {
                    Card card = controller.getLibrary().remove(cardId, game);
                    if (card != null) {
                        controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
View Full Code Here

            // search cards in Library
            // If the player has no nonland cards in his or her hand, you can still search that player's library and have him or her shuffle it.
            if (chosenCard != null || controller.chooseUse(outcome, "Search library anyway?", game)) {
                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

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            TargetCardInLibrary target = new TargetCardInLibrary(new FilterArtifactCard());
            if (controller.searchLibrary(target, game)) {
                if (target.getTargets().size() > 0) {
                    Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
                    if (card != null) {
                        controller.moveCardToExileWithInfo(card, exileId, "Hoarding Dragon", 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) {
            TargetCardInLibrary target = new TargetCardInLibrary();
            if (player.searchLibrary(target, game)) {
                Card card = player.getLibrary().remove(target.getFirstTarget(), game);
                if (card != null) {
                    player.shuffleLibrary(game);
                    Card cardTop = null;
                    Card cardSecond = null;
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

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            TargetCardInLibrary target = new TargetCardInLibrary(new FilterCreatureCard("creature card in your library"));
            if (player.searchLibrary(target, game)) {
                Card card = player.getLibrary().remove(target.getFirstTarget(), game);
                if (card != null) {
                    Cards cards = new CardsImpl();
                    cards.add(card);
                    player.revealCards("Brutalizer Exarch", cards, 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.