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

* Implemented new options system into Timespinner

* Fixed typo

* Fixed typo

* Fixed slotdata maybe

* Fixes

* more fixes

* Fixed failing unit tests

* Implemented options backwards comnpatibility

* Fixed option fallbacks

* Implemented review results

* Fixed logic bug

* Fixed python 3.8/3.9 compatibility

* Replaced one more multiworld option usage

* Update worlds/timespinner/Options.py

Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>

* Updated logging of options replacement to include player name and also write it to spoiler
Fixed generation bug
Implemented review results

---------

Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
This commit is contained in:
Jarno
2024-07-31 11:50:04 +02:00
committed by GitHub
parent 77e3f9fbef
commit 1d19da0c76
6 changed files with 417 additions and 233 deletions

View File

@@ -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
@@ -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
@@ -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:
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)),
@@ -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),
@@ -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),