Prize letters and numbers

Minor bug with max keys: prevent negative values
This commit is contained in:
aerinon
2022-04-21 15:44:52 -06:00
parent e0a6f26279
commit b514df76c3
5 changed files with 14 additions and 14 deletions

View File

@@ -1088,7 +1088,7 @@ def assign_cross_keys(dungeon_builders, world, player):
# Step 2: Initial Key Number Assignment & Calculate Flexibility
for name, builder in dungeon_builders.items():
calculated = int(round(builder.key_doors_num*total_keys/total_candidates))
max_keys = builder.location_cnt - calc_used_dungeon_items(builder)
max_keys = max(0, builder.location_cnt - calc_used_dungeon_items(builder))
cand_len = max(0, len(builder.candidates) - builder.key_drop_cnt)
limit = min(max_keys, cand_len)
suggested = min(calculated, limit)