Added Event and Landmarks. (#62)

Added Event and Landmarks from Empires, and the Summon Event.
Fixed some problems with display of Debt in descriptions.
This commit is contained in:
robertre2 authored and Peter committed 2016-06-16 13:39:45 -07:00
1 parent 4219753e39
commit eb338c77d8
17 files changed
+405 -11

No files matched your search

+5
View File
@@ -112,6 +112,8 @@ def parse_opts(argstring):
help="include a few dividers with extra text")
parser.add_option("--exclude_events", action="store_true",
default=False, help="exclude individual dividers for events")
parser.add_option("--exclude_landmarks", action="store_true",
default=False, help="exclude individual dividers for landmarks")
parser.add_option("--special_card_groups", action="store_true",
default=False, help="group some cards under special dividers (e.g. Shelters, Prizes)")
parser.add_option("--exclude_prizes", action="store_true",
@@ -305,6 +307,9 @@ def filter_sort_cards(cards, options):
if options.exclude_events:
cards = [card for card in cards if not card.isEvent() or card.name == 'Events']
if options.exclude_landmarks:
cards = [card for card in cards if not card.isLandmark() or card.name == 'Landmarks']
if options.exclude_prizes:
cards = [card for card in cards if not card.isPrize()]
+10 -4
View File
@@ -19,7 +19,8 @@ setImages = {
'guilds': 'guilds_set.png',
'adventures': 'adventures_set.png',
'adventures extras': 'adventures_set.png',
'empires': 'empires_set.png'
'empires': 'empires_set.png',
'empires extras': 'empires_set.png'
}
promoImages = {
'walled village': 'walled_village_set.png',
@@ -27,7 +28,8 @@ promoImages = {
'governor': 'governor_set.png',
'black market': 'black_market_set.png',
'envoy': 'envoy_set.png',
'prince': 'prince_set.png'
'prince': 'prince_set.png',
'summon': 'summon_set.png'
}
setTextIcons = {
@@ -44,7 +46,8 @@ setTextIcons = {
'guilds': 'G',
'adventures': 'Ad',
'adventures extras': 'Ad',
'empires': 'E'
'empires': 'E',
'empires extras': 'E'
}
promoTextIcons = {
@@ -124,6 +127,9 @@ class Card(object):
def isEvent(self):
return self.getType().getTypeNames() == ('Event',)
def isLandmark(self):
return self.getType().getTypeNames() == ('Landmark',)
def isPrize(self):
return 'Prize' in self.getType().getTypeNames()
@@ -221,7 +227,7 @@ cardTypes = [
CardType(('Curse',), 'curse.png', 3),
CardType(('Expansion',), 'expansion.png', 4),
CardType(('Blank',), ''),
CardType(('Landmark',), '')
CardType(('Landmark',), 'landmark.png')
]
cardTypes = dict(((c.getTypeNames(), c) for c in cardTypes))
+18 -4
View File
@@ -88,7 +88,7 @@ class DividerDrawer(object):
path = os.path.join(self.options.data_path, 'images')
replace = '<img src='"'%s/coin_small_\\1.png'"' width=%d height='"'100%%'"' valign='"'middle'"'/>' % (
path, fontsize * 1.2)
text = re.sub('(\d)\s(c|C)oin(s)?', replace, text)
text = re.sub('(\d+)\s(c|C)oin(s)?', replace, text)
replace = '<img src='"'%s/coin_small_question.png'"' width=%d height='"'100%%'"' valign='"'middle'"'/>' % (
path, fontsize * 1.2)
text = re.sub('\?\s(c|C)oin(s)?', replace, text)
@@ -98,9 +98,15 @@ class DividerDrawer(object):
replace = '<img src='"'%s/victory_emblem.png'"' width=%d height='"'120%%'"' valign='"'middle'"'/>' % (
path, fontsize * 1.5)
text = re.sub('\<VP\>', replace, text)
replace = '<img src='"'%s/debt.png'"' width=%d height='"'105%%'"' valign='"'middle'"'/>' % (
replace = '<img src='"'%s/debt_\\1.png'"' width=%d height='"'105%%'"' valign='"'middle'"'/>&thinsp;' % (
path, fontsize * 1.2)
text = re.sub('(\d+)\sDebt', replace, text)
replace = '<img src='"'%s/debt.png'"' width=%d height='"'105%%'"' valign='"'middle'"'/>&thinsp;' % (
path, fontsize * 1.2)
text = re.sub('Debt', replace, text)
replace = '<img src='"'%s/potion_small.png'"' width=%d height='"'100%%'"' valign='"'middle'"'/>' % (
path, fontsize * 1.2)
text = re.sub('Potion', replace, text)
return text
def drawOutline(self, x, y, rightSide, isBack=False, isExpansionDivider=False):
@@ -183,8 +189,16 @@ class DividerDrawer(object):
self.canvas.drawImage(os.path.join(self.options.data_path, 'images', 'debt.png'),
x, coinHeight, 16, 16, preserveAspectRatio=True,
mask=[255, 255, 255, 255, 255, 255])
self.canvas.setFillColorRGB(1, 1, 1)
cost = str(card.debtcost)
if card.cost != "" and int(card.cost) > 0:
self.canvas.drawImage(os.path.join(self.options.data_path, 'images', 'coin_small.png'), x + 17,
coinHeight, 16, 16, preserveAspectRatio=True,
mask=[255, 255, 255, 255, 255, 255])
self.canvas.setFont(self.fontNameBold, 12)
self.canvas.drawCentredString(x + 8 + 17, costHeight, str(card.cost))
self.canvas.setFillColorRGB(0, 0, 0)
width += 16
self.canvas.setFillColorRGB(1, 1, 1)
else:
self.canvas.drawImage(os.path.join(self.options.data_path, 'images', 'coin_small.png'),
x, coinHeight, 16, 16, preserveAspectRatio=True, mask='auto')
@@ -245,7 +259,7 @@ class DividerDrawer(object):
preserveAspectRatio=False, anchor='n', mask='auto')
# draw cost
if not card.isExpansion() and not card.isBlank():
if not card.isExpansion() and not card.isBlank() and not card.isLandmark():
if 'tab' in self.options.cost:
textInset = 4
textInset += self.drawCost(card, textInset, textHeight,