Package mage.cards

Examples of mage.cards.CardsImpl


        paid = false;
        Player player = game.getPlayer(controllerId);
        if (player != null) {
            Card card = player.getHand().get(ability.getSourceId(), game);
            if (card != null) {
                Cards cards = new CardsImpl(card);
                paid = true;
                player.revealCards("Reveal card cost", cards, game);
            }
        }
        return paid;
View Full Code Here


    public PlayerImpl(String name, RangeOfInfluence range) {
        this(UUID.randomUUID());
        this.name = name;
        this.range = range;
        hand = new CardsImpl(Zone.HAND);
        graveyard = new CardsImpl(Zone.GRAVEYARD);
        abilities = new AbilitiesImpl<>();
        counters = new Counters();
        manaPool = new ManaPool(playerId);
        library = new Library(playerId);
        sideboard = new CardsImpl(Zone.OUTSIDE);
    }
View Full Code Here


    @Override
    public void revealFaceDownCard(Card card, Game game) {
        if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.REVEAL_FACE_DOWN, this.getId(), game)) {
            Cards cards = new CardsImpl(card);
            this.revealCards(name, cards, game);
        }
    }
View Full Code Here

                        }
                    }
                    for (Ability ability: card.getAbilities()) {
                        if (ability instanceof ChancellorAbility) {
                            if (player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getName() + "?", this)) {
                                Cards cards = new CardsImpl();
                                cards.add(card);
                                player.revealCards("Revealed", cards, this);
                                ability.resolve(this);
                            }
                        }
                        if (ability instanceof GemstoneCavernsAbility) {
                            if (!playerId.equals(startingPlayerId)) {
                                if (player.chooseUse(Outcome.PutCardInPlay, "Do you wish to put " + card.getName() + " into play?", this)) {
                                    Cards cards = new CardsImpl();
                                    cards.add(card);
                                    player.revealCards("Revealed", cards, this);
                                    ability.resolve(this);
                                }
                            }
                        }
View Full Code Here

            FilterCard filter = new FilterCard("card with converted mana cost " + sourceCard.getManaCost().convertedManaCost());
            filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, sourceCard.getManaCost().convertedManaCost()));
            TargetCardInLibrary target = new TargetCardInLibrary(1, filter);
            if (player.searchLibrary(target, game)) {
                if (target.getTargets().size() > 0) {
                    Cards revealed = new CardsImpl();
                    for (UUID cardId : target.getTargets()) {
                        Card card = player.getLibrary().remove(cardId, game);
                        if (card != null) {
                            player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                            revealed.add(card);
                        }
                    }
                    player.revealCards("Search", revealed, game);
                }
            }
View Full Code Here

    public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
        if (targets.choose(Outcome.Benefit, controllerId, sourceId, game)) {
            convertedManaCosts = 0;
            numberCardsRevealed = 0;
            Player player = game.getPlayer(controllerId);
            Cards cards = new CardsImpl();
            for (UUID targetId: targets.get(0).getTargets()) {
                Card card = player.getHand().get(targetId, game);
                if (card == null)
                    return false;
                convertedManaCosts += card.getManaCost().convertedManaCost();
                numberCardsRevealed++;
                cards.add(card);               
                paid = true;
            }
            player.revealCards("card cost", cards, game); // this is not a boolean
            return paid;
        }
View Full Code Here

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

        CardsImpl cards = new CardsImpl();
        int amount = Math.min(amountCards.calculate(game, source, this), player.getLibrary().size());
        for (int i = 0; i < amount; i++) {
            cards.add(player.getLibrary().removeFromTop(game));
        }
        player.revealCards(new StringBuilder("Put ").append(filter.getMessage()).append(" into hand").toString(), cards, game);

        Set<Card> cardsList = cards.getCards(game);
        for (Card card : cardsList) {
            if (filter.match(card, game)) {
                player.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                cards.remove(card);
            }
        }

        player.putCardsOnBottomOfLibrary(cards, game, source, anyOrder);
        return true;
View Full Code Here

        MageObject sourceObject = game.getObject(source.getSourceId());
        Player player = game.getPlayer(source.getControllerId());
        if (player == null || sourceObject == null) {
            return false;
        }
        Cards revealed = new CardsImpl();
        Card creatureCard = null;
        Cards nonCreatureCards = new CardsImpl();
        //The first player may reveal cards from the top of his or her library
        while (creatureCard == null && player.getLibrary().size() > 0) {
            Card card = player.getLibrary().removeFromTop(game);
            revealed.add(card);
            // until he or she reveals a creature card.
            if (card.getCardType().contains(CardType.CREATURE)) {
                creatureCard = card;
            } else {
                nonCreatureCards.add(card);
            }
        }
        player.revealCards(sourceObject.getName(), revealed, game);

        //If he or she does, that player puts that card onto the battlefield
View Full Code Here

        }

        // take cards from library and look at them
        boolean topCardRevealed = player.isTopCardRevealed();
        player.setTopCardRevealed(false);
        Cards cards = new CardsImpl();
        int count = Math.min(player.getLibrary().size(), this.numberOfCards.calculate(game, source, this));
        for (int i = 0; i < count; i++) {
            Card card = player.getLibrary().removeFromTop(game);
            if (card != null) {
                cards.add(card);
                this.cardLooked(card, game, source);
            }
        }
        player.lookAtCards(windowName, cards, game);
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player you = game.getPlayer(source.getControllerId());
        if (you == null) {
            return false;
        }
        Cards cards = new CardsImpl();
        int max = Math.min(you.getLibrary().size(), 10);
        for (int i = 0; i < max; i++) {
            Card card = you.getLibrary().removeFromTop(game);
            if (card != null) {
                card.moveToExile(source.getSourceId(), "Chandra Pyromaster", source.getSourceId(), game);
                cards.add(card);
            }
        }

        if (cards.getCards(new FilterInstantOrSorceryCard(), game).size() > 0) {
            TargetCard target = new TargetCard(Zone.EXILED, new FilterInstantOrSorceryCard());
            if (you.chooseTarget(Outcome.PlayForFree, cards, target, source, game)) {
                Card card = cards.get(target.getFirstTarget(), game);
                if (card != null) {
                    Card copy1 = card.copy();
                    Card copy2 = card.copy();
                    Card copy3 = card.copy();
                    if (copy1 != null && you.chooseUse(outcome, "Do you wish to cast copy 1 of " + card.getName(), game)) {
View Full Code Here

TOP

Related Classes of mage.cards.CardsImpl

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.