Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cornucopia and Guilds 2nd Edition #517

Merged
merged 4 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
270 changes: 239 additions & 31 deletions card_db_src/cards_db.json

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions card_db_src/en_us/cards_en_us.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions card_db_src/en_us/types_en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"Projects": "Projects",
"Reaction": "Reaction",
"Reserve": "Reserve",
"Reward": "Reward",
"Rewards": "Rewards",
"Ruins": "Ruins",
"Shelter": "Shelter",
"Shelters": "Shelters",
Expand Down
75 changes: 68 additions & 7 deletions card_db_src/sets_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,50 @@
"set_text": "",
"text_icon": "*"
},
"cornucopia": {
"cornucopia1stEdition": {
"edition": [
"1"
],
"image": "cornucopia_set.png",
"set_name": "*cornucopia1stEdition*",
"set_text": "",
"short_name": "Cornucopia",
"text_icon": "*"
},
"cornucopia1stEditionRemoved": {
"edition": [
"1",
"removed"
],
"has_extras": false,
"image": "cornucopia_set.png",
"set_name": "*cornucopia1stEditionRemoved*",
"set_text": "",
"short_name": "Cornucopia",
"text_icon": "*"
},
"cornucopia2ndEditionUpgrade": {
"edition": [
"1",
"upgrade"
],
"has_extras": false,
"image": "cornucopia_set.png",
"set_name": "*cornucopia2ndEditionUpgrade*",
"set_text": "",
"short_name": "Cornucopia",
"text_icon": "*",
"upgrades": "cornucopia1stEdition"
},
"cornucopiaAndGuilds2ndEdition": {
"edition": [
"2",
"latest"
],
"image": "cornucopia_set.png",
"set_name": "*cornucopia*",
"set_name": "*cornucopiaAndGuilds2ndEdition*",
"set_text": "",
"short_name": "Cornucopia and Guilds",
"text_icon": "*"
},
"dark ages": {
Expand Down Expand Up @@ -139,26 +175,51 @@
"set_text": "",
"text_icon": "*"
},
"guilds": {
"guilds-bigbox2-de": {
"edition": [
"1",
"latest"
],
"image": "guilds_set.png",
"set_name": "*guilds*",
"set_name": "*guilds-bigbox2-de*",
"set_text": "",
"text_icon": "*"
},
"guilds-bigbox2-de": {
"guilds1stEdition": {
"edition": [
"1"
],
"image": "guilds_set.png",
"set_name": "*guilds1stEdition*",
"set_text": "",
"short_name": "Guilds",
"text_icon": "*"
},
"guilds1stEditionRemoved": {
"edition": [
"1",
"latest"
"removed"
],
"has_extras": false,
"image": "guilds_set.png",
"set_name": "*guilds-bigbox2-de*",
"set_name": "*guilds1stEditionRemoved*",
"set_text": "",
"short_name": "Guilds",
"text_icon": "*"
},
"guilds2ndEditionUpgrade": {
"edition": [
"1",
"upgrade"
],
"has_extras": false,
"image": "guilds_set.png",
"set_name": "*guilds2ndEditionUpgrade*",
"set_text": "",
"short_name": "Guilds",
"text_icon": "*",
"upgrades": "guilds1stEdition"
},
"hinterlands1stEdition": {
"edition": [
"1"
Expand Down
60 changes: 60 additions & 0 deletions card_db_src/types_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Action",
"Reward"
],
"card_type_image": "action.png",
"defaultCardCount": 2,
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Action",
Expand Down Expand Up @@ -291,6 +301,17 @@
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Action",
"Treasure",
"Reward"
],
"card_type_image": "action-treasure.png",
"defaultCardCount": 2,
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Action",
Expand All @@ -301,6 +322,17 @@
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Action",
"Victory",
"Reward"
],
"card_type_image": "action-victory.png",
"defaultCardCount": 2,
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Action",
Expand Down Expand Up @@ -797,6 +829,24 @@
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Reward"
],
"card_type_image": "action.png",
"defaultCardCount": 1,
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Rewards"
],
"card_type_image": "action.png",
"defaultCardCount": 0,
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Shelters"
Expand Down Expand Up @@ -978,6 +1028,16 @@
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Treasure",
"Reward"
],
"card_type_image": "treasure.png",
"defaultCardCount": 2,
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
"Treasure",
Expand Down
90 changes: 90 additions & 0 deletions card_db_src/xx/cards_xx.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions card_db_src/xx/types_xx.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"Project": "Project",
"Reaction": "Reaction",
"Reserve": "Reserve",
"Reward": "Reward",
"Rewards": "Rewards",
"Ruins": "Ruins",
"Shelter": "Shelter",
"Shelters": "Shelters",
Expand Down
Binary file modified src/domdiv/card_db/cards_db.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/cs/cards_cs.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/cs/sets_cs.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/cs/types_cs.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/de/cards_de.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/de/sets_de.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/de/types_de.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/en_us/cards_en_us.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/en_us/sets_en_us.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/en_us/types_en_us.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/es/cards_es.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/es/sets_es.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/es/types_es.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/fr/cards_fr.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/fr/sets_fr.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/fr/types_fr.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/it/cards_it.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/it/sets_it.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/it/types_it.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/nl_nl/cards_nl_nl.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/nl_nl/sets_nl_nl.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/nl_nl/types_nl_nl.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/sets_db.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/types_db.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/xx/cards_xx.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/xx/sets_xx.json.gz
Binary file not shown.
Binary file modified src/domdiv/card_db/xx/types_xx.json.gz
Binary file not shown.
50 changes: 31 additions & 19 deletions src/domdiv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,11 @@ def filter_sort_cards(cards, options):
keep_cards.append(card) # not part of a group, so just keep the card
else:
# have a card in a group
if card.group_tag not in group_cards:
if (card.group_tag, card.cardset_tag) not in group_cards:
# First card of a group
group_cards[card.group_tag] = card # save to update cost later
group_cards[(card.group_tag, card.cardset_tag)] = (
card # save to update cost later
)
# this card becomes the card holder for the whole group.
card.card_tag = card.group_tag
# These text fields should be updated later if there is a translation for this group_tag.
Expand All @@ -335,31 +337,41 @@ def filter_sort_cards(cards, options):
# subsequent cards in the group. Update group info, but don't keep the card.
if card.group_top:
# this is a designated card to represent the group, so update important data
group_cards[card.group_tag].cost = card.cost
group_cards[card.group_tag].potcost = card.potcost
group_cards[card.group_tag].debtcost = card.debtcost
group_cards[card.group_tag].types = card.types
group_cards[card.group_tag].randomizer = card.randomizer
group_cards[card.group_tag].image = card.image

group_cards[card.group_tag].addCardCount(
group_cards[(card.group_tag, card.cardset_tag)].cost = card.cost
group_cards[(card.group_tag, card.cardset_tag)].potcost = (
card.potcost
)
group_cards[(card.group_tag, card.cardset_tag)].debtcost = (
card.debtcost
)
group_cards[(card.group_tag, card.cardset_tag)].types = (
card.types
)
group_cards[(card.group_tag, card.cardset_tag)].randomizer = (
card.randomizer
)
group_cards[(card.group_tag, card.cardset_tag)].image = (
card.image
)

group_cards[(card.group_tag, card.cardset_tag)].addCardCount(
card.count
) # increase the count
# group_cards[card.group_tag].set_lowest_cost(card) # set holder to lowest cost of the two cards
# set holder to lowest cost of the two cards
# group_cards[(card.group_tag, card.cardset_tag)].set_lowest_cost(card)

cards = keep_cards

# Now fix up card costs for groups by Type (Events, Landmarks, etc.)
for card in cards:
if (
card.card_tag in group_cards
and group_cards[card.group_tag].get_GroupCost()
):
group_cards[card.group_tag].cost = group_cards[
card.group_tag
if (card.card_tag, card.cardset_tag) in group_cards and group_cards[
(card.group_tag, card.cardset_tag)
].get_GroupCost():
group_cards[(card.group_tag, card.cardset_tag)].cost = group_cards[
(card.group_tag, card.cardset_tag)
].get_GroupCost()
group_cards[card.group_tag].debtcost = 0
group_cards[card.group_tag].potcost = 0
group_cards[(card.group_tag, card.cardset_tag)].debtcost = 0
group_cards[(card.group_tag, card.cardset_tag)].potcost = 0

# Get the final type names in the requested language
Card.type_names = add_type_text(Card.type_names, db.LANGUAGE_DEFAULT)
Expand Down
14 changes: 10 additions & 4 deletions tests/carddb_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def rmd():


def test_cardread():
num_cards_expected = 958
# we test the number of cards only to make sure it doesn't get changed
# inadvertently by unrelated changes
num_cards_expected = 1017

options = config_options.parse_opts([])
options.data_path = "."
cards = db.read_card_data(options)
assert len(cards) == num_cards_expected
valid_cardsets = {
Expand All @@ -49,14 +50,19 @@ def test_cardread():
"prosperity2ndEdition",
"prosperity2ndEditionUpgrade",
"cornucopia extras",
"cornucopia",
"cornucopia1stEdition",
"cornucopia1stEditionRemoved",
"cornucopia2ndEditionUpgrade",
"cornucopiaAndGuilds2ndEdition",
"hinterlands1stEdition",
"hinterlands1stEditionRemoved",
"hinterlands2ndEdition",
"hinterlands2ndEditionUpgrade",
"dark ages",
"dark ages extras",
"guilds",
"guilds1stEdition",
"guilds1stEditionRemoved",
"guilds2ndEditionUpgrade",
"guilds-bigbox2-de",
"adventures",
"adventures extras",
Expand Down
1 change: 1 addition & 0 deletions tools/CrossReference.csv
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"Groups","Urchin - Mercenary","Urchin / Mercenary","Gassenjunge / Söldner",,"Orphelin / Mercenaire",
"Groups","Sauna - Avanto","Sauna / Avanto","Sauna / Eisloch",,,
"Groups","Tournament and Prizes","Tournament and Prizes","Turnier und Preise",,,
"Groups","Joust and Rewards","Joust and Rewards",,,,
"Groups","Hermit - Madman","Hermit / Madman","Eremit / Verrückter",,,
"Groups","Shelters","Shelters","Unterschlupfe",,,
"Groups","Settlers - Bustling Village","Settlers / Bustling Village","Siedler / Emsiges Dorf",,,
Expand Down