changed subsorting
changed html to sort colors by type
This commit is contained in:
parent
18eec4d0da
commit
dce65a7332
1 changed files with 20 additions and 1 deletions
21
decode.py
21
decode.py
|
@ -92,7 +92,7 @@ def main(fname, oname = None, verbose = True, encoding = 'std',
|
||||||
segments = sort_colors(cards)
|
segments = sort_colors(cards)
|
||||||
for i in range(len(segments)):
|
for i in range(len(segments)):
|
||||||
# sort color by CMC
|
# sort color by CMC
|
||||||
segments[i] = sort_cmc(segments[i])
|
segments[i] = sort_type(segments[i])
|
||||||
# this allows card boxes to be colored for each color
|
# this allows card boxes to be colored for each color
|
||||||
# for coloring of each box seperately cardlib.Card.format() must change non-minimaly
|
# for coloring of each box seperately cardlib.Card.format() must change non-minimaly
|
||||||
writer.write('<div id="' + utils.segment_ids[i] + '">')
|
writer.write('<div id="' + utils.segment_ids[i] + '">')
|
||||||
|
@ -201,6 +201,25 @@ def main(fname, oname = None, verbose = True, encoding = 'std',
|
||||||
colorless_cards += [card]
|
colorless_cards += [card]
|
||||||
return[white_cards, blue_cards, black_cards, red_cards, green_cards, multi_cards, colorless_cards, lands]
|
return[white_cards, blue_cards, black_cards, red_cards, green_cards, multi_cards, colorless_cards, lands]
|
||||||
|
|
||||||
|
def sort_type(card_set):
|
||||||
|
sorting = ["creature", "enchantment", "instant", "sorcery", "artifact", "planeswalker"]
|
||||||
|
sorted_cards = [[],[],[],[],[],[],[]]
|
||||||
|
sorted_set = []
|
||||||
|
for card in card_set:
|
||||||
|
types = card.get_types()
|
||||||
|
for i in range(len(sorting)):
|
||||||
|
if sorting[i] in types:
|
||||||
|
sorted_cards[i] += [card]
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
sorted_cards[6] += [card]
|
||||||
|
for value in sorted_cards:
|
||||||
|
for card in value:
|
||||||
|
sorted_set += [card]
|
||||||
|
return sorted_set
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def sort_cmc(card_set):
|
def sort_cmc(card_set):
|
||||||
sorted_cards = []
|
sorted_cards = []
|
||||||
sorted_set = []
|
sorted_set = []
|
||||||
|
|
Loading…
Reference in a new issue