Skip to content

Commit

Permalink
Simplified overriding conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkirby committed Oct 24, 2024
1 parent 2e8d548 commit cc7e5b7
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 41 deletions.
28 changes: 19 additions & 9 deletions roll_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ def load_weights_file(weights_fname):
datain = json.load(fin)

weight_options = datain["options"] if "options" in datain else None
conditionals = datain["conditionals"] if "conditionals" in datain else None
weight_multiselect = datain["multiselect"] if "multiselect" in datain else None
weight_dict = datain["weights"]

return weight_options, weight_multiselect, weight_dict
return weight_options, conditionals, weight_multiselect, weight_dict


def generate_balanced_weights(fname="default_weights.json"):
Expand Down Expand Up @@ -128,19 +129,19 @@ def draw_dungeon_shortcuts(random_settings):
def generate_weights_override(weights, override_weights_fname):
# Load the weight dictionary
if weights == "RSL":
weight_options, weight_multiselect, weight_dict = load_weights_file("weights/rsl_season6.json")
weight_options, conditionals, weight_multiselect, weight_dict = load_weights_file("weights/rsl_season6.json")
elif weights == "full-random":
weight_options = None
weight_dict = generate_balanced_weights(None)
else:
weight_options, weight_multiselect, weight_dict = load_weights_file(weights)
weight_options, conditionals, weight_multiselect, weight_dict = load_weights_file(weights)


# If an override_weights file name is provided, load it
start_with = {"starting_inventory":[], "starting_songs":[], "starting_equipment":[]}
if override_weights_fname is not None:
print(f"RSL GENERATOR: LOADING OVERRIDE WEIGHTS from {override_weights_fname}")
override_options, override_multiselect, override_weights = load_weights_file(override_weights_fname)
override_options, override_conditionals, override_multiselect, override_weights = load_weights_file(override_weights_fname)
# Check for starting items, songs and equipment
for key in start_with.keys():
if key in override_weights.keys():
Expand Down Expand Up @@ -179,16 +180,21 @@ def generate_weights_override(weights, override_weights_fname):
for key, value in override_weights.items():
weight_dict[key] = value

# Replace the conditionals
if override_conditionals is not None:
for name, state in override_conditionals.items():
conditionals[name] = state

# Replace the multiselects
if override_multiselect is not None:
for key, value in override_multiselect.items():
weight_multiselect[key] = value

return weight_options, weight_multiselect, weight_dict, start_with
return weight_options, conditionals, weight_multiselect, weight_dict, start_with


def generate_plando(weights, override_weights_fname, no_seed):
weight_options, weight_multiselects, weight_dict, start_with = generate_weights_override(weights, override_weights_fname)
weight_options, conditionals, weight_multiselects, weight_dict, start_with = generate_weights_override(weights, override_weights_fname)

####################################################################################
# Make a new function that parses the weights file that does this stuff
Expand All @@ -215,10 +221,14 @@ def generate_plando(weights, override_weights_fname, no_seed):
if weight_multiselects is not None:
random_settings.update(resolve_multiselects(weight_multiselects))

# Add starting items, conditionals, tricks, excluded locations, and misc hints
# Set the conditionals
if conditionals is not None:
conds.parse_conditionals(conditionals, weight_dict, random_settings, start_with)

# Add starting items, tricks, and excluded locations
if weight_options is not None:
if "conditionals" in weight_options:
conds.parse_conditionals(weight_options["conditionals"], weight_dict, random_settings, start_with)
# if "conditionals" in weight_options:
# conds.parse_conditionals(weight_options["conditionals"], weight_dict, random_settings, start_with)
if "tricks" in weight_options:
random_settings["allowed_tricks"] = weight_options["tricks"]
if "disabled_locations" in weight_options:
Expand Down
2 changes: 1 addition & 1 deletion rslversion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.7.3"
__version__ = "2.7.4"

# Randomizer Info
randomizer_repo = 'rrealmuto/OoT-Randomizer'
Expand Down
16 changes: 7 additions & 9 deletions weights/beginner_override.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
"ganon_bosskey_tokens_max": 50,
"bridge_hearts_max": 10,
"ganon_bosskey_hearts_max": 10,
"triforce_goal_per_world_max": 75,
"conditionals": {
"split_collectible_bridge_conditions": [true, "10%", "50/50", "40/40/20"],
"select_one_pots_crates_freestanding": [false]
},
"extra_conditionals": {
"limit_mixed_pool_entrances": [true, 2, true],
"keysanity_key_get_keyrings": [true]
}
"triforce_goal_per_world_max": 75
},
"conditionals": {
"split_collectible_bridge_conditions": [true, "10%", "50/50", "40/40/20"],
"select_one_pots_crates_freestanding": [false],
"limit_mixed_pool_entrances": [true, 2, true],
"keysanity_key_get_keyrings": [true]
},
"weights": {
"bridge": {
Expand Down
44 changes: 22 additions & 22 deletions weights/rsl_season6.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,6 @@
"ganon_bosskey_hearts_max": 20,
"triforce_goal_per_world_max": 100,
"starting_items": true,
"conditionals": {
"constant_triforce_hunt_extras": [true],
"exclude_ice_trap_misery": [true],
"disable_keysanity_independence": [true],
"random_scrubs_start_wallet": [true],
"split_collectible_bridge_conditions": [true, "15%", "50/50", "40/40/20"],
"replace_dampe_diary_hint_with_lightarrow": [true],
"adjust_chaos_hint_distro": [true],
"exclude_mapcompass_info_remove": [true],
"ohko_starts_with_nayrus": [true],
"shuffle_valley_lake_exit": [true],
"select_one_pots_crates_freestanding": [true, "20%", "1/1/1", "1/1/1"],
"geometrically_draw_dungeon_shortcuts": [true],
"limit_overworld_entrances_in_mixed_entrance_pools": [true, "20%"],
"restrict_one_entrance_randomizer": [false],
"disable_pot_chest_texture_independence": [false],
"shuffle_goal_hints": [false, "50%"],
"invert_dungeons_mq_count": [false, "0%"],
"exclude_minimal_triforce_hunt": [false],
"limit_mixed_pool_entrances": [false, 2, false],
"keysanity_key_get_keyrings": [false]
},
"misc_hints": [
"altar",
"dampe_diary",
Expand Down Expand Up @@ -61,6 +39,28 @@
],
"disabled_locations": []
},
"conditionals": {
"constant_triforce_hunt_extras": [true],
"exclude_ice_trap_misery": [true],
"disable_keysanity_independence": [true],
"random_scrubs_start_wallet": [true],
"split_collectible_bridge_conditions": [true, "15%", "50/50", "40/40/20"],
"replace_dampe_diary_hint_with_lightarrow": [true],
"adjust_chaos_hint_distro": [true],
"exclude_mapcompass_info_remove": [true],
"ohko_starts_with_nayrus": [true],
"shuffle_valley_lake_exit": [true],
"select_one_pots_crates_freestanding": [true, "20%", "1/1/1", "1/1/1"],
"geometrically_draw_dungeon_shortcuts": [true],
"limit_overworld_entrances_in_mixed_entrance_pools": [true, "20%"],
"restrict_one_entrance_randomizer": [false],
"disable_pot_chest_texture_independence": [false],
"shuffle_goal_hints": [false, "50%"],
"invert_dungeons_mq_count": [false, "0%"],
"exclude_minimal_triforce_hunt": [false],
"limit_mixed_pool_entrances": [false, 2, false],
"keysanity_key_get_keyrings": [false]
},
"multiselect": {
"key_rings": 20,
"silver_rupee_pouches": 100,
Expand Down

0 comments on commit cc7e5b7

Please sign in to comment.