From 1762fefba9e02045e79020ce58f2e4b558bcf131 Mon Sep 17 00:00:00 2001 From: MarioSpore Date: Mon, 28 Jul 2025 23:12:47 -0400 Subject: [PATCH] Filler is now being placed yippe --- worlds/grinch/Items.py | 22 +++++++++++++--------- worlds/grinch/Regions.py | 10 +++++++--- worlds/grinch/Rules.py | 4 +++- worlds/grinch/__init__.py | 13 +++++++++++-- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/worlds/grinch/Items.py b/worlds/grinch/Items.py index f7aabd56..b11e6cbb 100644 --- a/worlds/grinch/Items.py +++ b/worlds/grinch/Items.py @@ -153,12 +153,15 @@ KEYS_TABLE: dict[str, GrinchItemData] = { #Misc Items MISC_ITEMS_TABLE: dict[str, GrinchItemData] = { "Fully Healed Grinch": GrinchItemData("Health Items", 500, IC.filler, [GrinchRamData(0x800E8FDC, value=120)]), - "Heart of Stone": GrinchItemData("Health Items", 501, IC.useful, [GrinchRamData(0x800100ED, value=1)]), "5 Rotten Eggs": GrinchItemData("Rotten Egg Bundles", 502, IC.filler, [GrinchRamData(0x80010058, value=5)]), "10 Rotten Eggs": GrinchItemData("Rotten Egg Bundles", 503, IC.filler, [GrinchRamData(0x80010058, value=10)]), "20 Rotten Eggs": GrinchItemData("Rotten Egg Bundles", 504, IC.filler, [GrinchRamData(0x80010058, value=20)]) } +USEFUL_IC_TABLE: dict[str, GrinchItemData] = { + "Heart of Stone": GrinchItemData("Health Items", 501, IC.useful, [GrinchRamData(0x800100ED, value=1)]) +} + #Traps TRAPS_TABLE: dict[str, GrinchItemData] = { # "Freeze Trap": GrinchItemData("Traps", 600, IC.trap, [GrinchRamData()]), #alias to Ice Trap for traplink @@ -176,13 +179,13 @@ TRAPS_TABLE: dict[str, GrinchItemData] = { } #Movesets -MOVES_TABLE: dict[str, GrinchItemData] = { - "Bad Breath": GrinchItemData("Movesets", 700, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=1)]), - "Pancake": GrinchItemData("Movesets", 701, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=2)]), - "Push & Pull": GrinchItemData("Movesets", 702, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=3)]), - "Max": GrinchItemData("Movesets", 703, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=4)]), - "Tip Toe": GrinchItemData("Movesets", 704, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=5)]), -} +# MOVES_TABLE: dict[str, GrinchItemData] = { +# "Bad Breath": GrinchItemData("Movesets", 700, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=1)]), +# "Pancake": GrinchItemData("Movesets", 701, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=2)]), +# "Push & Pull": GrinchItemData("Movesets", 702, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=3)]), +# "Max": GrinchItemData("Movesets", 703, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=4)]), +# "Tip Toe": GrinchItemData("Movesets", 704, IC.progression, [GrinchRamData(0x800100BB, binary_bit_pos=5)]) +# } #Double star combines all dictionaries from each individual list together ALL_ITEMS_TABLE: dict[str, GrinchItemData] = { **GADGETS_TABLE, @@ -191,7 +194,8 @@ ALL_ITEMS_TABLE: dict[str, GrinchItemData] = { **KEYS_TABLE, **MISC_ITEMS_TABLE, **TRAPS_TABLE, - **MOVES_TABLE + **USEFUL_IC_TABLE + # **MOVES_TABLE } def grinch_items_to_id() -> dict[str, int]: diff --git a/worlds/grinch/Regions.py b/worlds/grinch/Regions.py index 8fee0112..341f2e7d 100644 --- a/worlds/grinch/Regions.py +++ b/worlds/grinch/Regions.py @@ -6,11 +6,14 @@ from .Options import GrinchOptions from BaseClasses import Region from .Rules import access_rules_dict, interpret_rule +import logging +logger = logging.getLogger() + if TYPE_CHECKING: + from . import GrinchWorld mainareas_list = [ - "Mount Crumpit", "Whoville", "Who Forest", "Who Dump", @@ -51,10 +54,11 @@ def create_regions(world: "GrinchWorld"): world.multiworld.regions.append(Region(supadow, world.player, world.multiworld)) def grinchconnect(world: "GrinchWorld", current_region_name: str, connected_region_name: str): - rule = [] + logger.info("Current Region Name: "+ current_region_name) + logger.info("Connected Region Name: "+ connected_region_name) current_region = world.get_region(current_region_name) connected_region = world.get_region(connected_region_name) - required_items: set[list[str]] = access_rules_dict[connected_region.name] + required_items: list[list[str]] = access_rules_dict[connected_region.name] rule = interpret_rule(required_items, world.player) #Goes from current to connected current_region.connect(connected_region, rule = rule) diff --git a/worlds/grinch/Rules.py b/worlds/grinch/Rules.py index 755f01d3..19633ca0 100644 --- a/worlds/grinch/Rules.py +++ b/worlds/grinch/Rules.py @@ -1,7 +1,8 @@ from worlds.AutoWorld import World # from .Options import GrinchOptions from worlds.generic.Rules import add_rule - +import logging +logger = logging.getLogger() def set_rules(world: World): all_locations = world.get_locations() @@ -455,5 +456,6 @@ def interpret_rule(rule_set: list[list[str]], player: int): else: old_rule = lambda state: False for item_set in rule_set: + logger.info("Rules to access: " + ";".join(item_set)) old_rule = lambda state: state.has_all(item_set, player) or old_rule return old_rule \ No newline at end of file diff --git a/worlds/grinch/__init__.py b/worlds/grinch/__init__.py index 82384ac3..e5439bb9 100644 --- a/worlds/grinch/__init__.py +++ b/worlds/grinch/__init__.py @@ -1,6 +1,6 @@ from BaseClasses import Region, Item, ItemClassification from .Locations import grinch_locations_to_id, grinch_locations, GrinchLocation -from .Items import grinch_items_to_id, GrinchItem, ALL_ITEMS_TABLE +from .Items import grinch_items_to_id, GrinchItem, ALL_ITEMS_TABLE, MISC_ITEMS_TABLE from .Regions import connect_regions from .Rules import set_rules @@ -53,8 +53,17 @@ class GrinchWorld(World): if item == "Heart of Stone": for _ in range(3): self_itempool.append(self.create_item(item)) + + #Get number of current unfilled locations + unfilled_locations: int = len(self.multiworld.get_unfilled_locations(self.player)) + + for _ in range(unfilled_locations): + self_itempool.append(self.create_item((self.get_other_filler_item(list(MISC_ITEMS_TABLE.keys()))))) self.multiworld.itempool += self_itempool def set_rules(self): self.multiworld.completion_condition[self.player] = lambda state: state.has("Goal", self.player) - set_rules(self) \ No newline at end of file + set_rules(self) + + def get_other_filler_item(self, other_filler: list[str]) -> str: + return self.random.choices(other_filler)[0] \ No newline at end of file