Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrement counter from required_dna to 0 #462

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/open_samus_returns_rando/files/templates/custom_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down