Package mage.constants

Examples of mage.constants.Zone


    @Override
    public boolean apply(Game game, Ability source) {
        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            Zone currentZone = game.getState().getZone(card.getId());
            if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), card.getOwnerId(),tapped)) {
                return true;
            }
        }
        return false;
View Full Code Here


        Card sourceCard = game.getCard(source.getSourceId());
        MageObject sourceObject = game.getObject(source.getSourceId());
        if (sourceCard != null) {
            Player player = game.getPlayer(sourceCard.getOwnerId());
            if (player != null) {
                Zone fromZone = game.getState().getZone(sourceCard.getId());
                Cards cards = new CardsImpl();
                cards.add(sourceCard);
                player.revealCards(sourceObject.getLogName(), cards, game);
                player.moveCardToLibraryWithInfo(sourceCard, source.getSourceId(), game, fromZone, true, true);
                player.shuffleLibrary(game);
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Card card = game.getCard(source.getSourceId());
        if (card != null) {
            Zone currentZone = game.getState().getZone(card.getId());
            if (card.putOntoBattlefield(game, currentZone, source.getSourceId(), source.getControllerId())) {
                return true;
            }
        }
        return false;
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Card card = game.getCard(targetPointer.getFirst(game, source));
            if (card != null) {
                Zone currentZone = game.getState().getZone(card.getId());
                if (controller.putOntoBattlefieldWithInfo(card, game, currentZone, source.getSourceId())) {
                    return true;
                }
            }
View Full Code Here

                } else {
                    boolean usable = ability.isInUseableZone(game, permanent, false);
                    log.error(uuid+"        instanceof StaticAbility: " + (ability instanceof StaticAbility) + ", ability=" + ability);
                    log.error(uuid+"        usable zone: " + usable + ", ability=" + ability);
                    if (!usable) {
                        Zone zone = ability.getZone();
                        log.error(uuid+"        zone: " + zone);
                        MageObject object = game.getObject(ability.getSourceId());
                        log.error(uuid+"        object: " + object);
                        if (object != null) {
                            log.error(uuid + "        contains ability: " + object.getAbilities().contains(ability));
                        }
                        Zone test = game.getState().getZone(ability.getSourceId());
                        log.error(uuid+"        test_zone: " + test);
                    }
                }
            }
        }
View Full Code Here

        return this.moveToZone(toZone, sourceId, game, flag, null);
    }

    @Override
    public boolean moveToZone(Zone toZone, UUID sourceId, Game game, boolean flag, ArrayList<UUID> appliedEffects) {
        Zone fromZone = game.getState().getZone(objectId);
        ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, ownerId, fromZone, toZone, appliedEffects);
        if (!game.replaceEvent(event)) {
            if (event.getFromZone() != null) {
                switch (event.getFromZone()) {
                    case GRAVEYARD:
View Full Code Here

        return moveToExile(exileId, name, sourceId, game, null);
    }

    @Override
    public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
        Zone fromZone = game.getState().getZone(objectId);
        ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, ownerId, fromZone, Zone.EXILED, appliedEffects);
        if (!game.replaceEvent(event)) {
            if (fromZone != null) {
                switch (fromZone) {
                    case GRAVEYARD:
View Full Code Here

    @Override
    public boolean isInUseableZone(Game game, MageObject source, boolean checkLKI) {
        // check it was previously on battlefield
        MageObject before = game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD);
        // check now it is in graveyard
        Zone after = game.getState().getZone(sourceId);
        return before != null && after != null && Zone.GRAVEYARD.match(after);
    }
View Full Code Here

            if (!anyOrder) {
                for (UUID cardId : cards) {
                    Card card =game.getCard(cardId);
                   
                    if (card != null) {
                        Zone fromZone = game.getState().getZone(cardId);
                        this.moveCardToLibraryWithInfo(card, source.getSourceId(), game, fromZone, false, false);
                    }
                }
            } else {
                TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the bottom of your library (last one chosen will be bottommost)"));
                target.setRequired(true);
                while (isInGame() && cards.size() > 1) {
                    this.choose(Outcome.Neutral, cards, target, game);
                    Card chosenCard = cards.get(target.getFirstTarget(), game);
                    if (chosenCard != null) {
                        cards.remove(chosenCard);
                        Zone fromZone = game.getState().getZone(chosenCard.getId());
                        this.moveCardToLibraryWithInfo(chosenCard, source.getSourceId(), game, fromZone, false, false);
                    }
                    target.clearChosen();
                }
                if (cards.size() == 1) {
                    Card chosenCard = cards.get(cards.iterator().next(), game);
                    Zone fromZone = game.getState().getZone(chosenCard.getId());
                    this.moveCardToLibraryWithInfo(chosenCard, source.getSourceId(), game, fromZone, false, false);
                }
            }
        }
        return true;
View Full Code Here

            if (!anyOrder) {
                for (UUID cardId : cards) {
                    Card card =game.getCard(cardId);

                    if (card != null) {
                        Zone fromZone = game.getState().getZone(cardId);
                        this.moveCardToLibraryWithInfo(card, source.getSourceId(), game, fromZone, true, false);
                    }
                }
            } else {
                TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of your library (last one chosen will be topmost)"));
                target.setRequired(true);
                while (isInGame() && cards.size() > 1) {
                    this.choose(Outcome.Neutral, cards, target, game);
                    Card chosenCard = cards.get(target.getFirstTarget(), game);
                    if (chosenCard != null) {
                        cards.remove(chosenCard);
                        Zone fromZone = game.getState().getZone(chosenCard.getId());
                        this.moveCardToLibraryWithInfo(chosenCard, source.getSourceId(), game, fromZone, true, false);
                    }
                    target.clearChosen();
                }
                if (cards.size() == 1) {
                    Card chosenCard = cards.get(cards.iterator().next(), game);
                    Zone fromZone = game.getState().getZone(chosenCard.getId());
                    this.moveCardToLibraryWithInfo(chosenCard, source.getSourceId(), game, fromZone, true, false);
                }
            }
        }
        return true;
View Full Code Here

TOP

Related Classes of mage.constants.Zone

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.