Skip to content

Commit

Permalink
Merge pull request #96 from randovania/bugfix/energy-part-heal
Browse files Browse the repository at this point in the history
Fix energy parts not incrementing current health along with maximum.
  • Loading branch information
henriquegemignani authored May 15, 2022
2 parents 80038be + 733267d commit 6bcbc61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 6 additions & 0 deletions open_dread_rando/files/randomizer_powerup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,9 @@ function RandomizerStormMissile.OnPickedUp(actor, progression)
actor, progression, "ITEM_MULTILOCKON"
)
end

RandomizerEnergyPart = {}
setmetatable(RandomizerEnergyPart, {__index = RandomizerPowerup})
function RandomizerEnergyPart.OnPickedUp(actor, progression)
RandomizerPowerup.IncreaseEnergy({item_id = "ITEM_LIFE_SHARDS"})
end
1 change: 1 addition & 0 deletions open_dread_rando/lua_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def _read_level_lua(level_id: str) -> str:
"ITEM_OPTIC_CAMOUFLAGE": "RandomizerPhantomCloak",
"ITEM_SPEED_BOOSTER": "RandomizerSpeedBooster",
"ITEM_MULTILOCKON": "RandomizerStormMissile",
"ITEM_LIFE_SHARDS": "RandomizerEnergyPart",
}


Expand Down
17 changes: 5 additions & 12 deletions open_dread_rando/pickup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,15 @@ def patch_single_item_pickup(self, bmsad: dict) -> dict:
item_id: str = self.pickup["resources"][0]["item_id"]
quantity: float = self.pickup["resources"][0]["quantity"]

energy_part = item_id == "ITEM_LIFE_SHARDS"
if (item_id == "ITEM_ENERGY_TANKS"
or energy_part and self.configuration["immediate_energy_parts"]
):
energy = self.configuration.get("energy_per_tank", 100.0)
if energy_part:
energy = self.configuration.get("energy_per_part", energy / 4)

quantity *= energy
set_custom_params["Param4"]["value"] = "Custom" if energy_part else "Full"
set_custom_params["Param5"]["value"] = "" if energy_part else "fCurrentLife"
if item_id == "ITEM_ENERGY_TANKS":
quantity *= self.configuration.get("energy_per_tank", 100.0)
set_custom_params["Param4"]["value"] = "Full"
set_custom_params["Param5"]["value"] = "fCurrentLife"
set_custom_params["Param6"]["value"] = "LIFE"

item_id = "fMaxLife"

elif energy_part:
elif item_id == "ITEM_LIFE_SHARDS" and self.configuration["immediate_energy_parts"]:
item_id = "fLifeShards"
set_custom_params["Param4"]["value"] = "Custom"
set_custom_params["Param5"]["value"] = ""
Expand Down

0 comments on commit 6bcbc61

Please sign in to comment.