Package mage.cards

Examples of mage.cards.CardsImpl


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


        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

            cards = targetPlayer.getLibrary().getTopCards(game, maxCards);
        }
        Collections.sort(cards, new CardNameComparator());
        while (!isChosen() && !doneChosing()) {
            chosen = targets.size() >= minNumberOfTargets;
            if (!player.choose(outcome, new CardsImpl(Zone.LIBRARY, cards), this, game)) {
                return chosen;
            }
            chosen = targets.size() >= minNumberOfTargets;
        }
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

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getFirstTarget());
        if (player != null && player.getLibrary().size() > 0) {
            Card card = player.getLibrary().getFromTop(game);
            Cards cards = new CardsImpl();
            cards.add(card);
            player.revealCards("Cerebral Eruption", cards, game);
            game.getState().setValue(source.getSourceId().toString(), card);
            int damage = card.getManaCost().convertedManaCost();
            player.damage(damage, source.getSourceId(), game, false, true);
            for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)) {
View Full Code Here

            if (player == null) {
                return false;
            }
            if (player.getLibrary().size() > 0) {
                Card card = player.getLibrary().getFromTop(game);
                Cards cards = new CardsImpl();
                cards.add(card);
                player.revealCards("Baneful Omen", cards, game);

                if (card != null) {
                    int loseLife = card.getManaCost().convertedManaCost();
                    Set<UUID> opponents = game.getOpponents(source.getControllerId());
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.