Skip to content

Commit

Permalink
Remove aeion tanks logic and handle them as ammo upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Oct 11, 2023
1 parent 3212e30 commit 4eabd1b
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 54 deletions.
28 changes: 8 additions & 20 deletions open_samus_returns_rando/files/randomizer_powerup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ function RandomizerPowerup.IncreaseItemAmount(item_id, quantity, capacity)
end
target = math.max(target, 0)
RandomizerPowerup.SetItemAmount(item_id, target)

if item_id == "ITEM_CURRENT_SPECIAL_ENERGY" then
local specialEnergy = Game.GetPlayer().SPECIALENERGY
specialEnergy.fMaxEnergy = capacity + quantity
specialEnergy.fEnergy = capacity + quantity
end
end

function RandomizerPowerup.OnPickedUp(resources)
Expand Down Expand Up @@ -123,6 +129,8 @@ function RandomizerPowerup.IncreaseAmmo(resource)
current_id = "ITEM_WEAPON_SUPER_MISSILE_CURRENT"
elseif resource.item_id == "ITEM_WEAPON_POWER_BOMB_MAX" then
current_id = "ITEM_WEAPON_POWER_BOMB_CURRENT"
elseif resource.item_id == "ITEM_MAX_SPECIAL_ENERGY" then
current_id = "ITEM_CURRENT_SPECIAL_ENERGY"
end

if current_id == nil then return end
Expand All @@ -143,19 +151,6 @@ function RandomizerPowerup.IncreaseEnergy()
life.fCurrentLife = new_max
end

MAX_AEION= 2200
function RandomizerPowerup.IncreaseAeion()
local aeion = Init.fAeionPerTank
local new_max = RandomizerPowerup.GetItemAmount("ITEM_MAX_SPECIAL_ENERGY") + aeion
new_max = math.min(new_max, MAX_AEION)
RandomizerPowerup.SetItemAmount("ITEM_MAX_SPECIAL_ENERGY", new_max)
RandomizerPowerup.SetItemAmount("ITEM_CURRENT_SPECIAL_ENERGY", new_max)

local specialEnergy = Game.GetPlayer().SPECIALENERGY
specialEnergy.fMaxEnergy = new_max
specialEnergy.fEnergy = new_max
end

RandomizerPowerBomb = {}
setmetatable(RandomizerPowerBomb, {__index = RandomizerPowerup})
function RandomizerPowerBomb.OnPickedUp(progression)
Expand Down Expand Up @@ -247,13 +242,6 @@ function RandomizerEnergyTank.OnPickedUp(progression)
RandomizerPowerup.IncreaseEnergy()
end

RandomizerAeionTank = {}
setmetatable(RandomizerAeionTank, {__index = RandomizerPowerup})
function RandomizerAeionTank.OnPickedUp(progression)
RandomizerPowerup.OnPickedUp(progression)
RandomizerPowerup.IncreaseAeion()
end

RandomizerBabyHatchling = {}
setmetatable(RandomizerBabyHatchling, {__index = RandomizerPowerup})
function RandomizerBabyHatchling.OnPickedUp(progression)
Expand Down
6 changes: 0 additions & 6 deletions open_samus_returns_rando/files/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@
"type": "number",
"default": 100.0
},
"aeion_per_tank": {
"description": "How much aeion collecting an Aeion Tank gives",
"type": "number",
"default": 50.0
},
"reveal_map_on_start": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -325,7 +320,6 @@
"ITEM_SCREW_ATTACK",
"ITEM_BABY_HATCHLING",
"ITEM_ENERGY_TANKS",
"ITEM_AEION_TANKS",
"ITEM_METROID_COUNT",
"ITEM_METROID_TOTAL_COUNT",
"ITEM_ADN",
Expand Down
1 change: 0 additions & 1 deletion open_samus_returns_rando/files/templates/custom_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Init.bRevealMap = TEMPLATE("reveal_map_on_start")
Init.sStartingScenario = TEMPLATE("starting_scenario")
Init.sStartingActor = TEMPLATE("starting_actor")
Init.fEnergyPerTank = TEMPLATE("energy_per_tank")
Init.fAeionPerTank = TEMPLATE("aeion_per_tank")

Game.LogWarn(0, "Inventory:")
for k, v in pairs(Init.tNewGameInventory) do
Expand Down
3 changes: 1 addition & 2 deletions open_samus_returns_rando/lua_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def _read_level_lua(level_id: str) -> str:
"ITEM_SPECIAL_ENERGY_ENERGY_WAVE": "RandomizerEnergyWave",
"ITEM_SPECIAL_ENERGY_PHASE_DISPLACEMENT": "RandomizerPhaseDisplacement",
"ITEM_ENERGY_TANKS": "RandomizerEnergyTank",
"ITEM_AEION_TANKS": "RandomizerAeionTank",
}

SPECIFIC_SOUNDS = {
Expand All @@ -36,7 +35,7 @@ def _read_level_lua(level_id: str) -> str:
"ITEM_SPECIAL_ENERGY_ENERGY_WAVE": "streams/music/special_ability2_32.wav",
"ITEM_SPECIAL_ENERGY_PHASE_DISPLACEMENT": "streams/music/special_ability2_32.wav",
"ITEM_ENERGY_TANKS": "streams/music/tank_jingle.wav",
"ITEM_AEION_TANKS": "streams/music/tank_jingle.wav",
"ITEM_MAX_SPECIAL_ENERGY": "streams/music/tank_jingle.wav",
"ITEM_SUPER_MISSILE_TANKS": "streams/music/tank_jingle.wav",
"ITEM_POWER_BOMB_TANKS": "streams/music/tank_jingle.wav",
"ITEM_WEAPON_MISSILE_MAX": "streams/music/tank_jingle.wav",
Expand Down
7 changes: 0 additions & 7 deletions open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,13 @@ def create_custom_init(configuration: dict) -> str:
energy_per_tank = configuration["energy_per_tank"]
max_life = inventory.pop("ITEM_MAX_LIFE")

aeion_per_tank = configuration["aeion_per_tank"]
max_aeion = inventory.pop("ITEM_MAX_SPECIAL_ENERGY")

# increase starting HP if starting with etanks
if "ITEM_ENERGY_TANKS" in inventory:
etanks = inventory.pop("ITEM_ENERGY_TANKS")
max_life += etanks * energy_per_tank

# increase starting Aeion if starting with atanks
if "ITEM_AEION_TANKS" in inventory:
atanks = inventory.pop("ITEM_AEION_TANKS")
max_aeion += atanks * aeion_per_tank

# These fields are required to start the game
final_inventory = {
"ITEM_MAX_LIFE": max_life,
Expand All @@ -68,7 +62,6 @@ def create_custom_init(configuration: dict) -> str:
"starting_scenario": lua_util.wrap_string(starting_location["scenario"]),
"starting_actor": lua_util.wrap_string(starting_location["actor"]),
"energy_per_tank": energy_per_tank,
"aeion_per_tank": aeion_per_tank,
"reveal_map_on_start": configuration["reveal_map_on_start"],
}

Expand Down
86 changes: 68 additions & 18 deletions tests/test_files/models_surface.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,39 @@
"actor": "StartPoint0"
},
"starting_items": {
"ITEM_MAX_LIFE": 599,
"ITEM_WEAPON_MISSILE_MAX": 50,
"ITEM_WEAPON_SUPER_MISSILE_MAX": 0,
"ITEM_WEAPON_POWER_BOMB_MAX": 0,
"ITEM_METROID_COUNT": 0,
"ITEM_METROID_TOTAL_COUNT": 40
"ITEM_WEAPON_MISSILE_MAX": 24,
"ITEM_SPECIAL_ENERGY_SCANNING_PULSE": 1,
"ITEM_RANDO_DNA_11": 1,
"ITEM_RANDO_DNA_12": 1,
"ITEM_RANDO_DNA_13": 1,
"ITEM_RANDO_DNA_14": 1,
"ITEM_RANDO_DNA_15": 1,
"ITEM_RANDO_DNA_16": 1,
"ITEM_RANDO_DNA_17": 1,
"ITEM_RANDO_DNA_18": 1,
"ITEM_RANDO_DNA_19": 1,
"ITEM_RANDO_DNA_20": 1,
"ITEM_RANDO_DNA_21": 1,
"ITEM_RANDO_DNA_22": 1,
"ITEM_RANDO_DNA_23": 1,
"ITEM_RANDO_DNA_24": 1,
"ITEM_RANDO_DNA_25": 1,
"ITEM_RANDO_DNA_26": 1,
"ITEM_RANDO_DNA_27": 1,
"ITEM_RANDO_DNA_28": 1,
"ITEM_RANDO_DNA_29": 1,
"ITEM_RANDO_DNA_30": 1,
"ITEM_RANDO_DNA_31": 1,
"ITEM_RANDO_DNA_32": 1,
"ITEM_RANDO_DNA_33": 1,
"ITEM_RANDO_DNA_34": 1,
"ITEM_RANDO_DNA_35": 1,
"ITEM_RANDO_DNA_36": 1,
"ITEM_RANDO_DNA_37": 1,
"ITEM_RANDO_DNA_38": 1,
"ITEM_RANDO_DNA_39": 1,
"ITEM_MAX_LIFE": 99,
"ITEM_MAX_SPECIAL_ENERGY": 1000
},
"pickups": [
{
Expand Down Expand Up @@ -72,11 +99,15 @@
},
{
"pickup_type": "actor",
"caption": "Power Bomb acquired.",
"caption": "Main Power Bomb acquired.",
"resources": [
[
{
"item_id": "ITEM_WEAPON_POWER_BOMB_MAX",
"item_id": "ITEM_WEAPON_POWER_BOMB",
"quantity": 1
},
{
"item_id": "ITEM_POWER_BOMB_TANKS",
"quantity": 5
}
]
Expand Down Expand Up @@ -281,11 +312,15 @@
},
{
"pickup_type": "actor",
"caption": "Super Missile acquired.",
"caption": "Super Missile Launcher acquired.",
"resources": [
[
{
"item_id": "ITEM_WEAPON_SUPER_MISSILE_MAX",
"item_id": "ITEM_WEAPON_SUPER_MISSILE",
"quantity": 1
},
{
"item_id": "ITEM_SUPER_MISSILE_TANKS",
"quantity": 5
}
]
Expand Down Expand Up @@ -344,6 +379,10 @@
{
"item_id": "ITEM_SPECIAL_ENERGY_SCANNING_PULSE",
"quantity": 1
},
{
"item_id": "ITEM_MAX_SPECIAL_ENERGY",
"quantity": 150
}
]
],
Expand All @@ -363,6 +402,10 @@
{
"item_id": "ITEM_SPECIAL_ENERGY_ENERGY_SHIELD",
"quantity": 1
},
{
"item_id": "ITEM_MAX_SPECIAL_ENERGY",
"quantity": 150
}
]
],
Expand All @@ -382,6 +425,10 @@
{
"item_id": "ITEM_SPECIAL_ENERGY_ENERGY_WAVE",
"quantity": 1
},
{
"item_id": "ITEM_MAX_SPECIAL_ENERGY",
"quantity": 150
}
]
],
Expand All @@ -401,6 +448,10 @@
{
"item_id": "ITEM_SPECIAL_ENERGY_PHASE_DISPLACEMENT",
"quantity": 1
},
{
"item_id": "ITEM_MAX_SPECIAL_ENERGY",
"quantity": 150
}
]
],
Expand Down Expand Up @@ -452,11 +503,11 @@
},
{
"pickup_type": "actor",
"caption": "Super Missile Tank acquired. Super Missile capacity increased by 1.",
"caption": "Super Missile Tank acquired.\nSuper Missile capacity increased by 1.",
"resources": [
[
{
"item_id": "ITEM_RANDO_LOCKED_SUPERS",
"item_id": "ITEM_SUPER_MISSILE_TANKS",
"quantity": 1
}
]
Expand All @@ -471,11 +522,11 @@
},
{
"pickup_type": "actor",
"caption": "Power Bomb Tank acquired. Power Bomb capacity increased by 1.",
"caption": "Power Bomb Tank acquired.\nPower Bomb capacity increased by 1.",
"resources": [
[
{
"item_id": "ITEM_RANDO_LOCKED_PBS",
"item_id": "ITEM_POWER_BOMB_TANKS",
"quantity": 1
}
]
Expand All @@ -490,12 +541,12 @@
},
{
"pickup_type": "actor",
"caption": "Aeion Tank acquired. Aeion capacity increased.",
"caption": "Aeion Tank acquired.\nAeion Gauge expanded.",
"resources": [
[
{
"item_id": "ITEM_AEION_TANKS",
"quantity": 1
"item_id": "ITEM_MAX_SPECIAL_ENERGY",
"quantity": 50
}
]
],
Expand Down Expand Up @@ -566,7 +617,6 @@
}
],
"energy_per_tank": 100,
"aeion_per_tank": 50,
"reveal_map_on_start": true,
"game_patches": {
"nerf_power_bombs": false
Expand Down

0 comments on commit 4eabd1b

Please sign in to comment.