Search in sources :

Example 1 with ExpansionInfo

use of mage.cards.repository.ExpansionInfo in project mage by magefree.

the class MageServerImpl method getMissingExpansionData.

@Override
public List<ExpansionInfo> getMissingExpansionData(List<String> codes) {
    List<ExpansionInfo> result = new ArrayList<>();
    for (ExpansionInfo expansionInfo : ExpansionRepository.instance.getAll()) {
        if (!codes.contains(expansionInfo.getCode())) {
            result.add(expansionInfo);
        }
    }
    logger.info("Missing exp downloaded: " + result.size());
    return result;
}
Also used : ExpansionInfo(mage.cards.repository.ExpansionInfo)

Example 2 with ExpansionInfo

use of mage.cards.repository.ExpansionInfo in project mage by magefree.

the class TestGameType method createFaceDownCard.

private CardView createFaceDownCard(Game game, UUID controllerId, String code, String cardNumber, boolean isMorphed, boolean isManifested, boolean tapped) {
    CardInfo cardInfo = CardRepository.instance.findCard(code, cardNumber);
    ExpansionInfo setInfo = ExpansionRepository.instance.getSetByCode(code);
    CardSetInfo testSet = new CardSetInfo(cardInfo.getName(), setInfo.getCode(), cardNumber, cardInfo.getRarity(), new CardGraphicInfo(cardInfo.getFrameStyle(), cardInfo.usesVariousArt()));
    Card newCard = CardImpl.createCard(cardInfo.getClassName(), testSet);
    Set<Card> cardsList = new HashSet<>();
    cardsList.add(newCard);
    game.loadCards(cardsList, controllerId);
    Card permCard = CardUtil.getDefaultCardSideForBattlefield(game, newCard);
    PermanentCard perm = new PermanentCard(permCard, controllerId, game);
    perm.setFaceDown(true, game);
    perm.setMorphed(isMorphed);
    perm.setManifested(isManifested);
    perm.removeSummoningSickness();
    perm.setTapped(tapped);
    if (perm.isTransformable()) {
        perm.setTransformed(true);
    }
    PermanentView cardView = new PermanentView(perm, permCard, controllerId, game);
    // must false for face down
    cardView.setInViewerOnly(false);
    return cardView;
}
Also used : CardInfo(mage.cards.repository.CardInfo) ExpansionInfo(mage.cards.repository.ExpansionInfo) BigCard(mage.client.cards.BigCard) PermanentCard(mage.game.permanent.PermanentCard) PermanentCard(mage.game.permanent.PermanentCard)

Example 3 with ExpansionInfo

use of mage.cards.repository.ExpansionInfo in project mage by magefree.

the class TestGameType method createPermanentCard.

private PermanentView createPermanentCard(Game game, UUID controllerId, String code, String cardNumber, int power, int toughness, int damage, boolean tapped, boolean transform, List<Ability> extraAbilities) {
    CardInfo cardInfo = CardRepository.instance.findCard(code, cardNumber);
    ExpansionInfo setInfo = ExpansionRepository.instance.getSetByCode(code);
    CardSetInfo testSet = new CardSetInfo(cardInfo.getName(), setInfo.getCode(), cardNumber, cardInfo.getRarity(), new CardGraphicInfo(cardInfo.getFrameStyle(), cardInfo.usesVariousArt()));
    Card newCard = CardImpl.createCard(cardInfo.getClassName(), testSet);
    Set<Card> cardsList = new HashSet<>();
    cardsList.add(newCard);
    game.loadCards(cardsList, controllerId);
    Card permCard = CardUtil.getDefaultCardSideForBattlefield(game, newCard);
    if (extraAbilities != null) {
        extraAbilities.forEach(ability -> permCard.addAbility(ability));
    }
    PermanentCard perm = new PermanentCard(permCard, controllerId, game);
    if (transform) {
        // need direct transform call to keep other side info (original)
        TransformAbility.transformPermanent(perm, permCard.getSecondCardFace(), game, null);
    }
    if (damage > 0)
        perm.damage(damage, controllerId, null, game);
    if (power > 0)
        perm.getPower().setValue(power);
    if (toughness > 0)
        perm.getToughness().setValue(toughness);
    perm.removeSummoningSickness();
    perm.setTapped(tapped);
    PermanentView cardView = new PermanentView(perm, permCard, controllerId, game);
    return cardView;
}
Also used : CardInfo(mage.cards.repository.CardInfo) ExpansionInfo(mage.cards.repository.ExpansionInfo) BigCard(mage.client.cards.BigCard) PermanentCard(mage.game.permanent.PermanentCard) PermanentCard(mage.game.permanent.PermanentCard)

Example 4 with ExpansionInfo

use of mage.cards.repository.ExpansionInfo in project mage by magefree.

the class RandomPacksSelectorDialog method createCheckboxes.

private void createCheckboxes() {
    if (!boxesCreated) {
        ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate();
        for (ExpansionInfo exp : allExpansions) {
            JCheckBox pack = new JCheckBox();
            pack.setSelected(true);
            pack.setText(exp.getCode());
            pack.setToolTipText(exp.getName());
            pnlPacks.add(pack);
        }
        pnlPacks.setVisible(true);
        this.pack();
        boxesCreated = true;
        pnlPacks.validate();
    }
}
Also used : JCheckBox(javax.swing.JCheckBox) ExpansionInfo(mage.cards.repository.ExpansionInfo)

Example 5 with ExpansionInfo

use of mage.cards.repository.ExpansionInfo in project mage by magefree.

the class NewTournamentDialog method loadBoosterPacks.

private void loadBoosterPacks(String packString) {
    if (!packString.isEmpty()) {
        String[] packsArray = packString.substring(1, packString.length() - 1).split(",");
        int packNumber = 0;
        for (String pack : packsArray) {
            packNumber++;
            if (!packPanels.isEmpty() && this.packPanels.size() >= packNumber - 1) {
                JPanel panel = packPanels.get(packNumber - 1);
                JComboBox comboBox = findComboInComponent(panel);
                if (comboBox != null) {
                    ComboBoxModel model = comboBox.getModel();
                    int size = model.getSize();
                    for (int i = 0; i < size; i++) {
                        ExpansionInfo element = (ExpansionInfo) model.getElementAt(i);
                        if (element.getCode().equals(pack.trim())) {
                            comboBox.setSelectedIndex(i);
                            break;
                        }
                    }
                } else {
                    logger.error("Can't find combo component in " + panel.toString());
                }
            }
        }
    }
}
Also used : ExpansionInfo(mage.cards.repository.ExpansionInfo)

Aggregations

ExpansionInfo (mage.cards.repository.ExpansionInfo)8 CardInfo (mage.cards.repository.CardInfo)3 BigCard (mage.client.cards.BigCard)3 PermanentCard (mage.game.permanent.PermanentCard)3 IOException (java.io.IOException)1 JCheckBox (javax.swing.JCheckBox)1 Deck (mage.cards.decks.Deck)1 TournamentPlayerPanel (mage.client.table.TournamentPlayerPanel)1 IgnoreList (mage.client.util.IgnoreList)1 SetType (mage.constants.SetType)1 GameException (mage.game.GameException)1 DraftOptions (mage.game.draft.DraftOptions)1 LimitedOptions (mage.game.tournament.LimitedOptions)1 TournamentOptions (mage.game.tournament.TournamentOptions)1 TournamentTypeView (mage.view.TournamentTypeView)1