Move Triforce Pieces Min and Max handling to Main

This commit is contained in:
Catobat
2023-07-26 02:40:40 +02:00
parent 213d3d3aa0
commit ea70d7cb5a
3 changed files with 28 additions and 12 deletions

2
CLI.py
View File

@@ -229,7 +229,7 @@ def parse_settings():
"triforce_pool_max": 0,
"triforce_goal_min": 0,
"triforce_goal_max": 0,
"triforce_min_difference": 10,
"triforce_min_difference": 0,
"code": "",
"multi": 1,

22
Main.py
View File

@@ -124,8 +124,6 @@ def main(args, seed=None, fish=None):
world.potshuffle = args.shufflepots.copy()
world.mixed_travel = args.mixed_travel.copy()
world.standardize_palettes = args.standardize_palettes.copy()
world.treasure_hunt_count = {k: int(v) for k, v in args.triforce_goal.items()}
world.treasure_hunt_total = {k: int(v) for k, v in args.triforce_pool.items()}
world.shufflelinks = args.shufflelinks.copy()
world.shuffletavern = args.shuffletavern.copy()
world.pseudoboots = args.pseudoboots.copy()
@@ -135,6 +133,26 @@ def main(args, seed=None, fish=None):
world.collection_rate = args.collection_rate.copy()
world.colorizepots = args.colorizepots.copy()
world.treasure_hunt_count = {}
world.treasure_hunt_total = {}
for p in args.triforce_goal:
if int(args.triforce_goal[p]) != 0 or int(args.triforce_pool[p]) != 0 or int(args.triforce_goal_min[p]) != 0 or int(args.triforce_goal_max[p]) != 0 or int(args.triforce_pool_min[p]) != 0 or int(args.triforce_pool_max[p]) != 0:
if int(args.triforce_goal[p]) != 0:
world.treasure_hunt_count[p] = int(args.triforce_goal[p])
elif int(args.triforce_goal_min[p]) != 0 and int(args.triforce_goal_max[p]) != 0:
world.treasure_hunt_count[p] = random.randint(int(args.triforce_goal_min[p]), int(args.triforce_goal_max[p]))
else:
world.treasure_hunt_count[p] = 8 if world.goal[p] == 'trinity' else 20
if int(args.triforce_pool[p]) != 0:
world.treasure_hunt_total[p] = int(args.triforce_pool[p])
elif int(args.triforce_pool_min[p]) != 0 and int(args.triforce_pool_max[p]) != 0:
world.treasure_hunt_total[p] = random.randint(max(int(args.triforce_pool_min[p]), world.treasure_hunt_count[p] + int(args.triforce_min_difference[p])), int(args.triforce_pool_max[p]))
else:
world.treasure_hunt_total[p] = 10 if world.goal[p] == 'trinity' else 30
else:
# this will be handled in ItemList.py and custom item pool is used to determine the numbers
world.treasure_hunt_count[p], world.treasure_hunt_total[p] = 0, 0
world.rom_seeds = {player: random.randint(0, 999999999) for player in range(1, world.players + 1)}
world.finish_init()

View File

@@ -125,15 +125,13 @@ def roll_settings(weights):
ret.crystals_ganon = get_choice('ganon_open')
from ItemList import set_default_triforce
default_tf_goal, default_tf_pool = set_default_triforce(ret.goal, 0, 0)
goal_min = get_choice_default('triforce_goal_min', default=default_tf_goal)
goal_max = get_choice_default('triforce_goal_max', default=default_tf_goal)
pool_min = get_choice_default('triforce_pool_min', default=default_tf_pool)
pool_max = get_choice_default('triforce_pool_max', default=default_tf_pool)
ret.triforce_goal = random.randint(int(goal_min), int(goal_max))
min_diff = get_choice_default('triforce_min_difference', default=default_tf_pool-default_tf_goal)
ret.triforce_pool = random.randint(max(int(pool_min), ret.triforce_goal + int(min_diff)), int(pool_max))
ret.triforce_pool = get_choice_default('triforce_pool', default=0)
ret.triforce_goal = get_choice_default('triforce_goal', default=0)
ret.triforce_pool_min = get_choice_default('triforce_pool_min', default=0)
ret.triforce_pool_max = get_choice_default('triforce_pool_max', default=0)
ret.triforce_goal_min = get_choice_default('triforce_goal_min', default=0)
ret.triforce_goal_max = get_choice_default('triforce_goal_max', default=0)
ret.triforce_min_difference = get_choice_default('triforce_min_difference', default=0)
ret.mode = get_choice('world_state')
if ret.mode == 'retro':