Landstalker: Fix paths Lantern logic affecting other Landstalker worlds (#4394)

The data from `WORLD_PATHS_JSON` is supposed to be constant logic data
shared by all Landstalker worlds, but `add_path_requirements()` was
modifying this data such that after adding a `Lantern` requirement for a
dark region, subsequent Landstalker worlds to have their logic set could
also be affected by this `Lantern` requirement and previous Landstalker
worlds without damage boosting logic could also be affected by this
`Lantern` requirement because they could all be using the same list
instances. This issue would only occur for paths that have
`"requiredItems"` because all paths without required items would create
a new empty list, avoiding the problem.

The items in `data["itemsPlacedWhenCrossing"]` were also getting added
once for each Landstalker player, but there are no paths that have both
`"itemsPlacedWhenCrossing"` and `"requiredItems"`, so all such cases
would start from a new empty list of required items and avoid modifying
`WORLD_PATHS_JSON`.
This commit is contained in:
Mysteryem 2024-12-25 01:44:47 +00:00 committed by GitHub
parent 5578ccd578
commit 6c1dc5f645
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,8 @@ def add_path_requirements(world: "LandstalkerWorld"):
name = data["fromId"] + " -> " + data["toId"]
# Determine required items to reach this region
required_items = data["requiredItems"] if "requiredItems" in data else []
# WORLD_PATHS_JSON is shared by all Landstalker worlds, so a copy is made to prevent modifying the original
required_items = data["requiredItems"].copy() if "requiredItems" in data else []
if "itemsPlacedWhenCrossing" in data:
required_items += data["itemsPlacedWhenCrossing"]