Files
aoe2-flashcard-creator/decks/units-costs.py
Nate Bowman 6e1b876a14 Add more data
Also renamed some of the files and had to change some code to account
for the new names.
2026-10-14 19:03:59 -04:00

29 lines
856 B
Python

from flashcards.decks import create_deck_from_back_function
# your choice of deck name and filename
deck_name = 'Unit Costs'
deck_fname = 'unit-costs'
# specify the namelist to be used to create the deck
# give the relative path of the file from config.namelists_dir
namelist = 'units-basic.txt'
# key into json file specifying which data you want
# uncomment either 'units_buildings' or 'techs'
data_json_key = 'units_buildings'
#data_json_key = 'techs'
def card_back(num, name, data):
cost = data[num]['cost']
back = '\n'.join([f'{res}: {val}' for res, val in cost.items()
if val != 0])
return back
create_deck_from_back_function(namelist,
data_json_key,
card_back,
deck_name,
deck_fname)