diff --git a/src/open_samus_returns_rando/files/schema.json b/src/open_samus_returns_rando/files/schema.json index 1738465..7297b04 100644 --- a/src/open_samus_returns_rando/files/schema.json +++ b/src/open_samus_returns_rando/files/schema.json @@ -258,8 +258,7 @@ "required_dna": { "description": "The amount of Metroid DNA required to access Proteus Ridley.", "type": "integer", - "minimum": 0, - "default": 39 + "minimum": 0 }, "reveal_map_on_start": { "type": "boolean", diff --git a/src/open_samus_returns_rando/lua_editor.py b/src/open_samus_returns_rando/lua_editor.py index cbfa684..6e45e51 100644 --- a/src/open_samus_returns_rando/lua_editor.py +++ b/src/open_samus_returns_rando/lua_editor.py @@ -261,6 +261,12 @@ def chunks(array: list[str], n: int) -> Iterable[list[str]]: if "baby_metroid_hint" in configuration: baby_metroid_hint = lua_util.wrap_string(configuration["baby_metroid_hint"]) + if "required_dna" in configuration: + required_dna = configuration["required_dna"] + else: + starting_dna = [item for item in inventory if item.startswith("ITEM_RANDO_DNA")] + required_dna = 39 - len(starting_dna) + replacement = { "new_game_inventory": final_inventory, "starting_scenario": lua_util.wrap_string(starting_location["scenario"]), @@ -276,7 +282,7 @@ def chunks(array: list[str], n: int) -> Iterable[list[str]]: "enable_remote_lua": enable_remote_lua, "baby_metroid_hint": baby_metroid_hint, "tanks_refill_ammo": game_patches["tanks_refill_ammo"], - "required_dna": configuration["required_dna"] + "required_dna": required_dna } return lua_util.replace_lua_template("custom_init.lua", replacement)