From 205c6acb495bdc6c213abfe77e134c52f5ca2339 Mon Sep 17 00:00:00 2001 From: el-u <109771707+el-u@users.noreply.github.com> Date: Fri, 24 Nov 2023 01:59:41 +0100 Subject: [PATCH] lufia2ac: fix client behavior at max blue chests combined with party member or capsule monster shuffle (#2478) When option combinations at (or near) the maximum location count were used, the client could trip over a wrongly coded limit and stop sending checks. --- worlds/lufia2ac/Client.py | 2 +- worlds/lufia2ac/Locations.py | 2 +- worlds/lufia2ac/Options.py | 1 + worlds/lufia2ac/__init__.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/worlds/lufia2ac/Client.py b/worlds/lufia2ac/Client.py index bc0cb6a7d8dd..ac0de19bfdd6 100644 --- a/worlds/lufia2ac/Client.py +++ b/worlds/lufia2ac/Client.py @@ -113,7 +113,7 @@ async def game_watcher(self, ctx: SNIContext) -> None: }], }]) - total_blue_chests_checked: int = min(sum(blue_chests_checked.values()), BlueChestCount.range_end) + total_blue_chests_checked: int = min(sum(blue_chests_checked.values()), BlueChestCount.overall_max) snes_buffered_write(ctx, L2AC_TX_ADDR + 8, total_blue_chests_checked.to_bytes(2, "little")) location_ids: List[int] = [locations_start_id + i for i in range(total_blue_chests_checked)] diff --git a/worlds/lufia2ac/Locations.py b/worlds/lufia2ac/Locations.py index 2f433f72e2ae..510ecbbbf7f4 100644 --- a/worlds/lufia2ac/Locations.py +++ b/worlds/lufia2ac/Locations.py @@ -6,7 +6,7 @@ start_id: int = 0xAC0000 l2ac_location_name_to_id: Dict[str, int] = { - **{f"Blue chest {i + 1}": (start_id + i) for i in range(BlueChestCount.range_end + 7 + 6)}, + **{f"Blue chest {i + 1}": (start_id + i) for i in range(BlueChestCount.overall_max)}, **{f"Iris treasure {i + 1}": (start_id + 0x039C + i) for i in range(9)}, "Boss": start_id + 0x01C2, } diff --git a/worlds/lufia2ac/Options.py b/worlds/lufia2ac/Options.py index 783da8e407b7..419532cded6b 100644 --- a/worlds/lufia2ac/Options.py +++ b/worlds/lufia2ac/Options.py @@ -121,6 +121,7 @@ class BlueChestCount(Range): range_start = 10 range_end = 100 default = 25 + overall_max = range_end + 7 + 6 # Have to account for capsule monster and party member items class Boss(RandomGroupsChoice): diff --git a/worlds/lufia2ac/__init__.py b/worlds/lufia2ac/__init__.py index 8f9b8d58231a..9bd436fa0d2f 100644 --- a/worlds/lufia2ac/__init__.py +++ b/worlds/lufia2ac/__init__.py @@ -66,7 +66,7 @@ class L2ACWorld(World): "Party members": {name for name, data in l2ac_item_table.items() if data.type is ItemType.PARTY_MEMBER}, } data_version: ClassVar[int] = 2 - required_client_version: Tuple[int, int, int] = (0, 4, 2) + required_client_version: Tuple[int, int, int] = (0, 4, 4) # L2ACWorld specific properties rom_name: bytearray