Usage:
npm i --save mtg-deck-checker
const Deck = require('mtg-deck-checker');
Update your cardData.json with Deck.updateCardData()
var decklist
assumes cockatrice deck editor format, but many other formats are supported incidentally.
var yourDeck = new Deck.Deck(decklist, format);
Deck constructor will automatically run yourDeck.check()
console.log(yourDeck.isLegal, yourDeck.errors);
You can see you deck hash with yourDeck.hash
if you want to keep the same obj but update the deck or format
yourDeck.check(decklist, format);
You can add cards to your deck, then check if it is still legal
yourDeck.addCard(card, 1);
yourDeck.check();
Access mainboard/sideboard directly with yourDeck.main, yourDeck.side
TODO:
- add checks for commander to make sure all cards are within commanders color identity