Merge branch 'jdgordon-master'
This commit is contained in:
commit
72f925e9e2
6
card_db/en_us/card_groups.txt
Normal file
6
card_db/en_us/card_groups.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Tournament, Bag of Gold, Diadem, Followers, Princess, Trusty Steed, Tournament and Prizes
|
||||||
|
Shelters, Hovel, Overgrown Estate, Necropolis, Shelters
|
||||||
|
Page, Treasure Hunter, Warrior, Hero, Champion, Page -> Champion
|
||||||
|
Peasant, Soldier, Fugitive, Disciple, Teacher, Peasant -> Teacher
|
||||||
|
Hermit, Madman, Hermit / Madman
|
||||||
|
Urchin, Mercenary, Urchin / Mercenary
|
||||||
@ -739,7 +739,9 @@
|
|||||||
|
|
||||||
Each player may reveal a Province from his hand. If you do, discard it and gain
|
Each player may reveal a Province from his hand. If you do, discard it and gain
|
||||||
a Prize (from the Prize pile) or a Duchy, putting it on top of your deck. If no-one
|
a Prize (from the Prize pile) or a Duchy, putting it on top of your deck. If no-one
|
||||||
else does, +1 Card +1 Coin.'
|
else does, +1 Card +1 Coin.
|
||||||
|
|
||||||
|
Prizes: Bag of Gold, Diadem, Followers, Princess, Trusty Steed'
|
||||||
extra: First you get +1 Action. Then each player, including you, may reveal a Province
|
extra: First you get +1 Action. Then each player, including you, may reveal a Province
|
||||||
card from his hand. Then, if you revealed a Province, discard that card, and you
|
card from his hand. Then, if you revealed a Province, discard that card, and you
|
||||||
gain a Prize of your choice, or a Duchy, putting whatever card you took on top
|
gain a Prize of your choice, or a Duchy, putting whatever card you took on top
|
||||||
|
|||||||
@ -259,6 +259,8 @@ When another player plays an Attack card, you may set this aside from your hand.
|
|||||||
11 Remake Cornucopia Action $4 Do this twice: Trash a card from your hand then gain a card costing exactly 1 more than the trashed card.
|
11 Remake Cornucopia Action $4 Do this twice: Trash a card from your hand then gain a card costing exactly 1 more than the trashed card.
|
||||||
12 Tournament Cornucopia Action $4 +1 Action
|
12 Tournament Cornucopia Action $4 +1 Action
|
||||||
Each player may reveal a Province from his hand. If you do, discard it and gain a Prize (from the Prize pile) or a Duchy, putting it on top of your deck. If no-one else does, +1 Card +1 Coin.
|
Each player may reveal a Province from his hand. If you do, discard it and gain a Prize (from the Prize pile) or a Duchy, putting it on top of your deck. If no-one else does, +1 Card +1 Coin.
|
||||||
|
|
||||||
|
Prizes: Bag of Gold, Diadem, Followers, Princess, Trusty Steed
|
||||||
13 Young Witch Cornucopia Action - Attack $4 +2 Cards
|
13 Young Witch Cornucopia Action - Attack $4 +2 Cards
|
||||||
Discard 2 cards. Each other player may reveal a Bane card from his hand.
|
Discard 2 cards. Each other player may reveal a Bane card from his hand.
|
||||||
If he doesn’t, he gains a Curse.
|
If he doesn’t, he gains a Curse.
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#!python
|
#!python
|
||||||
|
import csv
|
||||||
import re
|
import re
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import os.path
|
import os.path
|
||||||
@ -50,6 +51,9 @@ class Card:
|
|||||||
def isEvent(self):
|
def isEvent(self):
|
||||||
return self.getType().getTypeNames() == ('Event',)
|
return self.getType().getTypeNames() == ('Event',)
|
||||||
|
|
||||||
|
def isPrize(self):
|
||||||
|
return 'Prize' in self.getType().getTypeNames()
|
||||||
|
|
||||||
def setImage(self):
|
def setImage(self):
|
||||||
setImage = DominionTabs.getSetImage(self.cardset, self.name)
|
setImage = DominionTabs.getSetImage(self.cardset, self.name)
|
||||||
if setImage is None and self.cardset not in ['base', 'extra'] and not self.isExpansion():
|
if setImage is None and self.cardset not in ['base', 'extra'] and not self.isExpansion():
|
||||||
@ -566,6 +570,15 @@ class DominionTabs:
|
|||||||
if not self.options.tabs_only:
|
if not self.options.tabs_only:
|
||||||
self.drawText(card, useExtra)
|
self.drawText(card, useExtra)
|
||||||
|
|
||||||
|
def read_card_groups(self, fname):
|
||||||
|
groups = {}
|
||||||
|
with open(fname, 'r') as f:
|
||||||
|
for row in csv.reader(f, delimiter=','):
|
||||||
|
groups[row[0].strip()] = {
|
||||||
|
"subcards":[x.strip() for x in row[1:-1]],
|
||||||
|
"text":row[-1].strip()}
|
||||||
|
return groups
|
||||||
|
|
||||||
def read_card_extras(self, fname, cards):
|
def read_card_extras(self, fname, cards):
|
||||||
f = open(fname)
|
f = open(fname)
|
||||||
cardName = re.compile("^:::(?P<name>[ \w\-/']*)", re.UNICODE)
|
cardName = re.compile("^:::(?P<name>[ \w\-/']*)", re.UNICODE)
|
||||||
@ -743,7 +756,7 @@ class DominionTabs:
|
|||||||
# remember whether we start with odd or even divider for tab
|
# remember whether we start with odd or even divider for tab
|
||||||
# location
|
# location
|
||||||
pageStartOdd = self.odd
|
pageStartOdd = self.odd
|
||||||
if not self.options.tabs_only and self.options.order != "global":
|
if not self.options.no_page_footer and (not self.options.tabs_only and self.options.order != "global"):
|
||||||
self.drawSetNames(pageCards)
|
self.drawSetNames(pageCards)
|
||||||
for i, card in enumerate(pageCards):
|
for i, card in enumerate(pageCards):
|
||||||
# print card
|
# print card
|
||||||
@ -756,10 +769,10 @@ class DominionTabs:
|
|||||||
self.canvas.showPage()
|
self.canvas.showPage()
|
||||||
if pageNum + 1 == self.options.num_pages:
|
if pageNum + 1 == self.options.num_pages:
|
||||||
break
|
break
|
||||||
if self.options.tabs_only:
|
if self.options.tabs_only or self.options.no_card_backs:
|
||||||
# no set names or card backs for label-only sheets
|
# no set names or card backs for label-only sheets
|
||||||
continue
|
continue
|
||||||
if self.options.order != "global":
|
if not self.options.no_page_footer and self.options.order != "global":
|
||||||
self.drawSetNames(pageCards)
|
self.drawSetNames(pageCards)
|
||||||
# start at same oddness
|
# start at same oddness
|
||||||
self.odd = pageStartOdd
|
self.odd = pageStartOdd
|
||||||
@ -849,6 +862,10 @@ class DominionTabs:
|
|||||||
help="include a few dividers with extra text")
|
help="include a few dividers with extra text")
|
||||||
parser.add_option("--exclude_events", action="store_true",
|
parser.add_option("--exclude_events", action="store_true",
|
||||||
default=False, help="exclude individual dividers for events")
|
default=False, help="exclude individual dividers for events")
|
||||||
|
parser.add_option("--exclude_card_groups", action="store_true",
|
||||||
|
default=False, help="exclude individual dividers for events")
|
||||||
|
parser.add_option("--exclude_prizes", action="store_true",
|
||||||
|
default=False, help="exclude individual dividers for prizes (cornucopia)")
|
||||||
parser.add_option("--cardlist", type="string", dest="cardlist", default=None,
|
parser.add_option("--cardlist", type="string", dest="cardlist", default=None,
|
||||||
help="Path to file that enumerates each card to be printed on its own line.")
|
help="Path to file that enumerates each card to be printed on its own line.")
|
||||||
parser.add_option("--no-tab-artwork", action="store_true", dest="no_tab_artwork",
|
parser.add_option("--no-tab-artwork", action="store_true", dest="no_tab_artwork",
|
||||||
@ -857,6 +874,10 @@ class DominionTabs:
|
|||||||
help="don't print the card's rules on the tab body")
|
help="don't print the card's rules on the tab body")
|
||||||
parser.add_option("--use-text-set-icon", action="store_true", dest="use_text_set_icon",
|
parser.add_option("--use-text-set-icon", action="store_true", dest="use_text_set_icon",
|
||||||
help="use text/letters to represent a card's set instead of the set icon")
|
help="use text/letters to represent a card's set instead of the set icon")
|
||||||
|
parser.add_option("--no-page-footer", action="store_true", dest="no_page_footer",
|
||||||
|
help="don't print the set name at the bottom of the page.")
|
||||||
|
parser.add_option("--no-card-backs", action="store_true", dest="no_card_backs",
|
||||||
|
help="don't print the back page of the card sheets.")
|
||||||
|
|
||||||
options, args = parser.parse_args(argstring)
|
options, args = parser.parse_args(argstring)
|
||||||
if not options.cost:
|
if not options.cost:
|
||||||
@ -1061,6 +1082,22 @@ class DominionTabs:
|
|||||||
else:
|
else:
|
||||||
cards = [card for card in cards if not isBaseExpansionCard(card)]
|
cards = [card for card in cards if not isBaseExpansionCard(card)]
|
||||||
|
|
||||||
|
if self.options.exclude_card_groups:
|
||||||
|
# Load the card groupos file
|
||||||
|
card_groups = self.read_card_groups(os.path.join(self.filedir, "card_db", options.language, "card_groups.txt"))
|
||||||
|
# pull out any cards which are a subcard, and rename the master card
|
||||||
|
new_cards = []
|
||||||
|
all_subcards = []
|
||||||
|
for subs in [card_groups[x]["subcards"] for x in card_groups]:
|
||||||
|
all_subcards += subs
|
||||||
|
for card in cards:
|
||||||
|
if card.name in card_groups.keys():
|
||||||
|
card.name = card_groups[card.name]["text"]
|
||||||
|
elif card.name in all_subcards:
|
||||||
|
continue
|
||||||
|
new_cards.append(card)
|
||||||
|
cards = new_cards
|
||||||
|
|
||||||
if self.options.expansions:
|
if self.options.expansions:
|
||||||
self.options.expansions = [o.lower()
|
self.options.expansions = [o.lower()
|
||||||
for o in self.options.expansions]
|
for o in self.options.expansions]
|
||||||
@ -1084,6 +1121,9 @@ class DominionTabs:
|
|||||||
if self.options.exclude_events:
|
if self.options.exclude_events:
|
||||||
cards = [card for card in cards if not card.isEvent() or card.name == 'Events']
|
cards = [card for card in cards if not card.isEvent() or card.name == 'Events']
|
||||||
|
|
||||||
|
if self.options.exclude_prizes:
|
||||||
|
cards = [card for card in cards if not card.isPrize()]
|
||||||
|
|
||||||
if self.cardlist:
|
if self.cardlist:
|
||||||
cards = [card for card in cards if card.name in self.cardlist]
|
cards = [card for card in cards if card.name in self.cardlist]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user