Package mage.cards

Examples of mage.cards.Card


        return true;
    }

    @Override
    public boolean replaceEvent(GameEvent event, Ability source, Game game) {
        Card sourceCard = game.getCard(source.getSourceId());
        if (sourceCard == null) {
            return false;
        }
        Player player = game.getPlayer(source.getControllerId());
        if (player != null && player.getLibrary().size() >= amount
                && player.chooseUse(outcome, new StringBuilder("Dredge ").append(sourceCard.getName()).
                append("? (").append(amount).append(" cards go from top of library to graveyard)").toString(), game)) {
            game.informPlayers(new StringBuilder(player.getName()).append(" dreges ").append(sourceCard.getName()).toString());
            for (int i = 0; i < amount; i++) {
                Card card = player.getLibrary().removeFromTop(game);
                if (card != null) {
                    player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
                }
            }
            player.moveCardToHandWithInfo(sourceCard, source.getSourceId(), game, Zone.GRAVEYARD);
View Full Code Here


                default:
            }
            if (target != null && target.canChoose(player.getId(), game)) {
                if (target.choose(Outcome.Exile, player.getId(), source.getSourceId(), game)) {
                    for (UUID cardId : target.getTargets()) {
                        Card card = game.getCard(cardId);
                        if (card != null) {
                            card.moveToExile(exileId, exileName, source.getSourceId(), game);
                        }
                    }
                    return true;
                }
            }
View Full Code Here

                    Zone currentZone = game.getState().getZone(permanent.getId());
                    if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) {
                        controller.moveCardToExileWithInfo(permanent, exileId, exileZone, source.getSourceId(), game, currentZone);
                    }
                } else {
                    Card card = game.getCard(targetId);
                    if (card != null) {
                        Zone currentZone = game.getState().getZone(card.getId());
                        if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) {
                            controller.moveCardToExileWithInfo(card, exileId, exileZone, source.getSourceId(), game, currentZone);
                        }
                    }
                }
View Full Code Here

            p.removeCounters(counter.getName(), counter.getCount(), game);
            game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
                    .append(" counter from ").append(p.getName()).toString());
            return true;
        }
        Card c = game.getCard(source.getSourceId());
        if (c != null && c.getCounters().getCount(counter.getName()) >= counter.getCount()) {
            c.removeCounters(counter.getName(), counter.getCount(), game);
            game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
                    .append(" counter from ").append(c.getName())
                    .append(" (").append(c.getCounters().getCount(counter.getName())).append(" left)").toString());
            return true;
        }   
        return false;
    }
View Full Code Here

                }
                game.getStack().remove(stackObject);
                if (spell && !((Spell) stackObject).isCopiedSpell()) {
                    MageObject mageObject = game.getObject(stackObject.getSourceId());
                    if (mageObject instanceof Card) {
                        Card card = (Card) mageObject;
                        switch (targetZone) {
                            case HAND:
                                controller.moveCardToHandWithInfo(card, sourceId, game, Zone.STACK);
                                break;
                            case LIBRARY:
                                controller.moveCardToLibraryWithInfo(card, sourceId, game, Zone.STACK, flag, true);
                                break;
                            case EXILED:
                                controller.moveCardToExileWithInfo(card, null, "", sourceId, game, Zone.STACK);
                                break;
                            default:
                                card.moveToZone(targetZone, sourceId, game, flag);
                        }                       
                    } else {
                        return false;
                    }
                }
View Full Code Here

        }
       
        if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) {
            if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) {
                String logName;
                Card card = game.getCard(this.getId());
                if (card != null) {
                    logName = card.getLogName();
                } else {
                    logName = this.getLogName();
                }
                if (this.getCardType().contains(CardType.CREATURE)) {
                    game.informPlayers(logName +" died");
View Full Code Here

            int count = Math.min(scryNumber, player.getLibrary().size());
            if (count == 0) {
                return true;
            }
            for (int i = 0; i < count; i++) {
                Card card = player.getLibrary().removeFromTop(game);
                cards.add(card);
            }
            TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1);
            target1.setRequired(false);
            // move cards to the bottom of the library
            while (player.isInGame() && cards.size() > 0 && player.choose(Outcome.Detriment, cards, target1, game)) {
                Card card = cards.get(target1.getFirstTarget(), game);
                if (card != null) {
                    cards.remove(card);
                    player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, false, false);
                }
                target1.clearChosen();
View Full Code Here

        FilterCreatureCard filter = new FilterCreatureCard("Goblin creature card from your hand");
        filter.add(new SubtypePredicate("Goblin"));
        TargetCardInHand target = new TargetCardInHand(filter);
        if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
            Card card = game.getCard(target.getFirstTarget());
            if (card != null) {
                card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId());
                return true;
            }
        }
        return false;
    }
View Full Code Here

        return new SuspendExileEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Card card = game.getCard(source.getSourceId());
        Player controller = game.getPlayer(source.getControllerId());
        if (card != null && controller != null) {
            // check if the user really wants to suspend the card (only if the spell can't be casted because else the choose ability dialog appears)
            if (!card.getSpellAbility().canActivate(source.getControllerId(), game)) {
                if (!controller.chooseUse(outcome, new StringBuilder("Suspend ").append(card.getName()).append("?").toString(), game)) {
                    return false;
                }
            }
            UUID exileId = (UUID) game.getState().getValue("SuspendExileId" + source.getControllerId().toString());
            if (exileId == null) {
                exileId = UUID.randomUUID();
                game.getState().setValue("SuspendExileId" + source.getControllerId().toString(), exileId);
            }
            if (card.moveToExile(exileId, new StringBuilder("Suspended cards of ").append(controller.getName()).toString() , source.getSourceId(), game)) {
                if (suspend == Integer.MAX_VALUE) {
                    suspend = source.getManaCostsToPay().getX();
                }
                card.addCounters(CounterType.TIME.createInstance(suspend), game);
                game.informPlayers(new StringBuilder(controller.getName()).append(" suspends (").append(suspend).append(") ").append(card.getName()).toString());
                return true;
            }
        }
        return false;
    }
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.COUNTER_REMOVED && event.getTargetId().equals(getSourceId())) {
            Card card = game.getCard(getSourceId());
            if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED
                    && card.getCounters().getCount(CounterType.TIME) == 0) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of mage.cards.Card

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.