diff --git a/worlds/gl.apworld b/worlds/gl.apworld new file mode 100644 index 000000000000..dd89fc3e8f67 Binary files /dev/null and b/worlds/gl.apworld differ diff --git a/worlds/gl/GauntletLegendsClient.py b/worlds/gl/GauntletLegendsClient.py index fed21e8b6cd6..e868025dc7d4 100644 --- a/worlds/gl/GauntletLegendsClient.py +++ b/worlds/gl/GauntletLegendsClient.py @@ -350,50 +350,33 @@ async def inv_update(self, name: str, count: int, one=None): name = "Obelisk" if "Mirror" in name: name = "Mirror Shard" + players_to_check = range(self.players) if one is None else [one] zero = False - if one is None: - for player in range(self.players): - added = False - for item in self.inventory[player]: - if item.name == name: - zero = (item.count == 0 and "Health" not in name) - if name in timers: - count *= 96 - if "Compass" in name: - item.count = count - elif "Health" in name: - max_health = await self.item_from_name("Max", player) - item.count = min(max(item.count + count, 0), max_health.count) - elif "Runestone" in name or "Mirror" in name or "Obelisk" in name: - item.count |= count - else: - item.count += count - await self.write_item(item) - added = True - if not added: - await self.inv_add(name, count, player) - if zero: - await self.inv_refactor() - else: - for item in self.inventory[one]: + + for player in players_to_check: + added = False + for item in self.inventory[player]: if item.name == name: - zero = item.count == 0 + zero = (item.count == 0 and "Health" not in name) if name in timers: count *= 96 if "Compass" in name: item.count = count elif "Health" in name: - max_health = await self.item_from_name("Max", one) + max_health = await self.item_from_name("Max", player) item.count = min(max(item.count + count, 0), max_health.count) elif "Runestone" in name or "Mirror" in name or "Obelisk" in name: item.count |= count else: item.count += count await self.write_item(item) - if zero: - await self.inv_refactor() - return - await self.inv_add(name, count, one) + added = True + break + if not added: + await self.inv_add(name, count, player) + continue + if zero: + await self.inv_refactor() # Rewrite entire inventory in RAM. # This is necessary since item entries are not cleared after full use until a level is completed. diff --git a/worlds/gl/Rom.py b/worlds/gl/Rom.py index d803324dca6b..3316f69890dc 100644 --- a/worlds/gl/Rom.py +++ b/worlds/gl/Rom.py @@ -120,7 +120,7 @@ def patch_items(caller: APProcedurePatch, rom: bytes): continue if "Mirror" in location_name: continue - if "Obelisk" in location_name: + if "Obelisk" in location_name and "Obelisk" not in items_by_id[item[0]].item_name: try: index = [index for index in range(len(data.objects)) if data.objects[index][8] == 0x26][0] data.items += [