diff --git a/worlds/grinch/Client.py b/worlds/grinch/Client.py index 239a01db..51b4dc13 100644 --- a/worlds/grinch/Client.py +++ b/worlds/grinch/Client.py @@ -5,6 +5,7 @@ import NetUtils import copy import uuid import Utils +from worlds.grinch.RamHandler import UpdateMethod from .Locations import grinch_locations, GrinchLocation from .Items import ( ALL_ITEMS_TABLE, @@ -278,13 +279,18 @@ class GrinchClient(BizHawkClient): if is_binary: current_ram_address_value = current_ram_address_value | (1 << addr_to_update.binary_bit_pos) - 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 + elif addr_to_update.update_method == UpdateMethod.SET: + current_ram_address_value = addr_to_update.value + + elif addr_to_update.update_method == UpdateMethod.ADD: + # min() gets the lowest of a set, so we can't go over the max_count current_ram_address_value += addr_to_update.value current_ram_address_value = min(current_ram_address_value, addr_to_update.max_count) - else: - current_ram_address_value = addr_to_update.value + elif addr_to_update.update_method == UpdateMethod.SUBTRACT: + # max() gets the highest of a set, so we can't go under the min_count + current_ram_address_value += addr_to_update.value + current_ram_address_value = max(current_ram_address_value, addr_to_update.min_count) # Write the updated value back into RAM ram_addr_dict[addr_to_update.ram_address] = [ diff --git a/worlds/grinch/Rules.py b/worlds/grinch/Rules.py index 1ab47d8c..283c3cc3 100644 --- a/worlds/grinch/Rules.py +++ b/worlds/grinch/Rules.py @@ -26,13 +26,14 @@ def interpret_rule( ): # If a region/location does not have any items required, make the section(s) return no logic. if len(rule_set) < 1: - return True + return [] # Otherwise, if a region/location DOES have items required, make the section(s) return list of logic. access_list: list[Callable[[CollectionState], bool]] = [] for item_set in rule_set: access_list.append(lambda state, items=tuple(item_set): state.has_all(items, player)) + return access_list # Each item in the list is a separate list of rules. Each separate list is just an "OR" condition. @@ -406,10 +407,10 @@ rules_dict: dict[str, list[list[str]]] = { "WV - City Hall - Binoculars BP left side of Library": [[]], "WV - City Hall - Binoculars BP front side of Library": [[]], "WV - City Hall - Binoculars BP right side of Library": [[]], - "WV - TEL BP left of City Hall": [[]], + "WV - REL BP left of City Hall": [[]], "WV - REL BP left of Clock Tower": [[]], "WV - Post Office - REL BP inside Silver Room": [[]], - "WV - Post Office - REL BP at Entrance Door after Migrinch_items.gadgets.SLIME_SHOOTERion Completion": [[]], + "WV - Post Office - REL BP at Entrance Door after Mission Completion": [[]], "WV - City Hall - GC BP in Safe Room": [[]], "WV - City Hall - GC BP in Statue Room": [[]], "WV - Clock Tower - GC BP in Bedroom": [ @@ -479,7 +480,7 @@ rules_dict: dict[str, list[list[str]]] = { grinch_items.gadgets.GRINCH_COPTER, ], ], - "WF - SS BP in House acrogrinch_items.gadgets.SLIME_SHOOTER from Tree House": [ + "WF - SS BP in House across from Tree House": [ [ grinch_items.gadgets.ROCKET_EGG_LAUNCHER, grinch_items.gadgets.ROCKET_SPRING, @@ -696,7 +697,7 @@ rules_dict: dict[str, list[list[str]]] = { grinch_items.gadgets.ROCKET_SPRING, ], ], - "WD - Generator Building - GC BP at the Entrance after Migrinch_items.gadgets.SLIME_SHOOTERion Completion": [ + "WD - Generator Building - GC BP at the Entrance after Mission Completion": [ [ grinch_items.gadgets.ROCKET_EGG_LAUNCHER, grinch_items.gadgets.GRINCH_COPTER, diff --git a/worlds/grinch/__init__.py b/worlds/grinch/__init__.py index c4b6d73f..6d212531 100644 --- a/worlds/grinch/__init__.py +++ b/worlds/grinch/__init__.py @@ -47,7 +47,7 @@ class GrinchWorld(World): entry = GrinchLocation(self.player, location, region, data) if location == "MC - Sleigh Ride - Neutralizing Santa": - entry.place_locked_item(Item("Goal", ItemClassification.progression, None, self.player)) + entry.place_locked_item(Item("Goal", ItemClassification.progression, data.id, self.player)) region.locations.append(entry)