Skip to content

Commit

Permalink
Issue april#62: Updating parsecards to account for changes in MTGJSON…
Browse files Browse the repository at this point in the history
… schema.

- Updating colour codes to WUBRG.
- Updating CMC key to "convertedManaCost".
  • Loading branch information
sten626 committed Nov 5, 2019
1 parent 5b6aee9 commit 7173d79
Showing 1 changed file with 8 additions and 8 deletions.
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

0 comments on commit 7173d79

Please sign in to comment.