Remove Blacksmith upgrades from siege weapons

Siege weapons do not benefit from Blacksmith upgrades.  Also, this
commit splits the attack and defense ranges from Blacksmith upgrades
into two attributes, which makes it easier to see what is happening to
get the final range of attack-vs-defense upgrade values.
This commit is contained in:
Nate Bowman
2026-11-14 21:38:42 -05:00
parent 3fcbf0d0af
commit 67c9fc1696
3 changed files with 93 additions and 25 deletions

View File

@@ -20,4 +20,8 @@ data = read_data_to_dict(data_json_keys)
fight = Fighting(data, nums)
results = fight.generate_all_fight_results()
print(results)
for k, v in results.items():
print(k)
print(v)
print('\n\n')

View File

@@ -3,19 +3,37 @@ from fighting.types import ArmorClasses
ranges = {ArmorClasses.MELEE: {
'standard': range(-3, 5),
'parthian tactics (armor)': range(-3, 5),
'villager': range(0, 5),
'villager (loom)': range(-1, 4),
'attack': {
'standard': range(0, 5),
'villager': [0],
'siege (chemistry)': range(0, 2),
'siege': [0],
},
'armor': {
'standard': range(-3, 1),
'parthian tactics': range(-4, 1),
'villager': [0],
'villager (loom)': [-1],
'siege': [0],
},
},
ArmorClasses.PIERCE: {
'standard': range(-4, 5),
'parthian tactics (armor)': range(-6, 5),
'parthian tactics (attack)': range(-4, 7),
'gambesons': range(-5, 5),
'villager': range(0, 5),
'villager (loom)': range(-2, 4),
}
'attack': {
'standard': range(0, 5),
'parthian tactics': range(0, 7),
'villager': [0],
'siege (chemistry)': range(0, 2),
'siege': [0],
},
'armor': {
'standard': range(-4, 1),
'parthian tactics': range(-6, 1),
'gambesons': range(-5, 1),
'villager': [0],
'villager (loom)': [-2],
'siege': [0],
},
},
}
@@ -139,3 +157,31 @@ bonuses = {
},
}
bonuses['armor']['Parthian Tactics'] = bonuses['attack']['Parthian Tactics']['attackers']
siege = [
'Battering Ram',
'Capped Ram',
'Siege Ram',
'Mangonel',
'Onager',
'Siege Onager',
'Rocket Cart',
'Heavy Rocket Cart',
'Scorpion',
'Heavy Scorpion',
#'Siege Tower',
'Bombard Cannon',
'Trebuchet (packed)',
'Trebuchet (unpacked)',
'Traction Trebuchet',
]
siege_no_chemistry = [
'Battering Ram',
'Capped Ram',
'Siege Ram',
'Bombard Cannon',
'Trebuchet (packed)',
'Trebuchet (unpacked)',
'Traction Trebuchet',
]
siege_with_chemistry = list(set(siege) - set(siege_no_chemistry))

View File

@@ -145,22 +145,40 @@ class Fighting():
number in this way, we do not need to consider all possible combinations of
attack and armor blacksmith research.
'''
possible = constants.ranges[attack_type]
possible_attack = constants.ranges[attack_type]['attack']
if defender == 'Villager':
if 'Loom' in hp_bonuses:
return possible['villager (loom)']
else:
return possible['villager']
if attacker == 'Villager':
attack_range = possible_attack['villager']
elif 'Parthian Tactics' in extra_attack_bonuses:
attack_range = possible['parthian tactics']
elif attacker in constants.siege_no_chemistry:
attack_range = possible_attack['siege']
elif attacker in constants.siege_with_chemistry:
attack_range = possible_attack['siege (chemistry)']
else:
attack_range = possible_attack['standard']
possible_armor = constants.ranges[attack_type]['armor']
if 'Loom' in hp_bonuses:
armor_range = possible_armor['villager (loom)']
elif defender == 'Villager':
armor_range = possible_armor['villager']
elif 'Parthian Tactics' in extra_armor_bonuses:
return possible['parthian tactics (armor)']
elif attack_type == ArmorClasses.PIERCE:
if 'Parthian Tactics' in extra_attack_bonuses:
return possible['parthian tactics (attack)']
elif 'Gambesons' in extra_armor_bonuses:
return possible['gambesons']
armor_range = possible_armor['parthian tactics']
elif 'Gambesons' in extra_armor_bonuses:
armor_range = possible_armor['gambesons']
elif defender in constants.siege:
armor_range = possible_armor['siege']
else:
armor_range = possible_armor['standard']
return possible['standard']
all_range = set()
for attack in attack_range:
for armor in armor_range:
all_range.add(attack + armor)
return sorted(list(all_range))
def get_attack_type(self, attacker_id):