diff --git a/open_dread_rando/files/randomizer_powerup.lua b/open_dread_rando/files/randomizer_powerup.lua index 260498a5c..1a3c57456 100644 --- a/open_dread_rando/files/randomizer_powerup.lua +++ b/open_dread_rando/files/randomizer_powerup.lua @@ -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 diff --git a/open_dread_rando/lua_editor.py b/open_dread_rando/lua_editor.py index 87df25b6b..a6e972d57 100644 --- a/open_dread_rando/lua_editor.py +++ b/open_dread_rando/lua_editor.py @@ -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", } diff --git a/open_dread_rando/pickup.py b/open_dread_rando/pickup.py index b59eb2051..e6065c4c4 100644 --- a/open_dread_rando/pickup.py +++ b/open_dread_rando/pickup.py @@ -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"] = ""