Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timespinner: migrate to new options api and correct random #2485

Merged
merged 30 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a02ee4b
Implemented new options system into Timespinner
Jarno458 Oct 30, 2023
0be0739
Fixed typo
Jarno458 Oct 30, 2023
08baeb7
Fixed typo
Jarno458 Oct 30, 2023
eac14c7
Fixed slotdata maybe
Jarno458 Nov 1, 2023
baf6e7f
Merge remote-tracking branch 'remotes/origin/main' into ts_new_option…
Jarno458 Nov 22, 2023
5a2023f
Fixes
Jarno458 Nov 22, 2023
261b45d
more fixes
Jarno458 Nov 22, 2023
870fd19
Fixed failing unit tests
Jarno458 Nov 23, 2023
705c096
Merge branch 'main' into ts_new_options_api
Jarno458 Dec 2, 2023
58681ec
Merge branch 'main' into ts_new_options_api
Jarno458 Dec 9, 2023
7d9a04c
Merge branch 'main' into ts_new_options_api
Jarno458 Dec 20, 2023
bd3399a
Merge branch 'main' into ts_new_options_api
Jarno458 Apr 8, 2024
594f342
Merge branch 'main' into ts_new_options_api
Jarno458 May 1, 2024
bdc7da9
Implemented options backwards comnpatibility
Jarno458 May 2, 2024
cae983c
Fixed option fallbacks
Jarno458 May 3, 2024
47b74db
Merge branch 'main' into ts_new_options_api
Jarno458 May 3, 2024
9dd1e4b
Merge branch 'ArchipelagoMW:main' into ts_new_options_api
Jarno458 Jun 1, 2024
bffebb1
Implemented review results
Jarno458 Jun 1, 2024
d6ea280
Fixed logic bug
Jarno458 Jun 2, 2024
28f98cf
Merge branch 'main' into ts_new_options_api
Jarno458 Jun 2, 2024
cb30193
Fixed python 3.8/3.9 compatibility
Jarno458 Jun 2, 2024
1366e0f
Replaced one more multiworld option usage
Jarno458 Jun 2, 2024
018bad8
Merge branch 'main' into ts_new_options_api
Jarno458 Jun 2, 2024
08bf657
Update worlds/timespinner/Options.py
Jarno458 Jun 10, 2024
2a2b3f1
Updated logging of options replacement to include player name and als…
Jarno458 Jun 10, 2024
ee41c6d
Merge branch 'main' into ts_new_options_api
Jarno458 Jun 10, 2024
73ca328
Merge branch 'main' into ts_new_options_api
Jarno458 Jun 11, 2024
bb3c5d6
Merge branch 'main' into ts_new_options_api
Jarno458 Jul 3, 2024
68753f1
Merge branch 'main' into ts_new_options_api
Jarno458 Jul 10, 2024
c734c7b
Merge branch 'main' into ts_new_options_api
Jarno458 Jul 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions worlds/timespinner/Locations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Optional, Callable, NamedTuple
from BaseClasses import MultiWorld, CollectionState
from .Options import is_option_enabled
from BaseClasses import CollectionState
from .Options import TimespinnerOptions
from .PreCalculatedWeights import PreCalculatedWeights
from .LogicExtensions import TimespinnerLogic

Expand All @@ -14,11 +14,10 @@ class LocationData(NamedTuple):
rule: Optional[Callable[[CollectionState], bool]] = None


def get_location_datas(world: Optional[MultiWorld], player: Optional[int],
precalculated_weights: PreCalculatedWeights) -> List[LocationData]:

flooded: PreCalculatedWeights = precalculated_weights
logic = TimespinnerLogic(world, player, precalculated_weights)
def get_location_datas(player: Optional[int], options: Optional[TimespinnerOptions],
precalculated_weights: Optional[PreCalculatedWeights]) -> List[LocationData]:
flooded: Optional[PreCalculatedWeights] = precalculated_weights
logic = TimespinnerLogic(player, options, precalculated_weights)

# 1337000 - 1337155 Generic locations
# 1337171 - 1337175 New Pickup checks
Expand Down Expand Up @@ -203,7 +202,7 @@ def get_location_datas(world: Optional[MultiWorld], player: Optional[int],
]

# 1337156 - 1337170 Downloads
if not world or is_option_enabled(world, player, "DownloadableItems"):
if not options or options.downloadable_items:
Jarno458 marked this conversation as resolved.
Show resolved Hide resolved
location_table += (
LocationData('Library', 'Library: Terminal 2 (Lachiem)', 1337156, lambda state: state.has('Tablet', player)),
LocationData('Library', 'Library: Terminal 1 (Windaria)', 1337157, lambda state: state.has('Tablet', player)),
Expand All @@ -223,13 +222,13 @@ def get_location_datas(world: Optional[MultiWorld], player: Optional[int],
)

# 1337176 - 1337176 Cantoran
if not world or is_option_enabled(world, player, "Cantoran"):
if not options or options.cantoran:
location_table += (
LocationData('Left Side forest Caves', 'Lake Serene: Cantoran', 1337176),
)

# 1337177 - 1337198 Lore Checks
if not world or is_option_enabled(world, player, "LoreChecks"):
if not options or options.lore_checks:
location_table += (
LocationData('Lower lake desolation', 'Lake Desolation: Memory - Coyote Jump (Time Messenger)', 1337177),
LocationData('Library', 'Library: Memory - Waterway (A Message)', 1337178),
Expand Down Expand Up @@ -258,7 +257,7 @@ def get_location_datas(world: Optional[MultiWorld], player: Optional[int],
# 1337199 - 1337236 Reserved for future use

# 1337237 - 1337245 GyreArchives
if not world or is_option_enabled(world, player, "GyreArchives"):
if not options or options.gyre_archives:
location_table += (
LocationData('Ravenlord\'s Lair', 'Ravenlord: Post fight (pedestal)', 1337237),
LocationData('Ifrit\'s Lair', 'Ifrit: Post fight (pedestal)', 1337238),
Expand Down
23 changes: 12 additions & 11 deletions worlds/timespinner/LogicExtensions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Union
from BaseClasses import MultiWorld, CollectionState
from .Options import is_option_enabled
from typing import Union, Optional
from BaseClasses import CollectionState
from .Options import TimespinnerOptions
from .PreCalculatedWeights import PreCalculatedWeights


Expand All @@ -10,17 +10,18 @@ class TimespinnerLogic:
flag_unchained_keys: bool
flag_eye_spy: bool
flag_specific_keycards: bool
pyramid_keys_unlock: Union[str, None]
present_keys_unlock: Union[str, None]
past_keys_unlock: Union[str, None]
time_keys_unlock: Union[str, None]
pyramid_keys_unlock: Optional[str]
present_keys_unlock: Optional[str]
past_keys_unlock: Optional[str]
time_keys_unlock: Optional[str]

def __init__(self, world: MultiWorld, player: int, precalculated_weights: PreCalculatedWeights):
def __init__(self, player: int, options: Optional[TimespinnerOptions],
precalculated_weights: Optional[PreCalculatedWeights]):
self.player = player

self.flag_specific_keycards = is_option_enabled(world, player, "SpecificKeycards")
self.flag_eye_spy = is_option_enabled(world, player, "EyeSpy")
self.flag_unchained_keys = is_option_enabled(world, player, "UnchainedKeys")
self.flag_specific_keycards = bool(options and options.specific_keycards)
self.flag_eye_spy = bool(options and options.eye_spy)
self.flag_unchained_keys = bool(options and options.unchained_keys)

if precalculated_weights:
if self.flag_unchained_keys:
Expand Down
Loading
Loading