Package mage.cards.repository

Examples of mage.cards.repository.CardInfo


        addCardsForTesting(game);
        updateGame();
    }

    public boolean cheat(UUID userId, UUID playerId, String cardName) {
        CardInfo cardInfo = CardRepository.instance.findCard(cardName);
        Card card = cardInfo != null ? cardInfo.getCard() : null;
        if (card != null) {
            Set<Card> cards = new HashSet<>();
            cards.add(card);
            game.loadCards(cards, playerId);
            card.moveToZone(Zone.HAND, null, game, false);
View Full Code Here


                    }

                    Random random = new Random();
                    Set<Card> cardsToLoad = new HashSet<Card>();
                    for (int i = 0; i < amount; i++) {
                        CardInfo cardInfo = cards.get(random.nextInt(cards.size()));
                        Card card = cardInfo != null ? cardInfo.getCard() : null;
                        if (card != null) {
                            cardsToLoad.add(card);
                        }
                    }
                    game.loadCards(cardsToLoad, player.getId());
View Full Code Here

                }
            }
        }                           
        if (toDelete.isEmpty()) {
            // add cards
            CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
            for (int i = cardsFound; i < numberToSet; i++) {
                cards.add(cardInfo.getMockCard());
            }                                    
        } else {
            // remove cards
            for (Card card: toDelete) {
                cards.remove(card);
View Full Code Here

        refreshDeck();
    }
   
    private void moveSelectorCardToDeck(Event event) {
        SimpleCardView cardView = (SimpleCardView) event.getSource();
        CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
        Card card = null;
        if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
            Iterator sideboard = deck.getSideboard().iterator();
            while (sideboard.hasNext()) {
                card = (Card) sideboard.next();
                if (card.getId().equals(cardView.getId())) {
                    break;
                }
            }
        } else {
            card = cardInfo != null ? cardInfo.getMockCard() : null;
        }
        if (card != null) {
            deck.getCards().add(card);
            if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
                deck.getSideboard().remove(card);
View Full Code Here

        }       
    }

    private void moveSelectorCardToSideboard(Event event) {
        SimpleCardView cardView = (SimpleCardView) event.getSource();
        CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
        Card card = cardInfo != null ? cardInfo.getMockCard() : null;
        if (card != null) {
            deck.getSideboard().add(card);
        }
        if (cardInfoPane instanceof CardInfoPane) {
            ((CardInfoPane) cardInfoPane).setCard(new CardView(card), null);
View Full Code Here

    public static CardsView convertSimple(SimpleCardsView view) {
        CardsView cards = new CardsView();

        for (SimpleCardView simple: view.values()) {
            CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
            Card card = cardInfo != null ? cardInfo.getMockCard() : null;
            if (card != null) {
                cards.put(simple.getId(), new CardView(card, simple.getId()));
            }
        }
View Full Code Here

        for (SimpleCardView simple: view.values()) {
            String key = simple.getExpansionSetCode() + "_" + simple.getCardNumber();
            Card card = loadedCards.get(key);
            if(card == null)
            {
                CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
                card = cardInfo != null ? cardInfo.getMockCard() : null;
                loadedCards.put(key, card);
            }
            if (card != null) {
                cards.put(simple.getId(), new CardView(card, simple.getId()));
            }
View Full Code Here

    }

    public static Deck construct(DeckView view) {
        Deck deck = new Deck();
        for (SimpleCardView cardView : view.getCards().values()) {
            CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
            Card card = cardInfo != null ? cardInfo.getMockCard() : null;
            if (card != null) {
                deck.getCards().add(card);
            } else {
                log.fatal("(Deck constructing) Couldn't find card: set=" + cardView.getExpansionSetCode() + ", cid=" + Integer.valueOf(cardView.getCardNumber()));
            }
        }
        for (SimpleCardView cardView : view.getSideboard().values()) {
            CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
            Card card = cardInfo != null ? cardInfo.getMockCard() : null;
            if (card != null) {
                deck.getSideboard().add(card);
            } else {
                log.fatal("(Deck constructing) Couldn't find card: set=" + cardView.getExpansionSetCode() + ", cid=" + Integer.valueOf(cardView.getCardNumber()));
            }
View Full Code Here

    @Override
    public void addCard(Zone gameZone, TestPlayer player, String cardName, int count, boolean tapped) {

        if (gameZone.equals(Zone.BATTLEFIELD)) {
            for (int i = 0; i < count; i++) {
                CardInfo cardInfo = CardRepository.instance.findCard(cardName);
                Card card = cardInfo != null ? cardInfo.getCard() : null;
                if (card == null) {
                    throw new IllegalArgumentException("[TEST] Couldn't find a card: " + cardName);
                }
                PermanentCard p = new PermanentCard(card, null);
                p.setTapped(tapped);
                getBattlefieldCards(player).add(p);
            }
        } else {
            if (tapped) {
                throw new IllegalArgumentException("Parameter tapped=true can be used only for Zone.BATTLEFIELD.");
            }
            List<Card> cards = getCardList(gameZone, player);
            for (int i = 0; i < count; i++) {
                CardInfo cardInfo = CardRepository.instance.findCard(cardName);
                Card card = cardInfo != null ? cardInfo.getCard() : null;
                if (card == null) {
                    throw new AssertionError("Couldn't find a card: " + cardName);
                }
                cards.add(card);
            }
View Full Code Here

                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);
View Full Code Here

TOP

Related Classes of mage.cards.repository.CardInfo

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.