From bf9ad536fe3aa34f7130815c8ec41fa6671c622f Mon Sep 17 00:00:00 2001 From: Catobat <69204835+Catobat@users.noreply.github.com> Date: Wed, 26 Jul 2023 15:27:47 +0200 Subject: [PATCH] Implement triforce_max_difference --- CLI.py | 3 ++- Main.py | 2 +- README.md | 3 ++- mystery_example.yml | 1 + mystery_testsuite.yml | 1 + resources/app/cli/args.json | 1 + source/classes/CustomSettings.py | 1 + source/tools/MysteryUtils.py | 1 + 8 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CLI.py b/CLI.py index 85283053..2c925c6c 100644 --- a/CLI.py +++ b/CLI.py @@ -132,7 +132,7 @@ def parse_cli(argv, no_defaults=False): 'flute_mode', 'bow_mode', 'take_any', 'boots_hint', 'shuffle', 'door_shuffle', 'intensity', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'startinventory', - 'usestartinventory', 'bombbag', 'overworld_map', 'restrict_boss_items', + 'usestartinventory', 'bombbag', 'overworld_map', 'restrict_boss_items', 'triforce_max_difference', 'triforce_pool_min', 'triforce_pool_max', 'triforce_goal_min', 'triforce_goal_max', 'triforce_min_difference', 'triforce_goal', 'triforce_pool', 'shufflelinks', 'shuffletavern', 'pseudoboots', 'retro', 'accessibility', 'hints', 'beemizer', 'experimental', 'dungeon_counters', @@ -230,6 +230,7 @@ def parse_settings(): "triforce_goal_min": 0, "triforce_goal_max": 0, "triforce_min_difference": 0, + "triforce_max_difference": 10000, "code": "", "multi": 1, diff --git a/Main.py b/Main.py index 049f5932..17444ce7 100644 --- a/Main.py +++ b/Main.py @@ -146,7 +146,7 @@ def main(args, seed=None, fish=None): 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])) + 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])), min(int(args.triforce_pool_max[p]), world.treasure_hunt_count[p] + int(args.triforce_max_difference[p]))) else: world.treasure_hunt_total[p] = 10 if world.goal[p] == 'trinity' else 30 else: diff --git a/README.md b/README.md index 21a444cc..df21ad17 100644 --- a/README.md +++ b/README.md @@ -573,13 +573,14 @@ Create bps patch(es) instead of generating rom(s) for distribution. `--bps` ### Triforce Hunt Settings -A collection of settings to control the triforce piece pool for the CLI/Mystery +A collection of settings to control the triforce piece pool if not specified through --triforce_goal and --triforce_pool * --triforce_goal_min: Minimum number of pieces to collect to win * --triforce_goal_max: Maximum number of pieces to collect to win * --triforce_pool_min: Minimum number of pieces in item pool * --triforce_pool_max: Maximum number of pieces in item pool * --triforce_min_difference: Minimum difference between pool and goal to win +* --triforce_max_difference: Maximum difference between pool and goal to win ### Seed diff --git a/mystery_example.yml b/mystery_example.yml index 344875f4..92abd726 100644 --- a/mystery_example.yml +++ b/mystery_example.yml @@ -107,6 +107,7 @@ triforce_pool_min: 20 triforce_pool_max: 40 triforce_min_difference: 10 + triforce_max_difference: 15 dungeon_items: standard: 10 mc: 3 diff --git a/mystery_testsuite.yml b/mystery_testsuite.yml index f919b7cc..d6e46832 100644 --- a/mystery_testsuite.yml +++ b/mystery_testsuite.yml @@ -83,6 +83,7 @@ triforce_goal_max: 30 triforce_pool_min: 30 triforce_pool_max: 40 triforce_min_difference: 10 +triforce_max_difference: 12 map_shuffle: on: 1 off: 1 diff --git a/resources/app/cli/args.json b/resources/app/cli/args.json index 5254a1c4..2eaf847e 100644 --- a/resources/app/cli/args.json +++ b/resources/app/cli/args.json @@ -339,6 +339,7 @@ "triforce_goal_min": {}, "triforce_goal_max": {}, "triforce_min_difference": {}, + "triforce_max_difference": {}, "custom": { "type": "bool", "help": "suppress" diff --git a/source/classes/CustomSettings.py b/source/classes/CustomSettings.py index ca0f2062..a0cea069 100644 --- a/source/classes/CustomSettings.py +++ b/source/classes/CustomSettings.py @@ -149,6 +149,7 @@ class CustomSettings(object): args.triforce_pool_min[p] = get_setting(settings['triforce_pool_min'], args.triforce_pool_min[p]) args.triforce_pool_max[p] = get_setting(settings['triforce_pool_max'], args.triforce_pool_max[p]) args.triforce_min_difference[p] = get_setting(settings['triforce_min_difference'], args.triforce_min_difference[p]) + args.triforce_max_difference[p] = get_setting(settings['triforce_max_difference'], args.triforce_max_difference[p]) args.beemizer[p] = get_setting(settings['beemizer'], args.beemizer[p]) # mystery usage diff --git a/source/tools/MysteryUtils.py b/source/tools/MysteryUtils.py index 32ee9d5f..0405efff 100644 --- a/source/tools/MysteryUtils.py +++ b/source/tools/MysteryUtils.py @@ -132,6 +132,7 @@ def roll_settings(weights): 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.triforce_max_difference = get_choice_default('triforce_max_difference', default=10000) ret.mode = get_choice('world_state') if ret.mode == 'retro':