add base_cards_with_expansion option

This commit is contained in:
Paul Molodowitch 2013-12-29 09:11:22 -08:00
parent 2814a8b71d
commit 5d0b09d793
2 changed files with 52 additions and 10 deletions

View File

@ -23,6 +23,14 @@
23 Mine Dominion Action $5 Trash a Treasure card from your hand. Gain a Treasure card costing up to 3 Coins more; put it into your hand. 23 Mine Dominion Action $5 Trash a Treasure card from your hand. Gain a Treasure card costing up to 3 Coins more; put it into your hand.
24 Witch Dominion Action - Attack $5 +2 Cards, Each other player gains a Curse card. 24 Witch Dominion Action - Attack $5 +2 Cards, Each other player gains a Curse card.
25 Adventurer Dominion Action $6 Reveal cards from your deck until you reveal 2 Treasure cards. Put those Treasure cards in your hand and discard the other revealed cards. 25 Adventurer Dominion Action $6 Reveal cards from your deck until you reveal 2 Treasure cards. Put those Treasure cards in your hand and discard the other revealed cards.
26 Copper Dominion Treasure $0 Worth 1 Coin.
27 Silver Dominion Treasure $3 Worth 2 Coins.
28 Gold Dominion Treasure $6 Worth 3 Coins.
29 Curse Dominion Curse $0 -1 <VP>
30 Estate Dominion Victory $2 1 <VP>
31 Duchy Dominion Victory $5 3 <VP>
32 Province Dominion Victory $8 6 <VP>
33 Trash Dominion Action $0 Pile of trash.
1 Courtyard Intrigue Action $2 +3 Card, Put a card from your hand on top of your deck. 1 Courtyard Intrigue Action $2 +3 Card, Put a card from your hand on top of your deck.
2 Pawn Intrigue Action $2 Choose two: +1 Card, +1 Action, +1 Buy, +1 Coin. (The choices must be different.). 2 Pawn Intrigue Action $2 Choose two: +1 Card, +1 Action, +1 Buy, +1 Coin. (The choices must be different.).
@ -50,6 +58,14 @@
24 Harem Intrigue Treasure - Victory $6 Worth 2 Coins, 2 <VP> 24 Harem Intrigue Treasure - Victory $6 Worth 2 Coins, 2 <VP>
25 Nobles Intrigue Action - Victory $6 2 <VP> 25 Nobles Intrigue Action - Victory $6 2 <VP>
Choose one: +3 Cards, or +2 Actions. Choose one: +3 Cards, or +2 Actions.
26 Copper Intrigue Treasure $0 Worth 1 Coin.
27 Silver Intrigue Treasure $3 Worth 2 Coins.
28 Gold Intrigue Treasure $6 Worth 3 Coins.
29 Curse Intrigue Curse $0 -1 <VP>
30 Estate Intrigue Victory $2 1 <VP>
31 Duchy Intrigue Victory $5 3 <VP>
32 Province Intrigue Victory $8 6 <VP>
33 Trash Intrigue Action $0 Pile of trash.
1 Embargo Seaside Action $2 +2 Coins, Trash this card. Put an Embargo token on top of a Supply pile. - When a player buys a card, he gains a Curse card per Embargo token on that pile. 1 Embargo Seaside Action $2 +2 Coins, Trash this card. Put an Embargo token on top of a Supply pile. - When a player buys a card, he gains a Curse card per Embargo token on that pile.
2 Haven Seaside Action - Duration $2 +1 Card, +1 Action, Set aside a card from your hand face down. At the start of your next turn, put it into your hand. 2 Haven Seaside Action - Duration $2 +1 Card, +1 Action, Set aside a card from your hand face down. At the start of your next turn, put it into your hand.
@ -194,14 +210,14 @@ At the start of Clean-up, if you have this and no more than one other Action car
Choose one; you get the version in parentheses: Each player gets +1 (+3) Cards; or each player gains a Silver (Gold); or each player may trash a card from his hand and gain a card costing exactly 1 Coin (2 Coins) more. Choose one; you get the version in parentheses: Each player gets +1 (+3) Cards; or each player gains a Silver (Gold); or each player may trash a card from his hand and gain a card costing exactly 1 Coin (2 Coins) more.
1 Copper Base Treasure $0 Worth 1 Coin. 1 Copper Base Treasure $0 Worth 1 Coin.
2 Curse Base Curse $0 -1 <VP> 2 Silver Base Treasure $3 Worth 2 Coins.
3 Estate Base Victory $2 1 <VP> 3 Gold Base Treasure $6 Worth 3 Coins.
4 Silver Base Treasure $3 Worth 2 Coins. 4 Platinum Base Treasure $9 Worth 5 Coins.
5 Duchy Base Victory $5 3 <VP> 5 Potion Base Treasure $4 Worth 1 Potion.
6 Gold Base Treasure $6 Worth 3 Coins. 6 Curse Base Curse $0 -1 <VP>
7 Province Base Victory $8 6 <VP> 7 Estate Base Victory $2 1 <VP>
8 Potion Base Treasure $4 Worth 1 Potion. 8 Duchy Base Victory $5 3 <VP>
9 Platinum Base Treasure $9 Worth 5 Coins. 9 Province Base Victory $8 6 <VP>
10 Colony Base Victory $11 10 <VP> 10 Colony Base Victory $11 10 <VP>
11 Trash Base Action $0 Pile of trash. 11 Trash Base Action $0 Pile of trash.

View File

@ -645,6 +645,10 @@ class DominionTabs:
help="sort order for the cards, whether by expansion or globally alphabetical") help="sort order for the cards, whether by expansion or globally alphabetical")
parser.add_option("--expansion_dividers", action="store_true", dest="expansion_dividers", parser.add_option("--expansion_dividers", action="store_true", dest="expansion_dividers",
help="add dividers describing each expansion set") help="add dividers describing each expansion set")
parser.add_option("--base_cards_with_expansion", action="store_true",
help='print the base cards as part of the expansion; ie, a divider for "Silver"'
'will be printed as both a "Dominion" card and as an "Intrigue" card; if this'
'option is not given, all base cards are placed in their own "Base" expansion')
options, args = parser.parse_args(argstring) options, args = parser.parse_args(argstring)
if not options.cost: if not options.cost:
@ -787,6 +791,15 @@ class DominionTabs:
cards = self.read_card_defs(os.path.join(self.filedir,"dominion_cards.txt")) cards = self.read_card_defs(os.path.join(self.filedir,"dominion_cards.txt"))
self.read_card_extras(os.path.join(self.filedir,"dominion_card_extras.txt"),cards) self.read_card_extras(os.path.join(self.filedir,"dominion_card_extras.txt"),cards)
baseCards = [card.name for card in cards if card.cardset.lower() == 'base']
def isBaseExpansionCard(card):
return card.cardset.lower() != base and card.name in baseCards
if self.options.base_cards_with_expansion:
cards = [card for card in cards if card.cardset.lower() != 'base']
else:
cards = [card for card in cards if not isBaseExpansionCard(card)]
if self.options.expansions: if self.options.expansions:
self.options.expansions = [o.lower() for o in self.options.expansions] self.options.expansions = [o.lower() for o in self.options.expansions]
filteredCards = [] filteredCards = []
@ -805,6 +818,8 @@ class DominionTabs:
if options.expansion_dividers: if options.expansion_dividers:
cardnamesByExpansion = {} cardnamesByExpansion = {}
for c in cards: for c in cards:
if isBaseExpansionCard(c):
continue
cardnamesByExpansion.setdefault(c.cardset,[]).append(c.name.strip()) cardnamesByExpansion.setdefault(c.cardset,[]).append(c.name.strip())
for exp,names in cardnamesByExpansion.iteritems(): for exp,names in cardnamesByExpansion.iteritems():
c = Card(exp, exp, ("Expansion",), None, ' | '.join(sorted(names))) c = Card(exp, exp, ("Expansion",), None, ' | '.join(sorted(names)))
@ -815,10 +830,21 @@ class DominionTabs:
out = yaml.dump(cards) out = yaml.dump(cards)
open('cards.yaml','w').write(out) open('cards.yaml','w').write(out)
# When sorting cards, want to always put "base" cards after all
# kingdom cards, and order the base cards in a set order - the
# order they are listed in the database (ie, all normal treasures
# by worth, then potion, then all normal VP cards by worth, then
# trash)
def baseIndex(name):
try:
return baseCards.index(name)
except Exception:
return -1
if options.order == "global": if options.order == "global":
sortKey = lambda x: x.name sortKey = lambda x: (int(x.isExpansion()), baseIndex(x.name),x.name)
else: else:
sortKey = lambda x: (x.cardset,x.name) sortKey = lambda x: (x.cardset,int(x.isExpansion()),baseIndex(x.name),x.name)
cards.sort(key=sortKey) cards.sort(key=sortKey)
if not f: if not f: