Package mage.players

Examples of mage.players.Player.searchLibrary()


            }
            for(UUID playerId : controller.getInRange()) {
                Player player = game.getPlayer(playerId);
                if (player != null) {
                    TargetCardInLibrary target = new TargetCardInLibrary(0, xSum, new FilterBasicLandCard());
                    if (player.searchLibrary(target, game)) {
                        for (UUID cardId : target.getTargets()) {
                            Card card = player.getLibrary().getCard(cardId, game);
                            if (card != null) {
                                card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId(), true);
                            }
View Full Code Here


        Player opponent = game.getPlayer(source.getFirstTarget());
        Player player = game.getPlayer(source.getControllerId());
        if (player != null && opponent != null) {
            if (opponent.getLibrary().size() > 0) {
                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) {
                        player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY);
                        int cmc = card.getManaCost().convertedManaCost();
View Full Code Here

        filter.add(new CardTypePredicate(CardType.CREATURE));
        //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 (player.searchLibrary(target, game)) {
            if (target.getTargets().size() > 0) {
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                Cards cards = new CardsImpl();
                if (card != null){
                    card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
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: (List<UUID>)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 controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard());
            if (controller.searchLibrary(target, game)) {
                for (UUID cardId: target.getTargets()) {
                    Card card = game.getCard(cardId);
                    if (card != null) {
                        card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), controller.getId());
                    }
View Full Code Here

                Player opponent = game.getPlayer(playerId);
                if (opponent != null) {
                    if (opponent.chooseUse(outcome, "Search your library for a land card and put it onto the battlefield?", game)) {
                        target.clearChosen();
                        opponentsUsedSearch++;
                        if (opponent.searchLibrary(target, game)) {
                            for (UUID cardId: target.getTargets()) {
                                Card card = game.getCard(cardId);
                                if (card != null) {
                                    card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), opponent.getId());
                                }
View Full Code Here

            FilterNonlandCard filter = new FilterNonlandCard("nonland card with converted mana cost X = " + cmc);
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, cmc));
            TargetCardInLibrary target = new TargetCardInLibrary(filter);

            if (player.searchLibrary(target, game)) {
                Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
                if (card != null) {
                    card.moveToZone(Zone.HAND, source.getSourceId(), game, false);   
                   
                    String name = "Reveal";
View Full Code Here

        if (controller != null && permanent != null) {
            Player player = game.getPlayer(permanent.getControllerId());
            if (controller.moveCardToExileWithInfo(permanent, null, "",  source.getSourceId(), game, Zone.BATTLEFIELD)) {
                if (player.chooseUse(Outcome.PutCardInPlay, "Search your library for a basic land card?", 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(), true);
                        }
                    }
View Full Code Here

            filter.add(new SubtypePredicate("Aura"));
            filter.add(new AuraCardCanAttachToPermanentId(attackingCreature.getId()));
            if (you.chooseUse(Outcome.Benefit, "Do you want to search your library?", game)) {
                TargetCardInLibrary target = new TargetCardInLibrary(filter);
                target.setNotTarget(true);
                if (you.searchLibrary(target, game)) {
                    if (target.getFirstTarget() != null) {
                        Card aura = game.getCard(target.getFirstTarget());
                        game.getState().setValue("attachTo:" + aura.getId(), attackingCreature);
                        aura.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), you.getId());
                        return attackingCreature.addAttachment(aura.getId(), game);
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(0, 2, new FilterCreatureCard("creature cards"));
            if (player.searchLibrary(target, game)) {
                if (target.getTargets().size() > 0) {
                    Cards revealed = new CardsImpl();
                    for (UUID cardId: (List<UUID>)target.getTargets()) {
                        Card card = player.getLibrary().getCard(cardId, game);
                        revealed.add(card);
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.