LADX: Stabilize Item Pool Option (#3935)
Co-authored-by: Scipio Wright <scipiowright@gmail.com> Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
This commit is contained in:
parent
b7621a0923
commit
902d03d447
|
@ -68,10 +68,12 @@ DEFAULT_ITEM_POOL = {
|
||||||
|
|
||||||
|
|
||||||
class ItemPool:
|
class ItemPool:
|
||||||
def __init__(self, logic, settings, rnd):
|
def __init__(self, logic, settings, rnd, stabilize_item_pool: bool):
|
||||||
self.__pool = {}
|
self.__pool = {}
|
||||||
self.__setup(logic, settings)
|
self.__setup(logic, settings)
|
||||||
self.__randomizeRupees(settings, rnd)
|
|
||||||
|
if not stabilize_item_pool:
|
||||||
|
self.__randomizeRupees(settings, rnd)
|
||||||
|
|
||||||
def add(self, item, count=1):
|
def add(self, item, count=1):
|
||||||
self.__pool[item] = self.__pool.get(item, 0) + count
|
self.__pool[item] = self.__pool.get(item, 0) + count
|
||||||
|
|
|
@ -527,6 +527,13 @@ class InGameHints(DefaultOnToggle):
|
||||||
display_name = "In-game Hints"
|
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):
|
class ForeignItemIcons(Choice):
|
||||||
"""
|
"""
|
||||||
Choose how to display foreign items.
|
Choose how to display foreign items.
|
||||||
|
@ -562,6 +569,7 @@ ladx_option_groups = [
|
||||||
TrendyGame,
|
TrendyGame,
|
||||||
InGameHints,
|
InGameHints,
|
||||||
NagMessages,
|
NagMessages,
|
||||||
|
StabilizeItemPool,
|
||||||
Quickswap,
|
Quickswap,
|
||||||
HardMode,
|
HardMode,
|
||||||
BootsControls
|
BootsControls
|
||||||
|
@ -631,6 +639,7 @@ class LinksAwakeningOptions(PerGameCommonOptions):
|
||||||
no_flash: NoFlash
|
no_flash: NoFlash
|
||||||
in_game_hints: InGameHints
|
in_game_hints: InGameHints
|
||||||
overworld: Overworld
|
overworld: Overworld
|
||||||
|
stabilize_item_pool: StabilizeItemPool
|
||||||
|
|
||||||
warp_improvements: Removed
|
warp_improvements: Removed
|
||||||
additional_warp_points: Removed
|
additional_warp_points: Removed
|
||||||
|
|
|
@ -138,7 +138,8 @@ class LinksAwakeningWorld(World):
|
||||||
world_setup = LADXRWorldSetup()
|
world_setup = LADXRWorldSetup()
|
||||||
world_setup.randomize(self.ladxr_settings, self.random)
|
world_setup.randomize(self.ladxr_settings, self.random)
|
||||||
self.ladxr_logic = LADXRLogic(configuration_options=self.ladxr_settings, world_setup=world_setup)
|
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:
|
def generate_early(self) -> None:
|
||||||
self.dungeon_item_types = {
|
self.dungeon_item_types = {
|
||||||
|
@ -225,7 +226,7 @@ class LinksAwakeningWorld(World):
|
||||||
for _ in range(count):
|
for _ in range(count):
|
||||||
if item_name in exclude:
|
if item_name in exclude:
|
||||||
exclude.remove(item_name) # this is destructive. create unique list above
|
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:
|
else:
|
||||||
item = self.create_item(item_name)
|
item = self.create_item(item_name)
|
||||||
|
|
||||||
|
@ -499,8 +500,14 @@ class LinksAwakeningWorld(World):
|
||||||
state.prog_items[self.player]["RUPEES"] -= self.rupees[item.name]
|
state.prog_items[self.player]["RUPEES"] -= self.rupees[item.name]
|
||||||
return change
|
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:
|
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):
|
def fill_slot_data(self):
|
||||||
slot_data = {}
|
slot_data = {}
|
||||||
|
|
Loading…
Reference in New Issue