Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting by colour and CMC broken #65

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/cards/decklist-cards-min.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions js/cards/parsecards.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def getLegalities(card, cards):

# Make the colors shorter
if ('colors' not in cards[card]): pass
elif len(cards[card]['colors']) > 1: ocards[ocard]['c'] = 'F' # gold
elif cards[card]['colors'] == ['White']: ocards[ocard]['c'] = 'A'
elif cards[card]['colors'] == ['Blue']: ocards[ocard]['c'] = 'B'
elif cards[card]['colors'] == ['Black']: ocards[ocard]['c'] = 'C'
elif cards[card]['colors'] == ['Red']: ocards[ocard]['c'] = 'D'
elif cards[card]['colors'] == ['Green']: ocards[ocard]['c'] = 'E'
elif len(cards[card]['colors']) > 1: ocards[ocard]['c'] = 'F' # gold
elif cards[card]['colors'] == ['W']: ocards[ocard]['c'] = 'A'
elif cards[card]['colors'] == ['U']: ocards[ocard]['c'] = 'B'
elif cards[card]['colors'] == ['B']: ocards[ocard]['c'] = 'C'
elif cards[card]['colors'] == ['R']: ocards[ocard]['c'] = 'D'
elif cards[card]['colors'] == ['G']: ocards[ocard]['c'] = 'E'

if 'Land' in cards[card]['types']: ocards[ocard]['t'] = '1'
elif 'Creature' in cards[card]['types']: ocards[ocard]['t'] = '2'
Expand All @@ -72,8 +72,8 @@ def getLegalities(card, cards):
else: ocards[ocard]['t'] = '4'

# Now try to deal with CMC
if 'cmc' not in cards[card]: ocards[ocard]['m'] = 99
else: ocards[ocard]['m'] = cards[card]['cmc']
if 'convertedManaCost' not in cards[card]: ocards[ocard]['m'] = 99
else: ocards[ocard]['m'] = cards[card]['convertedManaCost']

# Add it into the file if the banned list isn't empty
legality = getLegalities(card, cards)
Expand Down