ItemLink: hopefully fix coop functionality

This commit is contained in:
Fabian Dill 2022-02-05 17:35:12 +01:00
parent 43ff476d98
commit 279b682ac2
2 changed files with 4 additions and 5 deletions

View File

@ -728,11 +728,11 @@ def get_remaining(ctx: Context, team: int, slot: int) -> typing.List[int]:
return sorted(items) return sorted(items)
def send_items_to(ctx: Context, team: int, slot: int, *items: NetworkItem): def send_items_to(ctx: Context, team: int, target_slot: int, *items: NetworkItem):
targets = ctx.groups.get(slot, [slot]) targets = ctx.groups.get(target_slot, [target_slot])
for target in targets: for target in targets:
for item in items: for item in items:
if target != item.player: if item.player != target_slot:
get_received_items(ctx, team, target, False).append(item) get_received_items(ctx, team, target, False).append(item)
get_received_items(ctx, team, target, True).append(item) get_received_items(ctx, team, target, True).append(item)

View File

@ -755,7 +755,6 @@ def patch_rom(world, rom, player, enemized):
local_random = world.slot_seeds[player] local_random = world.slot_seeds[player]
# patch items # patch items
targets_pointing_to_here = world.get_player_groups(player) | {player}
for location in world.get_locations(): for location in world.get_locations():
if location.player != player or location.address is None or location.shop_slot is not None: if location.player != player or location.address is None or location.shop_slot is not None:
@ -786,7 +785,7 @@ def patch_rom(world, rom, player, enemized):
itemid = list(location_table.keys()).index(location.name) + 1 itemid = list(location_table.keys()).index(location.name) + 1
assert itemid < 0x100 assert itemid < 0x100
rom.write_byte(location.player_address, 0xFF) rom.write_byte(location.player_address, 0xFF)
elif location.item.player not in targets_pointing_to_here: elif location.item.player != player:
if location.player_address is not None: if location.player_address is not None:
rom.write_byte(location.player_address, min(location.item.player, ROM_PLAYER_LIMIT)) rom.write_byte(location.player_address, min(location.item.player, ROM_PLAYER_LIMIT))
else: else: