Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lincolnthree/a456e62dd83f2b3912d32bfac5f53865 to your computer and use it in GitHub Desktop.
Save lincolnthree/a456e62dd83f2b3912d32bfac5f53865 to your computer and use it in GitHub Desktop.
zone_rules.push({
handles: ANY_SINGLETON,
validate: (zone) => {
if (def.countZone(zone) > 0) {
let commanderColorIdentity = {};
for (let card of zone) {
if (card.colorIdentity) {
for (let color of card.colorIdentity) {
commanderColorIdentity[color] = true;
}
}
}
if (deck.main) {
CARD: for (let card of deck.main) {
if (card.colorIdentity) {
for (let color of card.colorIdentity) {
if (!commanderColorIdentity[color]) {
violations.push({ card: card.name, message: def.ERR_COLOR_IDENTITY_SINGLETON, zone: "main" });
continue CARD;
}
}
}
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment