From 902d03d447344f06397633255f2cf3f50d484203 Mon Sep 17 00:00:00 2001 From: threeandthreee Date: Wed, 15 Jan 2025 21:42:19 -0500 Subject: [PATCH] LADX: Stabilize Item Pool Option (#3935) Co-authored-by: Scipio Wright Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> --- worlds/ladx/LADXR/itempool.py | 6 ++++-- worlds/ladx/Options.py | 9 +++++++++ worlds/ladx/__init__.py | 13 ++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/worlds/ladx/LADXR/itempool.py b/worlds/ladx/LADXR/itempool.py index 50314883..68f3e54e 100644 --- a/worlds/ladx/LADXR/itempool.py +++ b/worlds/ladx/LADXR/itempool.py @@ -68,10 +68,12 @@ DEFAULT_ITEM_POOL = { class ItemPool: - def __init__(self, logic, settings, rnd): + def __init__(self, logic, settings, rnd, stabilize_item_pool: bool): self.__pool = {} self.__setup(logic, settings) - self.__randomizeRupees(settings, rnd) + + if not stabilize_item_pool: + self.__randomizeRupees(settings, rnd) def add(self, item, count=1): self.__pool[item] = self.__pool.get(item, 0) + count diff --git a/worlds/ladx/Options.py b/worlds/ladx/Options.py index d92bd931..a35bb870 100644 --- a/worlds/ladx/Options.py +++ b/worlds/ladx/Options.py @@ -527,6 +527,13 @@ class InGameHints(DefaultOnToggle): display_name = "In-game Hints" +class StabilizeItemPool(DefaultOffToggle): + """ + By default, rupees in the item pool may be randomly swapped with bombs, arrows, powders, or capacity upgrades. This option disables that swapping, which is useful for plando. + """ + display_name = "Stabilize Item Pool" + + class ForeignItemIcons(Choice): """ Choose how to display foreign items. @@ -562,6 +569,7 @@ ladx_option_groups = [ TrendyGame, InGameHints, NagMessages, + StabilizeItemPool, Quickswap, HardMode, BootsControls @@ -631,6 +639,7 @@ class LinksAwakeningOptions(PerGameCommonOptions): no_flash: NoFlash in_game_hints: InGameHints overworld: Overworld + stabilize_item_pool: StabilizeItemPool warp_improvements: Removed additional_warp_points: Removed diff --git a/worlds/ladx/__init__.py b/worlds/ladx/__init__.py index 09a25eb1..f20b7f80 100644 --- a/worlds/ladx/__init__.py +++ b/worlds/ladx/__init__.py @@ -138,7 +138,8 @@ class LinksAwakeningWorld(World): world_setup = LADXRWorldSetup() world_setup.randomize(self.ladxr_settings, self.random) self.ladxr_logic = LADXRLogic(configuration_options=self.ladxr_settings, world_setup=world_setup) - self.ladxr_itempool = LADXRItemPool(self.ladxr_logic, self.ladxr_settings, self.random).toDict() + self.ladxr_itempool = LADXRItemPool(self.ladxr_logic, self.ladxr_settings, self.random, bool(self.options.stabilize_item_pool)).toDict() + def generate_early(self) -> None: self.dungeon_item_types = { @@ -225,7 +226,7 @@ class LinksAwakeningWorld(World): for _ in range(count): if item_name in exclude: exclude.remove(item_name) # this is destructive. create unique list above - self.multiworld.itempool.append(self.create_item("Nothing")) + self.multiworld.itempool.append(self.create_item(self.get_filler_item_name())) else: item = self.create_item(item_name) @@ -499,8 +500,14 @@ class LinksAwakeningWorld(World): state.prog_items[self.player]["RUPEES"] -= self.rupees[item.name] return change + # Same fill choices and weights used in LADXR.itempool.__randomizeRupees + filler_choices = ("Bomb", "Single Arrow", "10 Arrows", "Magic Powder", "Medicine") + filler_weights = ( 10, 5, 10, 10, 1) + def get_filler_item_name(self) -> str: - return "Nothing" + if self.options.stabilize_item_pool: + return "Nothing" + return self.random.choices(self.filler_choices, self.filler_weights)[0] def fill_slot_data(self): slot_data = {}