Automate generation of fight results
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import itertools
|
||||
|
||||
from flashcards.constants import UnitLines, ranges
|
||||
from flashcards.maps import (create_maps,
|
||||
read_data_to_dict,
|
||||
read_name_data_to_dict)
|
||||
from flashcards.fighting import (generate_all_combinations,
|
||||
generate_fight_results_from_names)
|
||||
from flashcards.fighting import generate_all_fight_results
|
||||
|
||||
|
||||
|
||||
@@ -19,43 +17,7 @@ namelist = 'units-buildings-trimmed.txt'
|
||||
name_json_keys = 'units_buildings'
|
||||
data_json_keys = ('data', 'Unit')
|
||||
|
||||
# --- Fight details start here
|
||||
|
||||
attacker_line = 'Spearman'
|
||||
defender_line = 'Knight'
|
||||
#defender_line = 'Scout Cavalry'
|
||||
range_type = 'standard'
|
||||
|
||||
# extra bonuses beyond the usual blacksmith upgrades and bloodlines
|
||||
hp_bonus_names = []
|
||||
attack_bonus_names = []
|
||||
armor_bonus_names = []
|
||||
|
||||
# --- Shouldn't need to change below this line
|
||||
|
||||
_, nums = create_maps(namelist, name_json_keys)
|
||||
data = read_data_to_dict(data_json_keys)
|
||||
|
||||
attack_type = UnitLines.get_attack(attacker_line)
|
||||
bonus_range = ranges[attack_type][range_type]
|
||||
|
||||
built_in_hp_bonus_names = UnitLines.get_hp_bonus_names(defender_line)
|
||||
all_hp_bonus_names = hp_bonus_names + built_in_hp_bonus_names
|
||||
bonus_names_combinations = generate_all_combinations(attack_bonus_names,
|
||||
armor_bonus_names,
|
||||
all_hp_bonus_names)
|
||||
|
||||
for attacker, defender in itertools.product(UnitLines.get_names(attacker_line),
|
||||
UnitLines.get_names(defender_line)):
|
||||
for combo in bonus_names_combinations:
|
||||
results = generate_fight_results_from_names(attacker,
|
||||
defender,
|
||||
attack_type,
|
||||
bonus_range,
|
||||
data,
|
||||
nums,
|
||||
combo[0],
|
||||
combo[1],
|
||||
combo[2],
|
||||
True)
|
||||
print(results)
|
||||
generate_all_fight_results(data, nums)
|
||||
|
||||
Reference in New Issue
Block a user