Package mage.cards

Examples of mage.cards.Card


    @Override
    public List<UUID> getTargets(Game game, Ability source) {
        // check target not changed zone
        if (this.zoneChangeCounter > 0) { // will be zero if not defined in init
            Card card = game.getCard(target);
            if (card != null && card.getZoneChangeCounter() != this.zoneChangeCounter) {
                return new ArrayList<>(); // return empty
            }
        }

        ArrayList<UUID> list = new ArrayList<>(1);
View Full Code Here


    @Override
    public UUID getFirst(Game game, Ability source) {
        // check target not changed zone
        if (this.zoneChangeCounter > 0) { // will be zero if not defined in init
            Card card = game.getCard(target);
            if (card != null && card.getZoneChangeCounter() != this.zoneChangeCounter) {
                return null;
            }
        }

        return target;
View Full Code Here

    public boolean apply(Game game, Ability source) {
        ExileZone zone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
        if (zone ==null || zone.isEmpty()) {
            return false;
        }
        Card card = zone.getCards(game).iterator().next();
        Player controller = game.getPlayer(source.getControllerId());
        if (card != null && controller != null) {
            if (card.getCardType().contains(CardType.LAND)) {
                // If the revealed card is a land, you can play it only if it's your turn and you haven't yet played a land this turn.
                if (game.getActivePlayerId().equals(source.getControllerId()) && controller.canPlayLand()) {
                    if (controller.chooseUse(Outcome.Benefit, new StringBuilder("Play ").append(card.getName()).append(" from Exile?").toString(), game)) {
                        card.setFaceDown(false);
                        return controller.playLand(card, game);
                    }
                } else {
                    game.informPlayer(controller, "You're not able to play the land now due to regular restrictions.");
                }
            } else {
                if (card.getSpellAbility() != null) {
                    // The land's last ability allows you to play the removed card as part of the resolution of that ability.
                    // Timing restrictions based on the card's type are ignored (for instance, if it's a creature or sorcery).
                    // Other play restrictions are not (such as "Play [this card] only during combat").
                    if (controller.chooseUse(Outcome.Benefit, new StringBuilder("Cast ").append(card.getName()).append(" without paying it's mana cost?").toString(), game)) {
                        card.setFaceDown(false);
                        return controller.cast(card.getSpellAbility(), game, true);
                    }
                } else {
                    Logger.getLogger(HideawayPlayEffect.class).error("Non land card had no spell ability: " + card.getName());
                    return false;
                }
            }
            return true;
        }
View Full Code Here

        this.kickerCostText = kickerCostText;
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            KickerAbility kickerAbility = null;
            for (Ability ability: card.getAbilities()) {
                if (ability instanceof KickerAbility) {
                    kickerAbility = (KickerAbility) ability;
                }
            }
            if (kickerAbility != null) {
View Full Code Here

    @Override
    public void init(Game game, Ability source) {
        if (source.getTargets().size() > 1) {
            for (UUID target : source.getTargets().get(1).getTargets()) {
                Card card = game.getCard(target);
                if (card != null) {
                    this.zoneChangeCounter.put(target, card.getZoneChangeCounter());
                }
            }
        }
    }
View Full Code Here

    @Override
    public List<UUID> getTargets(Game game, Ability source) {
        ArrayList<UUID> target = new ArrayList<UUID>();
        if (source.getTargets().size() > 1) {
            for (UUID targetId : source.getTargets().get(1).getTargets()) {
                Card card = game.getCard(targetId);
                if (card != null && zoneChangeCounter.containsKey(targetId)
                        && card.getZoneChangeCounter() != zoneChangeCounter.get(targetId)) {
                    continue;
                }
                target.add(targetId);
            }
        }
View Full Code Here

    @Override
    public UUID getFirst(Game game, Ability source) {
        if (source.getTargets().size() > 1) {
            UUID targetId = source.getTargets().get(1).getFirstTarget();
            if (zoneChangeCounter.containsKey(targetId)) {
                Card card = game.getCard(targetId);
                if (card != null && zoneChangeCounter.containsKey(targetId)
                            && card.getZoneChangeCounter() != zoneChangeCounter.get(targetId)) {
                    return null;
                }
            }
            return targetId;
        }
View Full Code Here

        super(effect);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            Player player = game.getPlayer(card.getOwnerId());
            if (player != null) {
                Zone fromZone = game.getState().getZone(card.getId());
                player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, fromZone, true, true);
                player.shuffleLibrary(game);
                return true;
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        // use target pointer here, so it's the same card that triggered the event (not gone back to library e.g.)
        Card card = game.getCard(getTargetPointer().getFirst(game, source));
        if (controller != null && card != null) {
            ManaCosts<ManaCost> costRef = card.getSpellAbility().getManaCostsToPay();
            // replace with the new cost
            costRef.clear();
            costRef.add(miracleCosts);
            controller.cast(card.getSpellAbility(), game, false);

            // Reset the casting costs (in case the player cancels cast and plays the card later)
            costRef.clear();
            for (ManaCost manaCost : card.getSpellAbility().getManaCosts()) {
                costRef.add(manaCost);
            }
            return true;
        }
        return false;
View Full Code Here

        return fInstance;
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            for (Ability ability: card.getAbilities()) {
                if (ability instanceof ProwlAbility) {
                    if(((ProwlAbility) ability).isActivated(source, game)) {
                        return true;
                    }
                }
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.