Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/gl' into gl
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbrq committed Sep 6, 2024
2 parents e52aca8 + a3707e0 commit e42a15b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 32 deletions.
Binary file added worlds/gl.apworld
Binary file not shown.
45 changes: 14 additions & 31 deletions worlds/gl/GauntletLegendsClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion worlds/gl/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 += [
Expand Down

0 comments on commit e42a15b

Please sign in to comment.