Package mage.Constants

Examples of mage.Constants.Zone


    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null && !player.getGraveyard().isEmpty()) {
            Card card = player.getGraveyard().getRandom(game);
            if (card != null) {
                Zone targetZone = Zone.HAND;
                String text = " put into hand of ";
                if (card.getCardType().contains(CardType.CREATURE)) {
                    targetZone = Zone.BATTLEFIELD;
                    text = " put onto battlefield for ";
                }
View Full Code Here


                    pile2CardsIds.add(card.getId());
                }
            }
            boolean choice = opponent.choosePile(Outcome.Detriment, new StringBuilder("Choose a pile to put into ").append(player.getName()).append("'s hand.").toString(), pile1, pile2, game);

            Zone pile1Zone = Zone.GRAVEYARD;
            Zone pile2Zone = Zone.HAND;
            if (choice) {
                pile1Zone = Zone.HAND;
                pile2Zone = Zone.GRAVEYARD;
            }

            StringBuilder sb = new StringBuilder("Steam Augury: Pile 1, going to ").append(pile1Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (": ");
            int i = 0;
            for (UUID cardUuid : pile1CardsIds) {
                i++;
                Card card = game.getCard(cardUuid);
                if (card != null) {
                    sb.append(card.getName());
                    if (i < pile1CardsIds.size()) {
                        sb.append(", ");
                    }
                    card.moveToZone(pile1Zone, source.getSourceId(), game, false);
                }
            }
            game.informPlayers(sb.toString());

            sb = new StringBuilder("Steam Augury: Pile 2, going to ").append(pile2Zone.equals(Zone.HAND)?"Hand":"Graveyard").append (":");
            i = 0;
            for (UUID cardUuid : pile2CardsIds) {
                Card card = game.getCard(cardUuid);
                if (card != null) {
                    i++;
View Full Code Here

    @Override
    public boolean applies(GameEvent event, Ability source, Game game) {
        if (event.getType() == GameEvent.EventType.CAST_SPELL) {
            Card card = game.getCard(event.getSourceId());
            if (card != null) {
                Zone zone = game.getState().getZone(card.getId());
                if (zone != null && (zone == Zone.GRAVEYARD || zone == Zone.LIBRARY)) {
                    return true;
                }
            }
        }
View Full Code Here

                }
            }
            sb.delete(sb.length() - 2, sb.length());
            choice.getChoices().add(sb.toString());

            Zone pile1Zone = Zone.GRAVEYARD;
            Zone pile2Zone = Zone.HAND;
            if (player.choose(Outcome.Neutral, choice, game)) {
                if (choice.getChoice().startsWith("Pile 1")) {
                    pile1Zone = Zone.HAND;
                    pile2Zone = Zone.GRAVEYARD;
                }
View Full Code Here

    public boolean applies(GameEvent event, Ability source, Game game) {
        if (event.getType() == GameEvent.EventType.TARGET) {
            Card targetCard = game.getCard(event.getTargetId());
            StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
            if (targetCard != null && stackObject != null) {
                Zone zone = game.getState().getZone(targetCard.getId());
                if (zone != null && (zone == Zone.GRAVEYARD)) {
                    return true;
                }
            }
        }
View Full Code Here

            Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
            if (permanent != null && sourcePermanent != null) {
                controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getName(), source.getSourceId(), game, Zone.BATTLEFIELD);
                Card card = game.getCard(targetPointer.getFirst(game, source));
                if (card != null) {
                    Zone currentZone = game.getState().getZone(card.getId());
                    return controller.putOntoBattlefieldWithInfo(card, game, currentZone, source.getSourceId());
                }
            }
        }
        return false;
View Full Code Here

            String nickname = m.group(2);

            if (nickname.startsWith("Computer")) {
                List<Card> cards = null;
                List<PermanentCard> perms = null;
                Zone gameZone;
                if ("hand".equalsIgnoreCase(zone)) {
                    gameZone = Zone.HAND;
                    cards = getHandCards(getPlayer(nickname));
                } else if ("battlefield".equalsIgnoreCase(zone)) {
                    gameZone = Zone.BATTLEFIELD;
                    perms = getBattlefieldCards(getPlayer(nickname));
                } else if ("graveyard".equalsIgnoreCase(zone)) {
                    gameZone = Zone.GRAVEYARD;
                    cards = getGraveCards(getPlayer(nickname));
                } else if ("library".equalsIgnoreCase(zone)) {
                    gameZone = Zone.LIBRARY;
                    cards = getLibraryCards(getPlayer(nickname));
                } else if ("player".equalsIgnoreCase(zone)) {
                    String command = m.group(3);
                    if ("life".equals(command)) {
                        getCommands(getPlayer(nickname)).put(Zone.OUTSIDE, "life:" + m.group(4));
                    }
                    return;
                } else {
                    return; // go parse next line
                }

                String cardName = m.group(3);
                Integer amount = Integer.parseInt(m.group(4));
                boolean tapped = m.group(5) != null && m.group(5).equals(":{tapped}");

                if (cardName.equals("clear")) {
                    getCommands(getPlayer(nickname)).put(gameZone, "clear");
                } else {
                    for (int i = 0; i < amount; i++) {
                        CardInfo cardInfo = CardRepository.instance.findCard(cardName);
                        Card card = cardInfo != null ? cardInfo.getCard() : null;
                        if (card != null) {
                            if (gameZone.equals(Zone.BATTLEFIELD)) {
                                PermanentCard p = new PermanentCard(card, null);
                                p.setTapped(tapped);
                                perms.add(p);
                            } else {
                                cards.add(card);
View Full Code Here

            String nickname = m.group(2);

            if (nickname.equals("ComputerA") || nickname.equals("ComputerB")) {
                List<Card> cards = null;
                List<PermanentCard> perms = null;
                Zone gameZone;
                if ("hand".equalsIgnoreCase(zone)) {
                    gameZone = Zone.HAND;
                    cards = nickname.equals("ComputerA") ? handCardsA : handCardsB;
                } else if ("battlefield".equalsIgnoreCase(zone)) {
                    gameZone = Zone.BATTLEFIELD;
                    perms = nickname.equals("ComputerA") ? battlefieldCardsA : battlefieldCardsB;
                } else if ("graveyard".equalsIgnoreCase(zone)) {
                    gameZone = Zone.GRAVEYARD;
                    cards = nickname.equals("ComputerA") ? graveyardCardsA : graveyardCardsB;
                } else if ("library".equalsIgnoreCase(zone)) {
                    gameZone = Zone.LIBRARY;
                    cards = nickname.equals("ComputerA") ? libraryCardsA : libraryCardsB;
                } else if ("player".equalsIgnoreCase(zone)) {
                    String command = m.group(3);
                    if ("life".equals(command)) {
                        if (nickname.equals("ComputerA")) {
                            commandsA.put(Zone.OUTSIDE, "life:" + m.group(4));
                        } else {
                            commandsB.put(Zone.OUTSIDE, "life:" + m.group(4));
                        }
                    }
                    return;
                } else {
                    return; // go parse next line
                }

                String cardName = m.group(3);
                Integer amount = Integer.parseInt(m.group(4));
                boolean tapped = m.group(5) != null && m.group(5).equals(":{tapped}");

                if (cardName.equals("clear")) {
                    if (nickname.equals("ComputerA")) {
                        commandsA.put(gameZone, "clear");
                    } else {
                        commandsB.put(gameZone, "clear");
                    }
                } else {
                    for (int i = 0; i < amount; i++) {
                        CardInfo cardInfo = CardRepository.instance.findCard(cardName);
                        Card card = cardInfo != null ? cardInfo.getCard() : null;
                        if (card != null) {
                            if (gameZone.equals(Zone.BATTLEFIELD)) {
                                PermanentCard p = new PermanentCard(card, null);
                                p.setTapped(tapped);
                                perms.add(p);
                            } else {
                                cards.add(card);
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.