Created
July 23, 2018 19:26
-
-
Save lincolnthree/a456e62dd83f2b3912d32bfac5f53865 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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