from flashcards.maps import (create_maps, read_data_to_dict, read_name_data_to_dict) from flashcards.fighting import (generate_fight_results, get_bonuses_from_names) from flashcards.types import ArmorClasses, BonusTypes # --- 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 = 'units-buildings-trimmed.txt' # key into json file specifying which data you want name_json_keys = 'units_buildings' data_json_keys = ('data', 'Unit') _, nums = create_maps(namelist, name_json_keys) data = read_data_to_dict(data_json_keys) # --- Fight details start here attacker = 'Spearman' defender = 'Scout Cavalry' bonus_range = range(-3, 5) armor_class = ArmorClasses.MELEE notes = 'with Bloodlines' suffix = '' hp_bonus_names = ['Bloodlines'] attack_bonus_names = [] armor_bonus_names = [] # --- You shouldn't need to change below this line hp_bonuses = get_bonuses_from_names(BonusTypes.HP, hp_bonus_names) attack_bonuses = get_bonuses_from_names(BonusTypes.ATTACK, attack_bonus_names) armor_bonuses = get_bonuses_from_names(BonusTypes.ARMOR, armor_bonus_names) results = generate_fight_results(attacker, defender, armor_class, bonus_range, data, nums, notes=notes, extra_attack_bonuses=attack_bonuses, extra_armor_bonuses=armor_bonuses, hp_bonuses=hp_bonuses, verbose=True) # --- TODO write file print(results)