use of mage.cards.decks.Deck in project mage by magefree.
the class DeckUtil method construct.
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()));
}
}
return deck;
}
use of mage.cards.decks.Deck in project mage by magefree.
the class GameController method cheat.
public void cheat(UUID userId, UUID playerId, DeckCardLists deckList) {
try {
Deck deck = Deck.load(deckList, false, false);
game.loadCards(deck.getCards(), playerId);
for (Card card : deck.getCards()) {
card.putOntoBattlefield(game, Zone.OUTSIDE, null, playerId);
}
} catch (GameException ex) {
logger.warn(ex.getMessage());
}
addCardsForTesting(game, playerId);
updateGame();
}
Aggregations