54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
from flashcards.maps import (create_maps,
|
|
read_data_to_dict,
|
|
read_name_data_to_dict,
|
|
read_string_data_to_dict)
|
|
from flashcards.fighting import (calculate_hits_to_kill,
|
|
generate_bonus_with_value)
|
|
from flashcards.types import ArmorClasses
|
|
|
|
|
|
|
|
# specify the namelist to be used to create the deck
|
|
# give the relative path of the file from config.namelists_dir
|
|
namelist = 'units-buildings-trimmed.txt'
|
|
|
|
# key into json file specifying which data you want
|
|
name_json_keys = 'units_buildings'
|
|
data_json_keys = ('data', 'Unit')
|
|
string_json_keys = ()
|
|
|
|
#name_data = read_name_data_to_dict(string_json_keys)
|
|
_, nums = create_maps(namelist, name_json_keys)
|
|
data = read_data_to_dict(data_json_keys)
|
|
|
|
attacker = 'Spearman'
|
|
defender = 'Scout Cavalry'
|
|
bloodlines = False
|
|
|
|
print(f'{attacker} attacking {defender} with bloodlines={bloodlines}')
|
|
print('--------------------------------')
|
|
|
|
for i in range(-3, 5):
|
|
attack_bonuses = []
|
|
armor_bonuses = []
|
|
hp_bonuses = []
|
|
|
|
b = generate_bonus_with_value(abs(i), ArmorClasses.MELEE)
|
|
if i < 0:
|
|
armor_bonuses.append(b)
|
|
else:
|
|
attack_bonuses.append(b)
|
|
|
|
if bloodlines:
|
|
bloodlines_bonus = generate_bonus_with_value(20, ArmorClasses.HP)
|
|
hp_bonuses.append(bloodlines_bonus)
|
|
|
|
hits = calculate_hits_to_kill(attacker,
|
|
defender,
|
|
data,
|
|
nums,
|
|
attack_bonuses=attack_bonuses,
|
|
armor_bonuses=armor_bonuses,
|
|
hp_bonuses=hp_bonuses)
|
|
print(f'Net attack bonus: {i}\thits: {hits}')
|