Skip to content

Commit

Permalink
Decrement counter from required_dna to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Aug 27, 2024
1 parent 6494b3e commit c885f83
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
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

0 comments on commit c885f83

Please sign in to comment.