Package mage.cards

Examples of mage.cards.Cards


        }

        // 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

        // check if player wants to use splice

        if (spliceAbilities.size() > 0) {
            Player controller = game.getPlayer(abilityToModify.getControllerId());
            if (controller.chooseUse(Outcome.Benefit, "Splice a card?", game)) {
                Cards cardsToReveal = new CardsImpl();
                do {
                    FilterCard filter = new FilterCard("a card to splice");
                    ArrayList<Predicate<MageObject>> idPredicates = new ArrayList<>();
                    for (SpliceOntoArcaneAbility ability : spliceAbilities) {
                        idPredicates.add(new CardIdPredicate((ability.getSourceId())));
                    }
                    filter.add(Predicates.or(idPredicates));
                    TargetCardInHand target = new TargetCardInHand(filter);
                    controller.chooseTarget(Outcome.Benefit, target, abilityToModify, game);
                    UUID cardId = target.getFirstTarget();
                    if (cardId != null) {
                        SpliceOntoArcaneAbility selectedAbility = null;
                        for(SpliceOntoArcaneAbility ability :spliceAbilities) {
                            if (ability.getSourceId().equals(cardId)) {
                                selectedAbility = ability;
                                break;
                            }
                        }
                        if (selectedAbility != null) {
                            SpliceCardEffect spliceEffect = (SpliceCardEffect) selectedAbility.getEffects().get(0);
                            spliceEffect.apply(game, selectedAbility, abilityToModify);
                            cardsToReveal.add(game.getCard(cardId));
                            spliceAbilities.remove(selectedAbility);
                        }
                    }
                } while (!spliceAbilities.isEmpty() && controller.chooseUse(Outcome.Benefit, "Splice another card?", game));
                controller.revealCards("Spliced cards", cardsToReveal, game);
View Full Code Here

    }

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        Cards cards = new CardsImpl(Zone.PICK);
        int count = Math.min(player.getLibrary().size(), 4);
        for (int i = 0; i < count; i++) {
            Card card = player.getLibrary().removeFromTop(game);
            cards.add(card);
            game.setZone(card.getId(), Zone.PICK);
        }

        Permanent hideawaySource = game.getPermanent(source.getSourceId());
        if (cards.size() == 0 || hideawaySource == null) {
            return false;
        }

        TargetCard target1 = new TargetCard(Zone.PICK, filter1);
        if (player.choose(Outcome.Detriment, cards, target1, game)) {
            Card card = cards.get(target1.getFirstTarget(), game);
            if (card != null) {
                cards.remove(card);
                card.setFaceDown(true);
                card.moveToExile(CardUtil.getCardExileZoneId(game, source),
                        new StringBuilder("Hideaway (").append(hideawaySource.getName()).append(")").toString(),
                        source.getSourceId(), game);
            }
            target1.clearChosen();
        }

        if (cards.size() > 0) {
            TargetCard target2 = new TargetCard(Zone.PICK, filter2);
            while (player.isInGame() && cards.size() > 1) {
                player.choose(Outcome.Benefit, cards, target2, game);
                Card card = cards.get(target2.getFirstTarget(), game);
                if (card != null) {
                    cards.remove(card);
                    card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
                }
                target2.clearChosen();
            }
            Card card = cards.get(cards.iterator().next(), game);
            card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
        }

        return true;
    }
View Full Code Here

        Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
        if (controller != null && sourcePermanent != null) {
            if (controller.getLibrary().size() > 0) {
                Card card = controller.getLibrary().getFromTop(game);
                if (card != null) {
                    Cards cards = new CardsImpl(card);
                    controller.lookAtCards(sourcePermanent.getLogName(), cards, game);
                    if (CardUtil.shareSubtypes(sourcePermanent, card)) {
                        if (controller.chooseUse(outcome,new StringBuilder("Kinship - Reveal ").append(card.getLogName()).append("?").toString(), game)) {
                            controller.revealCards(sourcePermanent.getLogName(), cards, game);
                            for (Effect effect: kinshipEffects) {
View Full Code Here

            return false;
       
        if (player.getLibrary().size() >= 3 && player.searchLibrary(target, game)) {
           
            if (target.getTargets().size() == 3) {
                Cards cards = new CardsImpl();
                for (UUID cardId: (List<UUID>)target.getTargets()) {
                    Card card = player.getLibrary().getCard(cardId, game);
                    if (card != null) {
                        cards.add(card);
                    }
                }
                player.revealCards("Reveal", cards, game);
               
                TargetCard targetCard = new TargetCard(Zone.PICK, new FilterCard());
               
                while(!opponent.choose(Outcome.Neutral, cards, targetCard, game));
                Card card = cards.get(targetCard.getFirstTarget(), game);
                if (card != null) {
                    cards.remove(card);
                    card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                }
               
                for(UUID uuid : cards){
                    card = cards.get(uuid, game);
                    card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false);
                }
               
            }
            player.shuffleLibrary(game);
View Full Code Here

        Player you = game.getPlayer(source.getControllerId());
        MageObject sourceObject = game.getObject(source.getSourceId());
        String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
        if (sourceObject != null && you != null && cardName != null && !cardName.isEmpty()) {
            if (you.getHand().size() > 0) {
                Cards revealed = new CardsImpl();
                Card card = you.getHand().getRandom(game);
                revealed.add(card);
                you.revealCards(sourceObject.getLogName(), revealed, game);
                if (card.getName().equals(cardName)) {
                    Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
                    if (creature != null) {
                        creature.damage(2, source.getSourceId(), game, false, true);
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());

        if (player != null) {
            Cards cards = new CardsImpl(Zone.PICK);
            int cardsCount = Math.min(3, player.getLibrary().size());
            for (int i = 0; i < cardsCount; i++) {
                Card card = player.getLibrary().removeFromTop(game);
                if (card != null) {
                    cards.add(card);
                    game.setZone(card.getId(), Zone.PICK);
                }
            }

            if (cards.size() > 0) {
                player.lookAtCards("Glimpse the Future", cards, game);

                TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put in your hand"));
                if (player.choose(Outcome.Benefit, cards, target, game)) {
                    Card card = cards.get(target.getFirstTarget(), game);
                    if (card != null) {
                        card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
                        cards.remove(card);
                    }
                }

                for (Card card : cards.getCards(game)) {
                    card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
                }
            }
            return true;
        }
View Full Code Here

            return false;
        }
        //Search your library for three creature cards
        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){
                        cards.add(card);
                    }
                }
                //Reveal them
                player.revealCards("Reveal", cards, game);
                Card cardsArray[] = cards.getCards(game).toArray(new Card[0]);
                //If you reveal three cards with different names
                if(cardsArray.length == 3 && !cardsArray[0].getName().equals(cardsArray[1]) && !cardsArray[0].getName().equals(cardsArray[2]) && !cardsArray[1].getName().equals(cardsArray[2])){
                    //Choose one of them at random and put that card into your hand
                    Card randomCard = cards.getRandom(game);
                    randomCard.moveToZone(Zone.HAND, source.getSourceId(), game, true);
                    cards.remove(randomCard);
                }
                //Shuffle the rest into your library
                for(Card card : cards.getCards(game)){
                    card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
                }
            }
            player.shuffleLibrary(game);
            return true;
View Full Code Here

    private Permanent chooseOnePermanent(Game game, Player player, List<Permanent> permanents) {
        Permanent permanent = null;
        if (permanents.size() == 1) {
            permanent = permanents.iterator().next();
        } else if (permanents.size() > 1) {
            Cards cards = new CardsImpl();
            for (Permanent card : permanents) {
                cards.add(card);
            }

            TargetCard targetCard = new TargetCard(Zone.BATTLEFIELD, new FilterCard());
            if (player.choose(Outcome.Benefit, cards, targetCard, game)) {
                permanent = game.getPermanent(targetCard.getFirstTarget());
View Full Code Here

TOP

Related Classes of mage.cards.Cards

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.