diff --git a/worlds/grinch/Client.py b/worlds/grinch/Client.py index ad646a42..583c8e90 100644 --- a/worlds/grinch/Client.py +++ b/worlds/grinch/Client.py @@ -117,7 +117,7 @@ class GrinchClient(BizHawkClient): await ctx.get_username() async def game_watcher(self, ctx: "BizHawkClientContext") -> None: - from CommonClient import logger + from CommonClient import logger #If the player is not connected to an AP Server, or their connection was disconnected. if not ctx.slot: return @@ -197,7 +197,6 @@ class GrinchClient(BizHawkClient): RECV_ITEM_ADDR, RECV_ITEM_BITSIZE, "MainRAM")]))[0], "little") if len(ctx.items_received) == self.last_received_index: return - # Ensures we only get the new items that we want to give the player new_items_only = ctx.items_received[self.last_received_index:] ram_addr_dict: dict[int, list[int]] = {} @@ -214,7 +213,9 @@ class GrinchClient(BizHawkClient): current_ram_address_value = int.from_bytes((await bizhawk.read(ctx.bizhawk_ctx, [( addr_to_update.ram_address, addr_to_update.bit_size, "MainRAM")]))[0], "little") if is_binary: + logger.info(str(item_received)+"before") current_ram_address_value = (current_ram_address_value | (1 << addr_to_update.binary_bit_pos)) + logger.info(str(item_received) + "after") elif addr_to_update.update_existing_value: # Grabs minimum value of a list of numbers and makes sure it does not go above max count possible current_ram_address_value += addr_to_update.value @@ -237,7 +238,8 @@ class GrinchClient(BizHawkClient): goal_ram_address = goal_loc.update_ram_addr[0] current_ram_address_value = int.from_bytes((await bizhawk.read(ctx.bizhawk_ctx, [( goal_ram_address.ram_address, goal_ram_address.bit_size, "MainRAM")]))[0], "little") - if (current_ram_address_value & (1 << goal_ram_address.binary_bit_pos)) > 0: + # if (current_ram_address_value & (1 << goal_ram_address.binary_bit_pos)) > 0: + if current_ram_address_value == goal_ram_address.value: ctx.finished_game = True await ctx.send_msgs([{ "cmd": "StatusUpdate", diff --git a/worlds/grinch/Locations.py b/worlds/grinch/Locations.py index 8666fecc..c0a420df 100644 --- a/worlds/grinch/Locations.py +++ b/worlds/grinch/Locations.py @@ -6,7 +6,7 @@ from BaseClasses import Location, Region class GrinchLocationData(NamedTuple): region: str - location_group: list[str] + location_group: Optional[list[str]] id: Optional[int] update_ram_addr: list[GrinchRamData] reset_addr: Optional[list[GrinchRamData]] = None # Addresses to update once we find the item @@ -32,6 +32,9 @@ def get_location_names_per_category() -> dict[str, set[str]]: categories: dict[str, set[str]] = {} for name, data in grinch_locations.items(): + if data.location_group is None: + continue + for group in data.location_group: # iterate over each category categories.setdefault(group, set()).add(name) @@ -166,7 +169,7 @@ grinch_locations = { "WL - Mayor's Villa - GC BP in Pirate's Cave": GrinchLocationData("Mayor's Villa", ["Grinch Copter Blueprints"], 1215, [GrinchRamData(0x010275, binary_bit_pos=6)]), #Sleigh Room Locations "MC - Sleigh Ride - Stealing All Gifts": GrinchLocationData("Sleigh Room", ["Sleigh Ride"], 1300, [GrinchRamData(0x0100BF, binary_bit_pos=6)]), - "MC - Sleigh Ride - Neutralizing Santa": GrinchLocationData("Sleigh Room", ["Sleigh Ride"], None, [GrinchRamData(0x010000, value=0x3E)]),#[GrinchRamData(0x0100BF, binary_bit_pos=7)]), + "MC - Sleigh Ride - Neutralizing Santa": GrinchLocationData("Sleigh Room", None, None, [GrinchRamData(0x010000, value=0x3E)]),#[GrinchRamData(0x0100BF, binary_bit_pos=7)]), #Heart of Stones "WV - Post Office - Heart of Stone": GrinchLocationData("Post Office", ["Heart of Stones"], 1400, [GrinchRamData(0x0101FA, binary_bit_pos=6)]), "WF - Ski Resort - Heart of Stone": GrinchLocationData("Ski Resort", ["Heart of Stones"], 1401, [GrinchRamData(0x0101FA, binary_bit_pos=7)]), diff --git a/worlds/grinch/__init__.py b/worlds/grinch/__init__.py index e8be371b..06db8474 100644 --- a/worlds/grinch/__init__.py +++ b/worlds/grinch/__init__.py @@ -43,7 +43,7 @@ class GrinchWorld(World): region = self.get_region(data.region) entry = GrinchLocation(self.player, location, region, data) if location == "MC - Sleigh Ride - Neutralizing Santa": - entry.place_locked_item(Item("Neutralized", ItemClassification.progression, None, self.player)) + entry.place_locked_item(Item("Goal", ItemClassification.progression, None, self.player)) region.locations.append(entry) connect_regions(self) @@ -68,7 +68,7 @@ class GrinchWorld(World): self.multiworld.itempool += self_itempool def set_rules(self): - self.multiworld.completion_condition[self.player] = lambda state: state.has("Neutralized", self.player) + self.multiworld.completion_condition[self.player] = lambda state: state.has("Goal", self.player) set_location_rules(self) def get_other_filler_item(self, other_filler: list[str]) -> str: