april / decklist

The code behind decklist.org, which generates DCI Registration Sheets.
https://decklist.org/
MIT License
45 stars 20 forks source link

Check against ban list #11

Open april opened 9 years ago

april commented 9 years ago

For Standard, Modern, or Legacy, verify cards against the ban list.

ChaimW commented 6 years ago

I'm probably going to work on this next.

Nightfirecat commented 6 years ago

For Standard, you may want to look into using http://whatsinstandard.com to help with set verification logic.

tooomm commented 6 years ago

Where do you get your card info from or how do you create it? @april

In case you use https://github.com/mtgjson/mtgjson as source for your minimized database, they might have data on banned cards for several tournament types, too.

All changes are posted to Banned and Restricted Announcement articles in the official News on magic.wiazrds.com on a monthly basis. Official up-to-date lists from wizards are always available and could be scraped from here: https://magic.wizards.com/en/game-info/gameplay/rules-and-formats/banned-restricted

ChaimW commented 6 years ago

a good portion of the necessary information is there, it is just not checked @tooomm

april commented 6 years ago

Yes, it's all pulled from mtgjson. Note that the site is designed to work completely offline, so it includes an entire copy of the card database in the JavaScript, for example:

"spikeshot elder":{c:"D",b:"s",m:1,t:"2",n:"Spikeshot Elder"}

Could probably add a ban key, such as:

b:"sm" (aka banned in Standard and Modern)

tooomm commented 6 years ago

You use b: already, but no idea what it stands for, haha. That file and it's values is a bit cryptic to be honest. Besides m for cmc and n for name I have no real clue. Also, why do you double the name information? Using mtgjson for legality info should be the easiest implementation then because you use it already.

If possible I suggest you get the information from wizards directly at one point, if one can parse that page properly...

I guess you use some kind of script to generate your database? Is that part of the repo?

Nightfirecat commented 6 years ago

generatecards.sh does the work of updating the cards definition file.

april commented 6 years ago

This is the comment in the code for what the keys mean:

# Just FYI!
# b (banned) = [sml] (standard, modern, legacy)
# c (color) = White = A, Blue = B, Black = C, Red = D, Green = E, Gold = F, Artifact = G , Split = S, Unknown = X, Land = Z
# m (CMC) = N  (Split = 98, Land = 99)
# n (actual name) = 'true name nemesis' to 'True Name Nemesis'
# t (type) = 1 = land, 2 = creature, 3 = instant or sorcery 4 = other
april commented 6 years ago

So I guess I already have the ban list in there, it's just not exposed obviously. :)

tooomm commented 6 years ago

Haha, I was about to link to that in parsecards.py @april :D Found it thanks to @Nightfirecat's link.

Yep, it looks like it's already included. Great!

ChaimW commented 6 years ago

Yeah, it's a partial ban list (no legacy yet, because of banned v. restricted), since my semester has nearly finished, I'll probably go back to working on that soon.

I've started working on that (locally)

ChaimW commented 6 years ago

I was thinking v for vintage banned, r for vintage restricted.

april commented 6 years ago

Legacy is already in there, there's only Vintage that isn't.

tooomm commented 6 years ago

Why are card names printed twice in the database?

Another thing to consider for the ban-feature: Until a event actually happen, there might be another ban list valid or our database (or mtgjson) has mistakes or delayed changes for example. There might be false alarms for different reasons. So the page can only give a warning instead an error, because we can never be sure. The ban check could be optional, and needs special explanation in any case! We can link to the official ban announcement from wizards for example. But at least players are aware of potential problems and can double check for themselves.

april commented 6 years ago

The key is what is likely to be entered into a decklist and the name is the canonical name that appears on the PDF.

tooomm commented 6 years ago

Are they any different? All entries I checked were identical... besides capitalization. Or is there another reason why you keep both?

Fryyyyy commented 6 years ago

Much like the multiple pages, I also do format legality checking in my fork - so feel free to copy that too if you like

ChaimW commented 6 years ago

@tooomm The idea is that the key used to locate the correct card is all lowercase, and the output is the properly capitalized form.

ChaimW commented 6 years ago

@Fryyyyy I'll probably do that when I get to this issue.