From ae60d0dcc7e1ee1afc5cce1a417b5db06f094dba Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:11:11 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.1...v0.6.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae7d7ff..fb5234b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.6.1 + rev: v0.6.2 hooks: - id: ruff args: [ --fix, --exit-non-zero-on-fix ] \ No newline at end of file From dc2388b5800c56e3b0c864ca69d43f12a385888f Mon Sep 17 00:00:00 2001 From: Thanatos <117127188+ThanatosGit@users.noreply.github.com> Date: Tue, 27 Aug 2024 22:28:51 +0200 Subject: [PATCH 2/5] Cleanup total dna counter functions (#461) --- .../files/custom/guilib.lua | 29 +++++++++++++++++-- .../files/custom/scenario.lua | 9 +----- .../files/templates/randomizerpowerup.lua | 20 +++---------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/open_samus_returns_rando/files/custom/guilib.lua b/src/open_samus_returns_rando/files/custom/guilib.lua index 15651bb..8c79646 100644 --- a/src/open_samus_returns_rando/files/custom/guilib.lua +++ b/src/open_samus_returns_rando/files/custom/guilib.lua @@ -64,9 +64,19 @@ function GUILib.UpdateDNACounter(currentDNA, maxDNA) end end +function GUILib.GetTotalDNACounter() + return GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter") +end + function GUILib.UpdateTotalDNAColor() - if Game.GetItemAmount(Game.GetPlayerName(), "ITEM_ADN") < 39 then - local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter") + local dnaCounter = GUILib.GetTotalDNACounter() + if Blackboard.GetProp("GAME", "OBJECTIVE_COMPLETE") then + GUI.SetProperties(dnaCounter, { + ColorR = "0.60392", + ColorG = "0.61569", + ColorB = "0.04314", + }) + else GUI.SetProperties(dnaCounter, { ColorR = "0.68000", ColorG = "0.83000", @@ -75,6 +85,21 @@ function GUILib.UpdateTotalDNAColor() end end +function GUILib.BlinkTotalDNACounter() + local dnaCounter = GUILib.GetTotalDNACounter() + GUI.SetProperties(dnaCounter, { + ColorR = "0.60392", + ColorG = "0.61569", + ColorB = "0.04314", + Blink = "1.00000", + }) +end + +function GUILib.DisableBlinkTotalDNACounter() + local dnaCounter = GUILib.GetTotalDNACounter() + GUI.SetProperties(dnaCounter, { Blink = "0.00000" }) +end + function GUILib.AddMessageBox() local randoUI = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.USSEF.Outer") if randoUI ~= nil then diff --git a/src/open_samus_returns_rando/files/custom/scenario.lua b/src/open_samus_returns_rando/files/custom/scenario.lua index 0179b26..f0affc3 100644 --- a/src/open_samus_returns_rando/files/custom/scenario.lua +++ b/src/open_samus_returns_rando/files/custom/scenario.lua @@ -88,14 +88,7 @@ function Scenario.UpdateDNACounter() local maxDNA = Init.tDNAPerArea[scenario] or 0 local currentDNA = Blackboard.GetProp("GAME", scenario .."_acquired_dna") or 0 GUILib.UpdateDNACounter(currentDNA, maxDNA) - if Blackboard.GetProp("GAME", "OBJECTIVE_COMPLETE") then - local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter") - GUI.SetProperties(dnaCounter, { - ColorR = "0.60392", - ColorG = "0.61569", - ColorB = "0.04314", - }) - end + GUILib.UpdateTotalDNAColor() end local original_init = Scenario.InitScenario diff --git a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua index a43504a..cd6ee1f 100644 --- a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua +++ b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua @@ -1,3 +1,5 @@ +Game.ImportLibrary("system/scripts/guilib.lua", false) + RandomizerPowerup = RandomizerPowerup or {} function RandomizerPowerup.main() end @@ -204,8 +206,8 @@ function RandomizerPowerup.ObjectiveComplete() if RandomizerPowerup.GetItemAmount("ITEM_ADN") == required_dna then Blackboard.SetProp("GAME", "OBJECTIVE_COMPLETE", "b", true) Game.HUDIdleScreenLeave() - RandomizerPowerup.UpdateDNACounter() - Game.AddGUISF(3, "RandomizerPowerup.DisableBlink", "") + GUILib.BlinkTotalDNACounter() + Game.AddGUISF(3, "GUILib.DisableBlinkTotalDNACounter", "") -- Assign boss names and areas to each boss local boss = Init.sFinalBoss @@ -241,20 +243,6 @@ function RandomizerPowerup.ObjectiveComplete() end end -function RandomizerPowerup.UpdateDNACounter() - local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter") - GUI.SetProperties(dnaCounter, { - ColorR = "0.60392", - ColorG = "0.61569", - ColorB = "0.04314", - Blink = "1.00000", - }) -end - -function RandomizerPowerup.DisableBlink() - local dnaCounter = GUI.GetDisplayObject("IngameMenuRoot.IngameMenuComposition.LowerComposition.LowerInfoComposition.DNACounter") - GUI.SetProperties(dnaCounter, { Blink = "0.00000" }) -end function RandomizerPowerup.IncreaseMissileCheckValue() -- Update the min missile reserve tank refill value (capped by config) From 83985bfe6cbc499e85e4743f2d056baa80dc8129 Mon Sep 17 00:00:00 2001 From: Thanatos <117127188+ThanatosGit@users.noreply.github.com> Date: Tue, 27 Aug 2024 23:35:08 +0200 Subject: [PATCH 3/5] Decrement counter from required_dna to 0 (#462) --- .../files/levels/s110_surfaceb.lua | 2 +- .../files/templates/custom_init.lua | 6 +----- .../files/templates/randomizerpowerup.lua | 10 ++-------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/open_samus_returns_rando/files/levels/s110_surfaceb.lua b/src/open_samus_returns_rando/files/levels/s110_surfaceb.lua index 8ed809a..042f034 100644 --- a/src/open_samus_returns_rando/files/levels/s110_surfaceb.lua +++ b/src/open_samus_returns_rando/files/levels/s110_surfaceb.lua @@ -61,7 +61,7 @@ function s110_surfaceb.ElevatorSetTarget(_ARG_0_) end function s110_surfaceb.InitFromBlackboard() s110_surfaceb.SetLowModelsVisibility(false) - if Game.GetItemAmount(Game.GetPlayerName(), "ITEM_ADN") < 39 and Game.GetItemAmount(Game.GetPlayerName(), "ITEM_BABY_HATCHLING") < 1 then + if Game.GetItemAmount(Game.GetPlayerName(), "ITEM_ADN") > 0 and Game.GetItemAmount(Game.GetPlayerName(), "ITEM_BABY_HATCHLING") < 1 then Game.PlayMusicStream(0, "streams/music/t_m2_surface_arr1.wav", -1, -1, -1, 2, 2, 1) end if Blackboard.GetProp("DEFEATED_ENEMIES", "Ridley") and Game.GetEntity("TG_Ridley_Access") ~= nil then diff --git a/src/open_samus_returns_rando/files/templates/custom_init.lua b/src/open_samus_returns_rando/files/templates/custom_init.lua index e671ab9..2c8ee79 100644 --- a/src/open_samus_returns_rando/files/templates/custom_init.lua +++ b/src/open_samus_returns_rando/files/templates/custom_init.lua @@ -62,14 +62,10 @@ function Init.InitGameBlackboard() end end Blackboard.SetProp("GAME", "OBJECTIVE_COMPLETE", "b", false) + Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_ADN", "f", Init.iRequiredDNA) if Init.iRequiredDNA == 0 then -- If no DNA is required, then the path to Ridley should always be open Blackboard.SetProp("GAME", "OBJECTIVE_COMPLETE", "b", true) - Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_ADN", "f", 39) - elseif Init.iRequiredDNA <= 39 then - Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_ADN", "f", 39 - Init.iRequiredDNA) - else - Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_ADN", "f", 0) end Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_METROID_COUNT", "f", 0) Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_CURRENT_LIFE", "f", Init.tNewGameInventory.ITEM_MAX_LIFE) diff --git a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua index cd6ee1f..7ff5b79 100644 --- a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua +++ b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua @@ -160,7 +160,7 @@ function RandomizerPowerup.HandlePickupResources(progression, actorOrName) Blackboard.SetProp("GAME", scenario .. "_acquired_dna", "i", currentDNA + 1) end Scenario.UpdateDNACounter() - RandomizerPowerup.IncreaseItemAmount("ITEM_ADN", resource.quantity) + RandomizerPowerup.IncreaseItemAmount("ITEM_ADN", -1 * resource.quantity) RandomizerPowerup.ObjectiveComplete() end end @@ -197,13 +197,7 @@ function RandomizerPowerup.IncreaseAmmo(resource) end function RandomizerPowerup.ObjectiveComplete() - local required_dna = 39 - -- Default required_dna is 39, so change the requirement if set higher in the config - if Init.iRequiredDNA > 39 then - required_dna = Init.iRequiredDNA - end - - if RandomizerPowerup.GetItemAmount("ITEM_ADN") == required_dna then + if RandomizerPowerup.GetItemAmount("ITEM_ADN") == 0 and not Blackboard.GetProp("GAME", "OBJECTIVE_COMPLETE") then Blackboard.SetProp("GAME", "OBJECTIVE_COMPLETE", "b", true) Game.HUDIdleScreenLeave() GUILib.BlinkTotalDNACounter() From ff2382bef4f73a9453b9f566fa2cd6fab2869417 Mon Sep 17 00:00:00 2001 From: Thanatos <117127188+ThanatosGit@users.noreply.github.com> Date: Tue, 27 Aug 2024 23:36:05 +0200 Subject: [PATCH 4/5] Move required_dna to correct place (#463) --- tests/test_files/starter_preset_patcher.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_files/starter_preset_patcher.json b/tests/test_files/starter_preset_patcher.json index f726392..264dced 100644 --- a/tests/test_files/starter_preset_patcher.json +++ b/tests/test_files/starter_preset_patcher.json @@ -4036,7 +4036,10 @@ } } }, - "required_dna": 10, + "objective": { + "final_boss": "Ridley", + "required_dna": 10 + }, "energy_per_tank": 100, "reserves_per_tank": { "life_tank_size": 299, From 6d02ea29356f49ab2d1d7f53cc94dc4a312b116c Mon Sep 17 00:00:00 2001 From: Thanatos <117127188+ThanatosGit@users.noreply.github.com> Date: Tue, 27 Aug 2024 23:39:39 +0200 Subject: [PATCH 5/5] Import consistency in main patcher file (#464) --- src/open_samus_returns_rando/samus_returns_patcher.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/open_samus_returns_rando/samus_returns_patcher.py b/src/open_samus_returns_rando/samus_returns_patcher.py index 1aaeadc..1a2818b 100644 --- a/src/open_samus_returns_rando/samus_returns_patcher.py +++ b/src/open_samus_returns_rando/samus_returns_patcher.py @@ -21,10 +21,11 @@ from open_samus_returns_rando.patcher_editor import PatcherEditor from open_samus_returns_rando.pickups.custom_pickups import patch_custom_pickups from open_samus_returns_rando.pickups.pickup import patch_pickups -from open_samus_returns_rando.specific_patches import cosmetic_patches, game_patches from open_samus_returns_rando.specific_patches.chozo_seal_patches import patch_chozo_seals +from open_samus_returns_rando.specific_patches.cosmetic_patches import patch_cosmetics from open_samus_returns_rando.specific_patches.door_patches import patch_doors from open_samus_returns_rando.specific_patches.environmental_damage import apply_constant_damage +from open_samus_returns_rando.specific_patches.game_patches import apply_game_patches from open_samus_returns_rando.specific_patches.heat_room_patches import patch_heat_rooms from open_samus_returns_rando.specific_patches.hint_patches import patch_hints from open_samus_returns_rando.specific_patches.metroid_patches import patch_metroids @@ -111,7 +112,7 @@ def patch_extracted(input_path: Path, input_exheader: Path | None, output_path: patch_tunables(editor, configuration) # Patch cosmetics - cosmetic_patches.patch_cosmetics(editor, configuration.get("cosmetic_patches", {})) + patch_cosmetics(editor, configuration.get("cosmetic_patches", {})) # Patch metroids patch_metroids(editor) @@ -121,7 +122,7 @@ def patch_extracted(input_path: Path, input_exheader: Path | None, output_path: patch_hints(lua_scripts, configuration["hints"]) # Specific game patches - game_patches.apply_game_patches(editor, configuration.get("game_patches", {})) + apply_game_patches(editor, configuration.get("game_patches", {})) # Text patches if "text_patches" in configuration: