Compare commits
4 Commits
b7c239b2fa
...
361a63b478
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
361a63b478 | ||
|
|
8cfd03c6ec | ||
|
|
d29868960e | ||
|
|
79e695a5b0 |
@@ -56,6 +56,8 @@ The data used for this project was downloaded from:
|
|||||||
* https://github.com/SiegeEngineers/aoe2techtree/blob/master/data/locales/en/strings.json
|
* https://github.com/SiegeEngineers/aoe2techtree/blob/master/data/locales/en/strings.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
A few duplicate(-ish) elements were removed from `units_buildings_techs.de.json`.
|
||||||
|
|
||||||
The SiegeEngineers team on Github has a lot of cool stuff.
|
The SiegeEngineers team on Github has a lot of cool stuff.
|
||||||
You should check them out.
|
You should check them out.
|
||||||
The particular projects I took this from are called HALFON and aoe2techtree.
|
The particular projects I took this from are called HALFON and aoe2techtree.
|
||||||
|
|||||||
@@ -805,29 +805,6 @@
|
|||||||
"localised_name": "",
|
"localised_name": "",
|
||||||
"rms_const": null
|
"rms_const": null
|
||||||
},
|
},
|
||||||
"35": {
|
|
||||||
"cost": {
|
|
||||||
"wood": 160,
|
|
||||||
"food": 0,
|
|
||||||
"gold": 75,
|
|
||||||
"stone": 0
|
|
||||||
},
|
|
||||||
"attack": 2,
|
|
||||||
"melee_armor": -3,
|
|
||||||
"pierce_armor": 180,
|
|
||||||
"base_id": 35,
|
|
||||||
"help_converter": 26094,
|
|
||||||
"language_file_name": 5094,
|
|
||||||
"language_file_help": 105094,
|
|
||||||
"name": "BTRAM",
|
|
||||||
"hit_points": 175,
|
|
||||||
"line_of_sight": 3,
|
|
||||||
"garrison_capacity": 6,
|
|
||||||
"type": 70,
|
|
||||||
"class": 13,
|
|
||||||
"localised_name": "Battering Ram",
|
|
||||||
"rms_const": "BATTERING_RAM"
|
|
||||||
},
|
|
||||||
"36": {
|
"36": {
|
||||||
"cost": {
|
"cost": {
|
||||||
"wood": 225,
|
"wood": 225,
|
||||||
@@ -4232,29 +4209,6 @@
|
|||||||
"localised_name": "",
|
"localised_name": "",
|
||||||
"rms_const": null
|
"rms_const": null
|
||||||
},
|
},
|
||||||
"184": {
|
|
||||||
"cost": {
|
|
||||||
"wood": 0,
|
|
||||||
"food": 50,
|
|
||||||
"gold": 35,
|
|
||||||
"stone": 0
|
|
||||||
},
|
|
||||||
"attack": 9,
|
|
||||||
"melee_armor": 1,
|
|
||||||
"pierce_armor": 3,
|
|
||||||
"base_id": 184,
|
|
||||||
"help_converter": 26114,
|
|
||||||
"language_file_name": 5114,
|
|
||||||
"language_file_help": 105114,
|
|
||||||
"name": "CONDOPLACEHOLDER",
|
|
||||||
"hit_points": 80,
|
|
||||||
"line_of_sight": 6,
|
|
||||||
"garrison_capacity": 0,
|
|
||||||
"type": 70,
|
|
||||||
"class": 6,
|
|
||||||
"localised_name": "Condottiero",
|
|
||||||
"rms_const": null
|
|
||||||
},
|
|
||||||
"185": {
|
"185": {
|
||||||
"cost": {
|
"cost": {
|
||||||
"wood": 25,
|
"wood": 25,
|
||||||
@@ -13202,29 +13156,6 @@
|
|||||||
"localised_name": "",
|
"localised_name": "",
|
||||||
"rms_const": null
|
"rms_const": null
|
||||||
},
|
},
|
||||||
"583": {
|
|
||||||
"cost": {
|
|
||||||
"wood": 50,
|
|
||||||
"food": 60,
|
|
||||||
"gold": 0,
|
|
||||||
"stone": 0
|
|
||||||
},
|
|
||||||
"attack": 4,
|
|
||||||
"melee_armor": 0,
|
|
||||||
"pierce_armor": 1,
|
|
||||||
"base_id": 583,
|
|
||||||
"help_converter": 26663,
|
|
||||||
"language_file_name": 5663,
|
|
||||||
"language_file_help": 105663,
|
|
||||||
"name": "GENIT",
|
|
||||||
"hit_points": 60,
|
|
||||||
"line_of_sight": 5,
|
|
||||||
"garrison_capacity": 0,
|
|
||||||
"type": 70,
|
|
||||||
"class": 36,
|
|
||||||
"localised_name": "Genitour",
|
|
||||||
"rms_const": "GENITOUR"
|
|
||||||
},
|
|
||||||
"584": {
|
"584": {
|
||||||
"cost": {
|
"cost": {
|
||||||
"wood": 100,
|
"wood": 100,
|
||||||
@@ -13501,29 +13432,6 @@
|
|||||||
"localised_name": "",
|
"localised_name": "",
|
||||||
"rms_const": null
|
"rms_const": null
|
||||||
},
|
},
|
||||||
"596": {
|
|
||||||
"cost": {
|
|
||||||
"wood": 50,
|
|
||||||
"food": 60,
|
|
||||||
"gold": 0,
|
|
||||||
"stone": 0
|
|
||||||
},
|
|
||||||
"attack": 5,
|
|
||||||
"melee_armor": 0,
|
|
||||||
"pierce_armor": 1,
|
|
||||||
"base_id": 596,
|
|
||||||
"help_converter": 26665,
|
|
||||||
"language_file_name": 5665,
|
|
||||||
"language_file_help": 105665,
|
|
||||||
"name": "GENITX",
|
|
||||||
"hit_points": 70,
|
|
||||||
"line_of_sight": 6,
|
|
||||||
"garrison_capacity": 0,
|
|
||||||
"type": 70,
|
|
||||||
"class": 36,
|
|
||||||
"localised_name": "Elite Genitour",
|
|
||||||
"rms_const": "ELITE_GENITOUR"
|
|
||||||
},
|
|
||||||
"597": {
|
"597": {
|
||||||
"cost": {
|
"cost": {
|
||||||
"wood": 275,
|
"wood": 275,
|
||||||
@@ -20079,29 +19987,6 @@
|
|||||||
"localised_name": "Wild Camel",
|
"localised_name": "Wild Camel",
|
||||||
"rms_const": "DLC_WILD_CAMEL"
|
"rms_const": "DLC_WILD_CAMEL"
|
||||||
},
|
},
|
||||||
"885": {
|
|
||||||
"cost": {
|
|
||||||
"wood": 220,
|
|
||||||
"food": 0,
|
|
||||||
"gold": 120,
|
|
||||||
"stone": 0
|
|
||||||
},
|
|
||||||
"attack": 6,
|
|
||||||
"melee_armor": -2,
|
|
||||||
"pierce_armor": 100,
|
|
||||||
"base_id": 885,
|
|
||||||
"help_converter": 26446,
|
|
||||||
"language_file_name": 5445,
|
|
||||||
"language_file_help": 105446,
|
|
||||||
"name": "SGTWR",
|
|
||||||
"hit_points": 220,
|
|
||||||
"line_of_sight": 8,
|
|
||||||
"garrison_capacity": 6,
|
|
||||||
"type": 70,
|
|
||||||
"class": 13,
|
|
||||||
"localised_name": "Siege Tower",
|
|
||||||
"rms_const": null
|
|
||||||
},
|
|
||||||
"886": {
|
"886": {
|
||||||
"cost": {
|
"cost": {
|
||||||
"wood": 0,
|
"wood": 0,
|
||||||
@@ -21114,29 +20999,6 @@
|
|||||||
"localised_name": "Khosrau",
|
"localised_name": "Khosrau",
|
||||||
"rms_const": null
|
"rms_const": null
|
||||||
},
|
},
|
||||||
"931": {
|
|
||||||
"cost": {
|
|
||||||
"wood": 0,
|
|
||||||
"food": 60,
|
|
||||||
"gold": 60,
|
|
||||||
"stone": 0
|
|
||||||
},
|
|
||||||
"attack": 18,
|
|
||||||
"melee_armor": 1,
|
|
||||||
"pierce_armor": 1,
|
|
||||||
"base_id": 931,
|
|
||||||
"help_converter": 26000,
|
|
||||||
"language_file_name": 5702,
|
|
||||||
"language_file_help": 105000,
|
|
||||||
"name": "JARL",
|
|
||||||
"hit_points": 140,
|
|
||||||
"line_of_sight": 7,
|
|
||||||
"garrison_capacity": 0,
|
|
||||||
"type": 70,
|
|
||||||
"class": 12,
|
|
||||||
"localised_name": "Jarl",
|
|
||||||
"rms_const": null
|
|
||||||
},
|
|
||||||
"932": {
|
"932": {
|
||||||
"cost": {
|
"cost": {
|
||||||
"wood": 0,
|
"wood": 0,
|
||||||
@@ -21275,29 +21137,6 @@
|
|||||||
"localised_name": "",
|
"localised_name": "",
|
||||||
"rms_const": null
|
"rms_const": null
|
||||||
},
|
},
|
||||||
"938": {
|
|
||||||
"cost": {
|
|
||||||
"wood": 180,
|
|
||||||
"food": 0,
|
|
||||||
"gold": 180,
|
|
||||||
"stone": 0
|
|
||||||
},
|
|
||||||
"attack": 4,
|
|
||||||
"melee_armor": 3,
|
|
||||||
"pierce_armor": 8,
|
|
||||||
"base_id": 938,
|
|
||||||
"help_converter": 26739,
|
|
||||||
"language_file_name": 5739,
|
|
||||||
"language_file_help": 105739,
|
|
||||||
"name": "DRAGS",
|
|
||||||
"hit_points": 150,
|
|
||||||
"line_of_sight": 6,
|
|
||||||
"garrison_capacity": 0,
|
|
||||||
"type": 70,
|
|
||||||
"class": 22,
|
|
||||||
"localised_name": "Dragon Ship",
|
|
||||||
"rms_const": null
|
|
||||||
},
|
|
||||||
"939": {
|
"939": {
|
||||||
"cost": {
|
"cost": {
|
||||||
"wood": 0,
|
"wood": 0,
|
||||||
@@ -80399,4 +80238,4 @@
|
|||||||
"localised_name": ""
|
"localised_name": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
54
decks/research-non-unique.py
Normal file
54
decks/research-non-unique.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
from flashcards.decks import create_deck
|
||||||
|
from flashcards.helpers import parse_research_string
|
||||||
|
from flashcards.maps import (create_maps,
|
||||||
|
read_data_to_dict,
|
||||||
|
read_name_data_to_dict,
|
||||||
|
read_string_data_to_dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# your choice of deck name and filename
|
||||||
|
deck_name = 'Research (Non-Unique)'
|
||||||
|
deck_fname = 'research-non-unique'
|
||||||
|
|
||||||
|
# specify the namelist to be used to create the deck
|
||||||
|
# give the relative path of the file from config.namelists_dir
|
||||||
|
namelist = 'research-non-unique.txt'
|
||||||
|
|
||||||
|
# key into json file specifying which data you want
|
||||||
|
name_json_keys = 'techs'
|
||||||
|
data_json_keys = ('data', 'Tech',)
|
||||||
|
string_json_keys = ()
|
||||||
|
|
||||||
|
# --- create list of notes ---
|
||||||
|
|
||||||
|
_, nums = create_maps(namelist, name_json_keys)
|
||||||
|
data = read_data_to_dict(data_json_keys)
|
||||||
|
names = read_name_data_to_dict(name_json_keys)
|
||||||
|
strings = read_string_data_to_dict(string_json_keys)
|
||||||
|
|
||||||
|
# create cards based on data and maps
|
||||||
|
order = ['Wood', 'Food', 'Gold', 'Stone']
|
||||||
|
notes = []
|
||||||
|
for name, num in nums.items():
|
||||||
|
front = name
|
||||||
|
|
||||||
|
cost = data[num]['Cost']
|
||||||
|
# works, but puts wood in the wrong order (i.e., after food)
|
||||||
|
#all_cost = '\n'.join([f'{res}: {val}' for res, val in cost.items()
|
||||||
|
#if val != 0])
|
||||||
|
all_cost = '\n'.join([f'{k}: {cost[k]}' for k in order
|
||||||
|
if k in cost.keys() and cost[k] != 0])
|
||||||
|
|
||||||
|
time_text = f'Research time: {data[num]["ResearchTime"]}'
|
||||||
|
|
||||||
|
help_id = str(names[num]['help_converter'])
|
||||||
|
help_text = parse_research_string(strings[help_id])
|
||||||
|
|
||||||
|
back = '\n\n'.join([all_cost, time_text, help_text])
|
||||||
|
|
||||||
|
notes.append((front, back))
|
||||||
|
#print(f'front: {name}\tback: {back}')
|
||||||
|
|
||||||
|
# write deck to .apkg file
|
||||||
|
deck = create_deck(notes, deck_name, deck_fname)
|
||||||
@@ -139,13 +139,6 @@ def generate_notes(attack_bonus_names, armor_bonus_names, hp_bonus_names):
|
|||||||
if len(hp_bonus_names) > 0:
|
if len(hp_bonus_names) > 0:
|
||||||
notes += f'with {" and ".join(hp_bonus_names)} applied. '
|
notes += f'with {" and ".join(hp_bonus_names)} applied. '
|
||||||
|
|
||||||
other = attack_bonus_names + armor_bonus_names
|
|
||||||
if len(other) > 0:
|
|
||||||
verb = 'is'
|
|
||||||
if len(other) > 1:
|
|
||||||
verb = 'are'
|
|
||||||
notes += f'{" and ".join(other)} {verb} incoporated into net attack range'
|
|
||||||
|
|
||||||
return notes
|
return notes
|
||||||
|
|
||||||
|
|
||||||
@@ -321,7 +314,9 @@ def generate_all_fight_results(data, nums):
|
|||||||
loops over all possible values of blacksmith research and any other
|
loops over all possible values of blacksmith research and any other
|
||||||
relevant non-blacksmith bonuses found in fighting.constants.bonuses.
|
relevant non-blacksmith bonuses found in fighting.constants.bonuses.
|
||||||
'''
|
'''
|
||||||
|
all_results = {}
|
||||||
for attacker, defender in itertools.product(nums.keys(), nums.keys()):
|
for attacker, defender in itertools.product(nums.keys(), nums.keys()):
|
||||||
|
fight_results = []
|
||||||
attack_type = get_attack_type(nums[attacker], data)
|
attack_type = get_attack_type(nums[attacker], data)
|
||||||
bonus_names = get_possible_bonus_names_for_fight(attacker, defender)
|
bonus_names = get_possible_bonus_names_for_fight(attacker, defender)
|
||||||
combos = generate_all_combinations(*bonus_names)
|
combos = generate_all_combinations(*bonus_names)
|
||||||
@@ -336,5 +331,7 @@ def generate_all_fight_results(data, nums):
|
|||||||
combo[0],
|
combo[0],
|
||||||
combo[1],
|
combo[1],
|
||||||
combo[2],
|
combo[2],
|
||||||
True)
|
False)
|
||||||
print(results)
|
fight_results.append(results)
|
||||||
|
all_results[(attacker, defender)] = fight_results
|
||||||
|
return all_results
|
||||||
|
|||||||
3
flashcards/helpers.py
Normal file
3
flashcards/helpers.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
def parse_research_string(string):
|
||||||
|
no_intro = string.split('\n')[1:]
|
||||||
|
return ' '.join(no_intro)
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
import itertools
|
|
||||||
|
|
||||||
from flashcards.maps import (create_maps,
|
from flashcards.maps import (create_maps,
|
||||||
read_data_to_dict,
|
read_data_to_dict)
|
||||||
read_name_data_to_dict)
|
|
||||||
from flashcards.fighting import generate_all_fight_results
|
from flashcards.fighting import generate_all_fight_results
|
||||||
|
|
||||||
|
|
||||||
@@ -11,7 +8,8 @@ from flashcards.fighting import generate_all_fight_results
|
|||||||
|
|
||||||
# specify the namelist to be used to create the deck
|
# specify the namelist to be used to create the deck
|
||||||
# give the relative path of the file from config.namelists_dir
|
# give the relative path of the file from config.namelists_dir
|
||||||
namelist = 'units-buildings-trimmed.txt'
|
namelist = 'units-test.txt'
|
||||||
|
#namelist = 'units-non-unique.txt'
|
||||||
|
|
||||||
# key into json file specifying which data you want
|
# key into json file specifying which data you want
|
||||||
name_json_keys = 'units_buildings'
|
name_json_keys = 'units_buildings'
|
||||||
@@ -20,4 +18,5 @@ data_json_keys = ('data', 'Unit')
|
|||||||
_, nums = create_maps(namelist, name_json_keys)
|
_, nums = create_maps(namelist, name_json_keys)
|
||||||
data = read_data_to_dict(data_json_keys)
|
data = read_data_to_dict(data_json_keys)
|
||||||
|
|
||||||
generate_all_fight_results(data, nums)
|
results = generate_all_fight_results(data, nums)
|
||||||
|
print(results)
|
||||||
44
scripts/find-unique-research.py
Normal file
44
scripts/find-unique-research.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import itertools
|
||||||
|
|
||||||
|
from flashcards.config import config
|
||||||
|
from flashcards.maps import (create_maps,
|
||||||
|
read_data_to_dict,
|
||||||
|
read_name_data_to_dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# --- General section to read in names and data
|
||||||
|
|
||||||
|
# specify the namelist to be used to create the deck
|
||||||
|
# give the relative path of the file from config.namelists_dir
|
||||||
|
namelist = 'research-standard.txt'
|
||||||
|
|
||||||
|
# key into json file specifying which data you want
|
||||||
|
name_json_keys = 'techs'
|
||||||
|
data_json_keys = ('civs',)
|
||||||
|
|
||||||
|
_, nums = create_maps(namelist, name_json_keys)
|
||||||
|
data = read_data_to_dict(data_json_keys)
|
||||||
|
|
||||||
|
non_uniques = []
|
||||||
|
uniques = []
|
||||||
|
for name, num in nums.items():
|
||||||
|
count = 0
|
||||||
|
recent_civ = None
|
||||||
|
for civ in data.keys():
|
||||||
|
if int(num) in data[civ]['Tech']:
|
||||||
|
count += 1
|
||||||
|
recent_civ = civ
|
||||||
|
if count == 1:
|
||||||
|
#print(f'{name}: {recent_civ}')
|
||||||
|
uniques.append(name)
|
||||||
|
elif count > 1:
|
||||||
|
non_uniques.append(name)
|
||||||
|
|
||||||
|
with open(config.namelists_dir / 'research-unique.txt', 'w') as f:
|
||||||
|
f.writelines('\n'.join(uniques))
|
||||||
|
f.write('\n')
|
||||||
|
|
||||||
|
with open(config.namelists_dir / 'research-non-unique.txt', 'w') as f:
|
||||||
|
f.writelines('\n'.join(non_uniques))
|
||||||
|
f.write('\n')
|
||||||
Reference in New Issue
Block a user