Compare commits

..

20 Commits

Author SHA1 Message Date
NewSoupVi
b350521893 Update docs/apworld_dev_faq.md
Co-authored-by: qwint <qwint.42@gmail.com>
2024-09-05 22:21:51 +02:00
NewSoupVi
a2ba2f3dbf Update docs/apworld_dev_faq.md
Co-authored-by: qwint <qwint.42@gmail.com>
2024-09-05 21:30:30 +02:00
NewSoupVi
ce8d254912 Update apworld_dev_faq.md 2024-09-05 21:23:33 +02:00
NewSoupVi
153f454fb8 Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-09-05 21:22:36 +02:00
NewSoupVi
df1f3dc730 Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-09-05 21:21:24 +02:00
NewSoupVi
8cefe85630 Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-09-05 21:20:51 +02:00
NewSoupVi
a1779c1924 Update apworld_dev_faq.md 2024-09-05 21:20:35 +02:00
NewSoupVi
663b5a28a5 Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-09-05 21:20:10 +02:00
NewSoupVi
cf3d4ff837 Update apworld_dev_faq.md 2024-09-05 19:04:07 +02:00
NewSoupVi
1d8d04ea03 Update docs/apworld_dev_faq.md
Co-authored-by: qwint <qwint.42@gmail.com>
2024-09-05 18:56:33 +02:00
NewSoupVi
49394bebda Update docs/apworld_dev_faq.md
Co-authored-by: qwint <qwint.42@gmail.com>
2024-09-05 18:55:58 +02:00
NewSoupVi
9ec1f8de6e Update docs/apworld_dev_faq.md
Co-authored-by: Scipio Wright <scipiowright@gmail.com>
2024-08-13 18:19:21 +02:00
NewSoupVi
e74e472e3f Update docs/apworld_dev_faq.md
Co-authored-by: Scipio Wright <scipiowright@gmail.com>
2024-08-13 18:18:55 +02:00
NewSoupVi
850033b311 Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-07-31 22:34:10 +02:00
NewSoupVi
3a70bf9f4f Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-07-31 22:33:57 +02:00
NewSoupVi
205fa71cc7 Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-07-31 22:33:50 +02:00
NewSoupVi
8420c72ec4 Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-07-31 22:33:44 +02:00
NewSoupVi
f9b07a5b9a Update docs/apworld_dev_faq.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-07-31 22:33:36 +02:00
NewSoupVi
295e719ef3 Actually copy in the text 2024-07-31 19:34:37 +02:00
NewSoupVi
db5be6a411 Docs: Dev FAQ - About indirect conditions
I wrote up a big effortpost about indirect conditions for nex on the [DS3 3.0 PR](https://github.com/ArchipelagoMW/Archipelago/pull/3128#discussion_r1693843193).

The version I'm [PRing to the world API document](https://github.com/ArchipelagoMW/Archipelago/pull/3552) is very brief and unnuanced, because I'd rather people use too many indirect conditions than too few.
But that might leave some devs wanting to know more.

I think that comment on nex's DS3 PR is probably the best detailed explanation for indirect conditions that exists currently.

So I think it's good if it exists somewhere. And the FAQ doc seems like the best place right now, because I don't want to write an entirely new doc at the moment.
2024-07-27 08:18:00 +02:00
75 changed files with 861 additions and 1430 deletions

View File

@@ -1,6 +1,5 @@
from __future__ import annotations from __future__ import annotations
import collections
import copy import copy
import itertools import itertools
import functools import functools
@@ -64,6 +63,7 @@ class MultiWorld():
state: CollectionState state: CollectionState
plando_options: PlandoOptions plando_options: PlandoOptions
accessibility: Dict[int, Options.Accessibility]
early_items: Dict[int, Dict[str, int]] early_items: Dict[int, Dict[str, int]]
local_early_items: Dict[int, Dict[str, int]] local_early_items: Dict[int, Dict[str, int]]
local_items: Dict[int, Options.LocalItems] local_items: Dict[int, Options.LocalItems]
@@ -288,86 +288,6 @@ class MultiWorld():
group["non_local_items"] = item_link["non_local_items"] group["non_local_items"] = item_link["non_local_items"]
group["link_replacement"] = replacement_prio[item_link["link_replacement"]] group["link_replacement"] = replacement_prio[item_link["link_replacement"]]
def link_items(self) -> None:
"""Called to link together items in the itempool related to the registered item link groups."""
from worlds import AutoWorld
for group_id, group in self.groups.items():
def find_common_pool(players: Set[int], shared_pool: Set[str]) -> Tuple[
Optional[Dict[int, Dict[str, int]]], Optional[Dict[str, int]]
]:
classifications: Dict[str, int] = collections.defaultdict(int)
counters = {player: {name: 0 for name in shared_pool} for player in players}
for item in self.itempool:
if item.player in counters and item.name in shared_pool:
counters[item.player][item.name] += 1
classifications[item.name] |= item.classification
for player in players.copy():
if all([counters[player][item] == 0 for item in shared_pool]):
players.remove(player)
del (counters[player])
if not players:
return None, None
for item in shared_pool:
count = min(counters[player][item] for player in players)
if count:
for player in players:
counters[player][item] = count
else:
for player in players:
del (counters[player][item])
return counters, classifications
common_item_count, classifications = find_common_pool(group["players"], group["item_pool"])
if not common_item_count:
continue
new_itempool: List[Item] = []
for item_name, item_count in next(iter(common_item_count.values())).items():
for _ in range(item_count):
new_item = group["world"].create_item(item_name)
# mangle together all original classification bits
new_item.classification |= classifications[item_name]
new_itempool.append(new_item)
region = Region("Menu", group_id, self, "ItemLink")
self.regions.append(region)
locations = region.locations
for item in self.itempool:
count = common_item_count.get(item.player, {}).get(item.name, 0)
if count:
loc = Location(group_id, f"Item Link: {item.name} -> {self.player_name[item.player]} {count}",
None, region)
loc.access_rule = lambda state, item_name = item.name, group_id_ = group_id, count_ = count: \
state.has(item_name, group_id_, count_)
locations.append(loc)
loc.place_locked_item(item)
common_item_count[item.player][item.name] -= 1
else:
new_itempool.append(item)
itemcount = len(self.itempool)
self.itempool = new_itempool
while itemcount > len(self.itempool):
items_to_add = []
for player in group["players"]:
if group["link_replacement"]:
item_player = group_id
else:
item_player = player
if group["replacement_items"][player]:
items_to_add.append(AutoWorld.call_single(self, "create_item", item_player,
group["replacement_items"][player]))
else:
items_to_add.append(AutoWorld.call_single(self, "create_filler", item_player))
self.random.shuffle(items_to_add)
self.itempool.extend(items_to_add[:itemcount - len(self.itempool)])
def secure(self): def secure(self):
self.random = ThreadBarrierProxy(secrets.SystemRandom()) self.random = ThreadBarrierProxy(secrets.SystemRandom())
self.is_race = True self.is_race = True
@@ -603,22 +523,26 @@ class MultiWorld():
players: Dict[str, Set[int]] = { players: Dict[str, Set[int]] = {
"minimal": set(), "minimal": set(),
"items": set(), "items": set(),
"full": set() "locations": set()
} }
for player, world in self.worlds.items(): for player, access in self.accessibility.items():
players[world.options.accessibility.current_key].add(player) players[access.current_key].add(player)
beatable_fulfilled = False beatable_fulfilled = False
def location_condition(location: Location) -> bool: def location_condition(location: Location):
"""Determine if this location has to be accessible, location is already filtered by location_relevant""" """Determine if this location has to be accessible, location is already filtered by location_relevant"""
return location.player in players["full"] or \ if location.player in players["locations"] or (location.item and location.item.player not in
(location.item and location.item.player not in players["minimal"]) players["minimal"]):
return True
return False
def location_relevant(location: Location) -> bool: def location_relevant(location: Location):
"""Determine if this location is relevant to sweep.""" """Determine if this location is relevant to sweep."""
return location.progress_type != LocationProgressType.EXCLUDED \ if location.progress_type != LocationProgressType.EXCLUDED \
and (location.player in players["full"] or location.advancement) and (location.player in players["locations"] or location.advancement):
return True
return False
def all_done() -> bool: def all_done() -> bool:
"""Check if all access rules are fulfilled""" """Check if all access rules are fulfilled"""
@@ -756,13 +680,13 @@ class CollectionState():
def can_reach_region(self, spot: str, player: int) -> bool: def can_reach_region(self, spot: str, player: int) -> bool:
return self.multiworld.get_region(spot, player).can_reach(self) return self.multiworld.get_region(spot, player).can_reach(self)
def sweep_for_events(self, locations: Optional[Iterable[Location]] = None) -> None: def sweep_for_events(self, key_only: bool = False, locations: Optional[Iterable[Location]] = None) -> None:
if locations is None: if locations is None:
locations = self.multiworld.get_filled_locations() locations = self.multiworld.get_filled_locations()
reachable_events = True reachable_events = True
# since the loop has a good chance to run more than once, only filter the events once # since the loop has a good chance to run more than once, only filter the events once
locations = {location for location in locations if location.advancement and location not in self.events} locations = {location for location in locations if location.advancement and location not in self.events and
not key_only or getattr(location.item, "locked_dungeon_item", False)}
while reachable_events: while reachable_events:
reachable_events = {location for location in locations if location.can_reach(self)} reachable_events = {location for location in locations if location.can_reach(self)}
locations -= reachable_events locations -= reachable_events
@@ -1367,6 +1291,8 @@ class Spoiler:
state = CollectionState(multiworld) state = CollectionState(multiworld)
collection_spheres = [] collection_spheres = []
while required_locations: while required_locations:
state.sweep_for_events(key_only=True)
sphere = set(filter(state.can_reach, required_locations)) sphere = set(filter(state.can_reach, required_locations))
for location in sphere: for location in sphere:

View File

@@ -227,15 +227,12 @@ def remaining_fill(multiworld: MultiWorld,
swapped_items: typing.Counter[typing.Tuple[int, str]] = Counter() swapped_items: typing.Counter[typing.Tuple[int, str]] = Counter()
total = min(len(itempool), len(locations)) total = min(len(itempool), len(locations))
placed = 0 placed = 0
state = CollectionState(multiworld)
while locations and itempool: while locations and itempool:
item_to_place = itempool.pop() item_to_place = itempool.pop()
spot_to_fill: typing.Optional[Location] = None spot_to_fill: typing.Optional[Location] = None
for i, location in enumerate(locations): for i, location in enumerate(locations):
if location.can_fill(state, item_to_place, check_access=False): if location.item_rule(item_to_place):
# popping by index is faster than removing by content, # popping by index is faster than removing by content,
spot_to_fill = locations.pop(i) spot_to_fill = locations.pop(i)
# skipping a scan for the element # skipping a scan for the element
@@ -256,7 +253,7 @@ def remaining_fill(multiworld: MultiWorld,
location.item = None location.item = None
placed_item.location = None placed_item.location = None
if location.can_fill(state, item_to_place, check_access=False): if location.item_rule(item_to_place):
# Add this item to the existing placement, and # Add this item to the existing placement, and
# add the old item to the back of the queue # add the old item to the back of the queue
spot_to_fill = placements.pop(i) spot_to_fill = placements.pop(i)
@@ -649,6 +646,7 @@ def balance_multiworld_progression(multiworld: MultiWorld) -> None:
def get_sphere_locations(sphere_state: CollectionState, def get_sphere_locations(sphere_state: CollectionState,
locations: typing.Set[Location]) -> typing.Set[Location]: locations: typing.Set[Location]) -> typing.Set[Location]:
sphere_state.sweep_for_events(key_only=True, locations=locations)
return {loc for loc in locations if sphere_state.can_reach(loc)} return {loc for loc in locations if sphere_state.can_reach(loc)}
def item_percentage(player: int, num: int) -> float: def item_percentage(player: int, num: int) -> float:

77
Main.py
View File

@@ -184,7 +184,82 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
assert len(multiworld.itempool) == len(new_items), "Item Pool amounts should not change." assert len(multiworld.itempool) == len(new_items), "Item Pool amounts should not change."
multiworld.itempool[:] = new_items multiworld.itempool[:] = new_items
multiworld.link_items() # temporary home for item links, should be moved out of Main
for group_id, group in multiworld.groups.items():
def find_common_pool(players: Set[int], shared_pool: Set[str]) -> Tuple[
Optional[Dict[int, Dict[str, int]]], Optional[Dict[str, int]]
]:
classifications: Dict[str, int] = collections.defaultdict(int)
counters = {player: {name: 0 for name in shared_pool} for player in players}
for item in multiworld.itempool:
if item.player in counters and item.name in shared_pool:
counters[item.player][item.name] += 1
classifications[item.name] |= item.classification
for player in players.copy():
if all([counters[player][item] == 0 for item in shared_pool]):
players.remove(player)
del (counters[player])
if not players:
return None, None
for item in shared_pool:
count = min(counters[player][item] for player in players)
if count:
for player in players:
counters[player][item] = count
else:
for player in players:
del (counters[player][item])
return counters, classifications
common_item_count, classifications = find_common_pool(group["players"], group["item_pool"])
if not common_item_count:
continue
new_itempool: List[Item] = []
for item_name, item_count in next(iter(common_item_count.values())).items():
for _ in range(item_count):
new_item = group["world"].create_item(item_name)
# mangle together all original classification bits
new_item.classification |= classifications[item_name]
new_itempool.append(new_item)
region = Region("Menu", group_id, multiworld, "ItemLink")
multiworld.regions.append(region)
locations = region.locations
for item in multiworld.itempool:
count = common_item_count.get(item.player, {}).get(item.name, 0)
if count:
loc = Location(group_id, f"Item Link: {item.name} -> {multiworld.player_name[item.player]} {count}",
None, region)
loc.access_rule = lambda state, item_name = item.name, group_id_ = group_id, count_ = count: \
state.has(item_name, group_id_, count_)
locations.append(loc)
loc.place_locked_item(item)
common_item_count[item.player][item.name] -= 1
else:
new_itempool.append(item)
itemcount = len(multiworld.itempool)
multiworld.itempool = new_itempool
while itemcount > len(multiworld.itempool):
items_to_add = []
for player in group["players"]:
if group["link_replacement"]:
item_player = group_id
else:
item_player = player
if group["replacement_items"][player]:
items_to_add.append(AutoWorld.call_single(multiworld, "create_item", item_player,
group["replacement_items"][player]))
else:
items_to_add.append(AutoWorld.call_single(multiworld, "create_filler", item_player))
multiworld.random.shuffle(items_to_add)
multiworld.itempool.extend(items_to_add[:itemcount - len(multiworld.itempool)])
if any(multiworld.item_links.values()): if any(multiworld.item_links.values()):
multiworld._all_state = None multiworld._all_state = None

View File

@@ -786,22 +786,17 @@ class VerifyKeys(metaclass=FreezeValidKeys):
verify_location_name: bool = False verify_location_name: bool = False
value: typing.Any value: typing.Any
def verify_keys(self) -> None: @classmethod
if self.valid_keys: def verify_keys(cls, data: typing.Iterable[str]) -> None:
data = set(self.value) if cls.valid_keys:
dataset = set(word.casefold() for word in data) if self.valid_keys_casefold else set(data) data = set(data)
extra = dataset - self._valid_keys dataset = set(word.casefold() for word in data) if cls.valid_keys_casefold else set(data)
extra = dataset - cls._valid_keys
if extra: if extra:
raise OptionError( raise Exception(f"Found unexpected key {', '.join(extra)} in {cls}. "
f"Found unexpected key {', '.join(extra)} in {getattr(self, 'display_name', self)}. " f"Allowed keys: {cls._valid_keys}.")
f"Allowed keys: {self._valid_keys}."
)
def verify(self, world: typing.Type[World], player_name: str, plando_options: "PlandoOptions") -> None: def verify(self, world: typing.Type[World], player_name: str, plando_options: "PlandoOptions") -> None:
try:
self.verify_keys()
except OptionError as validation_error:
raise OptionError(f"Player {player_name} has invalid option keys:\n{validation_error}")
if self.convert_name_groups and self.verify_item_name: if self.convert_name_groups and self.verify_item_name:
new_value = type(self.value)() # empty container of whatever value is new_value = type(self.value)() # empty container of whatever value is
for item_name in self.value: for item_name in self.value:
@@ -838,6 +833,7 @@ class OptionDict(Option[typing.Dict[str, typing.Any]], VerifyKeys, typing.Mappin
@classmethod @classmethod
def from_any(cls, data: typing.Dict[str, typing.Any]) -> OptionDict: def from_any(cls, data: typing.Dict[str, typing.Any]) -> OptionDict:
if type(data) == dict: if type(data) == dict:
cls.verify_keys(data)
return cls(data) return cls(data)
else: else:
raise NotImplementedError(f"Cannot Convert from non-dictionary, got {type(data)}") raise NotImplementedError(f"Cannot Convert from non-dictionary, got {type(data)}")
@@ -883,6 +879,7 @@ class OptionList(Option[typing.List[typing.Any]], VerifyKeys):
@classmethod @classmethod
def from_any(cls, data: typing.Any): def from_any(cls, data: typing.Any):
if is_iterable_except_str(data): if is_iterable_except_str(data):
cls.verify_keys(data)
return cls(data) return cls(data)
return cls.from_text(str(data)) return cls.from_text(str(data))
@@ -908,6 +905,7 @@ class OptionSet(Option[typing.Set[str]], VerifyKeys):
@classmethod @classmethod
def from_any(cls, data: typing.Any): def from_any(cls, data: typing.Any):
if is_iterable_except_str(data): if is_iterable_except_str(data):
cls.verify_keys(data)
return cls(data) return cls(data)
return cls.from_text(str(data)) return cls.from_text(str(data))
@@ -950,19 +948,6 @@ class PlandoTexts(Option[typing.List[PlandoText]], VerifyKeys):
self.value = [] self.value = []
logging.warning(f"The plando texts module is turned off, " logging.warning(f"The plando texts module is turned off, "
f"so text for {player_name} will be ignored.") f"so text for {player_name} will be ignored.")
else:
super().verify(world, player_name, plando_options)
def verify_keys(self) -> None:
if self.valid_keys:
data = set(text.at for text in self)
dataset = set(word.casefold() for word in data) if self.valid_keys_casefold else set(data)
extra = dataset - self._valid_keys
if extra:
raise OptionError(
f"Invalid \"at\" placement {', '.join(extra)} in {getattr(self, 'display_name', self)}. "
f"Allowed placements: {self._valid_keys}."
)
@classmethod @classmethod
def from_any(cls, data: PlandoTextsFromAnyType) -> Self: def from_any(cls, data: PlandoTextsFromAnyType) -> Self:
@@ -986,6 +971,7 @@ class PlandoTexts(Option[typing.List[PlandoText]], VerifyKeys):
texts.append(text) texts.append(text)
else: else:
raise Exception(f"Cannot create plando text from non-dictionary type, got {type(text)}") raise Exception(f"Cannot create plando text from non-dictionary type, got {type(text)}")
cls.verify_keys([text.at for text in texts])
return cls(texts) return cls(texts)
else: else:
raise NotImplementedError(f"Cannot Convert from non-list, got {type(data)}") raise NotImplementedError(f"Cannot Convert from non-list, got {type(data)}")
@@ -1158,35 +1144,18 @@ class PlandoConnections(Option[typing.List[PlandoConnection]], metaclass=Connect
class Accessibility(Choice): class Accessibility(Choice):
""" """Set rules for reachability of your items/locations.
Set rules for reachability of your items/locations.
**Full:** ensure everything can be reached and acquired.
**Minimal:** ensure what is needed to reach your goal can be acquired. - **Locations:** ensure everything can be reached and acquired.
- **Items:** ensure all logically relevant items can be acquired.
- **Minimal:** ensure what is needed to reach your goal can be acquired.
""" """
display_name = "Accessibility" display_name = "Accessibility"
rich_text_doc = True rich_text_doc = True
option_full = 0 option_locations = 0
option_items = 1
option_minimal = 2 option_minimal = 2
alias_none = 2 alias_none = 2
alias_locations = 0
alias_items = 0
default = 0
class ItemsAccessibility(Accessibility):
"""
Set rules for reachability of your items/locations.
**Full:** ensure everything can be reached and acquired.
**Minimal:** ensure what is needed to reach your goal can be acquired.
**Items:** ensure all logically relevant items can be acquired. Some items, such as keys, may be self-locking, and
some locations may be inaccessible.
"""
option_items = 1
default = 1 default = 1

View File

@@ -231,13 +231,6 @@ def generate_yaml(game: str):
del options[key] del options[key]
# Detect keys which end with -range, indicating a NamedRange with a possible custom value
elif key_parts[-1].endswith("-range"):
if options[key_parts[-1][:-6]] == "custom":
options[key_parts[-1][:-6]] = val
del options[key]
# Detect random-* keys and set their options accordingly # Detect random-* keys and set their options accordingly
for key, val in options.copy().items(): for key, val in options.copy().items():
if key.startswith("random-"): if key.startswith("random-"):

View File

@@ -54,7 +54,7 @@
{% macro NamedRange(option_name, option) %} {% macro NamedRange(option_name, option) %}
{{ OptionTitle(option_name, option) }} {{ OptionTitle(option_name, option) }}
<div class="named-range-container"> <div class="named-range-container">
<select id="{{ option_name }}-select" name="{{ option_name }}" data-option-name="{{ option_name }}" {{ "disabled" if option.default == "random" }}> <select id="{{ option_name }}-select" data-option-name="{{ option_name }}" {{ "disabled" if option.default == "random" }}>
{% for key, val in option.special_range_names.items() %} {% for key, val in option.special_range_names.items() %}
{% if option.default == val %} {% if option.default == val %}
<option value="{{ val }}" selected>{{ key|replace("_", " ")|title }} ({{ val }})</option> <option value="{{ val }}" selected>{{ key|replace("_", " ")|title }} ({{ val }})</option>
@@ -64,17 +64,17 @@
{% endfor %} {% endfor %}
<option value="custom" hidden>Custom</option> <option value="custom" hidden>Custom</option>
</select> </select>
<div class="named-range-wrapper js-required"> <div class="named-range-wrapper">
<input <input
type="range" type="range"
id="{{ option_name }}" id="{{ option_name }}"
name="{{ option_name }}-range" name="{{ option_name }}"
min="{{ option.range_start }}" min="{{ option.range_start }}"
max="{{ option.range_end }}" max="{{ option.range_end }}"
value="{{ option.default | default(option.range_start) if option.default != "random" else option.range_start }}" value="{{ option.default | default(option.range_start) if option.default != "random" else option.range_start }}"
{{ "disabled" if option.default == "random" }} {{ "disabled" if option.default == "random" }}
/> />
<span id="{{ option_name }}-value" class="range-value"> <span id="{{ option_name }}-value" class="range-value js-required">
{{ option.default | default(option.range_start) if option.default != "random" else option.range_start }} {{ option.default | default(option.range_start) if option.default != "random" else option.range_start }}
</span> </span>
{{ RandomizeButton(option_name, option) }} {{ RandomizeButton(option_name, option) }}

View File

@@ -11,7 +11,7 @@
<noscript> <noscript>
<style> <style>
.js-required{ .js-required{
display: none !important; display: none;
} }
</style> </style>
</noscript> </noscript>

View File

@@ -79,7 +79,7 @@ class TrackerData:
# Normal lookup tables as well. # Normal lookup tables as well.
self.item_name_to_id[game] = game_package["item_name_to_id"] self.item_name_to_id[game] = game_package["item_name_to_id"]
self.location_name_to_id[game] = game_package["location_name_to_id"] self.location_name_to_id[game] = game_package["item_name_to_id"]
def get_seed_name(self) -> str: def get_seed_name(self) -> str:
"""Retrieves the seed name.""" """Retrieves the seed name."""

View File

@@ -43,3 +43,26 @@ A faster alternative to the `for` loop would be to use a [list comprehension](ht
```py ```py
item_pool += [self.create_filler() for _ in range(total_locations - len(item_pool))] item_pool += [self.create_filler() for _ in range(total_locations - len(item_pool))]
``` ```
---
### I learned about indirect conditions in the world API document, but I want to know more. What are they and why are they necessary?
The world API document mentions indirect conditions and **when** you should use them, but not *how* they work and *why* they are necessary. This is because the explanation is quite complicated.
Region sweep (the algorithm that determines which regions are reachable) is a Breadth-First Search of the region graph from the origin region, checking entrances one by one and adding newly reached nodes (regions) and their entrances to the queue until there is nothing more to check.
For performance reasons, AP only checks every entrance once. However, if an entrance's access condition depends on regions, then it is possible for this to happen:
1. An entrance that depends on a region is checked and determined to be nontraversable because the region hasn't been reached yet during the graph search.
2. After that, the region is reached by the graph search.
The entrance *would* now be determined to be traversable if it were rechecked, but it is not.
To account for this case, AP would have to recheck all entrances every time a new region is reached until no new regions are reached.
However, there is a way to **manually** define that a *specific* entrance needs to be rechecked during region sweep if a *specific* region is reached during it. This is what an indirect condition is.
This keeps almost all of the performance upsides. Even a game making heavy use of indirect conditions (See: The Witness) is still significantly faster than if it just blanket "rechecked all entrances until nothing new is found".
The reason entrance access rules using `location.can_reach` and `entrance.can_reach` are also affected is simple: They call `region.can_reach` on their respective parent/source region.
We recognize it can feel like a trap since it will not alert you when you are missing an indirect condition, and that some games have very complex access rules.
As of [PR #3682 (Core: Region handling customization)](https://github.com/ArchipelagoMW/Archipelago/pull/3682) being merged, it is also possible for a world to opt out of indirect conditions entirely, although it does come at a flat performance cost.
It should only be used by games that *really* need it. For most games, it should be reasonable to know all entrance &rarr; region dependencies, and in this case, indirect conditions are still preferred because they are faster.

View File

@@ -66,6 +66,7 @@ non_apworlds: set = {
"Adventure", "Adventure",
"ArchipIDLE", "ArchipIDLE",
"Archipelago", "Archipelago",
"ChecksFinder",
"Clique", "Clique",
"Final Fantasy", "Final Fantasy",
"Lufia II Ancient Cave", "Lufia II Ancient Cave",

View File

@@ -174,8 +174,8 @@ class TestFillRestrictive(unittest.TestCase):
player1 = generate_player_data(multiworld, 1, 3, 3) player1 = generate_player_data(multiworld, 1, 3, 3)
player2 = generate_player_data(multiworld, 2, 3, 3) player2 = generate_player_data(multiworld, 2, 3, 3)
multiworld.worlds[player1.id].options.accessibility.value = Accessibility.option_minimal multiworld.accessibility[player1.id].value = multiworld.accessibility[player1.id].option_minimal
multiworld.worlds[player2.id].options.accessibility.value = Accessibility.option_full multiworld.accessibility[player2.id].value = multiworld.accessibility[player2.id].option_locations
multiworld.completion_condition[player1.id] = lambda state: True multiworld.completion_condition[player1.id] = lambda state: True
multiworld.completion_condition[player2.id] = lambda state: state.has(player2.prog_items[2].name, player2.id) multiworld.completion_condition[player2.id] = lambda state: state.has(player2.prog_items[2].name, player2.id)

View File

@@ -1,6 +1,6 @@
import unittest import unittest
from BaseClasses import MultiWorld, PlandoOptions from BaseClasses import PlandoOptions
from Options import ItemLinks from Options import ItemLinks
from worlds.AutoWorld import AutoWorldRegister from worlds.AutoWorld import AutoWorldRegister
@@ -47,15 +47,3 @@ class TestOptions(unittest.TestCase):
self.assertIn("Bow", link.value[0]["item_pool"]) self.assertIn("Bow", link.value[0]["item_pool"])
# TODO test that the group created using these options has the items # TODO test that the group created using these options has the items
def test_item_links_resolve(self):
"""Test item link option resolves correctly."""
item_link_group = [{
"name": "ItemLinkTest",
"item_pool": ["Everything"],
"link_replacement": False,
"replacement_item": None,
}]
item_links = {1: ItemLinks.from_any(item_link_group), 2: ItemLinks.from_any(item_link_group)}
for link in item_links.values():
self.assertEqual(link.value[0], item_link_group[0])

View File

@@ -69,7 +69,7 @@ class TestTwoPlayerMulti(MultiworldTestBase):
for world in AutoWorldRegister.world_types.values(): for world in AutoWorldRegister.world_types.values():
self.multiworld = setup_multiworld([world, world], ()) self.multiworld = setup_multiworld([world, world], ())
for world in self.multiworld.worlds.values(): for world in self.multiworld.worlds.values():
world.options.accessibility.value = Accessibility.option_full world.options.accessibility.value = Accessibility.option_locations
self.assertSteps(gen_steps) self.assertSteps(gen_steps)
with self.subTest("filling multiworld", seed=self.multiworld.seed): with self.subTest("filling multiworld", seed=self.multiworld.seed):
distribute_items_restrictive(self.multiworld) distribute_items_restrictive(self.multiworld)

View File

@@ -39,7 +39,7 @@ def create_itempool(world: "HatInTimeWorld") -> List[Item]:
continue continue
else: else:
if name == "Scooter Badge": if name == "Scooter Badge":
if world.options.CTRLogic == CTRLogic.option_scooter or get_difficulty(world) >= Difficulty.MODERATE: if world.options.CTRLogic is CTRLogic.option_scooter or get_difficulty(world) >= Difficulty.MODERATE:
item_type = ItemClassification.progression item_type = ItemClassification.progression
elif name == "No Bonk Badge" and world.is_dw(): elif name == "No Bonk Badge" and world.is_dw():
item_type = ItemClassification.progression item_type = ItemClassification.progression

View File

@@ -659,10 +659,6 @@ def is_valid_act_combo(world: "HatInTimeWorld", entrance_act: Region,
if exit_act.name not in chapter_finales: if exit_act.name not in chapter_finales:
return False return False
exit_chapter: str = act_chapters.get(exit_act.name)
# make sure that certain time rift combinations never happen
always_block: bool = exit_chapter != "Mafia Town" and exit_chapter != "Subcon Forest"
if not ignore_certain_rules or always_block:
if entrance_act.name in rift_access_regions and exit_act.name in rift_access_regions[entrance_act.name]: if entrance_act.name in rift_access_regions and exit_act.name in rift_access_regions[entrance_act.name]:
return False return False
@@ -688,12 +684,9 @@ def is_valid_first_act(world: "HatInTimeWorld", act: Region) -> bool:
if act.name not in guaranteed_first_acts: if act.name not in guaranteed_first_acts:
return False return False
if world.options.ActRandomizer == ActRandomizer.option_light and "Time Rift" in act.name:
return False
# If there's only a single level in the starting chapter, only allow Mafia Town or Subcon Forest levels # If there's only a single level in the starting chapter, only allow Mafia Town or Subcon Forest levels
start_chapter = world.options.StartingChapter start_chapter = world.options.StartingChapter
if start_chapter == ChapterIndex.ALPINE or start_chapter == ChapterIndex.SUBCON: if start_chapter is ChapterIndex.ALPINE or start_chapter is ChapterIndex.SUBCON:
if "Time Rift" in act.name: if "Time Rift" in act.name:
return False return False
@@ -730,8 +723,7 @@ def is_valid_first_act(world: "HatInTimeWorld", act: Region) -> bool:
elif act.name == "Contractual Obligations" and world.options.ShuffleSubconPaintings: elif act.name == "Contractual Obligations" and world.options.ShuffleSubconPaintings:
return False return False
if world.options.ShuffleSubconPaintings and "Time Rift" not in act.name \ if world.options.ShuffleSubconPaintings and act_chapters.get(act.name, "") == "Subcon Forest":
and act_chapters.get(act.name, "") == "Subcon Forest":
# Only allow Subcon levels if painting skips are allowed # Only allow Subcon levels if painting skips are allowed
if diff < Difficulty.MODERATE or world.options.NoPaintingSkips: if diff < Difficulty.MODERATE or world.options.NoPaintingSkips:
return False return False

View File

@@ -1,6 +1,7 @@
from worlds.AutoWorld import CollectionState from worlds.AutoWorld import CollectionState
from worlds.generic.Rules import add_rule, set_rule from worlds.generic.Rules import add_rule, set_rule
from .Locations import location_table, zipline_unlocks, is_location_valid, shop_locations, event_locs from .Locations import location_table, zipline_unlocks, is_location_valid, contract_locations, \
shop_locations, event_locs
from .Types import HatType, ChapterIndex, hat_type_to_item, Difficulty, HitType from .Types import HatType, ChapterIndex, hat_type_to_item, Difficulty, HitType
from BaseClasses import Location, Entrance, Region from BaseClasses import Location, Entrance, Region
from typing import TYPE_CHECKING, List, Callable, Union, Dict from typing import TYPE_CHECKING, List, Callable, Union, Dict
@@ -147,14 +148,14 @@ def set_rules(world: "HatInTimeWorld"):
if world.is_dlc1(): if world.is_dlc1():
chapter_list.append(ChapterIndex.CRUISE) chapter_list.append(ChapterIndex.CRUISE)
if world.is_dlc2() and final_chapter != ChapterIndex.METRO: if world.is_dlc2() and final_chapter is not ChapterIndex.METRO:
chapter_list.append(ChapterIndex.METRO) chapter_list.append(ChapterIndex.METRO)
chapter_list.remove(starting_chapter) chapter_list.remove(starting_chapter)
world.random.shuffle(chapter_list) world.random.shuffle(chapter_list)
# Make sure Alpine is unlocked before any DLC chapters are, as the Alpine door needs to be open to access them # Make sure Alpine is unlocked before any DLC chapters are, as the Alpine door needs to be open to access them
if starting_chapter != ChapterIndex.ALPINE and (world.is_dlc1() or world.is_dlc2()): if starting_chapter is not ChapterIndex.ALPINE and (world.is_dlc1() or world.is_dlc2()):
index1 = 69 index1 = 69
index2 = 69 index2 = 69
pos: int pos: int
@@ -164,7 +165,7 @@ def set_rules(world: "HatInTimeWorld"):
if world.is_dlc1(): if world.is_dlc1():
index1 = chapter_list.index(ChapterIndex.CRUISE) index1 = chapter_list.index(ChapterIndex.CRUISE)
if world.is_dlc2() and final_chapter != ChapterIndex.METRO: if world.is_dlc2() and final_chapter is not ChapterIndex.METRO:
index2 = chapter_list.index(ChapterIndex.METRO) index2 = chapter_list.index(ChapterIndex.METRO)
lowest_index = min(index1, index2) lowest_index = min(index1, index2)
@@ -241,6 +242,9 @@ def set_rules(world: "HatInTimeWorld"):
if not is_location_valid(world, key): if not is_location_valid(world, key):
continue continue
if key in contract_locations.keys():
continue
loc = world.multiworld.get_location(key, world.player) loc = world.multiworld.get_location(key, world.player)
for hat in data.required_hats: for hat in data.required_hats:
@@ -252,7 +256,7 @@ def set_rules(world: "HatInTimeWorld"):
if data.paintings > 0 and world.options.ShuffleSubconPaintings: if data.paintings > 0 and world.options.ShuffleSubconPaintings:
add_rule(loc, lambda state, paintings=data.paintings: has_paintings(state, world, paintings)) add_rule(loc, lambda state, paintings=data.paintings: has_paintings(state, world, paintings))
if data.hit_type != HitType.none and world.options.UmbrellaLogic: if data.hit_type is not HitType.none and world.options.UmbrellaLogic:
if data.hit_type == HitType.umbrella: if data.hit_type == HitType.umbrella:
add_rule(loc, lambda state: state.has("Umbrella", world.player)) add_rule(loc, lambda state: state.has("Umbrella", world.player))
@@ -514,7 +518,7 @@ def set_hard_rules(world: "HatInTimeWorld"):
lambda state: can_use_hat(state, world, HatType.ICE)) lambda state: can_use_hat(state, world, HatType.ICE))
# Hard: clear Rush Hour with Brewing Hat only # Hard: clear Rush Hour with Brewing Hat only
if world.options.NoTicketSkips != NoTicketSkips.option_true: if world.options.NoTicketSkips is not NoTicketSkips.option_true:
set_rule(world.multiworld.get_location("Act Completion (Rush Hour)", world.player), set_rule(world.multiworld.get_location("Act Completion (Rush Hour)", world.player),
lambda state: can_use_hat(state, world, HatType.BREWING)) lambda state: can_use_hat(state, world, HatType.BREWING))
else: else:

View File

@@ -1,16 +1,15 @@
from BaseClasses import Item, ItemClassification, Tutorial, Location, MultiWorld from BaseClasses import Item, ItemClassification, Tutorial, Location, MultiWorld
from .Items import item_table, create_item, relic_groups, act_contracts, create_itempool, get_shop_trap_name, \ from .Items import item_table, create_item, relic_groups, act_contracts, create_itempool, get_shop_trap_name, \
calculate_yarn_costs, alps_hooks calculate_yarn_costs
from .Regions import create_regions, randomize_act_entrances, chapter_act_info, create_events, get_shuffled_region from .Regions import create_regions, randomize_act_entrances, chapter_act_info, create_events, get_shuffled_region
from .Locations import location_table, contract_locations, is_location_valid, get_location_names, TASKSANITY_START_ID, \ from .Locations import location_table, contract_locations, is_location_valid, get_location_names, TASKSANITY_START_ID, \
get_total_locations get_total_locations
from .Rules import set_rules, has_paintings from .Rules import set_rules
from .Options import AHITOptions, slot_data_options, adjust_options, RandomizeHatOrder, EndGoal, create_option_groups from .Options import AHITOptions, slot_data_options, adjust_options, RandomizeHatOrder, EndGoal, create_option_groups
from .Types import HatType, ChapterIndex, HatInTimeItem, hat_type_to_item, Difficulty from .Types import HatType, ChapterIndex, HatInTimeItem, hat_type_to_item
from .DeathWishLocations import create_dw_regions, dw_classes, death_wishes from .DeathWishLocations import create_dw_regions, dw_classes, death_wishes
from .DeathWishRules import set_dw_rules, create_enemy_events, hit_list, bosses from .DeathWishRules import set_dw_rules, create_enemy_events, hit_list, bosses
from worlds.AutoWorld import World, WebWorld, CollectionState from worlds.AutoWorld import World, WebWorld, CollectionState
from worlds.generic.Rules import add_rule
from typing import List, Dict, TextIO from typing import List, Dict, TextIO
from worlds.LauncherComponents import Component, components, icon_paths, launch_subprocess, Type from worlds.LauncherComponents import Component, components, icon_paths, launch_subprocess, Type
from Utils import local_path from Utils import local_path
@@ -87,27 +86,19 @@ class HatInTimeWorld(World):
if self.is_dw_only(): if self.is_dw_only():
return return
# Take care of some extremely restrictive starts in other chapters with act shuffle off # If our starting chapter is 4 and act rando isn't on, force hookshot into inventory
if not self.options.ActRandomizer: # If starting chapter is 3 and painting shuffle is enabled, and act rando isn't, give one free painting unlock
start_chapter = self.options.StartingChapter start_chapter: ChapterIndex = ChapterIndex(self.options.StartingChapter)
if start_chapter == ChapterIndex.ALPINE:
self.multiworld.push_precollected(self.create_item("Hookshot Badge"))
if self.options.UmbrellaLogic:
self.multiworld.push_precollected(self.create_item("Umbrella"))
if self.options.ShuffleAlpineZiplines: if start_chapter == ChapterIndex.ALPINE or start_chapter == ChapterIndex.SUBCON:
ziplines = list(alps_hooks.keys()) if not self.options.ActRandomizer:
ziplines.remove("Zipline Unlock - The Twilight Bell Path") # not enough checks from this one if start_chapter == ChapterIndex.ALPINE:
self.multiworld.push_precollected(self.create_item(self.random.choice(ziplines))) self.multiworld.push_precollected(self.create_item("Hookshot Badge"))
elif start_chapter == ChapterIndex.SUBCON: if self.options.UmbrellaLogic:
if self.options.ShuffleSubconPaintings:
self.multiworld.push_precollected(self.create_item("Progressive Painting Unlock"))
elif start_chapter == ChapterIndex.BIRDS:
if self.options.UmbrellaLogic:
if self.options.LogicDifficulty < Difficulty.EXPERT:
self.multiworld.push_precollected(self.create_item("Umbrella")) self.multiworld.push_precollected(self.create_item("Umbrella"))
elif self.options.LogicDifficulty < Difficulty.MODERATE:
self.multiworld.push_precollected(self.create_item("Umbrella")) if start_chapter == ChapterIndex.SUBCON and self.options.ShuffleSubconPaintings:
self.multiworld.push_precollected(self.create_item("Progressive Painting Unlock"))
def create_regions(self): def create_regions(self):
# noinspection PyClassVar # noinspection PyClassVar
@@ -128,10 +119,7 @@ class HatInTimeWorld(World):
# place vanilla contract locations if contract shuffle is off # place vanilla contract locations if contract shuffle is off
if not self.options.ShuffleActContracts: if not self.options.ShuffleActContracts:
for name in contract_locations.keys(): for name in contract_locations.keys():
loc = self.get_location(name) self.multiworld.get_location(name, self.player).place_locked_item(create_item(self, name))
loc.place_locked_item(create_item(self, name))
if self.options.ShuffleSubconPaintings and loc.name != "Snatcher's Contract - The Subcon Well":
add_rule(loc, lambda state: has_paintings(state, self, 1))
def create_items(self): def create_items(self):
if self.has_yarn(): if self.has_yarn():
@@ -329,7 +317,7 @@ class HatInTimeWorld(World):
def remove(self, state: "CollectionState", item: "Item") -> bool: def remove(self, state: "CollectionState", item: "Item") -> bool:
old_count: int = state.count(item.name, self.player) old_count: int = state.count(item.name, self.player)
change = super().remove(state, item) change = super().collect(state, item)
if change and old_count == 1: if change and old_count == 1:
if "Stamp" in item.name: if "Stamp" in item.name:
if "2 Stamp" in item.name: if "2 Stamp" in item.name:

View File

@@ -1,8 +1,8 @@
import typing import typing
from BaseClasses import MultiWorld from BaseClasses import MultiWorld
from Options import Choice, Range, DeathLink, DefaultOnToggle, FreeText, ItemsAccessibility, Option, \ from Options import Choice, Range, Option, Toggle, DefaultOnToggle, DeathLink, \
PlandoBosses, PlandoConnections, PlandoTexts, Removed, StartInventoryPool, Toggle StartInventoryPool, PlandoBosses, PlandoConnections, PlandoTexts, FreeText, Removed
from .EntranceShuffle import default_connections, default_dungeon_connections, \ from .EntranceShuffle import default_connections, default_dungeon_connections, \
inverted_default_connections, inverted_default_dungeon_connections inverted_default_connections, inverted_default_dungeon_connections
from .Text import TextTable from .Text import TextTable
@@ -743,7 +743,6 @@ class ALttPPlandoTexts(PlandoTexts):
alttp_options: typing.Dict[str, type(Option)] = { alttp_options: typing.Dict[str, type(Option)] = {
"accessibility": ItemsAccessibility,
"plando_connections": ALttPPlandoConnections, "plando_connections": ALttPPlandoConnections,
"plando_texts": ALttPPlandoTexts, "plando_texts": ALttPPlandoTexts,
"start_inventory_from_pool": StartInventoryPool, "start_inventory_from_pool": StartInventoryPool,

View File

@@ -2,7 +2,6 @@ import collections
import logging import logging
from typing import Iterator, Set from typing import Iterator, Set
from Options import ItemsAccessibility
from BaseClasses import Entrance, MultiWorld from BaseClasses import Entrance, MultiWorld
from worlds.generic.Rules import (add_item_rule, add_rule, forbid_item, from worlds.generic.Rules import (add_item_rule, add_rule, forbid_item,
item_name_in_location_names, location_item_name, set_rule, allow_self_locking_items) item_name_in_location_names, location_item_name, set_rule, allow_self_locking_items)
@@ -40,7 +39,7 @@ def set_rules(world):
else: else:
# Set access rules according to max glitches for multiworld progression. # Set access rules according to max glitches for multiworld progression.
# Set accessibility to none, and shuffle assuming the no logic players can always win # Set accessibility to none, and shuffle assuming the no logic players can always win
world.accessibility[player].value = ItemsAccessibility.option_minimal world.accessibility[player] = world.accessibility[player].from_text("minimal")
world.progression_balancing[player].value = 0 world.progression_balancing[player].value = 0
else: else:
@@ -378,7 +377,7 @@ def global_rules(multiworld: MultiWorld, player: int):
or state.has("Cane of Somaria", player))) or state.has("Cane of Somaria", player)))
set_rule(multiworld.get_location('Tower of Hera - Big Chest', player), lambda state: state.has('Big Key (Tower of Hera)', player)) set_rule(multiworld.get_location('Tower of Hera - Big Chest', player), lambda state: state.has('Big Key (Tower of Hera)', player))
set_rule(multiworld.get_location('Tower of Hera - Big Key Chest', player), lambda state: has_fire_source(state, player)) set_rule(multiworld.get_location('Tower of Hera - Big Key Chest', player), lambda state: has_fire_source(state, player))
if multiworld.accessibility[player] != 'full': if multiworld.accessibility[player] != 'locations':
set_always_allow(multiworld.get_location('Tower of Hera - Big Key Chest', player), lambda state, item: item.name == 'Small Key (Tower of Hera)' and item.player == player) set_always_allow(multiworld.get_location('Tower of Hera - Big Key Chest', player), lambda state, item: item.name == 'Small Key (Tower of Hera)' and item.player == player)
set_rule(multiworld.get_entrance('Swamp Palace Moat', player), lambda state: state.has('Flippers', player) and state.has('Open Floodgate', player)) set_rule(multiworld.get_entrance('Swamp Palace Moat', player), lambda state: state.has('Flippers', player) and state.has('Open Floodgate', player))
@@ -394,7 +393,7 @@ def global_rules(multiworld: MultiWorld, player: int):
if state.has('Hookshot', player) if state.has('Hookshot', player)
else state._lttp_has_key('Small Key (Swamp Palace)', player, 4)) else state._lttp_has_key('Small Key (Swamp Palace)', player, 4))
set_rule(multiworld.get_location('Swamp Palace - Big Chest', player), lambda state: state.has('Big Key (Swamp Palace)', player)) set_rule(multiworld.get_location('Swamp Palace - Big Chest', player), lambda state: state.has('Big Key (Swamp Palace)', player))
if multiworld.accessibility[player] != 'full': if multiworld.accessibility[player] != 'locations':
allow_self_locking_items(multiworld.get_location('Swamp Palace - Big Chest', player), 'Big Key (Swamp Palace)') allow_self_locking_items(multiworld.get_location('Swamp Palace - Big Chest', player), 'Big Key (Swamp Palace)')
set_rule(multiworld.get_entrance('Swamp Palace (North)', player), lambda state: state.has('Hookshot', player) and state._lttp_has_key('Small Key (Swamp Palace)', player, 5)) set_rule(multiworld.get_entrance('Swamp Palace (North)', player), lambda state: state.has('Hookshot', player) and state._lttp_has_key('Small Key (Swamp Palace)', player, 5))
if not multiworld.small_key_shuffle[player] and multiworld.glitches_required[player] not in ['hybrid_major_glitches', 'no_logic']: if not multiworld.small_key_shuffle[player] and multiworld.glitches_required[player] not in ['hybrid_major_glitches', 'no_logic']:
@@ -424,7 +423,7 @@ def global_rules(multiworld: MultiWorld, player: int):
set_rule(multiworld.get_entrance('Skull Woods First Section West Door', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 5)) set_rule(multiworld.get_entrance('Skull Woods First Section West Door', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 5))
set_rule(multiworld.get_entrance('Skull Woods First Section (Left) Door to Exit', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 5)) set_rule(multiworld.get_entrance('Skull Woods First Section (Left) Door to Exit', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 5))
set_rule(multiworld.get_location('Skull Woods - Big Chest', player), lambda state: state.has('Big Key (Skull Woods)', player) and can_use_bombs(state, player)) set_rule(multiworld.get_location('Skull Woods - Big Chest', player), lambda state: state.has('Big Key (Skull Woods)', player) and can_use_bombs(state, player))
if multiworld.accessibility[player] != 'full': if multiworld.accessibility[player] != 'locations':
allow_self_locking_items(multiworld.get_location('Skull Woods - Big Chest', player), 'Big Key (Skull Woods)') allow_self_locking_items(multiworld.get_location('Skull Woods - Big Chest', player), 'Big Key (Skull Woods)')
set_rule(multiworld.get_entrance('Skull Woods Torch Room', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 4) and state.has('Fire Rod', player) and has_sword(state, player)) # sword required for curtain set_rule(multiworld.get_entrance('Skull Woods Torch Room', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 4) and state.has('Fire Rod', player) and has_sword(state, player)) # sword required for curtain
add_rule(multiworld.get_location('Skull Woods - Prize', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 5)) add_rule(multiworld.get_location('Skull Woods - Prize', player), lambda state: state._lttp_has_key('Small Key (Skull Woods)', player, 5))
@@ -523,12 +522,12 @@ def global_rules(multiworld: MultiWorld, player: int):
set_rule(multiworld.get_entrance('Palace of Darkness Big Key Chest Staircase', player), lambda state: can_use_bombs(state, player) and (state._lttp_has_key('Small Key (Palace of Darkness)', player, 6) or ( set_rule(multiworld.get_entrance('Palace of Darkness Big Key Chest Staircase', player), lambda state: can_use_bombs(state, player) and (state._lttp_has_key('Small Key (Palace of Darkness)', player, 6) or (
location_item_name(state, 'Palace of Darkness - Big Key Chest', player) in [('Small Key (Palace of Darkness)', player)] and state._lttp_has_key('Small Key (Palace of Darkness)', player, 3)))) location_item_name(state, 'Palace of Darkness - Big Key Chest', player) in [('Small Key (Palace of Darkness)', player)] and state._lttp_has_key('Small Key (Palace of Darkness)', player, 3))))
if multiworld.accessibility[player] != 'full': if multiworld.accessibility[player] != 'locations':
set_always_allow(multiworld.get_location('Palace of Darkness - Big Key Chest', player), lambda state, item: item.name == 'Small Key (Palace of Darkness)' and item.player == player and state._lttp_has_key('Small Key (Palace of Darkness)', player, 5)) set_always_allow(multiworld.get_location('Palace of Darkness - Big Key Chest', player), lambda state, item: item.name == 'Small Key (Palace of Darkness)' and item.player == player and state._lttp_has_key('Small Key (Palace of Darkness)', player, 5))
set_rule(multiworld.get_entrance('Palace of Darkness Spike Statue Room Door', player), lambda state: state._lttp_has_key('Small Key (Palace of Darkness)', player, 6) or ( set_rule(multiworld.get_entrance('Palace of Darkness Spike Statue Room Door', player), lambda state: state._lttp_has_key('Small Key (Palace of Darkness)', player, 6) or (
location_item_name(state, 'Palace of Darkness - Harmless Hellway', player) in [('Small Key (Palace of Darkness)', player)] and state._lttp_has_key('Small Key (Palace of Darkness)', player, 4))) location_item_name(state, 'Palace of Darkness - Harmless Hellway', player) in [('Small Key (Palace of Darkness)', player)] and state._lttp_has_key('Small Key (Palace of Darkness)', player, 4)))
if multiworld.accessibility[player] != 'full': if multiworld.accessibility[player] != 'locations':
set_always_allow(multiworld.get_location('Palace of Darkness - Harmless Hellway', player), lambda state, item: item.name == 'Small Key (Palace of Darkness)' and item.player == player and state._lttp_has_key('Small Key (Palace of Darkness)', player, 5)) set_always_allow(multiworld.get_location('Palace of Darkness - Harmless Hellway', player), lambda state, item: item.name == 'Small Key (Palace of Darkness)' and item.player == player and state._lttp_has_key('Small Key (Palace of Darkness)', player, 5))
set_rule(multiworld.get_entrance('Palace of Darkness Maze Door', player), lambda state: state._lttp_has_key('Small Key (Palace of Darkness)', player, 6)) set_rule(multiworld.get_entrance('Palace of Darkness Maze Door', player), lambda state: state._lttp_has_key('Small Key (Palace of Darkness)', player, 6))
@@ -1201,7 +1200,7 @@ def set_trock_key_rules(world, player):
# Must not go in the Chain Chomps chest - only 2 other chests available and 3+ keys required for all other chests # Must not go in the Chain Chomps chest - only 2 other chests available and 3+ keys required for all other chests
forbid_item(world.get_location('Turtle Rock - Chain Chomps', player), 'Big Key (Turtle Rock)', player) forbid_item(world.get_location('Turtle Rock - Chain Chomps', player), 'Big Key (Turtle Rock)', player)
forbid_item(world.get_location('Turtle Rock - Pokey 2 Key Drop', player), 'Big Key (Turtle Rock)', player) forbid_item(world.get_location('Turtle Rock - Pokey 2 Key Drop', player), 'Big Key (Turtle Rock)', player)
if world.accessibility[player] == 'full': if world.accessibility[player] == 'locations':
if world.big_key_shuffle[player] and can_reach_big_chest: if world.big_key_shuffle[player] and can_reach_big_chest:
# Must not go in the dungeon - all 3 available chests (Chomps, Big Chest, Crystaroller) must be keys to access laser bridge, and the big key is required first # Must not go in the dungeon - all 3 available chests (Chomps, Big Chest, Crystaroller) must be keys to access laser bridge, and the big key is required first
for location in ['Turtle Rock - Chain Chomps', 'Turtle Rock - Compass Chest', for location in ['Turtle Rock - Chain Chomps', 'Turtle Rock - Compass Chest',
@@ -1215,7 +1214,7 @@ def set_trock_key_rules(world, player):
location.place_locked_item(item) location.place_locked_item(item)
toss_junk_item(world, player) toss_junk_item(world, player)
if world.accessibility[player] != 'full': if world.accessibility[player] != 'locations':
set_always_allow(world.get_location('Turtle Rock - Big Key Chest', player), lambda state, item: item.name == 'Small Key (Turtle Rock)' and item.player == player set_always_allow(world.get_location('Turtle Rock - Big Key Chest', player), lambda state, item: item.name == 'Small Key (Turtle Rock)' and item.player == player
and state.can_reach(state.multiworld.get_region('Turtle Rock (Second Section)', player))) and state.can_reach(state.multiworld.get_region('Turtle Rock (Second Section)', player)))

View File

@@ -76,6 +76,10 @@ class ALttPItem(Item):
if self.type in {"SmallKey", "BigKey", "Map", "Compass"}: if self.type in {"SmallKey", "BigKey", "Map", "Compass"}:
return self.type return self.type
@property
def locked_dungeon_item(self):
return self.location.locked and self.dungeon_item
class LTTPRegionType(IntEnum): class LTTPRegionType(IntEnum):
LightWorld = 1 LightWorld = 1

View File

@@ -1,11 +1,11 @@
from worlds.alttp.Dungeons import get_dungeon_item_pool from worlds.alttp.Dungeons import create_dungeons, get_dungeon_item_pool
from worlds.alttp.EntranceShuffle import link_inverted_entrances from worlds.alttp.EntranceShuffle import link_inverted_entrances
from worlds.alttp.InvertedRegions import create_inverted_regions from worlds.alttp.InvertedRegions import create_inverted_regions
from worlds.alttp.ItemPool import difficulties from worlds.alttp.ItemPool import difficulties
from worlds.alttp.Items import item_factory from worlds.alttp.Items import item_factory
from worlds.alttp.Regions import mark_light_world_regions from worlds.alttp.Regions import mark_light_world_regions
from worlds.alttp.Shops import create_shops from worlds.alttp.Shops import create_shops
from test.bases import TestBase from test.TestBase import TestBase
from worlds.alttp.test import LTTPTestBase from worlds.alttp.test import LTTPTestBase

View File

@@ -6,7 +6,7 @@ from worlds.alttp.Items import item_factory
from worlds.alttp.Options import GlitchesRequired from worlds.alttp.Options import GlitchesRequired
from worlds.alttp.Regions import mark_light_world_regions from worlds.alttp.Regions import mark_light_world_regions
from worlds.alttp.Shops import create_shops from worlds.alttp.Shops import create_shops
from test.bases import TestBase from test.TestBase import TestBase
from worlds.alttp.test import LTTPTestBase from worlds.alttp.test import LTTPTestBase

View File

@@ -6,7 +6,7 @@ from worlds.alttp.Items import item_factory
from worlds.alttp.Options import GlitchesRequired from worlds.alttp.Options import GlitchesRequired
from worlds.alttp.Regions import mark_light_world_regions from worlds.alttp.Regions import mark_light_world_regions
from worlds.alttp.Shops import create_shops from worlds.alttp.Shops import create_shops
from test.bases import TestBase from test.TestBase import TestBase
from worlds.alttp.test import LTTPTestBase from worlds.alttp.test import LTTPTestBase

View File

@@ -1006,8 +1006,6 @@ def rules(brcworld):
lambda state: mataan_challenge2(state, player, limit, glitched)) lambda state: mataan_challenge2(state, player, limit, glitched))
set_rule(multiworld.get_location("Mataan: Score challenge reward", player), set_rule(multiworld.get_location("Mataan: Score challenge reward", player),
lambda state: mataan_challenge3(state, player)) lambda state: mataan_challenge3(state, player))
set_rule(multiworld.get_location("Mataan: Coil joins the crew", player),
lambda state: mataan_deepest(state, player, limit, glitched))
if photos: if photos:
set_rule(multiworld.get_location("Mataan: Trash Polo", player), set_rule(multiworld.get_location("Mataan: Trash Polo", player),
lambda state: camera(state, player)) lambda state: camera(state, player))

View File

@@ -3,8 +3,8 @@ import typing
class ItemData(typing.NamedTuple): class ItemData(typing.NamedTuple):
code: int code: typing.Optional[int]
progression: bool = True progression: bool
class ChecksFinderItem(Item): class ChecksFinderItem(Item):
@@ -12,9 +12,16 @@ class ChecksFinderItem(Item):
item_table = { item_table = {
"Map Width": ItemData(80000), "Map Width": ItemData(80000, True),
"Map Height": ItemData(80001), "Map Height": ItemData(80001, True),
"Map Bombs": ItemData(80002), "Map Bombs": ItemData(80002, True),
} }
lookup_id_to_name: typing.Dict[int, str] = {data.code: item_name for item_name, data in item_table.items()} required_items = {
}
item_frequencies = {
}
lookup_id_to_name: typing.Dict[int, str] = {data.code: item_name for item_name, data in item_table.items() if data.code}

View File

@@ -3,14 +3,46 @@ import typing
class AdvData(typing.NamedTuple): class AdvData(typing.NamedTuple):
id: int id: typing.Optional[int]
region: str = "Board" region: str
class ChecksFinderLocation(Location): class ChecksFinderAdvancement(Location):
game: str = "ChecksFinder" game: str = "ChecksFinder"
base_id = 81000 advancement_table = {
advancement_table = {f"Tile {i+1}": AdvData(base_id+i) for i in range(25)} "Tile 1": AdvData(81000, 'Board'),
lookup_id_to_name: typing.Dict[int, str] = {data.id: item_name for item_name, data in advancement_table.items()} "Tile 2": AdvData(81001, 'Board'),
"Tile 3": AdvData(81002, 'Board'),
"Tile 4": AdvData(81003, 'Board'),
"Tile 5": AdvData(81004, 'Board'),
"Tile 6": AdvData(81005, 'Board'),
"Tile 7": AdvData(81006, 'Board'),
"Tile 8": AdvData(81007, 'Board'),
"Tile 9": AdvData(81008, 'Board'),
"Tile 10": AdvData(81009, 'Board'),
"Tile 11": AdvData(81010, 'Board'),
"Tile 12": AdvData(81011, 'Board'),
"Tile 13": AdvData(81012, 'Board'),
"Tile 14": AdvData(81013, 'Board'),
"Tile 15": AdvData(81014, 'Board'),
"Tile 16": AdvData(81015, 'Board'),
"Tile 17": AdvData(81016, 'Board'),
"Tile 18": AdvData(81017, 'Board'),
"Tile 19": AdvData(81018, 'Board'),
"Tile 20": AdvData(81019, 'Board'),
"Tile 21": AdvData(81020, 'Board'),
"Tile 22": AdvData(81021, 'Board'),
"Tile 23": AdvData(81022, 'Board'),
"Tile 24": AdvData(81023, 'Board'),
"Tile 25": AdvData(81024, 'Board'),
}
exclusion_table = {
}
events_table = {
}
lookup_id_to_name: typing.Dict[int, str] = {data.id: item_name for item_name, data in advancement_table.items() if data.id}

View File

@@ -0,0 +1,6 @@
import typing
from Options import Option
checksfinder_options: typing.Dict[str, type(Option)] = {
}

View File

@@ -1,24 +1,44 @@
from worlds.generic.Rules import set_rule from ..generic.Rules import set_rule
from BaseClasses import MultiWorld from BaseClasses import MultiWorld, CollectionState
items = ["Map Width", "Map Height", "Map Bombs"] def _has_total(state: CollectionState, player: int, total: int):
return (state.count('Map Width', player) + state.count('Map Height', player) +
state.count('Map Bombs', player)) >= total
# Sets rules on entrances and advancements that are always applied # Sets rules on entrances and advancements that are always applied
def set_rules(multiworld: MultiWorld, player: int): def set_rules(world: MultiWorld, player: int):
for i in range(20): set_rule(world.get_location("Tile 6", player), lambda state: _has_total(state, player, 1))
set_rule(multiworld.get_location(f"Tile {i+6}", player), lambda state, i=i: state.has_from_list(items, player, i+1)) set_rule(world.get_location("Tile 7", player), lambda state: _has_total(state, player, 2))
set_rule(world.get_location("Tile 8", player), lambda state: _has_total(state, player, 3))
set_rule(world.get_location("Tile 9", player), lambda state: _has_total(state, player, 4))
set_rule(world.get_location("Tile 10", player), lambda state: _has_total(state, player, 5))
set_rule(world.get_location("Tile 11", player), lambda state: _has_total(state, player, 6))
set_rule(world.get_location("Tile 12", player), lambda state: _has_total(state, player, 7))
set_rule(world.get_location("Tile 13", player), lambda state: _has_total(state, player, 8))
set_rule(world.get_location("Tile 14", player), lambda state: _has_total(state, player, 9))
set_rule(world.get_location("Tile 15", player), lambda state: _has_total(state, player, 10))
set_rule(world.get_location("Tile 16", player), lambda state: _has_total(state, player, 11))
set_rule(world.get_location("Tile 17", player), lambda state: _has_total(state, player, 12))
set_rule(world.get_location("Tile 18", player), lambda state: _has_total(state, player, 13))
set_rule(world.get_location("Tile 19", player), lambda state: _has_total(state, player, 14))
set_rule(world.get_location("Tile 20", player), lambda state: _has_total(state, player, 15))
set_rule(world.get_location("Tile 21", player), lambda state: _has_total(state, player, 16))
set_rule(world.get_location("Tile 22", player), lambda state: _has_total(state, player, 17))
set_rule(world.get_location("Tile 23", player), lambda state: _has_total(state, player, 18))
set_rule(world.get_location("Tile 24", player), lambda state: _has_total(state, player, 19))
set_rule(world.get_location("Tile 25", player), lambda state: _has_total(state, player, 20))
# Sets rules on completion condition # Sets rules on completion condition
def set_completion_rules(multiworld: MultiWorld, player: int): def set_completion_rules(world: MultiWorld, player: int):
width_req = 5 # 10 - 5
height_req = 5 # 10 - 5 width_req = 10-5
bomb_req = 15 # 20 - 5 height_req = 10-5
multiworld.completion_condition[player] = lambda state: state.has_all_counts( bomb_req = 20-5
{ completion_requirements = lambda state: \
"Map Width": width_req, state.has("Map Width", player, width_req) and \
"Map Height": height_req, state.has("Map Height", player, height_req) and \
"Map Bombs": bomb_req, state.has("Map Bombs", player, bomb_req)
}, player) world.completion_condition[player] = lambda state: completion_requirements(state)

View File

@@ -1,9 +1,9 @@
from BaseClasses import Region, Entrance, Tutorial, ItemClassification from BaseClasses import Region, Entrance, Item, Tutorial, ItemClassification
from .Items import ChecksFinderItem, item_table from .Items import ChecksFinderItem, item_table, required_items
from .Locations import ChecksFinderLocation, advancement_table from .Locations import ChecksFinderAdvancement, advancement_table, exclusion_table
from Options import PerGameCommonOptions from .Options import checksfinder_options
from .Rules import set_rules, set_completion_rules from .Rules import set_rules, set_completion_rules
from worlds.AutoWorld import World, WebWorld from ..AutoWorld import World, WebWorld
client_version = 7 client_version = 7
@@ -25,34 +25,38 @@ class ChecksFinderWorld(World):
ChecksFinder is a game where you avoid mines and find checks inside the board ChecksFinder is a game where you avoid mines and find checks inside the board
with the mines! You win when you get all your items and beat the board! with the mines! You win when you get all your items and beat the board!
""" """
game = "ChecksFinder" game: str = "ChecksFinder"
options_dataclass = PerGameCommonOptions option_definitions = checksfinder_options
topology_present = True
web = ChecksFinderWeb() web = ChecksFinderWeb()
item_name_to_id = {name: data.code for name, data in item_table.items()} item_name_to_id = {name: data.code for name, data in item_table.items()}
location_name_to_id = {name: data.id for name, data in advancement_table.items()} location_name_to_id = {name: data.id for name, data in advancement_table.items()}
def create_regions(self): def _get_checksfinder_data(self):
menu = Region("Menu", self.player, self.multiworld) return {
board = Region("Board", self.player, self.multiworld) 'world_seed': self.multiworld.per_slot_randoms[self.player].getrandbits(32),
board.locations += [ChecksFinderLocation(self.player, loc_name, loc_data.id, board) 'seed_name': self.multiworld.seed_name,
for loc_name, loc_data in advancement_table.items()] 'player_name': self.multiworld.get_player_name(self.player),
'player_id': self.player,
connection = Entrance(self.player, "New Board", menu) 'client_version': client_version,
menu.exits.append(connection) 'race': self.multiworld.is_race,
connection.connect(board) }
self.multiworld.regions += [menu, board]
def create_items(self): def create_items(self):
# Generate item pool # Generate item pool
itempool = [] itempool = []
# Add all required progression items
for (name, num) in required_items.items():
itempool += [name] * num
# Add the map width and height stuff # Add the map width and height stuff
itempool += ["Map Width"] * 5 # 10 - 5 itempool += ["Map Width"] * (10-5)
itempool += ["Map Height"] * 5 # 10 - 5 itempool += ["Map Height"] * (10-5)
# Add the map bombs # Add the map bombs
itempool += ["Map Bombs"] * 15 # 20 - 5 itempool += ["Map Bombs"] * (20-5)
# Convert itempool into real items # Convert itempool into real items
itempool = [self.create_item(item) for item in itempool] itempool = [item for item in map(lambda name: self.create_item(name), itempool)]
self.multiworld.itempool += itempool self.multiworld.itempool += itempool
@@ -60,16 +64,28 @@ class ChecksFinderWorld(World):
set_rules(self.multiworld, self.player) set_rules(self.multiworld, self.player)
set_completion_rules(self.multiworld, self.player) set_completion_rules(self.multiworld, self.player)
def fill_slot_data(self): def create_regions(self):
return { menu = Region("Menu", self.player, self.multiworld)
"world_seed": self.random.getrandbits(32), board = Region("Board", self.player, self.multiworld)
"seed_name": self.multiworld.seed_name, board.locations += [ChecksFinderAdvancement(self.player, loc_name, loc_data.id, board)
"player_name": self.player_name, for loc_name, loc_data in advancement_table.items() if loc_data.region == board.name]
"player_id": self.player,
"client_version": client_version,
"race": self.multiworld.is_race,
}
def create_item(self, name: str) -> ChecksFinderItem: connection = Entrance(self.player, "New Board", menu)
menu.exits.append(connection)
connection.connect(board)
self.multiworld.regions += [menu, board]
def fill_slot_data(self):
slot_data = self._get_checksfinder_data()
for option_name in checksfinder_options:
option = getattr(self.multiworld, option_name)[self.player]
if slot_data.get(option_name, None) is None and type(option.value) in {str, int}:
slot_data[option_name] = int(option.value)
return slot_data
def create_item(self, name: str) -> Item:
item_data = item_table[name] item_data = item_table[name]
return ChecksFinderItem(name, ItemClassification.progression, item_data.code, self.player) item = ChecksFinderItem(name,
ItemClassification.progression if item_data.progression else ItemClassification.filler,
item_data.code, self.player)
return item

View File

@@ -24,3 +24,8 @@ next to an icon, the number is how many you have gotten and the icon represents
Victory is achieved when the player wins a board they were given after they have received all of their Map Width, Map Victory is achieved when the player wins a board they were given after they have received all of their Map Width, Map
Height, and Map Bomb items. The game will say at the bottom of the screen how many of each you have received. Height, and Map Bomb items. The game will say at the bottom of the screen how many of each you have received.
## Unique Local Commands
The following command is only available when using the ChecksFinderClient to play with Archipelago.
- `/resync` Manually trigger a resync.

View File

@@ -4,6 +4,7 @@
- ChecksFinder from - ChecksFinder from
the [Github releases Page for the game](https://github.com/jonloveslegos/ChecksFinder/releases) (latest version) the [Github releases Page for the game](https://github.com/jonloveslegos/ChecksFinder/releases) (latest version)
- Archipelago from the [Archipelago Releases Page](https://github.com/ArchipelagoMW/Archipelago/releases)
## Configuring your YAML file ## Configuring your YAML file
@@ -16,15 +17,28 @@ guide: [Basic Multiworld Setup Guide](/tutorial/Archipelago/setup/en)
You can customize your options by visiting the [ChecksFinder Player Options Page](/games/ChecksFinder/player-options) You can customize your options by visiting the [ChecksFinder Player Options Page](/games/ChecksFinder/player-options)
## Joining a MultiWorld Game ### Generating a ChecksFinder game
1. Start ChecksFinder **ChecksFinder is meant to be played _alongside_ another game! You may not be playing it for long periods of time if
2. Enter the following information: you play it by itself with another person!**
- Enter the server url (starting from `wss://` for https connection like archipelago.gg, and starting from `ws://` for http connection and local multiserver)
- Enter server port When you join a multiworld game, you will be asked to provide your YAML file to whoever is hosting. Once that is done,
- Enter the name of the slot you wish to connect to the host will provide you with either a link to download your data file, or with a zip file containing everyone's data
- Enter the room password (optional) files. You do not have a file inside that zip though!
- Press `Play Online` to connect
3. Start playing! You need to start ChecksFinder client yourself, it is located within the Archipelago folder.
### Connect to the MultiServer
First start ChecksFinder.
Once both ChecksFinder and the client are started. In the client at the top type in the spot labeled `Server` type the
`Ip Address` and `Port` separated with a `:` symbol.
The client will then ask for the username you chose, input that in the text box at the bottom of the client.
### Play the game
When the console tells you that you have joined the room, you're all set. Congratulations on successfully joining a
multiworld game!
Game options and controls are described in the readme on the github repository for the game

View File

@@ -1,6 +1,5 @@
from dataclasses import dataclass from dataclasses import dataclass
from Options import (OptionGroup, Choice, DefaultOnToggle, ItemsAccessibility, PerGameCommonOptions, Range, Toggle, from Options import OptionGroup, Choice, DefaultOnToggle, Range, Toggle, PerGameCommonOptions, StartInventoryPool
StartInventoryPool)
class CharacterStages(Choice): class CharacterStages(Choice):
@@ -522,7 +521,6 @@ class DeathLink(Choice):
@dataclass @dataclass
class CV64Options(PerGameCommonOptions): class CV64Options(PerGameCommonOptions):
accessibility: ItemsAccessibility
start_inventory_from_pool: StartInventoryPool start_inventory_from_pool: StartInventoryPool
character_stages: CharacterStages character_stages: CharacterStages
stage_shuffle: StageShuffle stage_shuffle: StageShuffle

View File

@@ -660,18 +660,11 @@ commands.add_command("ap-get-technology", "Grant a technology, used by the Archi
end end
local tech local tech
local force = game.forces["player"] local force = game.forces["player"]
if call.parameter == nil then
game.print("ap-get-technology is only to be used by the Archipelago Factorio Client")
return
end
chunks = split(call.parameter, "\t") chunks = split(call.parameter, "\t")
local item_name = chunks[1] local item_name = chunks[1]
local index = chunks[2] local index = chunks[2]
local source = chunks[3] or "Archipelago" local source = chunks[3] or "Archipelago"
if index == nil then if index == -1 then -- for coop sync and restoring from an older savegame
game.print("ap-get-technology is only to be used by the Archipelago Factorio Client")
return
elseif index == -1 then -- for coop sync and restoring from an older savegame
tech = force.technologies[item_name] tech = force.technologies[item_name]
if tech.researched ~= true then if tech.researched ~= true then
game.print({"", "Received [technology=" .. tech.name .. "] as it is already checked."}) game.print({"", "Received [technology=" .. tech.name .. "] as it is already checked."})

View File

@@ -71,7 +71,7 @@ class FFMQClient(SNIClient):
received = await snes_read(ctx, RECEIVED_DATA[0], RECEIVED_DATA[1]) received = await snes_read(ctx, RECEIVED_DATA[0], RECEIVED_DATA[1])
data = await snes_read(ctx, READ_DATA_START, READ_DATA_END - READ_DATA_START) data = await snes_read(ctx, READ_DATA_START, READ_DATA_END - READ_DATA_START)
check_2 = await snes_read(ctx, 0xF53749, 1) check_2 = await snes_read(ctx, 0xF53749, 1)
if check_1 != b'\x01' or check_2 != b'\x01': if check_1 != b'01' or check_2 != b'01':
return return
def get_range(data_range): def get_range(data_range):

View File

@@ -216,7 +216,7 @@ def stage_set_rules(multiworld):
multiworld.worlds[player].options.accessibility == "minimal"]) * 3): multiworld.worlds[player].options.accessibility == "minimal"]) * 3):
for player in no_enemies_players: for player in no_enemies_players:
for location in vendor_locations: for location in vendor_locations:
if multiworld.worlds[player].options.accessibility == "full": if multiworld.worlds[player].options.accessibility == "locations":
multiworld.get_location(location, player).progress_type = LocationProgressType.EXCLUDED multiworld.get_location(location, player).progress_type = LocationProgressType.EXCLUDED
else: else:
multiworld.get_location(location, player).access_rule = lambda state: False multiworld.get_location(location, player).access_rule = lambda state: False

View File

@@ -25,25 +25,14 @@ from .Client import FFMQClient
class FFMQWebWorld(WebWorld): class FFMQWebWorld(WebWorld):
setup_en = Tutorial( tutorials = [Tutorial(
"Multiworld Setup Guide", "Multiworld Setup Guide",
"A guide to playing Final Fantasy Mystic Quest with Archipelago.", "A guide to playing Final Fantasy Mystic Quest with Archipelago.",
"English", "English",
"setup_en.md", "setup_en.md",
"setup/en", "setup/en",
["Alchav"] ["Alchav"]
) )]
setup_fr = Tutorial(
setup_en.tutorial_name,
setup_en.description,
"Français",
"setup_fr.md",
"setup/fr",
["Artea"]
)
tutorials = [setup_en, setup_fr]
class FFMQWorld(World): class FFMQWorld(World):

View File

@@ -1,8 +1,5 @@
# Final Fantasy Mystic Quest # Final Fantasy Mystic Quest
## Game page in other languages:
* [Français](/games/Final%20Fantasy%20Mystic%20Quest/info/fr)
## Where is the options page? ## Where is the options page?
The [player options page for this game](../player-options) contains all the options you need to configure and export a The [player options page for this game](../player-options) contains all the options you need to configure and export a

View File

@@ -1,36 +0,0 @@
# Final Fantasy Mystic Quest
## Page d'info dans d'autres langues :
* [English](/games/Final%20Fantasy%20Mystic%20Quest/info/en)
## Où se situe la page d'options?
La [page de configuration](../player-options) contient toutes les options nécessaires pour créer un fichier de configuration.
## Qu'est-ce qui est rendu aléatoire dans ce jeu?
Outre les objets mélangés, il y a plusieurs options pour aussi mélanger les villes et donjons, les pièces dans les donjons, les téléporteurs et les champs de bataille.
Il y a aussi plusieurs autres options afin d'ajuster la difficulté du jeu et la vitesse d'une partie.
## Quels objets et emplacements sont mélangés?
Les objets normalement reçus des coffres rouges, des PNJ et des champs de bataille sont mélangés. Vous pouvez aussi
inclure les objets des coffres bruns (qui contiennent normalement des consommables) dans les objets mélangés.
## Quels objets peuvent être dans les mondes des autres joueurs?
Tous les objets qui ont été déterminés mélangés dans les options peuvent être placés dans d'autres mondes.
## À quoi ressemblent les objets des autres joueurs dans Final Fantasy Mystic Quest?
Les emplacements qui étaient à l'origine des coffres (rouges ou bruns si ceux-ci sont inclus) apparaîtront comme des coffres.
Les coffres rouges seront des objets utiles ou de progression, alors que les coffres bruns seront des objets de remplissage.
Les pièges peuvent apparaître comme des coffres rouges ou bruns.
Lorsque vous ouvrirez un coffre contenant un objet d'un autre joueur, vous recevrez l'icône d'Archipelago et
la boîte de dialogue vous indiquera avoir reçu un "Archipelago Item".
## Lorsqu'un joueur reçoit un objet, qu'arrive-t-il?
Une boîte de dialogue apparaîtra pour vous montrer l'objet que vous avez reçu. Vous ne pourrez pas recevoir d'objet si vous êtes
en combat, dans la mappemonde ou dans les menus (à l'exception de lorsque vous fermez le menu).

View File

@@ -17,12 +17,6 @@ The Archipelago community cannot supply you with this.
## Installation Procedures ## Installation Procedures
### Linux Setup
1. Download and install [Archipelago](<https://github.com/ArchipelagoMW/Archipelago/releases/latest>). **The installer
file is located in the assets section at the bottom of the version information. You'll likely be looking for the `.AppImage`.**
2. It is recommended to use either RetroArch or BizHawk if you run on linux, as snes9x-rr isn't compatible.
### Windows Setup ### Windows Setup
1. Download and install [Archipelago](<https://github.com/ArchipelagoMW/Archipelago/releases/latest>). **The installer 1. Download and install [Archipelago](<https://github.com/ArchipelagoMW/Archipelago/releases/latest>). **The installer
@@ -81,7 +75,8 @@ Manually launch the SNI Client, and run the patched ROM in your chosen software
#### With an emulator #### With an emulator
If this is the first time SNI launches, you may be prompted to allow it to communicate through the Windows Firewall. When the client launched automatically, SNI should have also automatically launched in the background. If this is its
first time launching, you may be prompted to allow it to communicate through the Windows Firewall.
##### snes9x-rr ##### snes9x-rr
@@ -138,10 +133,10 @@ page: [usb2snes Supported Platforms Page](http://usb2snes.com/#supported-platfor
### Connect to the Archipelago Server ### Connect to the Archipelago Server
SNI serves as the interface between your emulator and the server. Since you launched it manually, you need to tell it what server to connect to. The patch file which launched your client should have automatically connected you to the AP Server. There are a few
If the server is hosted on Archipelago.gg, get the port the server hosts your game on at the top of the game room (last line before the worlds are listed). reasons this may not happen however, including if the game is hosted on the website but was generated elsewhere. If the
In the SNI client, either type `/connect address` (where `address` is the address of the server, for example `/connect archipelago.gg:12345`), or type the address and port on the "Server" input field, then press `Connect`. client window shows "Server Status: Not Connected", simply ask the host for the address of the server, and copy/paste it
If the server is hosted locally, simply ask the host for the address of the server, and copy/paste it into the "Server" input field then press `Connect`. into the "Server" input field then press enter.
The client will attempt to reconnect to the new server address, and should momentarily show "Server Status: Connected". The client will attempt to reconnect to the new server address, and should momentarily show "Server Status: Connected".

View File

@@ -1,178 +0,0 @@
# Final Fantasy Mystic Quest Setup Guide
## Logiciels requis
- [Archipelago](https://github.com/ArchipelagoMW/Archipelago/releases)
- Une solution logicielle ou matérielle capable de charger et de lancer des fichiers ROM de SNES
- Un émulateur capable d'éxécuter des scripts Lua
- snes9x-rr de: [snes9x rr](https://github.com/gocha/snes9x-rr/releases),
- BizHawk from: [BizHawk Website](http://tasvideos.org/BizHawk.html),
- RetroArch 1.10.1 or newer from: [RetroArch Website](https://retroarch.com?page=platforms). Ou,
- Un SD2SNES, [FXPak Pro](https://krikzz.com/store/home/54-fxpak-pro.html), ou une autre solution matérielle
compatible
- Le fichier ROM de la v1.0 ou v1.1 NA de Final Fantasy Mystic Quest obtenu légalement, sûrement nommé `Final Fantasy - Mystic Quest (U) (V1.0).sfc` ou `Final Fantasy - Mystic Quest (U) (V1.1).sfc`
La communauté d'Archipelago ne peut vous fournir avec ce fichier.
## Procédure d'installation
### Installation sur Linux
1. Téléchargez et installez [Archipelago](<https://github.com/ArchipelagoMW/Archipelago/releases/latest>).
** Le fichier d'installation est situé dans la section "assets" dans le bas de la fenêtre d'information de la version. Vous voulez probablement le `.AppImage`**
2. L'utilisation de RetroArch ou BizHawk est recommandé pour les utilisateurs linux, puisque snes9x-rr n'est pas compatible.
### Installation sur Windows
1. Téléchargez et installez [Archipelago](<https://github.com/ArchipelagoMW/Archipelago/releases/latest>).
** Le fichier d'installation est situé dans la section "assets" dans le bas de la fenêtre d'information de la version.**
2. Si vous utilisez un émulateur, il est recommandé d'assigner votre émulateur capable d'éxécuter des scripts Lua comme
programme par défaut pour ouvrir vos ROMs.
1. Extrayez votre dossier d'émulateur sur votre Bureau, ou à un endroit dont vous vous souviendrez.
2. Faites un clic droit sur un fichier ROM et sélectionnez **Ouvrir avec...**
3. Cochez la case à côté de **Toujours utiliser cette application pour ouvrir les fichiers `.sfc`**
4. Descendez jusqu'en bas de la liste et sélectionnez **Rechercher une autre application sur ce PC**
5. Naviguez dans les dossiers jusqu'au fichier `.exe` de votre émulateur et choisissez **Ouvrir**. Ce fichier
devrait se trouver dans le dossier que vous avez extrait à la première étape.
## Créer son fichier de configuration (.yaml)
### Qu'est-ce qu'un fichier de configuration et pourquoi en ai-je besoin ?
Votre fichier de configuration contient un ensemble d'options de configuration pour indiquer au générateur
comment il devrait générer votre seed. Chaque joueur d'un multiworld devra fournir son propre fichier de configuration. Cela permet
à chaque joueur d'apprécier une expérience personalisée. Les différents joueurs d'un même multiworld
pouront avoir des options de génération différentes.
Vous pouvez lire le [guide pour créer un YAML de base](/tutorial/Archipelago/setup/en) en anglais.
### Où est-ce que j'obtiens un fichier de configuration ?
La [page d'options sur le site](/games/Final%20Fantasy%20Mystic%20Quest/player-options) vous permet de choisir vos
options de génération et de les exporter vers un fichier de configuration.
Il vous est aussi possible de trouver le fichier de configuration modèle de Mystic Quest dans votre répertoire d'installation d'Archipelago,
dans le dossier Players/Templates.
### Vérifier son fichier de configuration
Si vous voulez valider votre fichier de configuration pour être sûr qu'il fonctionne, vous pouvez le vérifier sur la page du
[Validateur de YAML](/mysterycheck).
## Générer une partie pour un joueur
1. Aller sur la page [Génération de partie](/games/Final%20Fantasy%20Mystic%20Quest/player-options), configurez vos options,
et cliquez sur le bouton "Generate Game".
2. Il vous sera alors présenté une page d'informations sur la seed
3. Cliquez sur le lien "Create New Room".
4. Vous verrez s'afficher la page du server, de laquelle vous pourrez télécharger votre fichier patch `.apmq`.
5. Rendez-vous sur le [site FFMQR](https://ffmqrando.net/Archipelago).
Sur cette page, sélectionnez votre ROM Final Fantasy Mystic Quest original dans le boîte "ROM", puis votre ficher patch `.apmq` dans la boîte "Load Archipelago Config File".
Cliquez sur "Generate". Un téléchargement avec votre ROM aléatoire devrait s'amorcer.
6. Puisque cette partie est à un seul joueur, vous n'avez plus besoin du client Archipelago ni du serveur, sentez-vous libre de les fermer.
## Rejoindre un MultiWorld
### Obtenir son patch et créer sa ROM
Quand vous rejoignez un multiworld, il vous sera demandé de fournir votre fichier de configuration à celui qui héberge la partie ou
s'occupe de la génération. Une fois cela fait, l'hôte vous fournira soit un lien pour télécharger votre patch, soit un
fichier `.zip` contenant les patchs de tous les joueurs. Votre patch devrait avoir l'extension `.apmq`.
Allez au [site FFMQR](https://ffmqrando.net/Archipelago) et sélectionnez votre ROM Final Fantasy Mystic Quest original dans le boîte "ROM", puis votre ficher patch `.apmq` dans la boîte "Load Archipelago Config File".
Cliquez sur "Generate". Un téléchargement avec votre ROM aléatoire devrait s'amorcer.
Ouvrez le client SNI (sur Windows ArchipelagoSNIClient.exe, sur Linux ouvrez le `.appImage` puis cliquez sur SNI Client), puis ouvrez le ROM téléchargé avec votre émulateur choisi.
### Se connecter au client
#### Avec un émulateur
Quand le client se lance automatiquement, QUsb2Snes devrait également se lancer automatiquement en arrière-plan. Si
c'est la première fois qu'il démarre, il vous sera peut-être demandé de l'autoriser à communiquer à travers le pare-feu
Windows.
##### snes9x-rr
1. Chargez votre ROM si ce n'est pas déjà fait.
2. Cliquez sur le menu "File" et survolez l'option **Lua Scripting**
3. Cliquez alors sur **New Lua Script Window...**
4. Dans la nouvelle fenêtre, sélectionnez **Browse...**
5. Sélectionnez le fichier connecteur lua fourni avec votre client
- Regardez dans le dossier Archipelago et cherchez `/SNI/lua/x64` ou `/SNI/lua/x86`, dépendemment de si votre emulateur
est 64-bit ou 32-bit.
6. Si vous obtenez une erreur `socket.dll missing` ou une erreur similaire lorsque vous chargez le script lua, vous devez naviguer dans le dossier
contenant le script lua, puis copier le fichier `socket.dll` dans le dossier d'installation de votre emulateur snes9x.
##### BizHawk
1. Assurez vous d'avoir le coeur BSNES chargé. Cela est possible en cliquant sur le menu "Tools" de BizHawk et suivant
ces options de menu :
`Config --> Cores --> SNES --> BSNES`
Une fois le coeur changé, vous devez redémarrer BizHawk.
2. Chargez votre ROM si ce n'est pas déjà fait.
3. Cliquez sur le menu "Tools" et cliquez sur **Lua Console**
4. Cliquez sur le bouton pour ouvrir un nouveau script Lua, soit par le bouton avec un icône "Ouvrir un dossier",
en cliquant `Open Script...` dans le menu Script ou en appuyant sur `ctrl-O`.
5. Sélectionnez le fichier `Connector.lua` inclus avec le client
- Regardez dans le dossier Archipelago et cherchez `/SNI/lua/x64` ou `/SNI/lua/x86`, dépendemment de si votre emulateur
est 64-bit ou 32-bit. Notez que les versions les plus récentes de BizHawk ne sont que 64-bit.
##### RetroArch 1.10.1 ou plus récent
Vous ne devez faire ces étapes qu'une fois. À noter que RetroArch 1.9.x ne fonctionnera pas puisqu'il s'agit d'une version moins récente que 1.10.1.
1. Entrez dans le menu principal de RetroArch.
2. Allez dans Settings --> User Interface. Activez l'option "Show Advanced Settings".
3. Allez dans Settings --> Network. Activez l'option "Network Commands", qui se trouve sous "Request Device 16".
Laissez le "Network Command Port" à sa valeur par defaut, qui devrait être 55355.
![Capture d'écran du menu Network Commands setting](/static/generated/docs/A%20Link%20to%20the%20Past/retroarch-network-commands-en.png)
4. Allez dans le Menu Principal --> Online Updater --> Core Downloader. Trouvez et sélectionnez "Nintendo - SNES / SFC (bsnes-mercury
Performance)".
Lorsque vous chargez un ROM pour Archipelago, assurez vous de toujours sélectionner le coeur **bsnes-mercury**.
Ce sont les seuls coeurs qui permettent à des outils extérieurs de lire les données du ROM.
#### Avec une solution matérielle
Ce guide suppose que vous avez téléchargé le bon micro-logiciel pour votre appareil. Si ce n'est pas déjà le cas, faites
le maintenant. Les utilisateurs de SD2SNES et de FXPak Pro peuvent télécharger le micro-logiciel approprié
[ici](https://github.com/RedGuyyyy/sd2snes/releases). Pour les autres solutions, de l'aide peut être trouvée
[sur cette page](http://usb2snes.com/#supported-platforms).
1. Fermez votre émulateur, qui s'est potentiellement lancé automatiquement.
2. Ouvrez votre appareil et chargez le ROM.
### Se connecter au MultiServer
Puisque vous avez lancé SNI manuellement, vous devrez probablement lui indiquer l'adresse à laquelle il doit se connecter.
Si le serveur est hébergé sur le site d'Archipelago, vous verrez l'adresse à laquelle vous connecter dans le haut de la page, dernière ligne avant la liste des mondes.
Tapez `/connect adresse` (ou le "adresse" est remplacé par l'adresse archipelago, par exemple `/connect archipelago.gg:12345`) dans la boîte de commande au bas de votre client SNI, ou encore écrivez l'adresse dans la boîte "server" dans le haut du client, puis cliquez `Connect`.
Si le serveur n'est pas hébergé sur le site d'Archipelago, demandez à l'hôte l'adresse du serveur, puis tapez `/connect adresse` (ou "adresse" est remplacé par l'adresse fourni par l'hôte) ou copiez/collez cette adresse dans le champ "Server" puis appuyez sur "Connect".
Le client essaiera de vous reconnecter à la nouvelle adresse du serveur, et devrait mentionner "Server Status:
Connected". Si le client ne se connecte pas après quelques instants, il faudra peut-être rafraîchir la page de
l'interface Web.
### Jouer au jeu
Une fois que l'interface Web affiche que la SNES et le serveur sont connectés, vous êtes prêt à jouer. Félicitations
pour avoir rejoint un multiworld !
## Héberger un MultiWorld
La méthode recommandée pour héberger une partie est d'utiliser le service d'hébergement fourni par
Archipelago. Le processus est relativement simple :
1. Récupérez les fichiers de configuration (.yaml) des joueurs.
2. Créez une archive zip contenant ces fichiers de configuration.
3. Téléversez l'archive zip sur le lien ci-dessous.
- Generate page: [WebHost Seed Generation Page](/generate)
4. Attendez un moment que la seed soit générée.
5. Lorsque la seed est générée, vous serez redirigé vers une page d'informations "Seed Info".
6. Cliquez sur "Create New Room". Cela vous amènera à la page du serveur. Fournissez le lien de cette page aux autres
joueurs afin qu'ils puissent récupérer leurs patchs.
7. Remarquez qu'un lien vers le traqueur du MultiWorld est en haut de la page de la salle. Vous devriez également
fournir ce lien aux joueurs pour qu'ils puissent suivre la progression de la partie. N'importe quelle personne voulant
observer devrait avoir accès à ce lien.
8. Une fois que tous les joueurs ont rejoint, vous pouvez commencer à jouer.

View File

@@ -102,10 +102,10 @@ See the plando guide for more info on plando options. Plando
guide: [Archipelago Plando Guide](/tutorial/Archipelago/plando/en) guide: [Archipelago Plando Guide](/tutorial/Archipelago/plando/en)
* `accessibility` determines the level of access to the game the generation will expect you to have in order to reach * `accessibility` determines the level of access to the game the generation will expect you to have in order to reach
your completion goal. This supports `full`, `items`, and `minimal` and is set to `full` by default. your completion goal. This supports `items`, `locations`, and `minimal` and is set to `locations` by default.
* `full` will guarantee all locations are accessible in your world. * `locations` will guarantee all locations are accessible in your world.
* `items` will guarantee you can acquire all logically relevant items in your world. Some items, such as keys, may * `items` will guarantee you can acquire all logically relevant items in your world. Some items, such as keys, may
be self-locking. This value only exists in and affects some worlds. be self-locking.
* `minimal` will only guarantee that the seed is beatable. You will be guaranteed able to finish the seed logically * `minimal` will only guarantee that the seed is beatable. You will be guaranteed able to finish the seed logically
but may not be able to access all locations or acquire all items. A good example of this is having a big key in but may not be able to access all locations or acquire all items. A good example of this is having a big key in
the big chest in a dungeon in ALTTP making it impossible to get and finish the dungeon. the big chest in a dungeon in ALTTP making it impossible to get and finish the dungeon.

View File

@@ -1,12 +1,10 @@
import typing import typing
import re import re
from dataclasses import dataclass, make_dataclass
from .ExtractedData import logic_options, starts, pool_options from .ExtractedData import logic_options, starts, pool_options
from .Rules import cost_terms from .Rules import cost_terms
from schema import And, Schema, Optional from schema import And, Schema, Optional
from Options import Option, DefaultOnToggle, Toggle, Choice, Range, OptionDict, NamedRange, DeathLink, PerGameCommonOptions from Options import Option, DefaultOnToggle, Toggle, Choice, Range, OptionDict, NamedRange, DeathLink
from .Charms import vanilla_costs, names as charm_names from .Charms import vanilla_costs, names as charm_names
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
@@ -540,5 +538,3 @@ hollow_knight_options: typing.Dict[str, type(Option)] = {
}, },
**cost_sanity_weights **cost_sanity_weights
} }
HKOptions = make_dataclass("HKOptions", [(name, option) for name, option in hollow_knight_options.items()], bases=(PerGameCommonOptions,))

View File

@@ -49,42 +49,3 @@ def set_rules(hk_world: World):
if term == "GEO": # No geo logic! if term == "GEO": # No geo logic!
continue continue
add_rule(location, lambda state, term=term, amount=amount: state.count(term, player) >= amount) add_rule(location, lambda state, term=term, amount=amount: state.count(term, player) >= amount)
def _hk_nail_combat(state, player) -> bool:
return state.has_any({'LEFTSLASH', 'RIGHTSLASH', 'UPSLASH'}, player)
def _hk_can_beat_thk(state, player) -> bool:
return (
state.has('Opened_Black_Egg_Temple', player)
and (state.count('FIREBALL', player) + state.count('SCREAM', player) + state.count('QUAKE', player)) > 1
and _hk_nail_combat(state, player)
and (
state.has_any({'LEFTDASH', 'RIGHTDASH'}, player)
or state._hk_option(player, 'ProficientCombat')
)
and state.has('FOCUS', player)
)
def _hk_siblings_ending(state, player) -> bool:
return _hk_can_beat_thk(state, player) and state.has('WHITEFRAGMENT', player, 3)
def _hk_can_beat_radiance(state, player) -> bool:
return (
state.has('Opened_Black_Egg_Temple', player)
and _hk_nail_combat(state, player)
and state.has('WHITEFRAGMENT', player, 3)
and state.has('DREAMNAIL', player)
and (
(state.has('LEFTCLAW', player) and state.has('RIGHTCLAW', player))
or state.has('WINGS', player)
)
and (state.count('FIREBALL', player) + state.count('SCREAM', player) + state.count('QUAKE', player)) > 1
and (
(state.has('LEFTDASH', player, 2) and state.has('RIGHTDASH', player, 2)) # Both Shade Cloaks
or (state._hk_option(player, 'ProficientCombat') and state.has('QUAKE', player)) # or Dive
)
)

View File

@@ -10,9 +10,9 @@ logger = logging.getLogger("Hollow Knight")
from .Items import item_table, lookup_type_to_names, item_name_groups from .Items import item_table, lookup_type_to_names, item_name_groups
from .Regions import create_regions from .Regions import create_regions
from .Rules import set_rules, cost_terms, _hk_can_beat_thk, _hk_siblings_ending, _hk_can_beat_radiance from .Rules import set_rules, cost_terms
from .Options import hollow_knight_options, hollow_knight_randomize_options, Goal, WhitePalace, CostSanity, \ from .Options import hollow_knight_options, hollow_knight_randomize_options, Goal, WhitePalace, CostSanity, \
shop_to_option, HKOptions shop_to_option
from .ExtractedData import locations, starts, multi_locations, location_to_region_lookup, \ from .ExtractedData import locations, starts, multi_locations, location_to_region_lookup, \
event_names, item_effects, connectors, one_ways, vanilla_shop_costs, vanilla_location_costs event_names, item_effects, connectors, one_ways, vanilla_shop_costs, vanilla_location_costs
from .Charms import names as charm_names from .Charms import names as charm_names
@@ -142,8 +142,7 @@ class HKWorld(World):
As the enigmatic Knight, youll traverse the depths, unravel its mysteries and conquer its evils. As the enigmatic Knight, youll traverse the depths, unravel its mysteries and conquer its evils.
""" # from https://www.hollowknight.com """ # from https://www.hollowknight.com
game: str = "Hollow Knight" game: str = "Hollow Knight"
options_dataclass = HKOptions option_definitions = hollow_knight_options
options: HKOptions
web = HKWeb() web = HKWeb()
@@ -156,8 +155,8 @@ class HKWorld(World):
charm_costs: typing.List[int] charm_costs: typing.List[int]
cached_filler_items = {} cached_filler_items = {}
def __init__(self, multiworld, player): def __init__(self, world, player):
super(HKWorld, self).__init__(multiworld, player) super(HKWorld, self).__init__(world, player)
self.created_multi_locations: typing.Dict[str, typing.List[HKLocation]] = { self.created_multi_locations: typing.Dict[str, typing.List[HKLocation]] = {
location: list() for location in multi_locations location: list() for location in multi_locations
} }
@@ -166,29 +165,29 @@ class HKWorld(World):
self.vanilla_shop_costs = deepcopy(vanilla_shop_costs) self.vanilla_shop_costs = deepcopy(vanilla_shop_costs)
def generate_early(self): def generate_early(self):
options = self.options world = self.multiworld
charm_costs = options.RandomCharmCosts.get_costs(self.random) charm_costs = world.RandomCharmCosts[self.player].get_costs(world.random)
self.charm_costs = options.PlandoCharmCosts.get_costs(charm_costs) self.charm_costs = world.PlandoCharmCosts[self.player].get_costs(charm_costs)
# options.exclude_locations.value.update(white_palace_locations) # world.exclude_locations[self.player].value.update(white_palace_locations)
for term, data in cost_terms.items(): for term, data in cost_terms.items():
mini = getattr(options, f"Minimum{data.option}Price") mini = getattr(world, f"Minimum{data.option}Price")[self.player]
maxi = getattr(options, f"Maximum{data.option}Price") maxi = getattr(world, f"Maximum{data.option}Price")[self.player]
# if minimum > maximum, set minimum to maximum # if minimum > maximum, set minimum to maximum
mini.value = min(mini.value, maxi.value) mini.value = min(mini.value, maxi.value)
self.ranges[term] = mini.value, maxi.value self.ranges[term] = mini.value, maxi.value
self.multiworld.push_precollected(HKItem(starts[options.StartLocation.current_key], world.push_precollected(HKItem(starts[world.StartLocation[self.player].current_key],
True, None, "Event", self.player)) True, None, "Event", self.player))
def white_palace_exclusions(self): def white_palace_exclusions(self):
exclusions = set() exclusions = set()
wp = self.options.WhitePalace wp = self.multiworld.WhitePalace[self.player]
if wp <= WhitePalace.option_nopathofpain: if wp <= WhitePalace.option_nopathofpain:
exclusions.update(path_of_pain_locations) exclusions.update(path_of_pain_locations)
if wp <= WhitePalace.option_kingfragment: if wp <= WhitePalace.option_kingfragment:
exclusions.update(white_palace_checks) exclusions.update(white_palace_checks)
if wp == WhitePalace.option_exclude: if wp == WhitePalace.option_exclude:
exclusions.add("King_Fragment") exclusions.add("King_Fragment")
if self.options.RandomizeCharms: if self.multiworld.RandomizeCharms[self.player]:
# If charms are randomized, this will be junk-filled -- so transitions and events are not progression # If charms are randomized, this will be junk-filled -- so transitions and events are not progression
exclusions.update(white_palace_transitions) exclusions.update(white_palace_transitions)
exclusions.update(white_palace_events) exclusions.update(white_palace_events)
@@ -201,7 +200,7 @@ class HKWorld(World):
# check for any goal that godhome events are relevant to # check for any goal that godhome events are relevant to
all_event_names = event_names.copy() all_event_names = event_names.copy()
if self.options.Goal in [Goal.option_godhome, Goal.option_godhome_flower]: if self.multiworld.Goal[self.player] in [Goal.option_godhome, Goal.option_godhome_flower]:
from .GodhomeData import godhome_event_names from .GodhomeData import godhome_event_names
all_event_names.update(set(godhome_event_names)) all_event_names.update(set(godhome_event_names))
@@ -231,12 +230,12 @@ class HKWorld(World):
pool: typing.List[HKItem] = [] pool: typing.List[HKItem] = []
wp_exclusions = self.white_palace_exclusions() wp_exclusions = self.white_palace_exclusions()
junk_replace: typing.Set[str] = set() junk_replace: typing.Set[str] = set()
if self.options.RemoveSpellUpgrades: if self.multiworld.RemoveSpellUpgrades[self.player]:
junk_replace.update(("Abyss_Shriek", "Shade_Soul", "Descending_Dark")) junk_replace.update(("Abyss_Shriek", "Shade_Soul", "Descending_Dark"))
randomized_starting_items = set() randomized_starting_items = set()
for attr, items in randomizable_starting_items.items(): for attr, items in randomizable_starting_items.items():
if getattr(self.options, attr): if getattr(self.multiworld, attr)[self.player]:
randomized_starting_items.update(items) randomized_starting_items.update(items)
# noinspection PyShadowingNames # noinspection PyShadowingNames
@@ -258,7 +257,7 @@ class HKWorld(World):
if item_name in junk_replace: if item_name in junk_replace:
item_name = self.get_filler_item_name() item_name = self.get_filler_item_name()
item = self.create_item(item_name) if not vanilla or location_name == "Start" or self.options.AddUnshuffledLocations else self.create_event(item_name) item = self.create_item(item_name) if not vanilla or location_name == "Start" or self.multiworld.AddUnshuffledLocations[self.player] else self.create_event(item_name)
if location_name == "Start": if location_name == "Start":
if item_name in randomized_starting_items: if item_name in randomized_starting_items:
@@ -282,55 +281,55 @@ class HKWorld(World):
location.progress_type = LocationProgressType.EXCLUDED location.progress_type = LocationProgressType.EXCLUDED
for option_key, option in hollow_knight_randomize_options.items(): for option_key, option in hollow_knight_randomize_options.items():
randomized = getattr(self.options, option_key) randomized = getattr(self.multiworld, option_key)[self.player]
if all([not randomized, option_key in logicless_options, not self.options.AddUnshuffledLocations]): if all([not randomized, option_key in logicless_options, not self.multiworld.AddUnshuffledLocations[self.player]]):
continue continue
for item_name, location_name in zip(option.items, option.locations): for item_name, location_name in zip(option.items, option.locations):
if item_name in junk_replace: if item_name in junk_replace:
item_name = self.get_filler_item_name() item_name = self.get_filler_item_name()
if (item_name == "Crystal_Heart" and self.options.SplitCrystalHeart) or \ if (item_name == "Crystal_Heart" and self.multiworld.SplitCrystalHeart[self.player]) or \
(item_name == "Mothwing_Cloak" and self.options.SplitMothwingCloak): (item_name == "Mothwing_Cloak" and self.multiworld.SplitMothwingCloak[self.player]):
_add("Left_" + item_name, location_name, randomized) _add("Left_" + item_name, location_name, randomized)
_add("Right_" + item_name, "Split_" + location_name, randomized) _add("Right_" + item_name, "Split_" + location_name, randomized)
continue continue
if item_name == "Mantis_Claw" and self.options.SplitMantisClaw: if item_name == "Mantis_Claw" and self.multiworld.SplitMantisClaw[self.player]:
_add("Left_" + item_name, "Left_" + location_name, randomized) _add("Left_" + item_name, "Left_" + location_name, randomized)
_add("Right_" + item_name, "Right_" + location_name, randomized) _add("Right_" + item_name, "Right_" + location_name, randomized)
continue continue
if item_name == "Shade_Cloak" and self.options.SplitMothwingCloak: if item_name == "Shade_Cloak" and self.multiworld.SplitMothwingCloak[self.player]:
if self.random.randint(0, 1): if self.multiworld.random.randint(0, 1):
item_name = "Left_Mothwing_Cloak" item_name = "Left_Mothwing_Cloak"
else: else:
item_name = "Right_Mothwing_Cloak" item_name = "Right_Mothwing_Cloak"
if item_name == "Grimmchild2" and self.options.RandomizeGrimmkinFlames and self.options.RandomizeCharms: if item_name == "Grimmchild2" and self.multiworld.RandomizeGrimmkinFlames[self.player] and self.multiworld.RandomizeCharms[self.player]:
_add("Grimmchild1", location_name, randomized) _add("Grimmchild1", location_name, randomized)
continue continue
_add(item_name, location_name, randomized) _add(item_name, location_name, randomized)
if self.options.RandomizeElevatorPass: if self.multiworld.RandomizeElevatorPass[self.player]:
randomized = True randomized = True
_add("Elevator_Pass", "Elevator_Pass", randomized) _add("Elevator_Pass", "Elevator_Pass", randomized)
for shop, locations in self.created_multi_locations.items(): for shop, locations in self.created_multi_locations.items():
for _ in range(len(locations), getattr(self.options, shop_to_option[shop]).value): for _ in range(len(locations), getattr(self.multiworld, shop_to_option[shop])[self.player].value):
loc = self.create_location(shop) loc = self.create_location(shop)
unfilled_locations += 1 unfilled_locations += 1
# Balance the pool # Balance the pool
item_count = len(pool) item_count = len(pool)
additional_shop_items = max(item_count - unfilled_locations, self.options.ExtraShopSlots.value) additional_shop_items = max(item_count - unfilled_locations, self.multiworld.ExtraShopSlots[self.player].value)
# Add additional shop items, as needed. # Add additional shop items, as needed.
if additional_shop_items > 0: if additional_shop_items > 0:
shops = list(shop for shop, locations in self.created_multi_locations.items() if len(locations) < 16) shops = list(shop for shop, locations in self.created_multi_locations.items() if len(locations) < 16)
if not self.options.EggShopSlots: # No eggshop, so don't place items there if not self.multiworld.EggShopSlots[self.player].value: # No eggshop, so don't place items there
shops.remove('Egg_Shop') shops.remove('Egg_Shop')
if shops: if shops:
for _ in range(additional_shop_items): for _ in range(additional_shop_items):
shop = self.random.choice(shops) shop = self.multiworld.random.choice(shops)
loc = self.create_location(shop) loc = self.create_location(shop)
unfilled_locations += 1 unfilled_locations += 1
if len(self.created_multi_locations[shop]) >= 16: if len(self.created_multi_locations[shop]) >= 16:
@@ -356,7 +355,7 @@ class HKWorld(World):
loc.costs = costs loc.costs = costs
def apply_costsanity(self): def apply_costsanity(self):
setting = self.options.CostSanity.value setting = self.multiworld.CostSanity[self.player].value
if not setting: if not setting:
return # noop return # noop
@@ -370,10 +369,10 @@ class HKWorld(World):
return {k: v for k, v in weights.items() if v} return {k: v for k, v in weights.items() if v}
random = self.random random = self.multiworld.random
hybrid_chance = getattr(self.options, f"CostSanityHybridChance").value hybrid_chance = getattr(self.multiworld, f"CostSanityHybridChance")[self.player].value
weights = { weights = {
data.term: getattr(self.options, f"CostSanity{data.option}Weight").value data.term: getattr(self.multiworld, f"CostSanity{data.option}Weight")[self.player].value
for data in cost_terms.values() for data in cost_terms.values()
} }
weights_geoless = dict(weights) weights_geoless = dict(weights)
@@ -428,22 +427,22 @@ class HKWorld(World):
location.sort_costs() location.sort_costs()
def set_rules(self): def set_rules(self):
multiworld = self.multiworld world = self.multiworld
player = self.player player = self.player
goal = self.options.Goal goal = world.Goal[player]
if goal == Goal.option_hollowknight: if goal == Goal.option_hollowknight:
multiworld.completion_condition[player] = lambda state: _hk_can_beat_thk(state, player) world.completion_condition[player] = lambda state: state._hk_can_beat_thk(player)
elif goal == Goal.option_siblings: elif goal == Goal.option_siblings:
multiworld.completion_condition[player] = lambda state: _hk_siblings_ending(state, player) world.completion_condition[player] = lambda state: state._hk_siblings_ending(player)
elif goal == Goal.option_radiance: elif goal == Goal.option_radiance:
multiworld.completion_condition[player] = lambda state: _hk_can_beat_radiance(state, player) world.completion_condition[player] = lambda state: state._hk_can_beat_radiance(player)
elif goal == Goal.option_godhome: elif goal == Goal.option_godhome:
multiworld.completion_condition[player] = lambda state: state.count("Defeated_Pantheon_5", player) world.completion_condition[player] = lambda state: state.count("Defeated_Pantheon_5", player)
elif goal == Goal.option_godhome_flower: elif goal == Goal.option_godhome_flower:
multiworld.completion_condition[player] = lambda state: state.count("Godhome_Flower_Quest", player) world.completion_condition[player] = lambda state: state.count("Godhome_Flower_Quest", player)
else: else:
# Any goal # Any goal
multiworld.completion_condition[player] = lambda state: _hk_can_beat_thk(state, player) or _hk_can_beat_radiance(state, player) world.completion_condition[player] = lambda state: state._hk_can_beat_thk(player) or state._hk_can_beat_radiance(player)
set_rules(self) set_rules(self)
@@ -451,8 +450,8 @@ class HKWorld(World):
slot_data = {} slot_data = {}
options = slot_data["options"] = {} options = slot_data["options"] = {}
for option_name in hollow_knight_options: for option_name in self.option_definitions:
option = getattr(self.options, option_name) option = getattr(self.multiworld, option_name)[self.player]
try: try:
optionvalue = int(option.value) optionvalue = int(option.value)
except TypeError: except TypeError:
@@ -461,10 +460,10 @@ class HKWorld(World):
options[option_name] = optionvalue options[option_name] = optionvalue
# 32 bit int # 32 bit int
slot_data["seed"] = self.random.randint(-2147483647, 2147483646) slot_data["seed"] = self.multiworld.per_slot_randoms[self.player].randint(-2147483647, 2147483646)
# Backwards compatibility for shop cost data (HKAP < 0.1.0) # Backwards compatibility for shop cost data (HKAP < 0.1.0)
if not self.options.CostSanity: if not self.multiworld.CostSanity[self.player]:
for shop, terms in shop_cost_types.items(): for shop, terms in shop_cost_types.items():
unit = cost_terms[next(iter(terms))].option unit = cost_terms[next(iter(terms))].option
if unit == "Geo": if unit == "Geo":
@@ -499,7 +498,7 @@ class HKWorld(World):
basename = name basename = name
if name in shop_cost_types: if name in shop_cost_types:
costs = { costs = {
term: self.random.randint(*self.ranges[term]) term: self.multiworld.random.randint(*self.ranges[term])
for term in shop_cost_types[name] for term in shop_cost_types[name]
} }
elif name in vanilla_location_costs: elif name in vanilla_location_costs:
@@ -513,7 +512,7 @@ class HKWorld(World):
region = self.multiworld.get_region("Menu", self.player) region = self.multiworld.get_region("Menu", self.player)
if vanilla and not self.options.AddUnshuffledLocations: if vanilla and not self.multiworld.AddUnshuffledLocations[self.player]:
loc = HKLocation(self.player, name, loc = HKLocation(self.player, name,
None, region, costs=costs, vanilla=vanilla, None, region, costs=costs, vanilla=vanilla,
basename=basename) basename=basename)
@@ -561,26 +560,26 @@ class HKWorld(World):
return change return change
@classmethod @classmethod
def stage_write_spoiler(cls, multiworld: MultiWorld, spoiler_handle): def stage_write_spoiler(cls, world: MultiWorld, spoiler_handle):
hk_players = multiworld.get_game_players(cls.game) hk_players = world.get_game_players(cls.game)
spoiler_handle.write('\n\nCharm Notches:') spoiler_handle.write('\n\nCharm Notches:')
for player in hk_players: for player in hk_players:
name = multiworld.get_player_name(player) name = world.get_player_name(player)
spoiler_handle.write(f'\n{name}\n') spoiler_handle.write(f'\n{name}\n')
hk_world: HKWorld = multiworld.worlds[player] hk_world: HKWorld = world.worlds[player]
for charm_number, cost in enumerate(hk_world.charm_costs): for charm_number, cost in enumerate(hk_world.charm_costs):
spoiler_handle.write(f"\n{charm_names[charm_number]}: {cost}") spoiler_handle.write(f"\n{charm_names[charm_number]}: {cost}")
spoiler_handle.write('\n\nShop Prices:') spoiler_handle.write('\n\nShop Prices:')
for player in hk_players: for player in hk_players:
name = multiworld.get_player_name(player) name = world.get_player_name(player)
spoiler_handle.write(f'\n{name}\n') spoiler_handle.write(f'\n{name}\n')
hk_world: HKWorld = multiworld.worlds[player] hk_world: HKWorld = world.worlds[player]
if hk_world.options.CostSanity: if world.CostSanity[player].value:
for loc in sorted( for loc in sorted(
( (
loc for loc in itertools.chain(*(region.locations for region in multiworld.get_regions(player))) loc for loc in itertools.chain(*(region.locations for region in world.get_regions(player)))
if loc.costs if loc.costs
), key=operator.attrgetter('name') ), key=operator.attrgetter('name')
): ):
@@ -604,15 +603,15 @@ class HKWorld(World):
'RandomizeGeoRocks', 'RandomizeSoulTotems', 'RandomizeLoreTablets', 'RandomizeJunkPitChests', 'RandomizeGeoRocks', 'RandomizeSoulTotems', 'RandomizeLoreTablets', 'RandomizeJunkPitChests',
'RandomizeRancidEggs' 'RandomizeRancidEggs'
): ):
if getattr(self.options, group): if getattr(self.multiworld, group):
fillers.extend(item for item in hollow_knight_randomize_options[group].items if item not in fillers.extend(item for item in hollow_knight_randomize_options[group].items if item not in
exclusions) exclusions)
self.cached_filler_items[self.player] = fillers self.cached_filler_items[self.player] = fillers
return self.random.choice(self.cached_filler_items[self.player]) return self.multiworld.random.choice(self.cached_filler_items[self.player])
def create_region(multiworld: MultiWorld, player: int, name: str, location_names=None) -> Region: def create_region(world: MultiWorld, player: int, name: str, location_names=None) -> Region:
ret = Region(name, player, multiworld) ret = Region(name, player, world)
if location_names: if location_names:
for location in location_names: for location in location_names:
loc_id = HKWorld.location_name_to_id.get(location, None) loc_id = HKWorld.location_name_to_id.get(location, None)
@@ -685,7 +684,42 @@ class HKLogicMixin(LogicMixin):
return sum(self.multiworld.worlds[player].charm_costs[notch] for notch in notches) return sum(self.multiworld.worlds[player].charm_costs[notch] for notch in notches)
def _hk_option(self, player: int, option_name: str) -> int: def _hk_option(self, player: int, option_name: str) -> int:
return getattr(self.multiworld.worlds[player].options, option_name).value return getattr(self.multiworld, option_name)[player].value
def _hk_start(self, player, start_location: str) -> bool: def _hk_start(self, player, start_location: str) -> bool:
return self.multiworld.worlds[player].options.StartLocation == start_location return self.multiworld.StartLocation[player] == start_location
def _hk_nail_combat(self, player: int) -> bool:
return self.has_any({'LEFTSLASH', 'RIGHTSLASH', 'UPSLASH'}, player)
def _hk_can_beat_thk(self, player: int) -> bool:
return (
self.has('Opened_Black_Egg_Temple', player)
and (self.count('FIREBALL', player) + self.count('SCREAM', player) + self.count('QUAKE', player)) > 1
and self._hk_nail_combat(player)
and (
self.has_any({'LEFTDASH', 'RIGHTDASH'}, player)
or self._hk_option(player, 'ProficientCombat')
)
and self.has('FOCUS', player)
)
def _hk_siblings_ending(self, player: int) -> bool:
return self._hk_can_beat_thk(player) and self.has('WHITEFRAGMENT', player, 3)
def _hk_can_beat_radiance(self, player: int) -> bool:
return (
self.has('Opened_Black_Egg_Temple', player)
and self._hk_nail_combat(player)
and self.has('WHITEFRAGMENT', player, 3)
and self.has('DREAMNAIL', player)
and (
(self.has('LEFTCLAW', player) and self.has('RIGHTCLAW', player))
or self.has('WINGS', player)
)
and (self.count('FIREBALL', player) + self.count('SCREAM', player) + self.count('QUAKE', player)) > 1
and (
(self.has('LEFTDASH', player, 2) and self.has('RIGHTDASH', player, 2)) # Both Shade Cloaks
or (self._hk_option(player, 'ProficientCombat') and self.has('QUAKE', player)) # or Dive
)
)

View File

@@ -1556,8 +1556,6 @@
room: Owl Hallway room: Owl Hallway
door: Shortcut to Hedge Maze door: Shortcut to Hedge Maze
Roof: True Roof: True
The Incomparable:
door: Observant Entrance
panels: panels:
DOWN: DOWN:
id: Maze Room/Panel_down_up id: Maze Room/Panel_down_up
@@ -1969,9 +1967,6 @@
door: Eight Door door: Eight Door
Orange Tower Sixth Floor: Orange Tower Sixth Floor:
painting: True painting: True
Hedge Maze:
room: Hedge Maze
door: Observant Entrance
panels: panels:
Achievement: Achievement:
id: Countdown Panels/Panel_incomparable_incomparable id: Countdown Panels/Panel_incomparable_incomparable
@@ -7654,8 +7649,6 @@
LEAP: LEAP:
id: Double Room/Panel_leap_leap id: Double Room/Panel_leap_leap
tag: midwhite tag: midwhite
required_door:
door: Door to Cross
doors: doors:
Door to Cross: Door to Cross:
id: Double Room Area Doors/Door_room_4a id: Double Room Area Doors/Door_room_4a

Binary file not shown.

View File

@@ -3,15 +3,15 @@ from typing import Dict
from schema import And, Optional, Or, Schema from schema import And, Optional, Or, Schema
from Options import Choice, DeathLinkMixin, DefaultOnToggle, ItemsAccessibility, OptionDict, PerGameCommonOptions, \ from Options import Accessibility, Choice, DeathLinkMixin, DefaultOnToggle, OptionDict, PerGameCommonOptions, \
PlandoConnections, Range, StartInventoryPool, Toggle, Visibility PlandoConnections, Range, StartInventoryPool, Toggle, Visibility
from .portals import CHECKPOINTS, PORTALS, SHOP_POINTS from .portals import CHECKPOINTS, PORTALS, SHOP_POINTS
class MessengerAccessibility(ItemsAccessibility): class MessengerAccessibility(Accessibility):
default = Accessibility.option_locations
# defaulting to locations accessibility since items makes certain items self-locking # defaulting to locations accessibility since items makes certain items self-locking
default = ItemsAccessibility.option_full __doc__ = Accessibility.__doc__.replace(f"default {Accessibility.default}", f"default {default}")
__doc__ = ItemsAccessibility.__doc__
class PortalPlando(PlandoConnections): class PortalPlando(PlandoConnections):

View File

@@ -29,7 +29,7 @@ name: TuNombre
game: Minecraft game: Minecraft
# Opciones compartidas por todos los juegos: # Opciones compartidas por todos los juegos:
accessibility: full accessibility: locations
progression_balancing: 50 progression_balancing: 50
# Opciones Especficicas para Minecraft # Opciones Especficicas para Minecraft

View File

@@ -79,7 +79,7 @@ description: Template Name
# Ditt spelnamn. Mellanslag kommer bli omplacerad med understräck och det är en 16-karaktärsgräns. # Ditt spelnamn. Mellanslag kommer bli omplacerad med understräck och det är en 16-karaktärsgräns.
name: YourName name: YourName
game: Minecraft game: Minecraft
accessibility: full accessibility: locations
progression_balancing: 0 progression_balancing: 0
advancement_goal: advancement_goal:
few: 0 few: 0

View File

@@ -443,7 +443,7 @@ class PokemonRedBlueWorld(World):
self.multiworld.elite_four_pokedex_condition[self.player].total = \ self.multiworld.elite_four_pokedex_condition[self.player].total = \
int((len(reachable_mons) / 100) * self.multiworld.elite_four_pokedex_condition[self.player].value) int((len(reachable_mons) / 100) * self.multiworld.elite_four_pokedex_condition[self.player].value)
if self.multiworld.accessibility[self.player] == "full": if self.multiworld.accessibility[self.player] == "locations":
balls = [self.create_item(ball) for ball in ["Poke Ball", "Great Ball", "Ultra Ball"]] balls = [self.create_item(ball) for ball in ["Poke Ball", "Great Ball", "Ultra Ball"]]
traps = [self.create_item(trap) for trap in item_groups["Traps"]] traps = [self.create_item(trap) for trap in item_groups["Traps"]]
locations = [location for location in self.multiworld.get_locations(self.player) if "Pokedex - " in locations = [location for location in self.multiworld.get_locations(self.player) if "Pokedex - " in

View File

@@ -1,4 +1,4 @@
from Options import Toggle, Choice, Range, NamedRange, TextChoice, DeathLink, ItemsAccessibility from Options import Toggle, Choice, Range, NamedRange, TextChoice, DeathLink
class GameVersion(Choice): class GameVersion(Choice):
@@ -287,7 +287,7 @@ class AllPokemonSeen(Toggle):
class DexSanity(NamedRange): class DexSanity(NamedRange):
"""Adds location checks for Pokemon flagged "owned" on your Pokedex. You may specify a percentage of Pokemon to """Adds location checks for Pokemon flagged "owned" on your Pokedex. You may specify a percentage of Pokemon to
have checks added. If Accessibility is set to full, this will be the percentage of all logically reachable have checks added. If Accessibility is set to locations, this will be the percentage of all logically reachable
Pokemon that will get a location check added to it. With items or minimal Accessibility, it will be the percentage Pokemon that will get a location check added to it. With items or minimal Accessibility, it will be the percentage
of all 151 Pokemon. of all 151 Pokemon.
If Pokedex is required, the items for Pokemon acquired before acquiring the Pokedex can be found by talking to If Pokedex is required, the items for Pokemon acquired before acquiring the Pokedex can be found by talking to
@@ -418,10 +418,10 @@ class ExpModifier(NamedRange):
"""Modifier for EXP gained. When specifying a number, exp is multiplied by this amount and divided by 16.""" """Modifier for EXP gained. When specifying a number, exp is multiplied by this amount and divided by 16."""
display_name = "Exp Modifier" display_name = "Exp Modifier"
default = 16 default = 16
range_start = default // 4 range_start = default / 4
range_end = 255 range_end = 255
special_range_names = { special_range_names = {
"half": default // 2, "half": default / 2,
"normal": default, "normal": default,
"double": default * 2, "double": default * 2,
"triple": default * 3, "triple": default * 3,
@@ -861,7 +861,6 @@ class RandomizePokemonPalettes(Choice):
pokemon_rb_options = { pokemon_rb_options = {
"accessibility": ItemsAccessibility,
"game_version": GameVersion, "game_version": GameVersion,
"trainer_name": TrainerName, "trainer_name": TrainerName,
"rival_name": RivalName, "rival_name": RivalName,
@@ -960,4 +959,4 @@ pokemon_rb_options = {
"ice_trap_weight": IceTrapWeight, "ice_trap_weight": IceTrapWeight,
"randomize_pokemon_palettes": RandomizePokemonPalettes, "randomize_pokemon_palettes": RandomizePokemonPalettes,
"death_link": DeathLink "death_link": DeathLink
} }

View File

@@ -22,7 +22,7 @@ def set_rules(multiworld, player):
item_rules["Celadon Prize Corner - Item Prize 2"] = prize_rule item_rules["Celadon Prize Corner - Item Prize 2"] = prize_rule
item_rules["Celadon Prize Corner - Item Prize 3"] = prize_rule item_rules["Celadon Prize Corner - Item Prize 3"] = prize_rule
if multiworld.accessibility[player] != "full": if multiworld.accessibility[player] != "locations":
multiworld.get_location("Cerulean Bicycle Shop", player).always_allow = (lambda state, item: multiworld.get_location("Cerulean Bicycle Shop", player).always_allow = (lambda state, item:
item.name == "Bike Voucher" item.name == "Bike Voucher"
and item.player == player) and item.player == player)

View File

@@ -1 +1,2 @@
nest-asyncio >= 1.5.5 nest-asyncio >= 1.5.5
six >= 1.16.0

View File

@@ -33,38 +33,28 @@ item_table = {
"Lightning Pot Top": ItemData(SHIVERS_ITEM_ID_OFFSET + 17, "pot"), "Lightning Pot Top": ItemData(SHIVERS_ITEM_ID_OFFSET + 17, "pot"),
"Sand Pot Top": ItemData(SHIVERS_ITEM_ID_OFFSET + 18, "pot"), "Sand Pot Top": ItemData(SHIVERS_ITEM_ID_OFFSET + 18, "pot"),
"Metal Pot Top": ItemData(SHIVERS_ITEM_ID_OFFSET + 19, "pot"), "Metal Pot Top": ItemData(SHIVERS_ITEM_ID_OFFSET + 19, "pot"),
"Water Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 20, "pot_type2"),
"Wax Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 21, "pot_type2"),
"Ash Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 22, "pot_type2"),
"Oil Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 23, "pot_type2"),
"Cloth Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 24, "pot_type2"),
"Wood Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 25, "pot_type2"),
"Crystal Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 26, "pot_type2"),
"Lightning Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 27, "pot_type2"),
"Sand Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 28, "pot_type2"),
"Metal Pot Complete": ItemData(SHIVERS_ITEM_ID_OFFSET + 29, "pot_type2"),
#Keys #Keys
"Key for Office Elevator": ItemData(SHIVERS_ITEM_ID_OFFSET + 30, "key"), "Key for Office Elevator": ItemData(SHIVERS_ITEM_ID_OFFSET + 20, "key"),
"Key for Bedroom Elevator": ItemData(SHIVERS_ITEM_ID_OFFSET + 31, "key"), "Key for Bedroom Elevator": ItemData(SHIVERS_ITEM_ID_OFFSET + 21, "key"),
"Key for Three Floor Elevator": ItemData(SHIVERS_ITEM_ID_OFFSET + 32, "key"), "Key for Three Floor Elevator": ItemData(SHIVERS_ITEM_ID_OFFSET + 22, "key"),
"Key for Workshop": ItemData(SHIVERS_ITEM_ID_OFFSET + 33, "key"), "Key for Workshop": ItemData(SHIVERS_ITEM_ID_OFFSET + 23, "key"),
"Key for Office": ItemData(SHIVERS_ITEM_ID_OFFSET + 34, "key"), "Key for Office": ItemData(SHIVERS_ITEM_ID_OFFSET + 24, "key"),
"Key for Prehistoric Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 35, "key"), "Key for Prehistoric Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 25, "key"),
"Key for Greenhouse Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 36, "key"), "Key for Greenhouse Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 26, "key"),
"Key for Ocean Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 37, "key"), "Key for Ocean Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 27, "key"),
"Key for Projector Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 38, "key"), "Key for Projector Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 28, "key"),
"Key for Generator Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 39, "key"), "Key for Generator Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 29, "key"),
"Key for Egypt Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 40, "key"), "Key for Egypt Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 30, "key"),
"Key for Library Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 41, "key"), "Key for Library Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 31, "key"),
"Key for Shaman Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 42, "key"), "Key for Shaman Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 32, "key"),
"Key for UFO Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 43, "key"), "Key for UFO Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 33, "key"),
"Key for Torture Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 44, "key"), "Key for Torture Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 34, "key"),
"Key for Puzzle Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 45, "key"), "Key for Puzzle Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 35, "key"),
"Key for Bedroom": ItemData(SHIVERS_ITEM_ID_OFFSET + 46, "key"), "Key for Bedroom": ItemData(SHIVERS_ITEM_ID_OFFSET + 36, "key"),
"Key for Underground Lake Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 47, "key"), "Key for Underground Lake Room": ItemData(SHIVERS_ITEM_ID_OFFSET + 37, "key"),
"Key for Janitor Closet": ItemData(SHIVERS_ITEM_ID_OFFSET + 48, "key"), "Key for Janitor Closet": ItemData(SHIVERS_ITEM_ID_OFFSET + 38, "key"),
"Key for Front Door": ItemData(SHIVERS_ITEM_ID_OFFSET + 49, "key-optional"), "Key for Front Door": ItemData(SHIVERS_ITEM_ID_OFFSET + 39, "key-optional"),
#Abilities #Abilities
"Crawling": ItemData(SHIVERS_ITEM_ID_OFFSET + 50, "ability"), "Crawling": ItemData(SHIVERS_ITEM_ID_OFFSET + 50, "ability"),
@@ -93,16 +83,6 @@ item_table = {
"Lightning Pot Top DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 87, "potduplicate"), "Lightning Pot Top DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 87, "potduplicate"),
"Sand Pot Top DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 88, "potduplicate"), "Sand Pot Top DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 88, "potduplicate"),
"Metal Pot Top DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 89, "potduplicate"), "Metal Pot Top DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 89, "potduplicate"),
"Water Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 140, "potduplicate_type2"),
"Wax Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 141, "potduplicate_type2"),
"Ash Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 142, "potduplicate_type2"),
"Oil Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 143, "potduplicate_type2"),
"Cloth Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 144, "potduplicate_type2"),
"Wood Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 145, "potduplicate_type2"),
"Crystal Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 146, "potduplicate_type2"),
"Lightning Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 147, "potduplicate_type2"),
"Sand Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 148, "potduplicate_type2"),
"Metal Pot Complete DUPE": ItemData(SHIVERS_ITEM_ID_OFFSET + 149, "potduplicate_type2"),
#Filler #Filler
"Empty": ItemData(SHIVERS_ITEM_ID_OFFSET + 90, "filler"), "Empty": ItemData(SHIVERS_ITEM_ID_OFFSET + 90, "filler"),

View File

@@ -1,37 +1,21 @@
from Options import Choice, DefaultOnToggle, Toggle, PerGameCommonOptions, Range from Options import Choice, DefaultOnToggle, Toggle, PerGameCommonOptions
from dataclasses import dataclass from dataclasses import dataclass
class IxupiCapturesNeeded(Range):
"""
Number of Ixupi Captures needed for goal condition.
"""
display_name = "Number of Ixupi Captures Needed"
range_start = 1
range_end = 10
default = 10
class LobbyAccess(Choice): class LobbyAccess(Choice):
""" """Chooses how keys needed to reach the lobby are placed.
Chooses how keys needed to reach the lobby are placed.
- Normal: Keys are placed anywhere - Normal: Keys are placed anywhere
- Early: Keys are placed early - Early: Keys are placed early
- Local: Keys are placed locally - Local: Keys are placed locally"""
"""
display_name = "Lobby Access" display_name = "Lobby Access"
option_normal = 0 option_normal = 0
option_early = 1 option_early = 1
option_local = 2 option_local = 2
default = 1
class PuzzleHintsRequired(DefaultOnToggle): class PuzzleHintsRequired(DefaultOnToggle):
""" """If turned on puzzle hints will be available before the corresponding puzzle is required. For example: The Shaman
If turned on puzzle hints/solutions will be available before the corresponding puzzle is required. Drums puzzle will be placed after access to the security cameras which give you the solution. Turning this off
allows for greater randomization."""
For example: The Red Door puzzle will be logically required only after access to the Beth's Address Book which gives you the solution.
Turning this off allows for greater randomization.
"""
display_name = "Puzzle Hints Required" display_name = "Puzzle Hints Required"
class InformationPlaques(Toggle): class InformationPlaques(Toggle):
@@ -42,9 +26,7 @@ class InformationPlaques(Toggle):
display_name = "Include Information Plaques" display_name = "Include Information Plaques"
class FrontDoorUsable(Toggle): class FrontDoorUsable(Toggle):
""" """Adds a key to unlock the front door of the museum."""
Adds a key to unlock the front door of the museum.
"""
display_name = "Front Door Usable" display_name = "Front Door Usable"
class ElevatorsStaySolved(DefaultOnToggle): class ElevatorsStaySolved(DefaultOnToggle):
@@ -55,9 +37,7 @@ class ElevatorsStaySolved(DefaultOnToggle):
display_name = "Elevators Stay Solved" display_name = "Elevators Stay Solved"
class EarlyBeth(DefaultOnToggle): class EarlyBeth(DefaultOnToggle):
""" """Beth's body is open at the start of the game. This allows any pot piece to be placed in the slide and early checks on the second half of the final riddle."""
Beth's body is open at the start of the game. This allows any pot piece to be placed in the slide and early checks on the second half of the final riddle.
"""
display_name = "Early Beth" display_name = "Early Beth"
class EarlyLightning(Toggle): class EarlyLightning(Toggle):
@@ -67,34 +47,9 @@ class EarlyLightning(Toggle):
""" """
display_name = "Early Lightning" display_name = "Early Lightning"
class LocationPotPieces(Choice):
"""
Chooses where pot pieces will be located within the multiworld.
- Own World: Pot pieces will be located within your own world
- Different World: Pot pieces will be located in another world
- Any World: Pot pieces will be located in any world
"""
display_name = "Location of Pot Pieces"
option_own_world = 0
option_different_world = 1
option_any_world = 2
class FullPots(Choice):
"""
Chooses if pots will be in pieces or already completed
- Pieces: Only pot pieces will be added to the item pool
- Complete: Only completed pots will be added to the item pool
- Mixed: Each pot will be randomly chosen to be pieces or already completed.
"""
display_name = "Full Pots"
option_pieces = 0
option_complete = 1
option_mixed = 2
@dataclass @dataclass
class ShiversOptions(PerGameCommonOptions): class ShiversOptions(PerGameCommonOptions):
ixupi_captures_needed: IxupiCapturesNeeded
lobby_access: LobbyAccess lobby_access: LobbyAccess
puzzle_hints_required: PuzzleHintsRequired puzzle_hints_required: PuzzleHintsRequired
include_information_plaques: InformationPlaques include_information_plaques: InformationPlaques
@@ -102,5 +57,3 @@ class ShiversOptions(PerGameCommonOptions):
elevators_stay_solved: ElevatorsStaySolved elevators_stay_solved: ElevatorsStaySolved
early_beth: EarlyBeth early_beth: EarlyBeth
early_lightning: EarlyLightning early_lightning: EarlyLightning
location_pot_pieces: LocationPotPieces
full_pots: FullPots

View File

@@ -8,58 +8,58 @@ if TYPE_CHECKING:
def water_capturable(state: CollectionState, player: int) -> bool: def water_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Water Pot Bottom", "Water Pot Top", "Water Pot Bottom DUPE", "Water Pot Top DUPE"}, player) or \ return (state.can_reach("Lobby", "Region", player) or (state.can_reach("Janitor Closet", "Region", player) and cloth_capturable(state, player))) \
state.has_all({"Water Pot Complete", "Water Pot Complete DUPE"}, player) and state.has_all({"Water Pot Bottom", "Water Pot Top", "Water Pot Bottom DUPE", "Water Pot Top DUPE"}, player)
def wax_capturable(state: CollectionState, player: int) -> bool: def wax_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Wax Pot Bottom", "Wax Pot Top", "Wax Pot Bottom DUPE", "Wax Pot Top DUPE"}, player) or \ return (state.can_reach("Library", "Region", player) or state.can_reach("Anansi", "Region", player)) \
state.has_all({"Wax Pot Complete", "Wax Pot Complete DUPE"}, player) and state.has_all({"Wax Pot Bottom", "Wax Pot Top", "Wax Pot Bottom DUPE", "Wax Pot Top DUPE"}, player)
def ash_capturable(state: CollectionState, player: int) -> bool: def ash_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Ash Pot Bottom", "Ash Pot Top", "Ash Pot Bottom DUPE", "Ash Pot Top DUPE"}, player) or \ return (state.can_reach("Office", "Region", player) or state.can_reach("Burial", "Region", player)) \
state.has_all({"Ash Pot Complete", "Ash Pot Complete DUPE"}, player) and state.has_all({"Ash Pot Bottom", "Ash Pot Top", "Ash Pot Bottom DUPE", "Ash Pot Top DUPE"}, player)
def oil_capturable(state: CollectionState, player: int) -> bool: def oil_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Oil Pot Bottom", "Oil Pot Top", "Oil Pot Bottom DUPE", "Oil Pot Top DUPE"}, player) or \ return (state.can_reach("Prehistoric", "Region", player) or state.can_reach("Tar River", "Region", player)) \
state.has_all({"Oil Pot Complete", "Oil Pot Complete DUPE"}, player) and state.has_all({"Oil Pot Bottom", "Oil Pot Top", "Oil Pot Bottom DUPE", "Oil Pot Top DUPE"}, player)
def cloth_capturable(state: CollectionState, player: int) -> bool: def cloth_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Cloth Pot Bottom", "Cloth Pot Top", "Cloth Pot Bottom DUPE", "Cloth Pot Top DUPE"}, player) or \ return (state.can_reach("Egypt", "Region", player) or state.can_reach("Burial", "Region", player) or state.can_reach("Janitor Closet", "Region", player)) \
state.has_all({"Cloth Pot Complete", "Cloth Pot Complete DUPE"}, player) and state.has_all({"Cloth Pot Bottom", "Cloth Pot Top", "Cloth Pot Bottom DUPE", "Cloth Pot Top DUPE"}, player)
def wood_capturable(state: CollectionState, player: int) -> bool: def wood_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Wood Pot Bottom", "Wood Pot Top", "Wood Pot Bottom DUPE", "Wood Pot Top DUPE"}, player) or \ return (state.can_reach("Workshop", "Region", player) or state.can_reach("Blue Maze", "Region", player) or state.can_reach("Gods Room", "Region", player) or state.can_reach("Anansi", "Region", player)) \
state.has_all({"Wood Pot Complete", "Wood Pot Complete DUPE"}, player) and state.has_all({"Wood Pot Bottom", "Wood Pot Top", "Wood Pot Bottom DUPE", "Wood Pot Top DUPE"}, player)
def crystal_capturable(state: CollectionState, player: int) -> bool: def crystal_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Crystal Pot Bottom", "Crystal Pot Top", "Crystal Pot Bottom DUPE", "Crystal Pot Top DUPE"}, player) or \ return (state.can_reach("Lobby", "Region", player) or state.can_reach("Ocean", "Region", player)) \
state.has_all({"Crystal Pot Complete", "Crystal Pot Complete DUPE"}, player) and state.has_all({"Crystal Pot Bottom", "Crystal Pot Top", "Crystal Pot Bottom DUPE", "Crystal Pot Top DUPE"}, player)
def sand_capturable(state: CollectionState, player: int) -> bool: def sand_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Sand Pot Bottom", "Sand Pot Top", "Sand Pot Bottom DUPE", "Sand Pot Top DUPE"}, player) or \ return (state.can_reach("Greenhouse", "Region", player) or state.can_reach("Ocean", "Region", player)) \
state.has_all({"Sand Pot Complete", "Sand Pot Complete DUPE"}, player) and state.has_all({"Sand Pot Bottom", "Sand Pot Top", "Sand Pot Bottom DUPE", "Sand Pot Top DUPE"}, player)
def metal_capturable(state: CollectionState, player: int) -> bool: def metal_capturable(state: CollectionState, player: int) -> bool:
return state.has_all({"Metal Pot Bottom", "Metal Pot Top", "Metal Pot Bottom DUPE", "Metal Pot Top DUPE"}, player) or \ return (state.can_reach("Projector Room", "Region", player) or state.can_reach("Prehistoric", "Region", player) or state.can_reach("Bedroom", "Region", player)) \
state.has_all({"Metal Pot Complete", "Metal Pot Complete DUPE"}, player) and state.has_all({"Metal Pot Bottom", "Metal Pot Top", "Metal Pot Bottom DUPE", "Metal Pot Top DUPE"}, player)
def lightning_capturable(state: CollectionState, player: int) -> bool: def lightning_capturable(state: CollectionState, player: int) -> bool:
return (first_nine_ixupi_capturable(state, player) or state.multiworld.worlds[player].options.early_lightning.value) \ return (first_nine_ixupi_capturable or state.multiworld.early_lightning[player].value) \
and (state.has_all({"Lightning Pot Bottom", "Lightning Pot Top", "Lightning Pot Bottom DUPE", "Lightning Pot Top DUPE"}, player) or \ and state.can_reach("Generator", "Region", player) \
state.has_all({"Lightning Pot Complete", "Lightning Pot Complete DUPE"}, player)) and state.has_all({"Lightning Pot Bottom", "Lightning Pot Top", "Lightning Pot Bottom DUPE", "Lightning Pot Top DUPE"}, player)
def beths_body_available(state: CollectionState, player: int) -> bool: def beths_body_available(state: CollectionState, player: int) -> bool:
return (first_nine_ixupi_capturable(state, player) or state.multiworld.worlds[player].options.early_beth.value) \ return (first_nine_ixupi_capturable(state, player) or state.multiworld.early_beth[player].value) \
and state.can_reach("Generator", "Region", player) and state.can_reach("Generator", "Region", player)
@@ -123,8 +123,7 @@ def get_rules_lookup(player: int):
"To Burial From Egypt": lambda state: state.can_reach("Egypt", "Region", player), "To Burial From Egypt": lambda state: state.can_reach("Egypt", "Region", player),
"To Gods Room From Anansi": lambda state: state.can_reach("Gods Room", "Region", player), "To Gods Room From Anansi": lambda state: state.can_reach("Gods Room", "Region", player),
"To Slide Room": lambda state: all_skull_dials_available(state, player), "To Slide Room": lambda state: all_skull_dials_available(state, player),
"To Lobby From Slide Room": lambda state: beths_body_available(state, player), "To Lobby From Slide Room": lambda state: (beths_body_available(state, player))
"To Water Capture From Janitor Closet": lambda state: cloth_capturable(state, player)
}, },
"locations_required": { "locations_required": {
"Puzzle Solved Anansi Musicbox": lambda state: state.can_reach("Clock Tower", "Region", player), "Puzzle Solved Anansi Musicbox": lambda state: state.can_reach("Clock Tower", "Region", player),
@@ -208,10 +207,8 @@ def set_rules(world: "ShiversWorld") -> None:
# forbid cloth in janitor closet and oil in tar river # forbid cloth in janitor closet and oil in tar river
forbid_item(multiworld.get_location("Accessible: Storage: Janitor Closet", player), "Cloth Pot Bottom DUPE", player) forbid_item(multiworld.get_location("Accessible: Storage: Janitor Closet", player), "Cloth Pot Bottom DUPE", player)
forbid_item(multiworld.get_location("Accessible: Storage: Janitor Closet", player), "Cloth Pot Top DUPE", player) forbid_item(multiworld.get_location("Accessible: Storage: Janitor Closet", player), "Cloth Pot Top DUPE", player)
forbid_item(multiworld.get_location("Accessible: Storage: Janitor Closet", player), "Cloth Pot Complete DUPE", player)
forbid_item(multiworld.get_location("Accessible: Storage: Tar River", player), "Oil Pot Bottom DUPE", player) forbid_item(multiworld.get_location("Accessible: Storage: Tar River", player), "Oil Pot Bottom DUPE", player)
forbid_item(multiworld.get_location("Accessible: Storage: Tar River", player), "Oil Pot Top DUPE", player) forbid_item(multiworld.get_location("Accessible: Storage: Tar River", player), "Oil Pot Top DUPE", player)
forbid_item(multiworld.get_location("Accessible: Storage: Tar River", player), "Oil Pot Complete DUPE", player)
# Filler Item Forbids # Filler Item Forbids
forbid_item(multiworld.get_location("Puzzle Solved Lyre", player), "Easier Lyre", player) forbid_item(multiworld.get_location("Puzzle Solved Lyre", player), "Easier Lyre", player)
@@ -237,8 +234,4 @@ def set_rules(world: "ShiversWorld") -> None:
forbid_item(multiworld.get_location("Ixupi Captured Metal", player), "Metal Always Available in Prehistoric", player) forbid_item(multiworld.get_location("Ixupi Captured Metal", player), "Metal Always Available in Prehistoric", player)
# Set completion condition # Set completion condition
multiworld.completion_condition[player] = lambda state: (( multiworld.completion_condition[player] = lambda state: (first_nine_ixupi_capturable(state, player) and lightning_capturable(state, player))
water_capturable(state, player) + wax_capturable(state, player) + ash_capturable(state, player) \
+ oil_capturable(state, player) + cloth_capturable(state, player) + wood_capturable(state, player) \
+ crystal_capturable(state, player) + sand_capturable(state, player) + metal_capturable(state, player) \
+ lightning_capturable(state, player)) >= world.options.ixupi_captures_needed.value)

View File

@@ -1,4 +1,3 @@
from typing import List
from .Items import item_table, ShiversItem from .Items import item_table, ShiversItem
from .Rules import set_rules from .Rules import set_rules
from BaseClasses import Item, Tutorial, Region, Location from BaseClasses import Item, Tutorial, Region, Location
@@ -23,7 +22,7 @@ class ShiversWorld(World):
Shivers is a horror themed point and click adventure. Explore the mysteries of Windlenot's Museum of the Strange and Unusual. Shivers is a horror themed point and click adventure. Explore the mysteries of Windlenot's Museum of the Strange and Unusual.
""" """
game = "Shivers" game: str = "Shivers"
topology_present = False topology_present = False
web = ShiversWeb() web = ShiversWeb()
options_dataclass = ShiversOptions options_dataclass = ShiversOptions
@@ -31,13 +30,7 @@ class ShiversWorld(World):
item_name_to_id = {name: data.code for name, data in item_table.items()} item_name_to_id = {name: data.code for name, data in item_table.items()}
location_name_to_id = Constants.location_name_to_id location_name_to_id = Constants.location_name_to_id
shivers_item_id_offset = 27000
pot_completed_list: List[int]
def generate_early(self):
self.pot_completed_list = []
def create_item(self, name: str) -> Item: def create_item(self, name: str) -> Item:
data = item_table[name] data = item_table[name]
return ShiversItem(name, data.classification, data.code, self.player) return ShiversItem(name, data.classification, data.code, self.player)
@@ -85,28 +78,9 @@ class ShiversWorld(World):
#Add items to item pool #Add items to item pool
itempool = [] itempool = []
for name, data in item_table.items(): for name, data in item_table.items():
if data.type in {"key", "ability", "filler2"}: if data.type in {"pot", "key", "ability", "filler2"}:
itempool.append(self.create_item(name)) itempool.append(self.create_item(name))
# Pot pieces/Completed/Mixed:
for i in range(10):
if self.options.full_pots == "pieces":
itempool.append(self.create_item(self.item_id_to_name[self.shivers_item_id_offset + i]))
itempool.append(self.create_item(self.item_id_to_name[self.shivers_item_id_offset + 10 + i]))
elif self.options.full_pots == "complete":
itempool.append(self.create_item(self.item_id_to_name[self.shivers_item_id_offset + 20 + i]))
else:
# Roll for if pieces or a complete pot will be used.
# Pot Pieces
if self.random.randint(0, 1) == 0:
self.pot_completed_list.append(0)
itempool.append(self.create_item(self.item_id_to_name[self.shivers_item_id_offset + i]))
itempool.append(self.create_item(self.item_id_to_name[self.shivers_item_id_offset + 10 + i]))
# Completed Pot
else:
self.pot_completed_list.append(1)
itempool.append(self.create_item(self.item_id_to_name[self.shivers_item_id_offset + 20 + i]))
#Add Filler #Add Filler
itempool += [self.create_item("Easier Lyre") for i in range(9)] itempool += [self.create_item("Easier Lyre") for i in range(9)]
@@ -114,6 +88,7 @@ class ShiversWorld(World):
filler_needed = len(self.multiworld.get_unfilled_locations(self.player)) - 24 - len(itempool) filler_needed = len(self.multiworld.get_unfilled_locations(self.player)) - 24 - len(itempool)
itempool += [self.random.choices([self.create_item("Heal"), self.create_item("Easier Lyre")], weights=[95, 5])[0] for i in range(filler_needed)] itempool += [self.random.choices([self.create_item("Heal"), self.create_item("Easier Lyre")], weights=[95, 5])[0] for i in range(filler_needed)]
#Place library escape items. Choose a location to place the escape item #Place library escape items. Choose a location to place the escape item
library_region = self.multiworld.get_region("Library", self.player) library_region = self.multiworld.get_region("Library", self.player)
librarylocation = self.random.choice([loc for loc in library_region.locations if not loc.name.startswith("Accessible:")]) librarylocation = self.random.choice([loc for loc in library_region.locations if not loc.name.startswith("Accessible:")])
@@ -148,14 +123,14 @@ class ShiversWorld(World):
self.multiworld.itempool += itempool self.multiworld.itempool += itempool
#Lobby acess: #Lobby acess:
if self.options.lobby_access == "early": if self.options.lobby_access == 1:
if lobby_access_keys == 1: if lobby_access_keys == 1:
self.multiworld.early_items[self.player]["Key for Underground Lake Room"] = 1 self.multiworld.early_items[self.player]["Key for Underground Lake Room"] = 1
self.multiworld.early_items[self.player]["Key for Office Elevator"] = 1 self.multiworld.early_items[self.player]["Key for Office Elevator"] = 1
self.multiworld.early_items[self.player]["Key for Office"] = 1 self.multiworld.early_items[self.player]["Key for Office"] = 1
elif lobby_access_keys == 2: elif lobby_access_keys == 2:
self.multiworld.early_items[self.player]["Key for Front Door"] = 1 self.multiworld.early_items[self.player]["Key for Front Door"] = 1
if self.options.lobby_access == "local": if self.options.lobby_access == 2:
if lobby_access_keys == 1: if lobby_access_keys == 1:
self.multiworld.local_early_items[self.player]["Key for Underground Lake Room"] = 1 self.multiworld.local_early_items[self.player]["Key for Underground Lake Room"] = 1
self.multiworld.local_early_items[self.player]["Key for Office Elevator"] = 1 self.multiworld.local_early_items[self.player]["Key for Office Elevator"] = 1
@@ -163,12 +138,6 @@ class ShiversWorld(World):
elif lobby_access_keys == 2: elif lobby_access_keys == 2:
self.multiworld.local_early_items[self.player]["Key for Front Door"] = 1 self.multiworld.local_early_items[self.player]["Key for Front Door"] = 1
#Pot piece shuffle location:
if self.options.location_pot_pieces == "own_world":
self.options.local_items.value |= {name for name, data in item_table.items() if data.type == "pot" or data.type == "pot_type2"}
if self.options.location_pot_pieces == "different_world":
self.options.non_local_items.value |= {name for name, data in item_table.items() if data.type == "pot" or data.type == "pot_type2"}
def pre_fill(self) -> None: def pre_fill(self) -> None:
# Prefills event storage locations with duplicate pots # Prefills event storage locations with duplicate pots
storagelocs = [] storagelocs = []
@@ -180,23 +149,7 @@ class ShiversWorld(World):
if loc_name.startswith("Accessible: "): if loc_name.startswith("Accessible: "):
storagelocs.append(self.multiworld.get_location(loc_name, self.player)) storagelocs.append(self.multiworld.get_location(loc_name, self.player))
#Pot pieces/Completed/Mixed: storageitems += [self.create_item(name) for name, data in item_table.items() if data.type == 'potduplicate']
if self.options.full_pots == "pieces":
storageitems += [self.create_item(name) for name, data in item_table.items() if data.type == 'potduplicate']
elif self.options.full_pots == "complete":
storageitems += [self.create_item(name) for name, data in item_table.items() if data.type == 'potduplicate_type2']
storageitems += [self.create_item("Empty") for i in range(10)]
else:
for i in range(10):
#Pieces
if self.pot_completed_list[i] == 0:
storageitems += [self.create_item(self.item_id_to_name[self.shivers_item_id_offset + 70 + i])]
storageitems += [self.create_item(self.item_id_to_name[self.shivers_item_id_offset + 80 + i])]
#Complete
else:
storageitems += [self.create_item(self.item_id_to_name[self.shivers_item_id_offset + 140 + i])]
storageitems += [self.create_item("Empty")]
storageitems += [self.create_item("Empty") for i in range(3)] storageitems += [self.create_item("Empty") for i in range(3)]
state = self.multiworld.get_all_state(True) state = self.multiworld.get_all_state(True)
@@ -213,13 +166,11 @@ class ShiversWorld(World):
def fill_slot_data(self) -> dict: def fill_slot_data(self) -> dict:
return { return {
"StoragePlacements": self.storage_placements, "storageplacements": self.storage_placements,
"ExcludedLocations": list(self.options.exclude_locations.value), "excludedlocations": {str(excluded_location).replace('ExcludeLocations(', '').replace(')', '') for excluded_location in self.multiworld.exclude_locations.values()},
"IxupiCapturesNeeded": self.options.ixupi_captures_needed.value, "elevatorsstaysolved": {self.options.elevators_stay_solved.value},
"ElevatorsStaySolved": self.options.elevators_stay_solved.value, "earlybeth": {self.options.early_beth.value},
"EarlyBeth": self.options.early_beth.value, "earlylightning": {self.options.early_lightning.value},
"EarlyLightning": self.options.early_lightning.value,
"FrontDoorUsable": self.options.front_door_usable.value
} }

View File

@@ -81,7 +81,7 @@
"Information Plaque: (Ocean) Poseidon", "Information Plaque: (Ocean) Poseidon",
"Information Plaque: (Ocean) Colossus of Rhodes", "Information Plaque: (Ocean) Colossus of Rhodes",
"Information Plaque: (Ocean) Poseidon's Temple", "Information Plaque: (Ocean) Poseidon's Temple",
"Information Plaque: (Underground Maze Staircase) Subterranean World", "Information Plaque: (Underground Maze) Subterranean World",
"Information Plaque: (Underground Maze) Dero", "Information Plaque: (Underground Maze) Dero",
"Information Plaque: (Egypt) Tomb of the Ixupi", "Information Plaque: (Egypt) Tomb of the Ixupi",
"Information Plaque: (Egypt) The Sphinx", "Information Plaque: (Egypt) The Sphinx",
@@ -119,6 +119,16 @@
"Outside": [ "Outside": [
"Puzzle Solved Gears", "Puzzle Solved Gears",
"Puzzle Solved Stone Henge", "Puzzle Solved Stone Henge",
"Ixupi Captured Water",
"Ixupi Captured Wax",
"Ixupi Captured Ash",
"Ixupi Captured Oil",
"Ixupi Captured Cloth",
"Ixupi Captured Wood",
"Ixupi Captured Crystal",
"Ixupi Captured Sand",
"Ixupi Captured Metal",
"Ixupi Captured Lightning",
"Puzzle Solved Office Elevator", "Puzzle Solved Office Elevator",
"Puzzle Solved Three Floor Elevator", "Puzzle Solved Three Floor Elevator",
"Puzzle Hint Found: Combo Lock in Mailbox", "Puzzle Hint Found: Combo Lock in Mailbox",
@@ -172,8 +182,7 @@
"Accessible: Storage: Transforming Mask" "Accessible: Storage: Transforming Mask"
], ],
"Generator": [ "Generator": [
"Final Riddle: Beth's Body Page 17", "Final Riddle: Beth's Body Page 17"
"Ixupi Captured Lightning"
], ],
"Theater Back Hallways": [ "Theater Back Hallways": [
"Puzzle Solved Clock Tower Door" "Puzzle Solved Clock Tower Door"
@@ -201,7 +210,6 @@
"Information Plaque: (Ocean) Poseidon's Temple" "Information Plaque: (Ocean) Poseidon's Temple"
], ],
"Maze Staircase": [ "Maze Staircase": [
"Information Plaque: (Underground Maze Staircase) Subterranean World",
"Puzzle Solved Maze Door" "Puzzle Solved Maze Door"
], ],
"Egypt": [ "Egypt": [
@@ -297,6 +305,7 @@
], ],
"Tar River": [ "Tar River": [
"Accessible: Storage: Tar River", "Accessible: Storage: Tar River",
"Information Plaque: (Underground Maze) Subterranean World",
"Information Plaque: (Underground Maze) Dero" "Information Plaque: (Underground Maze) Dero"
], ],
"Theater": [ "Theater": [
@@ -311,33 +320,6 @@
"Skull Dial Bridge": [ "Skull Dial Bridge": [
"Accessible: Storage: Skull Bridge", "Accessible: Storage: Skull Bridge",
"Puzzle Solved Skull Dial Door" "Puzzle Solved Skull Dial Door"
],
"Water Capture": [
"Ixupi Captured Water"
],
"Wax Capture": [
"Ixupi Captured Wax"
],
"Ash Capture": [
"Ixupi Captured Ash"
],
"Oil Capture": [
"Ixupi Captured Oil"
],
"Cloth Capture": [
"Ixupi Captured Cloth"
],
"Wood Capture": [
"Ixupi Captured Wood"
],
"Crystal Capture": [
"Ixupi Captured Crystal"
],
"Sand Capture": [
"Ixupi Captured Sand"
],
"Metal Capture": [
"Ixupi Captured Metal"
] ]
} }
} }

View File

@@ -7,35 +7,35 @@
["Underground Lake", ["To Underground Tunnels From Underground Lake", "To Underground Blue Tunnels From Underground Lake"]], ["Underground Lake", ["To Underground Tunnels From Underground Lake", "To Underground Blue Tunnels From Underground Lake"]],
["Underground Blue Tunnels", ["To Underground Lake From Underground Blue Tunnels", "To Office Elevator From Underground Blue Tunnels"]], ["Underground Blue Tunnels", ["To Underground Lake From Underground Blue Tunnels", "To Office Elevator From Underground Blue Tunnels"]],
["Office Elevator", ["To Underground Blue Tunnels From Office Elevator","To Office From Office Elevator"]], ["Office Elevator", ["To Underground Blue Tunnels From Office Elevator","To Office From Office Elevator"]],
["Office", ["To Office Elevator From Office", "To Workshop", "To Lobby From Office", "To Bedroom Elevator From Office", "To Ash Capture From Office"]], ["Office", ["To Office Elevator From Office", "To Workshop", "To Lobby From Office", "To Bedroom Elevator From Office"]],
["Workshop", ["To Office From Workshop", "To Wood Capture From Workshop"]], ["Workshop", ["To Office From Workshop"]],
["Bedroom Elevator", ["To Office From Bedroom Elevator", "To Bedroom"]], ["Bedroom Elevator", ["To Office From Bedroom Elevator", "To Bedroom"]],
["Bedroom", ["To Bedroom Elevator From Bedroom", "To Metal Capture From Bedroom"]], ["Bedroom", ["To Bedroom Elevator From Bedroom"]],
["Lobby", ["To Office From Lobby", "To Library From Lobby", "To Theater From Lobby", "To Prehistoric From Lobby", "To Egypt From Lobby", "To Tar River From Lobby", "To Outside From Lobby", "To Water Capture From Lobby", "To Crystal Capture From Lobby"]], ["Lobby", ["To Office From Lobby", "To Library From Lobby", "To Theater From Lobby", "To Prehistoric From Lobby", "To Egypt From Lobby", "To Tar River From Lobby", "To Outside From Lobby"]],
["Library", ["To Lobby From Library", "To Maintenance Tunnels From Library", "To Wax Capture From Library"]], ["Library", ["To Lobby From Library", "To Maintenance Tunnels From Library"]],
["Maintenance Tunnels", ["To Library From Maintenance Tunnels", "To Three Floor Elevator From Maintenance Tunnels", "To Generator"]], ["Maintenance Tunnels", ["To Library From Maintenance Tunnels", "To Three Floor Elevator From Maintenance Tunnels", "To Generator"]],
["Generator", ["To Maintenance Tunnels From Generator"]], ["Generator", ["To Maintenance Tunnels From Generator"]],
["Theater", ["To Lobby From Theater", "To Theater Back Hallways From Theater"]], ["Theater", ["To Lobby From Theater", "To Theater Back Hallways From Theater"]],
["Theater Back Hallways", ["To Theater From Theater Back Hallways", "To Clock Tower Staircase From Theater Back Hallways", "To Maintenance Tunnels From Theater Back Hallways", "To Projector Room"]], ["Theater Back Hallways", ["To Theater From Theater Back Hallways", "To Clock Tower Staircase From Theater Back Hallways", "To Maintenance Tunnels From Theater Back Hallways", "To Projector Room"]],
["Clock Tower Staircase", ["To Theater Back Hallways From Clock Tower Staircase", "To Clock Tower"]], ["Clock Tower Staircase", ["To Theater Back Hallways From Clock Tower Staircase", "To Clock Tower"]],
["Clock Tower", ["To Clock Tower Staircase From Clock Tower"]], ["Clock Tower", ["To Clock Tower Staircase From Clock Tower"]],
["Projector Room", ["To Theater Back Hallways From Projector Room", "To Metal Capture From Projector Room"]], ["Projector Room", ["To Theater Back Hallways From Projector Room"]],
["Prehistoric", ["To Lobby From Prehistoric", "To Greenhouse", "To Ocean From Prehistoric", "To Oil Capture From Prehistoric", "To Metal Capture From Prehistoric"]], ["Prehistoric", ["To Lobby From Prehistoric", "To Greenhouse", "To Ocean From Prehistoric"]],
["Greenhouse", ["To Prehistoric From Greenhouse", "To Sand Capture From Greenhouse"]], ["Greenhouse", ["To Prehistoric From Greenhouse"]],
["Ocean", ["To Prehistoric From Ocean", "To Maze Staircase From Ocean", "To Crystal Capture From Ocean", "To Sand Capture From Ocean"]], ["Ocean", ["To Prehistoric From Ocean", "To Maze Staircase From Ocean"]],
["Maze Staircase", ["To Ocean From Maze Staircase", "To Maze From Maze Staircase"]], ["Maze Staircase", ["To Ocean From Maze Staircase", "To Maze From Maze Staircase"]],
["Maze", ["To Maze Staircase From Maze", "To Tar River"]], ["Maze", ["To Maze Staircase From Maze", "To Tar River"]],
["Tar River", ["To Maze From Tar River", "To Lobby From Tar River", "To Oil Capture From Tar River"]], ["Tar River", ["To Maze From Tar River", "To Lobby From Tar River"]],
["Egypt", ["To Lobby From Egypt", "To Burial From Egypt", "To Blue Maze From Egypt", "To Cloth Capture From Egypt"]], ["Egypt", ["To Lobby From Egypt", "To Burial From Egypt", "To Blue Maze From Egypt"]],
["Burial", ["To Egypt From Burial", "To Shaman From Burial", "To Ash Capture From Burial", "To Cloth Capture From Burial"]], ["Burial", ["To Egypt From Burial", "To Shaman From Burial"]],
["Shaman", ["To Burial From Shaman", "To Gods Room", "To Wax Capture From Shaman"]], ["Shaman", ["To Burial From Shaman", "To Gods Room"]],
["Gods Room", ["To Shaman From Gods Room", "To Anansi From Gods Room", "To Wood Capture From Gods Room"]], ["Gods Room", ["To Shaman From Gods Room", "To Anansi From Gods Room"]],
["Anansi", ["To Gods Room From Anansi", "To Werewolf From Anansi", "To Wax Capture From Anansi", "To Wood Capture From Anansi"]], ["Anansi", ["To Gods Room From Anansi", "To Werewolf From Anansi"]],
["Werewolf", ["To Anansi From Werewolf", "To Night Staircase From Werewolf"]], ["Werewolf", ["To Anansi From Werewolf", "To Night Staircase From Werewolf"]],
["Night Staircase", ["To Werewolf From Night Staircase", "To Janitor Closet", "To UFO"]], ["Night Staircase", ["To Werewolf From Night Staircase", "To Janitor Closet", "To UFO"]],
["Janitor Closet", ["To Night Staircase From Janitor Closet", "To Water Capture From Janitor Closet", "To Cloth Capture From Janitor Closet"]], ["Janitor Closet", ["To Night Staircase From Janitor Closet"]],
["UFO", ["To Night Staircase From UFO", "To Inventions From UFO"]], ["UFO", ["To Night Staircase From UFO", "To Inventions From UFO"]],
["Blue Maze", ["To Egypt From Blue Maze", "To Three Floor Elevator From Blue Maze Bottom", "To Three Floor Elevator From Blue Maze Top", "To Fortune Teller", "To Inventions From Blue Maze", "To Wood Capture From Blue Maze"]], ["Blue Maze", ["To Egypt From Blue Maze", "To Three Floor Elevator From Blue Maze Bottom", "To Three Floor Elevator From Blue Maze Top", "To Fortune Teller", "To Inventions From Blue Maze"]],
["Three Floor Elevator", ["To Maintenance Tunnels From Three Floor Elevator", "To Blue Maze From Three Floor Elevator"]], ["Three Floor Elevator", ["To Maintenance Tunnels From Three Floor Elevator", "To Blue Maze From Three Floor Elevator"]],
["Fortune Teller", ["To Blue Maze From Fortune Teller"]], ["Fortune Teller", ["To Blue Maze From Fortune Teller"]],
["Inventions", ["To Blue Maze From Inventions", "To UFO From Inventions", "To Torture From Inventions"]], ["Inventions", ["To Blue Maze From Inventions", "To UFO From Inventions", "To Torture From Inventions"]],
@@ -43,16 +43,7 @@
["Puzzle Room Mastermind", ["To Torture", "To Puzzle Room Marbles From Puzzle Room Mastermind"]], ["Puzzle Room Mastermind", ["To Torture", "To Puzzle Room Marbles From Puzzle Room Mastermind"]],
["Puzzle Room Marbles", ["To Puzzle Room Mastermind From Puzzle Room Marbles", "To Skull Dial Bridge From Puzzle Room Marbles"]], ["Puzzle Room Marbles", ["To Puzzle Room Mastermind From Puzzle Room Marbles", "To Skull Dial Bridge From Puzzle Room Marbles"]],
["Skull Dial Bridge", ["To Puzzle Room Marbles From Skull Dial Bridge", "To Slide Room"]], ["Skull Dial Bridge", ["To Puzzle Room Marbles From Skull Dial Bridge", "To Slide Room"]],
["Slide Room", ["To Skull Dial Bridge From Slide Room", "To Lobby From Slide Room"]], ["Slide Room", ["To Skull Dial Bridge From Slide Room", "To Lobby From Slide Room"]]
["Water Capture", []],
["Wax Capture", []],
["Ash Capture", []],
["Oil Capture", []],
["Cloth Capture", []],
["Wood Capture", []],
["Crystal Capture", []],
["Sand Capture", []],
["Metal Capture", []]
], ],
"mandatory_connections": [ "mandatory_connections": [
["To Registry", "Registry"], ["To Registry", "Registry"],
@@ -149,29 +140,6 @@
["To Puzzle Room Marbles From Skull Dial Bridge", "Puzzle Room Marbles"], ["To Puzzle Room Marbles From Skull Dial Bridge", "Puzzle Room Marbles"],
["To Skull Dial Bridge From Puzzle Room Marbles", "Skull Dial Bridge"], ["To Skull Dial Bridge From Puzzle Room Marbles", "Skull Dial Bridge"],
["To Skull Dial Bridge From Slide Room", "Skull Dial Bridge"], ["To Skull Dial Bridge From Slide Room", "Skull Dial Bridge"],
["To Slide Room", "Slide Room"], ["To Slide Room", "Slide Room"]
["To Wax Capture From Library", "Wax Capture"],
["To Wax Capture From Shaman", "Wax Capture"],
["To Wax Capture From Anansi", "Wax Capture"],
["To Water Capture From Lobby", "Water Capture"],
["To Water Capture From Janitor Closet", "Water Capture"],
["To Ash Capture From Office", "Ash Capture"],
["To Ash Capture From Burial", "Ash Capture"],
["To Oil Capture From Prehistoric", "Oil Capture"],
["To Oil Capture From Tar River", "Oil Capture"],
["To Cloth Capture From Egypt", "Cloth Capture"],
["To Cloth Capture From Burial", "Cloth Capture"],
["To Cloth Capture From Janitor Closet", "Cloth Capture"],
["To Wood Capture From Workshop", "Wood Capture"],
["To Wood Capture From Gods Room", "Wood Capture"],
["To Wood Capture From Anansi", "Wood Capture"],
["To Wood Capture From Blue Maze", "Wood Capture"],
["To Crystal Capture From Lobby", "Crystal Capture"],
["To Crystal Capture From Ocean", "Crystal Capture"],
["To Sand Capture From Greenhouse", "Sand Capture"],
["To Sand Capture From Ocean", "Sand Capture"],
["To Metal Capture From Bedroom", "Metal Capture"],
["To Metal Capture From Projector Room", "Metal Capture"],
["To Metal Capture From Prehistoric", "Metal Capture"]
] ]
} }

View File

@@ -12,8 +12,8 @@ these are randomized. Crawling has been added and is required to use any crawl s
## What is considered a location check in Shivers? ## What is considered a location check in Shivers?
1. All puzzle solves are location checks. 1. All puzzle solves are location checks excluding elevator puzzles.
2. All Ixupi captures are location checks. 2. All Ixupi captures are location checks excluding Lightning.
3. Puzzle hints/solutions are location checks. For example, looking at the Atlantis map. 3. Puzzle hints/solutions are location checks. For example, looking at the Atlantis map.
4. Optionally information plaques are location checks. 4. Optionally information plaques are location checks.
@@ -23,9 +23,9 @@ If the player receives a key then the corresponding door will be unlocked. If th
## What is the victory condition? ## What is the victory condition?
Victory is achieved when the player has captured the required number Ixupi set in their options. Victory is achieved when the player captures Lightning in the generator room.
## Encountered a bug? ## Encountered a bug?
Please contact GodlFire on Discord for bugs related to Shivers world generation.<br> Please contact GodlFire on Discord for bugs related to Shivers world generation.\
Please contact GodlFire or mouse on Discord for bugs related to the Shivers Randomizer. Please contact GodlFire or mouse on Discord for bugs related to the Shivers Randomizer.

View File

@@ -5,7 +5,7 @@
- [Shivers (GOG version)](https://www.gog.com/en/game/shivers) or original disc - [Shivers (GOG version)](https://www.gog.com/en/game/shivers) or original disc
- [ScummVM](https://www.scummvm.org/downloads/) version 2.7.0 or later - [ScummVM](https://www.scummvm.org/downloads/) version 2.7.0 or later
- [Shivers Randomizer](https://github.com/GodlFire/Shivers-Randomizer-CSharp/releases/latest) Latest release version - [Shivers Randomizer](https://www.speedrun.com/shivers/resources)
## Setup ScummVM for Shivers ## Setup ScummVM for Shivers

View File

@@ -1,5 +1,5 @@
import typing import typing
from Options import Choice, Option, Toggle, DefaultOnToggle, Range, ItemsAccessibility from Options import Choice, Option, Toggle, DefaultOnToggle, Range
class SMLogic(Choice): class SMLogic(Choice):
"""This option selects what kind of logic to use for item placement inside """This option selects what kind of logic to use for item placement inside
@@ -128,7 +128,6 @@ class EnergyBeep(DefaultOnToggle):
smz3_options: typing.Dict[str, type(Option)] = { smz3_options: typing.Dict[str, type(Option)] = {
"accessibility": ItemsAccessibility,
"sm_logic": SMLogic, "sm_logic": SMLogic,
"sword_location": SwordLocation, "sword_location": SwordLocation,
"morph_location": MorphLocation, "morph_location": MorphLocation,

View File

@@ -215,6 +215,7 @@ class SMZ3World(World):
niceItems = TotalSMZ3Item.Item.CreateNicePool(self.smz3World) niceItems = TotalSMZ3Item.Item.CreateNicePool(self.smz3World)
junkItems = TotalSMZ3Item.Item.CreateJunkPool(self.smz3World) junkItems = TotalSMZ3Item.Item.CreateJunkPool(self.smz3World)
allJunkItems = niceItems + junkItems
self.junkItemsNames = [item.Type.name for item in junkItems] self.junkItemsNames = [item.Type.name for item in junkItems]
if (self.smz3World.Config.Keysanity): if (self.smz3World.Config.Keysanity):
@@ -227,8 +228,7 @@ class SMZ3World(World):
self.multiworld.push_precollected(SMZ3Item(item.Type.name, ItemClassification.filler, item.Type, self.item_name_to_id[item.Type.name], self.player, item)) self.multiworld.push_precollected(SMZ3Item(item.Type.name, ItemClassification.filler, item.Type, self.item_name_to_id[item.Type.name], self.player, item))
itemPool = [SMZ3Item(item.Type.name, ItemClassification.progression, item.Type, self.item_name_to_id[item.Type.name], self.player, item) for item in progressionItems] + \ itemPool = [SMZ3Item(item.Type.name, ItemClassification.progression, item.Type, self.item_name_to_id[item.Type.name], self.player, item) for item in progressionItems] + \
[SMZ3Item(item.Type.name, ItemClassification.useful, item.Type, self.item_name_to_id[item.Type.name], self.player, item) for item in niceItems] + \ [SMZ3Item(item.Type.name, ItemClassification.filler, item.Type, self.item_name_to_id[item.Type.name], self.player, item) for item in allJunkItems]
[SMZ3Item(item.Type.name, ItemClassification.filler, item.Type, self.item_name_to_id[item.Type.name], self.player, item) for item in junkItems]
self.smz3DungeonItems = [SMZ3Item(item.Type.name, ItemClassification.progression, item.Type, self.item_name_to_id[item.Type.name], self.player, item) for item in self.dungeon] self.smz3DungeonItems = [SMZ3Item(item.Type.name, ItemClassification.progression, item.Type, self.item_name_to_id[item.Type.name], self.player, item) for item in self.dungeon]
self.multiworld.itempool += itemPool self.multiworld.itempool += itemPool
@@ -244,7 +244,7 @@ class SMZ3World(World):
set_rule(entrance, lambda state, region=region: region.CanEnter(state.smz3state[self.player])) set_rule(entrance, lambda state, region=region: region.CanEnter(state.smz3state[self.player]))
for loc in region.Locations: for loc in region.Locations:
l = self.locations[loc.Name] l = self.locations[loc.Name]
if self.multiworld.accessibility[self.player] != 'full': if self.multiworld.accessibility[self.player] != 'locations':
l.always_allow = lambda state, item, loc=loc: \ l.always_allow = lambda state, item, loc=loc: \
item.game == "SMZ3" and \ item.game == "SMZ3" and \
loc.alwaysAllow(item.item, state.smz3state[self.player]) loc.alwaysAllow(item.item, state.smz3state[self.player])

View File

@@ -1,7 +1,5 @@
import typing import typing
from dataclasses import dataclass from Options import TextChoice, Option, Range, Toggle
from Options import TextChoice, Range, Toggle, PerGameCommonOptions
class Character(TextChoice): class Character(TextChoice):
@@ -57,18 +55,9 @@ class Downfall(Toggle):
default = 0 default = 0
class DeathLink(Range): spire_options: typing.Dict[str, type(Option)] = {
"""Percentage of health to lose when a death link is received.""" "character": Character,
display_name = "Death Link %" "ascension": Ascension,
range_start = 0 "final_act": FinalAct,
range_end = 100 "downfall": Downfall,
default = 0 }
@dataclass
class SpireOptions(PerGameCommonOptions):
character: Character
ascension: Ascension
final_act: FinalAct
downfall: Downfall
death_link: DeathLink

View File

@@ -3,7 +3,7 @@ import string
from BaseClasses import Entrance, Item, ItemClassification, Location, MultiWorld, Region, Tutorial from BaseClasses import Entrance, Item, ItemClassification, Location, MultiWorld, Region, Tutorial
from .Items import event_item_pairs, item_pool, item_table from .Items import event_item_pairs, item_pool, item_table
from .Locations import location_table from .Locations import location_table
from .Options import SpireOptions from .Options import spire_options
from .Regions import create_regions from .Regions import create_regions
from .Rules import set_rules from .Rules import set_rules
from ..AutoWorld import WebWorld, World from ..AutoWorld import WebWorld, World
@@ -27,8 +27,7 @@ class SpireWorld(World):
immense power, and Slay the Spire! immense power, and Slay the Spire!
""" """
options_dataclass = SpireOptions option_definitions = spire_options
options: SpireOptions
game = "Slay the Spire" game = "Slay the Spire"
topology_present = False topology_present = False
web = SpireWeb() web = SpireWeb()
@@ -64,13 +63,15 @@ class SpireWorld(World):
def fill_slot_data(self) -> dict: def fill_slot_data(self) -> dict:
slot_data = { slot_data = {
'seed': "".join(self.random.choice(string.ascii_letters) for i in range(16)) 'seed': "".join(self.multiworld.per_slot_randoms[self.player].choice(string.ascii_letters) for i in range(16))
} }
slot_data.update(self.options.as_dict("character", "ascension", "final_act", "downfall", "death_link")) for option_name in spire_options:
option = getattr(self.multiworld, option_name)[self.player]
slot_data[option_name] = option.value
return slot_data return slot_data
def get_filler_item_name(self) -> str: def get_filler_item_name(self) -> str:
return self.random.choice(["Card Draw", "Card Draw", "Card Draw", "Relic", "Relic"]) return self.multiworld.random.choice(["Card Draw", "Card Draw", "Card Draw", "Relic", "Relic"])
def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None): def create_region(world: MultiWorld, player: int, name: str, locations=None, exits=None):

View File

@@ -2212,7 +2212,7 @@ id,region,name,tags,mod_name
3808,Shipping,Shipsanity: Mystery Box,"SHIPSANITY", 3808,Shipping,Shipsanity: Mystery Box,"SHIPSANITY",
3809,Shipping,Shipsanity: Golden Tag,"SHIPSANITY", 3809,Shipping,Shipsanity: Golden Tag,"SHIPSANITY",
3810,Shipping,Shipsanity: Deluxe Bait,"SHIPSANITY", 3810,Shipping,Shipsanity: Deluxe Bait,"SHIPSANITY",
3811,Shipping,Shipsanity: Moss,"SHIPSANITY,SHIPSANITY_FULL_SHIPMENT", 3811,Shipping,Shipsanity: Moss,"SHIPSANITY,SHIPSANITY_CROP,SHIPSANITY_FULL_SHIPMENT",
3812,Shipping,Shipsanity: Mossy Seed,"SHIPSANITY", 3812,Shipping,Shipsanity: Mossy Seed,"SHIPSANITY",
3813,Shipping,Shipsanity: Sonar Bobber,"SHIPSANITY", 3813,Shipping,Shipsanity: Sonar Bobber,"SHIPSANITY",
3814,Shipping,Shipsanity: Tent Kit,"SHIPSANITY", 3814,Shipping,Shipsanity: Tent Kit,"SHIPSANITY",
1 id region name tags mod_name
2212 3808 Shipping Shipsanity: Mystery Box SHIPSANITY
2213 3809 Shipping Shipsanity: Golden Tag SHIPSANITY
2214 3810 Shipping Shipsanity: Deluxe Bait SHIPSANITY
2215 3811 Shipping Shipsanity: Moss SHIPSANITY,SHIPSANITY_FULL_SHIPMENT SHIPSANITY,SHIPSANITY_CROP,SHIPSANITY_FULL_SHIPMENT
2216 3812 Shipping Shipsanity: Mossy Seed SHIPSANITY
2217 3813 Shipping Shipsanity: Sonar Bobber SHIPSANITY
2218 3814 Shipping Shipsanity: Tent Kit SHIPSANITY

View File

@@ -58,7 +58,7 @@ all_random_settings = {
easy_settings = { easy_settings = {
"progression_balancing": ProgressionBalancing.default, "progression_balancing": ProgressionBalancing.default,
"accessibility": Accessibility.option_full, "accessibility": Accessibility.option_items,
Goal.internal_name: Goal.option_community_center, Goal.internal_name: Goal.option_community_center,
FarmType.internal_name: "random", FarmType.internal_name: "random",
StartingMoney.internal_name: "very rich", StartingMoney.internal_name: "very rich",
@@ -104,7 +104,7 @@ easy_settings = {
medium_settings = { medium_settings = {
"progression_balancing": 25, "progression_balancing": 25,
"accessibility": Accessibility.option_full, "accessibility": Accessibility.option_locations,
Goal.internal_name: Goal.option_community_center, Goal.internal_name: Goal.option_community_center,
FarmType.internal_name: "random", FarmType.internal_name: "random",
StartingMoney.internal_name: "rich", StartingMoney.internal_name: "rich",
@@ -150,7 +150,7 @@ medium_settings = {
hard_settings = { hard_settings = {
"progression_balancing": 0, "progression_balancing": 0,
"accessibility": Accessibility.option_full, "accessibility": Accessibility.option_locations,
Goal.internal_name: Goal.option_grandpa_evaluation, Goal.internal_name: Goal.option_grandpa_evaluation,
FarmType.internal_name: "random", FarmType.internal_name: "random",
StartingMoney.internal_name: "extra", StartingMoney.internal_name: "extra",
@@ -196,7 +196,7 @@ hard_settings = {
nightmare_settings = { nightmare_settings = {
"progression_balancing": 0, "progression_balancing": 0,
"accessibility": Accessibility.option_full, "accessibility": Accessibility.option_locations,
Goal.internal_name: Goal.option_community_center, Goal.internal_name: Goal.option_community_center,
FarmType.internal_name: "random", FarmType.internal_name: "random",
StartingMoney.internal_name: "vanilla", StartingMoney.internal_name: "vanilla",
@@ -242,7 +242,7 @@ nightmare_settings = {
short_settings = { short_settings = {
"progression_balancing": ProgressionBalancing.default, "progression_balancing": ProgressionBalancing.default,
"accessibility": Accessibility.option_full, "accessibility": Accessibility.option_items,
Goal.internal_name: Goal.option_bottom_of_the_mines, Goal.internal_name: Goal.option_bottom_of_the_mines,
FarmType.internal_name: "random", FarmType.internal_name: "random",
StartingMoney.internal_name: "filthy rich", StartingMoney.internal_name: "filthy rich",
@@ -334,7 +334,7 @@ minsanity_settings = {
allsanity_settings = { allsanity_settings = {
"progression_balancing": ProgressionBalancing.default, "progression_balancing": ProgressionBalancing.default,
"accessibility": Accessibility.option_full, "accessibility": Accessibility.option_locations,
Goal.internal_name: Goal.default, Goal.internal_name: Goal.default,
FarmType.internal_name: "random", FarmType.internal_name: "random",
StartingMoney.internal_name: StartingMoney.default, StartingMoney.internal_name: StartingMoney.default,

View File

@@ -6,7 +6,7 @@ from argparse import Namespace
from contextlib import contextmanager from contextlib import contextmanager
from typing import Dict, ClassVar, Iterable, Tuple, Optional, List, Union, Any from typing import Dict, ClassVar, Iterable, Tuple, Optional, List, Union, Any
from BaseClasses import MultiWorld, CollectionState, PlandoOptions, get_seed, Location, Item, ItemClassification from BaseClasses import MultiWorld, CollectionState, get_seed, Location, Item, ItemClassification
from Options import VerifyKeys from Options import VerifyKeys
from test.bases import WorldTestBase from test.bases import WorldTestBase
from test.general import gen_steps, setup_solo_multiworld as setup_base_solo_multiworld from test.general import gen_steps, setup_solo_multiworld as setup_base_solo_multiworld
@@ -365,7 +365,7 @@ def setup_solo_multiworld(test_options: Optional[Dict[Union[str, StardewValleyOp
if issubclass(option, VerifyKeys): if issubclass(option, VerifyKeys):
# Values should already be verified, but just in case... # Values should already be verified, but just in case...
value.verify(StardewValleyWorld, "Tester", PlandoOptions.bosses) option.verify_keys(value.value)
setattr(args, name, {1: value}) setattr(args, name, {1: value})
multiworld.set_options(args) multiworld.set_options(args)

View File

@@ -1,6 +1,6 @@
from typing import List, Optional, Callable, NamedTuple from typing import List, Optional, Callable, NamedTuple
from BaseClasses import CollectionState from BaseClasses import MultiWorld, CollectionState
from .Options import TimespinnerOptions from .Options import is_option_enabled
from .PreCalculatedWeights import PreCalculatedWeights from .PreCalculatedWeights import PreCalculatedWeights
from .LogicExtensions import TimespinnerLogic from .LogicExtensions import TimespinnerLogic
@@ -14,10 +14,11 @@ class LocationData(NamedTuple):
rule: Optional[Callable[[CollectionState], bool]] = None rule: Optional[Callable[[CollectionState], bool]] = None
def get_location_datas(player: Optional[int], options: Optional[TimespinnerOptions], def get_location_datas(world: Optional[MultiWorld], player: Optional[int],
precalculated_weights: Optional[PreCalculatedWeights]) -> List[LocationData]: precalculated_weights: PreCalculatedWeights) -> List[LocationData]:
flooded: Optional[PreCalculatedWeights] = precalculated_weights
logic = TimespinnerLogic(player, options, precalculated_weights) flooded: PreCalculatedWeights = precalculated_weights
logic = TimespinnerLogic(world, player, precalculated_weights)
# 1337000 - 1337155 Generic locations # 1337000 - 1337155 Generic locations
# 1337171 - 1337175 New Pickup checks # 1337171 - 1337175 New Pickup checks
@@ -202,7 +203,7 @@ def get_location_datas(player: Optional[int], options: Optional[TimespinnerOptio
] ]
# 1337156 - 1337170 Downloads # 1337156 - 1337170 Downloads
if not options or options.downloadable_items: if not world or is_option_enabled(world, player, "DownloadableItems"):
location_table += ( location_table += (
LocationData('Library', 'Library: Terminal 2 (Lachiem)', 1337156, lambda state: state.has('Tablet', player)), 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)), LocationData('Library', 'Library: Terminal 1 (Windaria)', 1337157, lambda state: state.has('Tablet', player)),
@@ -222,13 +223,13 @@ def get_location_datas(player: Optional[int], options: Optional[TimespinnerOptio
) )
# 1337176 - 1337176 Cantoran # 1337176 - 1337176 Cantoran
if not options or options.cantoran: if not world or is_option_enabled(world, player, "Cantoran"):
location_table += ( location_table += (
LocationData('Left Side forest Caves', 'Lake Serene: Cantoran', 1337176), LocationData('Left Side forest Caves', 'Lake Serene: Cantoran', 1337176),
) )
# 1337177 - 1337198 Lore Checks # 1337177 - 1337198 Lore Checks
if not options or options.lore_checks: if not world or is_option_enabled(world, player, "LoreChecks"):
location_table += ( location_table += (
LocationData('Lower lake desolation', 'Lake Desolation: Memory - Coyote Jump (Time Messenger)', 1337177), LocationData('Lower lake desolation', 'Lake Desolation: Memory - Coyote Jump (Time Messenger)', 1337177),
LocationData('Library', 'Library: Memory - Waterway (A Message)', 1337178), LocationData('Library', 'Library: Memory - Waterway (A Message)', 1337178),
@@ -257,7 +258,7 @@ def get_location_datas(player: Optional[int], options: Optional[TimespinnerOptio
# 1337199 - 1337236 Reserved for future use # 1337199 - 1337236 Reserved for future use
# 1337237 - 1337245 GyreArchives # 1337237 - 1337245 GyreArchives
if not options or options.gyre_archives: if not world or is_option_enabled(world, player, "GyreArchives"):
location_table += ( location_table += (
LocationData('Ravenlord\'s Lair', 'Ravenlord: Post fight (pedestal)', 1337237), LocationData('Ravenlord\'s Lair', 'Ravenlord: Post fight (pedestal)', 1337237),
LocationData('Ifrit\'s Lair', 'Ifrit: Post fight (pedestal)', 1337238), LocationData('Ifrit\'s Lair', 'Ifrit: Post fight (pedestal)', 1337238),

View File

@@ -1,6 +1,6 @@
from typing import Union, Optional from typing import Union
from BaseClasses import CollectionState from BaseClasses import MultiWorld, CollectionState
from .Options import TimespinnerOptions from .Options import is_option_enabled
from .PreCalculatedWeights import PreCalculatedWeights from .PreCalculatedWeights import PreCalculatedWeights
@@ -10,18 +10,17 @@ class TimespinnerLogic:
flag_unchained_keys: bool flag_unchained_keys: bool
flag_eye_spy: bool flag_eye_spy: bool
flag_specific_keycards: bool flag_specific_keycards: bool
pyramid_keys_unlock: Optional[str] pyramid_keys_unlock: Union[str, None]
present_keys_unlock: Optional[str] present_keys_unlock: Union[str, None]
past_keys_unlock: Optional[str] past_keys_unlock: Union[str, None]
time_keys_unlock: Optional[str] time_keys_unlock: Union[str, None]
def __init__(self, player: int, options: Optional[TimespinnerOptions], def __init__(self, world: MultiWorld, player: int, precalculated_weights: PreCalculatedWeights):
precalculated_weights: Optional[PreCalculatedWeights]):
self.player = player self.player = player
self.flag_specific_keycards = bool(options and options.specific_keycards) self.flag_specific_keycards = is_option_enabled(world, player, "SpecificKeycards")
self.flag_eye_spy = bool(options and options.eye_spy) self.flag_eye_spy = is_option_enabled(world, player, "EyeSpy")
self.flag_unchained_keys = bool(options and options.unchained_keys) self.flag_unchained_keys = is_option_enabled(world, player, "UnchainedKeys")
if precalculated_weights: if precalculated_weights:
if self.flag_unchained_keys: if self.flag_unchained_keys:

View File

@@ -1,50 +1,59 @@
from dataclasses import dataclass from typing import Dict, Union, List
from typing import Type, Any from BaseClasses import MultiWorld
from typing import Dict from Options import Toggle, DefaultOnToggle, DeathLink, Choice, Range, Option, OptionDict, OptionList
from Options import Toggle, DefaultOnToggle, DeathLink, Choice, Range, OptionDict, OptionList, Visibility, Option
from Options import PerGameCommonOptions, DeathLinkMixin, AssembleOptions
from schema import Schema, And, Optional, Or from schema import Schema, And, Optional, Or
class StartWithJewelryBox(Toggle): class StartWithJewelryBox(Toggle):
"Start with Jewelry Box unlocked" "Start with Jewelry Box unlocked"
display_name = "Start with Jewelry Box" display_name = "Start with Jewelry Box"
class DownloadableItems(DefaultOnToggle): class DownloadableItems(DefaultOnToggle):
"With the tablet you will be able to download items at terminals" "With the tablet you will be able to download items at terminals"
display_name = "Downloadable items" display_name = "Downloadable items"
class EyeSpy(Toggle): class EyeSpy(Toggle):
"Requires Oculus Ring in inventory to be able to break hidden walls." "Requires Oculus Ring in inventory to be able to break hidden walls."
display_name = "Eye Spy" display_name = "Eye Spy"
class StartWithMeyef(Toggle): class StartWithMeyef(Toggle):
"Start with Meyef, ideal for when you want to play multiplayer." "Start with Meyef, ideal for when you want to play multiplayer."
display_name = "Start with Meyef" display_name = "Start with Meyef"
class QuickSeed(Toggle): class QuickSeed(Toggle):
"Start with Talaria Attachment, Nyoom!" "Start with Talaria Attachment, Nyoom!"
display_name = "Quick seed" display_name = "Quick seed"
class SpecificKeycards(Toggle): class SpecificKeycards(Toggle):
"Keycards can only open corresponding doors" "Keycards can only open corresponding doors"
display_name = "Specific Keycards" display_name = "Specific Keycards"
class Inverted(Toggle): class Inverted(Toggle):
"Start in the past" "Start in the past"
display_name = "Inverted" display_name = "Inverted"
class GyreArchives(Toggle): class GyreArchives(Toggle):
"Gyre locations are in logic. New warps are gated by Merchant Crow and Kobo" "Gyre locations are in logic. New warps are gated by Merchant Crow and Kobo"
display_name = "Gyre Archives" display_name = "Gyre Archives"
class Cantoran(Toggle): class Cantoran(Toggle):
"Cantoran's fight and check are available upon revisiting his room" "Cantoran's fight and check are available upon revisiting his room"
display_name = "Cantoran" display_name = "Cantoran"
class LoreChecks(Toggle): class LoreChecks(Toggle):
"Memories and journal entries contain items." "Memories and journal entries contain items."
display_name = "Lore Checks" display_name = "Lore Checks"
class BossRando(Choice): class BossRando(Choice):
"Wheter all boss locations are shuffled, and if their damage/hp should be scaled." "Wheter all boss locations are shuffled, and if their damage/hp should be scaled."
display_name = "Boss Randomization" display_name = "Boss Randomization"
@@ -53,6 +62,7 @@ class BossRando(Choice):
option_unscaled = 2 option_unscaled = 2
alias_true = 1 alias_true = 1
class EnemyRando(Choice): class EnemyRando(Choice):
"Wheter enemies will be randomized, and if their damage/hp should be scaled." "Wheter enemies will be randomized, and if their damage/hp should be scaled."
display_name = "Enemy Randomization" display_name = "Enemy Randomization"
@@ -62,6 +72,7 @@ class EnemyRando(Choice):
option_ryshia = 3 option_ryshia = 3
alias_true = 1 alias_true = 1
class DamageRando(Choice): class DamageRando(Choice):
"Randomly nerfs and buffs some orbs and their associated spells as well as some associated rings." "Randomly nerfs and buffs some orbs and their associated spells as well as some associated rings."
display_name = "Damage Rando" display_name = "Damage Rando"
@@ -74,6 +85,7 @@ class DamageRando(Choice):
option_manual = 6 option_manual = 6
alias_true = 2 alias_true = 2
class DamageRandoOverrides(OptionDict): class DamageRandoOverrides(OptionDict):
"""Manual +/-/normal odds for an orb. Put 0 if you don't want a certain nerf or buff to be a possibility. Orbs that """Manual +/-/normal odds for an orb. Put 0 if you don't want a certain nerf or buff to be a possibility. Orbs that
you don't specify will roll with 1/1/1 as odds""" you don't specify will roll with 1/1/1 as odds"""
@@ -179,6 +191,7 @@ class DamageRandoOverrides(OptionDict):
"Radiant": { "MinusOdds": 1, "NormalOdds": 1, "PlusOdds": 1 }, "Radiant": { "MinusOdds": 1, "NormalOdds": 1, "PlusOdds": 1 },
} }
class HpCap(Range): class HpCap(Range):
"Sets the number that Lunais's HP maxes out at." "Sets the number that Lunais's HP maxes out at."
display_name = "HP Cap" display_name = "HP Cap"
@@ -186,6 +199,7 @@ class HpCap(Range):
range_end = 999 range_end = 999
default = 999 default = 999
class LevelCap(Range): class LevelCap(Range):
"""Sets the max level Lunais can achieve.""" """Sets the max level Lunais can achieve."""
display_name = "Level Cap" display_name = "Level Cap"
@@ -193,17 +207,20 @@ class LevelCap(Range):
range_end = 99 range_end = 99
default = 99 default = 99
class ExtraEarringsXP(Range): class ExtraEarringsXP(Range):
"""Adds additional XP granted by Galaxy Earrings.""" """Adds additional XP granted by Galaxy Earrings."""
display_name = "Extra Earrings XP" display_name = "Extra Earrings XP"
range_start = 0 range_start = 0
range_end = 24 range_end = 24
default = 0 default = 0
class BossHealing(DefaultOnToggle): class BossHealing(DefaultOnToggle):
"Enables/disables healing after boss fights. NOTE: Currently only applicable when Boss Rando is enabled." "Enables/disables healing after boss fights. NOTE: Currently only applicable when Boss Rando is enabled."
display_name = "Heal After Bosses" display_name = "Heal After Bosses"
class ShopFill(Choice): class ShopFill(Choice):
"""Sets the items for sale in Merchant Crow's shops. """Sets the items for sale in Merchant Crow's shops.
Default: No sunglasses or trendy jacket, but sand vials for sale. Default: No sunglasses or trendy jacket, but sand vials for sale.
@@ -216,10 +233,12 @@ class ShopFill(Choice):
option_vanilla = 2 option_vanilla = 2
option_empty = 3 option_empty = 3
class ShopWarpShards(DefaultOnToggle): class ShopWarpShards(DefaultOnToggle):
"Shops always sell warp shards (when keys possessed), ignoring inventory setting." "Shops always sell warp shards (when keys possessed), ignoring inventory setting."
display_name = "Always Sell Warp Shards" display_name = "Always Sell Warp Shards"
class ShopMultiplier(Range): class ShopMultiplier(Range):
"Multiplier for the cost of items in the shop. Set to 0 for free shops." "Multiplier for the cost of items in the shop. Set to 0 for free shops."
display_name = "Shop Price Multiplier" display_name = "Shop Price Multiplier"
@@ -227,6 +246,7 @@ class ShopMultiplier(Range):
range_end = 10 range_end = 10
default = 1 default = 1
class LootPool(Choice): class LootPool(Choice):
"""Sets the items that drop from enemies (does not apply to boss reward checks) """Sets the items that drop from enemies (does not apply to boss reward checks)
Vanilla: Drops are the same as the base game Vanilla: Drops are the same as the base game
@@ -237,6 +257,7 @@ class LootPool(Choice):
option_randomized = 1 option_randomized = 1
option_empty = 2 option_empty = 2
class DropRateCategory(Choice): class DropRateCategory(Choice):
"""Sets the drop rate when 'Loot Pool' is set to 'Random' """Sets the drop rate when 'Loot Pool' is set to 'Random'
Tiered: Based on item rarity/value Tiered: Based on item rarity/value
@@ -250,6 +271,7 @@ class DropRateCategory(Choice):
option_randomized = 2 option_randomized = 2
option_fixed = 3 option_fixed = 3
class FixedDropRate(Range): class FixedDropRate(Range):
"Base drop rate percentage when 'Drop Rate Category' is set to 'Fixed'" "Base drop rate percentage when 'Drop Rate Category' is set to 'Fixed'"
display_name = "Fixed Drop Rate" display_name = "Fixed Drop Rate"
@@ -257,6 +279,7 @@ class FixedDropRate(Range):
range_end = 100 range_end = 100
default = 5 default = 5
class LootTierDistro(Choice): class LootTierDistro(Choice):
"""Sets how often items of each rarity tier are placed when 'Loot Pool' is set to 'Random' """Sets how often items of each rarity tier are placed when 'Loot Pool' is set to 'Random'
Default Weight: Rarer items will be assigned to enemy drop slots less frequently than common items Default Weight: Rarer items will be assigned to enemy drop slots less frequently than common items
@@ -268,26 +291,32 @@ class LootTierDistro(Choice):
option_full_random = 1 option_full_random = 1
option_inverted_weight = 2 option_inverted_weight = 2
class ShowBestiary(Toggle): class ShowBestiary(Toggle):
"All entries in the bestiary are visible, without needing to kill one of a given enemy first" "All entries in the bestiary are visible, without needing to kill one of a given enemy first"
display_name = "Show Bestiary Entries" display_name = "Show Bestiary Entries"
class ShowDrops(Toggle): class ShowDrops(Toggle):
"All item drops in the bestiary are visible, without needing an enemy to drop one of a given item first" "All item drops in the bestiary are visible, without needing an enemy to drop one of a given item first"
display_name = "Show Bestiary Item Drops" display_name = "Show Bestiary Item Drops"
class EnterSandman(Toggle): class EnterSandman(Toggle):
"The Ancient Pyramid is unlocked by the Twin Pyramid Keys, but the final boss door opens if you have all 5 Timespinner pieces" "The Ancient Pyramid is unlocked by the Twin Pyramid Keys, but the final boss door opens if you have all 5 Timespinner pieces"
display_name = "Enter Sandman" display_name = "Enter Sandman"
class DadPercent(Toggle): class DadPercent(Toggle):
"""The win condition is beating the boss of Emperor's Tower""" """The win condition is beating the boss of Emperor's Tower"""
display_name = "Dad Percent" display_name = "Dad Percent"
class RisingTides(Toggle): class RisingTides(Toggle):
"""Random areas are flooded or drained, can be further specified with RisingTidesOverrides""" """Random areas are flooded or drained, can be further specified with RisingTidesOverrides"""
display_name = "Rising Tides" display_name = "Rising Tides"
def rising_tide_option(location: str, with_save_point_option: bool = False) -> Dict[Optional, Or]: def rising_tide_option(location: str, with_save_point_option: bool = False) -> Dict[Optional, Or]:
if with_save_point_option: if with_save_point_option:
return { return {
@@ -312,6 +341,7 @@ def rising_tide_option(location: str, with_save_point_option: bool = False) -> D
"Flooded") "Flooded")
} }
class RisingTidesOverrides(OptionDict): class RisingTidesOverrides(OptionDict):
"""Odds for specific areas to be flooded or drained, only has effect when RisingTides is on. """Odds for specific areas to be flooded or drained, only has effect when RisingTides is on.
Areas that are not specified will roll with the default 33% chance of getting flooded or drained""" Areas that are not specified will roll with the default 33% chance of getting flooded or drained"""
@@ -343,11 +373,13 @@ class RisingTidesOverrides(OptionDict):
"Lab": { "Dry": 67, "Flooded": 33 }, "Lab": { "Dry": 67, "Flooded": 33 },
} }
class UnchainedKeys(Toggle): class UnchainedKeys(Toggle):
"""Start with Twin Pyramid Key, which does not give free warp; """Start with Twin Pyramid Key, which does not give free warp;
warp items for Past, Present, (and ??? with Enter Sandman) can be found.""" warp items for Past, Present, (and ??? with Enter Sandman) can be found."""
display_name = "Unchained Keys" display_name = "Unchained Keys"
class TrapChance(Range): class TrapChance(Range):
"""Chance of traps in the item pool. """Chance of traps in the item pool.
Traps will only replace filler items such as potions, vials and antidotes""" Traps will only replace filler items such as potions, vials and antidotes"""
@@ -356,256 +388,67 @@ class TrapChance(Range):
range_end = 100 range_end = 100
default = 10 default = 10
class Traps(OptionList): class Traps(OptionList):
"""List of traps that may be in the item pool to find""" """List of traps that may be in the item pool to find"""
display_name = "Traps Types" display_name = "Traps Types"
valid_keys = { "Meteor Sparrow Trap", "Poison Trap", "Chaos Trap", "Neurotoxin Trap", "Bee Trap" } valid_keys = { "Meteor Sparrow Trap", "Poison Trap", "Chaos Trap", "Neurotoxin Trap", "Bee Trap" }
default = [ "Meteor Sparrow Trap", "Poison Trap", "Chaos Trap", "Neurotoxin Trap", "Bee Trap" ] default = [ "Meteor Sparrow Trap", "Poison Trap", "Chaos Trap", "Neurotoxin Trap", "Bee Trap" ]
class PresentAccessWithWheelAndSpindle(Toggle): class PresentAccessWithWheelAndSpindle(Toggle):
"""When inverted, allows using the refugee camp warp when both the Timespinner Wheel and Spindle is acquired.""" """When inverted, allows using the refugee camp warp when both the Timespinner Wheel and Spindle is acquired."""
display_name = "Back to the future" display_name = "Past Wheel & Spindle Warp"
@dataclass
class TimespinnerOptions(PerGameCommonOptions, DeathLinkMixin):
start_with_jewelry_box: StartWithJewelryBox
downloadable_items: DownloadableItems
eye_spy: EyeSpy
start_with_meyef: StartWithMeyef
quick_seed: QuickSeed
specific_keycards: SpecificKeycards
inverted: Inverted
gyre_archives: GyreArchives
cantoran: Cantoran
lore_checks: LoreChecks
boss_rando: BossRando
damage_rando: DamageRando
damage_rando_overrides: DamageRandoOverrides
hp_cap: HpCap
level_cap: LevelCap
extra_earrings_xp: ExtraEarringsXP
boss_healing: BossHealing
shop_fill: ShopFill
shop_warp_shards: ShopWarpShards
shop_multiplier: ShopMultiplier
loot_pool: LootPool
drop_rate_category: DropRateCategory
fixed_drop_rate: FixedDropRate
loot_tier_distro: LootTierDistro
show_bestiary: ShowBestiary
show_drops: ShowDrops
enter_sandman: EnterSandman
dad_percent: DadPercent
rising_tides: RisingTides
rising_tides_overrides: RisingTidesOverrides
unchained_keys: UnchainedKeys
back_to_the_future: PresentAccessWithWheelAndSpindle
trap_chance: TrapChance
traps: Traps
class HiddenDamageRandoOverrides(DamageRandoOverrides): # Some options that are available in the timespinner randomizer arent currently implemented
"""Manual +/-/normal odds for an orb. Put 0 if you don't want a certain nerf or buff to be a possibility. Orbs that timespinner_options: Dict[str, Option] = {
you don't specify will roll with 1/1/1 as odds""" "StartWithJewelryBox": StartWithJewelryBox,
visibility = Visibility.none "DownloadableItems": DownloadableItems,
"EyeSpy": EyeSpy,
"StartWithMeyef": StartWithMeyef,
"QuickSeed": QuickSeed,
"SpecificKeycards": SpecificKeycards,
"Inverted": Inverted,
"GyreArchives": GyreArchives,
"Cantoran": Cantoran,
"LoreChecks": LoreChecks,
"BossRando": BossRando,
"EnemyRando": EnemyRando,
"DamageRando": DamageRando,
"DamageRandoOverrides": DamageRandoOverrides,
"HpCap": HpCap,
"LevelCap": LevelCap,
"ExtraEarringsXP": ExtraEarringsXP,
"BossHealing": BossHealing,
"ShopFill": ShopFill,
"ShopWarpShards": ShopWarpShards,
"ShopMultiplier": ShopMultiplier,
"LootPool": LootPool,
"DropRateCategory": DropRateCategory,
"FixedDropRate": FixedDropRate,
"LootTierDistro": LootTierDistro,
"ShowBestiary": ShowBestiary,
"ShowDrops": ShowDrops,
"EnterSandman": EnterSandman,
"DadPercent": DadPercent,
"RisingTides": RisingTides,
"RisingTidesOverrides": RisingTidesOverrides,
"UnchainedKeys": UnchainedKeys,
"TrapChance": TrapChance,
"Traps": Traps,
"PresentAccessWithWheelAndSpindle": PresentAccessWithWheelAndSpindle,
"DeathLink": DeathLink,
}
class HiddenRisingTidesOverrides(RisingTidesOverrides):
"""Odds for specific areas to be flooded or drained, only has effect when RisingTides is on.
Areas that are not specified will roll with the default 33% chance of getting flooded or drained"""
visibility = Visibility.none
class HiddenTraps(Traps): def is_option_enabled(world: MultiWorld, player: int, name: str) -> bool:
"""List of traps that may be in the item pool to find""" return get_option_value(world, player, name) > 0
visibility = Visibility.none
class OptionsHider:
@classmethod
def hidden(cls, option: Type[Option[Any]]) -> Type[Option]:
new_option = AssembleOptions(f"{option}Hidden", option.__bases__, vars(option).copy())
new_option.visibility = Visibility.none
new_option.__doc__ = option.__doc__
return new_option
class HasReplacedCamelCase(Toggle):
"""For internal use will display a warning message if true"""
visibility = Visibility.none
@dataclass def get_option_value(world: MultiWorld, player: int, name: str) -> Union[int, Dict, List]:
class BackwardsCompatiableTimespinnerOptions(TimespinnerOptions): option = getattr(world, name, None)
StartWithJewelryBox: OptionsHider.hidden(StartWithJewelryBox) # type: ignore if option == None:
DownloadableItems: OptionsHider.hidden(DownloadableItems) # type: ignore return 0
EyeSpy: OptionsHider.hidden(EyeSpy) # type: ignore
StartWithMeyef: OptionsHider.hidden(StartWithMeyef) # type: ignore
QuickSeed: OptionsHider.hidden(QuickSeed) # type: ignore
SpecificKeycards: OptionsHider.hidden(SpecificKeycards) # type: ignore
Inverted: OptionsHider.hidden(Inverted) # type: ignore
GyreArchives: OptionsHider.hidden(GyreArchives) # type: ignore
Cantoran: OptionsHider.hidden(Cantoran) # type: ignore
LoreChecks: OptionsHider.hidden(LoreChecks) # type: ignore
BossRando: OptionsHider.hidden(BossRando) # type: ignore
DamageRando: OptionsHider.hidden(DamageRando) # type: ignore
DamageRandoOverrides: HiddenDamageRandoOverrides
HpCap: OptionsHider.hidden(HpCap) # type: ignore
LevelCap: OptionsHider.hidden(LevelCap) # type: ignore
ExtraEarringsXP: OptionsHider.hidden(ExtraEarringsXP) # type: ignore
BossHealing: OptionsHider.hidden(BossHealing) # type: ignore
ShopFill: OptionsHider.hidden(ShopFill) # type: ignore
ShopWarpShards: OptionsHider.hidden(ShopWarpShards) # type: ignore
ShopMultiplier: OptionsHider.hidden(ShopMultiplier) # type: ignore
LootPool: OptionsHider.hidden(LootPool) # type: ignore
DropRateCategory: OptionsHider.hidden(DropRateCategory) # type: ignore
FixedDropRate: OptionsHider.hidden(FixedDropRate) # type: ignore
LootTierDistro: OptionsHider.hidden(LootTierDistro) # type: ignore
ShowBestiary: OptionsHider.hidden(ShowBestiary) # type: ignore
ShowDrops: OptionsHider.hidden(ShowDrops) # type: ignore
EnterSandman: OptionsHider.hidden(EnterSandman) # type: ignore
DadPercent: OptionsHider.hidden(DadPercent) # type: ignore
RisingTides: OptionsHider.hidden(RisingTides) # type: ignore
RisingTidesOverrides: HiddenRisingTidesOverrides
UnchainedKeys: OptionsHider.hidden(UnchainedKeys) # type: ignore
PresentAccessWithWheelAndSpindle: OptionsHider.hidden(PresentAccessWithWheelAndSpindle) # type: ignore
TrapChance: OptionsHider.hidden(TrapChance) # type: ignore
Traps: HiddenTraps # type: ignore
DeathLink: OptionsHider.hidden(DeathLink) # type: ignore
has_replaced_options: HasReplacedCamelCase
def handle_backward_compatibility(self) -> None: return option[player].value
if self.StartWithJewelryBox != StartWithJewelryBox.default and \
self.start_with_jewelry_box == StartWithJewelryBox.default:
self.start_with_jewelry_box.value = self.StartWithJewelryBox.value
self.has_replaced_options.value = Toggle.option_true
if self.DownloadableItems != DownloadableItems.default and \
self.downloadable_items == DownloadableItems.default:
self.downloadable_items.value = self.DownloadableItems.value
self.has_replaced_options.value = Toggle.option_true
if self.EyeSpy != EyeSpy.default and \
self.eye_spy == EyeSpy.default:
self.eye_spy.value = self.EyeSpy.value
self.has_replaced_options.value = Toggle.option_true
if self.StartWithMeyef != StartWithMeyef.default and \
self.start_with_meyef == StartWithMeyef.default:
self.start_with_meyef.value = self.StartWithMeyef.value
self.has_replaced_options.value = Toggle.option_true
if self.QuickSeed != QuickSeed.default and \
self.quick_seed == QuickSeed.default:
self.quick_seed.value = self.QuickSeed.value
self.has_replaced_options.value = Toggle.option_true
if self.SpecificKeycards != SpecificKeycards.default and \
self.specific_keycards == SpecificKeycards.default:
self.specific_keycards.value = self.SpecificKeycards.value
self.has_replaced_options.value = Toggle.option_true
if self.Inverted != Inverted.default and \
self.inverted == Inverted.default:
self.inverted.value = self.Inverted.value
self.has_replaced_options.value = Toggle.option_true
if self.GyreArchives != GyreArchives.default and \
self.gyre_archives == GyreArchives.default:
self.gyre_archives.value = self.GyreArchives.value
self.has_replaced_options.value = Toggle.option_true
if self.Cantoran != Cantoran.default and \
self.cantoran == Cantoran.default:
self.cantoran.value = self.Cantoran.value
self.has_replaced_options.value = Toggle.option_true
if self.LoreChecks != LoreChecks.default and \
self.lore_checks == LoreChecks.default:
self.lore_checks.value = self.LoreChecks.value
self.has_replaced_options.value = Toggle.option_true
if self.BossRando != BossRando.default and \
self.boss_rando == BossRando.default:
self.boss_rando.value = self.BossRando.value
self.has_replaced_options.value = Toggle.option_true
if self.DamageRando != DamageRando.default and \
self.damage_rando == DamageRando.default:
self.damage_rando.value = self.DamageRando.value
self.has_replaced_options.value = Toggle.option_true
if self.DamageRandoOverrides != DamageRandoOverrides.default and \
self.damage_rando_overrides == DamageRandoOverrides.default:
self.damage_rando_overrides.value = self.DamageRandoOverrides.value
self.has_replaced_options.value = Toggle.option_true
if self.HpCap != HpCap.default and \
self.hp_cap == HpCap.default:
self.hp_cap.value = self.HpCap.value
self.has_replaced_options.value = Toggle.option_true
if self.LevelCap != LevelCap.default and \
self.level_cap == LevelCap.default:
self.level_cap.value = self.LevelCap.value
self.has_replaced_options.value = Toggle.option_true
if self.ExtraEarringsXP != ExtraEarringsXP.default and \
self.extra_earrings_xp == ExtraEarringsXP.default:
self.extra_earrings_xp.value = self.ExtraEarringsXP.value
self.has_replaced_options.value = Toggle.option_true
if self.BossHealing != BossHealing.default and \
self.boss_healing == BossHealing.default:
self.boss_healing.value = self.BossHealing.value
self.has_replaced_options.value = Toggle.option_true
if self.ShopFill != ShopFill.default and \
self.shop_fill == ShopFill.default:
self.shop_fill.value = self.ShopFill.value
self.has_replaced_options.value = Toggle.option_true
if self.ShopWarpShards != ShopWarpShards.default and \
self.shop_warp_shards == ShopWarpShards.default:
self.shop_warp_shards.value = self.ShopWarpShards.value
self.has_replaced_options.value = Toggle.option_true
if self.ShopMultiplier != ShopMultiplier.default and \
self.shop_multiplier == ShopMultiplier.default:
self.shop_multiplier.value = self.ShopMultiplier.value
self.has_replaced_options.value = Toggle.option_true
if self.LootPool != LootPool.default and \
self.loot_pool == LootPool.default:
self.loot_pool.value = self.LootPool.value
self.has_replaced_options.value = Toggle.option_true
if self.DropRateCategory != DropRateCategory.default and \
self.drop_rate_category == DropRateCategory.default:
self.drop_rate_category.value = self.DropRateCategory.value
self.has_replaced_options.value = Toggle.option_true
if self.FixedDropRate != FixedDropRate.default and \
self.fixed_drop_rate == FixedDropRate.default:
self.fixed_drop_rate.value = self.FixedDropRate.value
self.has_replaced_options.value = Toggle.option_true
if self.LootTierDistro != LootTierDistro.default and \
self.loot_tier_distro == LootTierDistro.default:
self.loot_tier_distro.value = self.LootTierDistro.value
self.has_replaced_options.value = Toggle.option_true
if self.ShowBestiary != ShowBestiary.default and \
self.show_bestiary == ShowBestiary.default:
self.show_bestiary.value = self.ShowBestiary.value
self.has_replaced_options.value = Toggle.option_true
if self.ShowDrops != ShowDrops.default and \
self.show_drops == ShowDrops.default:
self.show_drops.value = self.ShowDrops.value
self.has_replaced_options.value = Toggle.option_true
if self.EnterSandman != EnterSandman.default and \
self.enter_sandman == EnterSandman.default:
self.enter_sandman.value = self.EnterSandman.value
self.has_replaced_options.value = Toggle.option_true
if self.DadPercent != DadPercent.default and \
self.dad_percent == DadPercent.default:
self.dad_percent.value = self.DadPercent.value
self.has_replaced_options.value = Toggle.option_true
if self.RisingTides != RisingTides.default and \
self.rising_tides == RisingTides.default:
self.rising_tides.value = self.RisingTides.value
self.has_replaced_options.value = Toggle.option_true
if self.RisingTidesOverrides != RisingTidesOverrides.default and \
self.rising_tides_overrides == RisingTidesOverrides.default:
self.rising_tides_overrides.value = self.RisingTidesOverrides.value
self.has_replaced_options.value = Toggle.option_true
if self.UnchainedKeys != UnchainedKeys.default and \
self.unchained_keys == UnchainedKeys.default:
self.unchained_keys.value = self.UnchainedKeys.value
self.has_replaced_options.value = Toggle.option_true
if self.PresentAccessWithWheelAndSpindle != PresentAccessWithWheelAndSpindle.default and \
self.back_to_the_future == PresentAccessWithWheelAndSpindle.default:
self.back_to_the_future.value = self.PresentAccessWithWheelAndSpindle.value
self.has_replaced_options.value = Toggle.option_true
if self.TrapChance != TrapChance.default and \
self.trap_chance == TrapChance.default:
self.trap_chance.value = self.TrapChance.value
self.has_replaced_options.value = Toggle.option_true
if self.Traps != Traps.default and \
self.traps == Traps.default:
self.traps.value = self.Traps.value
self.has_replaced_options.value = Toggle.option_true
if self.DeathLink != DeathLink.default and \
self.death_link == DeathLink.default:
self.death_link.value = self.DeathLink.value
self.has_replaced_options.value = Toggle.option_true

View File

@@ -1,6 +1,6 @@
from typing import Tuple, Dict, Union, List from typing import Tuple, Dict, Union, List
from random import Random from BaseClasses import MultiWorld
from .Options import TimespinnerOptions from .Options import timespinner_options, is_option_enabled, get_option_value
class PreCalculatedWeights: class PreCalculatedWeights:
pyramid_keys_unlock: str pyramid_keys_unlock: str
@@ -21,22 +21,22 @@ class PreCalculatedWeights:
flood_lake_serene_bridge: bool flood_lake_serene_bridge: bool
flood_lab: bool flood_lab: bool
def __init__(self, options: TimespinnerOptions, random: Random): def __init__(self, world: MultiWorld, player: int):
if options.rising_tides: if world and is_option_enabled(world, player, "RisingTides"):
weights_overrrides: Dict[str, Union[str, Dict[str, int]]] = self.get_flood_weights_overrides(options) weights_overrrides: Dict[str, Union[str, Dict[str, int]]] = self.get_flood_weights_overrides(world, player)
self.flood_basement, self.flood_basement_high = \ self.flood_basement, self.flood_basement_high = \
self.roll_flood_setting(random, weights_overrrides, "CastleBasement") self.roll_flood_setting(world, player, weights_overrrides, "CastleBasement")
self.flood_xarion, _ = self.roll_flood_setting(random, weights_overrrides, "Xarion") self.flood_xarion, _ = self.roll_flood_setting(world, player, weights_overrrides, "Xarion")
self.flood_maw, _ = self.roll_flood_setting(random, weights_overrrides, "Maw") self.flood_maw, _ = self.roll_flood_setting(world, player, weights_overrrides, "Maw")
self.flood_pyramid_shaft, _ = self.roll_flood_setting(random, weights_overrrides, "AncientPyramidShaft") self.flood_pyramid_shaft, _ = self.roll_flood_setting(world, player, weights_overrrides, "AncientPyramidShaft")
self.flood_pyramid_back, _ = self.roll_flood_setting(random, weights_overrrides, "Sandman") self.flood_pyramid_back, _ = self.roll_flood_setting(world, player, weights_overrrides, "Sandman")
self.flood_moat, _ = self.roll_flood_setting(random, weights_overrrides, "CastleMoat") self.flood_moat, _ = self.roll_flood_setting(world, player, weights_overrrides, "CastleMoat")
self.flood_courtyard, _ = self.roll_flood_setting(random, weights_overrrides, "CastleCourtyard") self.flood_courtyard, _ = self.roll_flood_setting(world, player, weights_overrrides, "CastleCourtyard")
self.flood_lake_desolation, _ = self.roll_flood_setting(random, weights_overrrides, "LakeDesolation") self.flood_lake_desolation, _ = self.roll_flood_setting(world, player, weights_overrrides, "LakeDesolation")
self.flood_lake_serene, _ = self.roll_flood_setting(random, weights_overrrides, "LakeSerene") self.flood_lake_serene, _ = self.roll_flood_setting(world, player, weights_overrrides, "LakeSerene")
self.flood_lake_serene_bridge, _ = self.roll_flood_setting(random, weights_overrrides, "LakeSereneBridge") self.flood_lake_serene_bridge, _ = self.roll_flood_setting(world, player, weights_overrrides, "LakeSereneBridge")
self.flood_lab, _ = self.roll_flood_setting(random, weights_overrrides, "Lab") self.flood_lab, _ = self.roll_flood_setting(world, player, weights_overrrides, "Lab")
else: else:
self.flood_basement = False self.flood_basement = False
self.flood_basement_high = False self.flood_basement_high = False
@@ -52,12 +52,10 @@ class PreCalculatedWeights:
self.flood_lab = False self.flood_lab = False
self.pyramid_keys_unlock, self.present_key_unlock, self.past_key_unlock, self.time_key_unlock = \ self.pyramid_keys_unlock, self.present_key_unlock, self.past_key_unlock, self.time_key_unlock = \
self.get_pyramid_keys_unlocks(options, random, self.flood_maw, self.flood_xarion) self.get_pyramid_keys_unlocks(world, player, self.flood_maw, self.flood_xarion)
@staticmethod @staticmethod
def get_pyramid_keys_unlocks(options: TimespinnerOptions, random: Random, def get_pyramid_keys_unlocks(world: MultiWorld, player: int, is_maw_flooded: bool, is_xarion_flooded: bool) -> Tuple[str, str, str, str]:
is_maw_flooded: bool, is_xarion_flooded: bool) -> Tuple[str, str, str, str]:
present_teleportation_gates: List[str] = [ present_teleportation_gates: List[str] = [
"GateKittyBoss", "GateKittyBoss",
"GateLeftLibrary", "GateLeftLibrary",
@@ -82,30 +80,38 @@ class PreCalculatedWeights:
"GateRightPyramid" "GateRightPyramid"
) )
if not world:
return (
present_teleportation_gates[0],
present_teleportation_gates[0],
past_teleportation_gates[0],
ancient_pyramid_teleportation_gates[0]
)
if not is_maw_flooded: if not is_maw_flooded:
past_teleportation_gates.append("GateMaw") past_teleportation_gates.append("GateMaw")
if not is_xarion_flooded: if not is_xarion_flooded:
present_teleportation_gates.append("GateXarion") present_teleportation_gates.append("GateXarion")
if options.inverted: if is_option_enabled(world, player, "Inverted"):
all_gates: Tuple[str, ...] = present_teleportation_gates all_gates: Tuple[str, ...] = present_teleportation_gates
else: else:
all_gates: Tuple[str, ...] = past_teleportation_gates + present_teleportation_gates all_gates: Tuple[str, ...] = past_teleportation_gates + present_teleportation_gates
return ( return (
random.choice(all_gates), world.random.choice(all_gates),
random.choice(present_teleportation_gates), world.random.choice(present_teleportation_gates),
random.choice(past_teleportation_gates), world.random.choice(past_teleportation_gates),
random.choice(ancient_pyramid_teleportation_gates) world.random.choice(ancient_pyramid_teleportation_gates)
) )
@staticmethod @staticmethod
def get_flood_weights_overrides(options: TimespinnerOptions) -> Dict[str, Union[str, Dict[str, int]]]: def get_flood_weights_overrides(world: MultiWorld, player: int) -> Dict[str, Union[str, Dict[str, int]]]:
weights_overrides_option: Union[int, Dict[str, Union[str, Dict[str, int]]]] = \ weights_overrides_option: Union[int, Dict[str, Union[str, Dict[str, int]]]] = \
options.rising_tides_overrides.value get_option_value(world, player, "RisingTidesOverrides")
default_weights: Dict[str, Dict[str, int]] = options.rising_tides_overrides.default default_weights: Dict[str, Dict[str, int]] = timespinner_options["RisingTidesOverrides"].default
if not weights_overrides_option: if not weights_overrides_option:
weights_overrides_option = default_weights weights_overrides_option = default_weights
@@ -117,13 +123,13 @@ class PreCalculatedWeights:
return weights_overrides_option return weights_overrides_option
@staticmethod @staticmethod
def roll_flood_setting(random: Random, all_weights: Dict[str, Union[Dict[str, int], str]], def roll_flood_setting(world: MultiWorld, player: int,
key: str) -> Tuple[bool, bool]: all_weights: Dict[str, Union[Dict[str, int], str]], key: str) -> Tuple[bool, bool]:
weights: Union[Dict[str, int], str] = all_weights[key] weights: Union[Dict[str, int], str] = all_weights[key]
if isinstance(weights, dict): if isinstance(weights, dict):
result: str = random.choices(list(weights.keys()), weights=list(map(int, weights.values())))[0] result: str = world.random.choices(list(weights.keys()), weights=list(map(int, weights.values())))[0]
else: else:
result: str = weights result: str = weights

View File

@@ -1,16 +1,14 @@
from typing import List, Set, Dict, Optional, Callable from typing import List, Set, Dict, Optional, Callable
from BaseClasses import CollectionState, MultiWorld, Region, Entrance, Location from BaseClasses import CollectionState, MultiWorld, Region, Entrance, Location
from .Options import TimespinnerOptions from .Options import is_option_enabled
from .Locations import LocationData, get_location_datas from .Locations import LocationData, get_location_datas
from .PreCalculatedWeights import PreCalculatedWeights from .PreCalculatedWeights import PreCalculatedWeights
from .LogicExtensions import TimespinnerLogic from .LogicExtensions import TimespinnerLogic
def create_regions_and_locations(world: MultiWorld, player: int, options: TimespinnerOptions, def create_regions_and_locations(world: MultiWorld, player: int, precalculated_weights: PreCalculatedWeights):
precalculated_weights: PreCalculatedWeights):
locations_per_region: Dict[str, List[LocationData]] = split_location_datas_per_region( locations_per_region: Dict[str, List[LocationData]] = split_location_datas_per_region(
get_location_datas(player, options, precalculated_weights)) get_location_datas(world, player, precalculated_weights))
regions = [ regions = [
create_region(world, player, locations_per_region, 'Menu'), create_region(world, player, locations_per_region, 'Menu'),
@@ -55,7 +53,7 @@ def create_regions_and_locations(world: MultiWorld, player: int, options: Timesp
create_region(world, player, locations_per_region, 'Space time continuum') create_region(world, player, locations_per_region, 'Space time continuum')
] ]
if options.gyre_archives: if is_option_enabled(world, player, "GyreArchives"):
regions.extend([ regions.extend([
create_region(world, player, locations_per_region, 'Ravenlord\'s Lair'), create_region(world, player, locations_per_region, 'Ravenlord\'s Lair'),
create_region(world, player, locations_per_region, 'Ifrit\'s Lair'), create_region(world, player, locations_per_region, 'Ifrit\'s Lair'),
@@ -66,10 +64,10 @@ def create_regions_and_locations(world: MultiWorld, player: int, options: Timesp
world.regions += regions world.regions += regions
connectStartingRegion(world, player, options) connectStartingRegion(world, player)
flooded: PreCalculatedWeights = precalculated_weights flooded: PreCalculatedWeights = precalculated_weights
logic = TimespinnerLogic(player, options, precalculated_weights) logic = TimespinnerLogic(world, player, precalculated_weights)
connect(world, player, 'Lake desolation', 'Lower lake desolation', lambda state: flooded.flood_lake_desolation or logic.has_timestop(state) or state.has('Talaria Attachment', player)) connect(world, player, 'Lake desolation', 'Lower lake desolation', lambda state: flooded.flood_lake_desolation or logic.has_timestop(state) or state.has('Talaria Attachment', player))
connect(world, player, 'Lake desolation', 'Upper lake desolation', lambda state: logic.has_fire(state) and state.can_reach('Upper Lake Serene', 'Region', player), "Upper Lake Serene") connect(world, player, 'Lake desolation', 'Upper lake desolation', lambda state: logic.has_fire(state) and state.can_reach('Upper Lake Serene', 'Region', player), "Upper Lake Serene")
@@ -125,7 +123,7 @@ def create_regions_and_locations(world: MultiWorld, player: int, options: Timesp
connect(world, player, 'Sealed Caves (Xarion)', 'Skeleton Shaft') connect(world, player, 'Sealed Caves (Xarion)', 'Skeleton Shaft')
connect(world, player, 'Sealed Caves (Xarion)', 'Space time continuum', logic.has_teleport) connect(world, player, 'Sealed Caves (Xarion)', 'Space time continuum', logic.has_teleport)
connect(world, player, 'Refugee Camp', 'Forest') connect(world, player, 'Refugee Camp', 'Forest')
connect(world, player, 'Refugee Camp', 'Library', lambda state: options.inverted and options.back_to_the_future and state.has_all({'Timespinner Wheel', 'Timespinner Spindle'}, player)) connect(world, player, 'Refugee Camp', 'Library', lambda state: is_option_enabled(world, player, "Inverted") and is_option_enabled(world, player, "PresentAccessWithWheelAndSpindle") and state.has_all({'Timespinner Wheel', 'Timespinner Spindle'}, player))
connect(world, player, 'Refugee Camp', 'Space time continuum', logic.has_teleport) connect(world, player, 'Refugee Camp', 'Space time continuum', logic.has_teleport)
connect(world, player, 'Forest', 'Refugee Camp') connect(world, player, 'Forest', 'Refugee Camp')
connect(world, player, 'Forest', 'Left Side forest Caves', lambda state: flooded.flood_lake_serene_bridge or state.has('Talaria Attachment', player) or logic.has_timestop(state)) connect(world, player, 'Forest', 'Left Side forest Caves', lambda state: flooded.flood_lake_serene_bridge or state.has('Talaria Attachment', player) or logic.has_timestop(state))
@@ -180,11 +178,11 @@ def create_regions_and_locations(world: MultiWorld, player: int, options: Timesp
connect(world, player, 'Space time continuum', 'Royal towers (lower)', lambda state: logic.can_teleport_to(state, "Past", "GateRoyalTowers")) connect(world, player, 'Space time continuum', 'Royal towers (lower)', lambda state: logic.can_teleport_to(state, "Past", "GateRoyalTowers"))
connect(world, player, 'Space time continuum', 'Caves of Banishment (Maw)', lambda state: logic.can_teleport_to(state, "Past", "GateMaw")) connect(world, player, 'Space time continuum', 'Caves of Banishment (Maw)', lambda state: logic.can_teleport_to(state, "Past", "GateMaw"))
connect(world, player, 'Space time continuum', 'Caves of Banishment (upper)', lambda state: logic.can_teleport_to(state, "Past", "GateCavesOfBanishment")) connect(world, player, 'Space time continuum', 'Caves of Banishment (upper)', lambda state: logic.can_teleport_to(state, "Past", "GateCavesOfBanishment"))
connect(world, player, 'Space time continuum', 'Ancient Pyramid (entrance)', lambda state: logic.can_teleport_to(state, "Time", "GateGyre") or (not options.unchained_keys and options.enter_sandman)) connect(world, player, 'Space time continuum', 'Ancient Pyramid (entrance)', lambda state: logic.can_teleport_to(state, "Time", "GateGyre") or (not is_option_enabled(world, player, "UnchainedKeys") and is_option_enabled(world, player, "EnterSandman")))
connect(world, player, 'Space time continuum', 'Ancient Pyramid (left)', lambda state: logic.can_teleport_to(state, "Time", "GateLeftPyramid")) connect(world, player, 'Space time continuum', 'Ancient Pyramid (left)', lambda state: logic.can_teleport_to(state, "Time", "GateLeftPyramid"))
connect(world, player, 'Space time continuum', 'Ancient Pyramid (right)', lambda state: logic.can_teleport_to(state, "Time", "GateRightPyramid")) connect(world, player, 'Space time continuum', 'Ancient Pyramid (right)', lambda state: logic.can_teleport_to(state, "Time", "GateRightPyramid"))
if options.gyre_archives: if is_option_enabled(world, player, "GyreArchives"):
connect(world, player, 'The lab (upper)', 'Ravenlord\'s Lair', lambda state: state.has('Merchant Crow', player)) connect(world, player, 'The lab (upper)', 'Ravenlord\'s Lair', lambda state: state.has('Merchant Crow', player))
connect(world, player, 'Ravenlord\'s Lair', 'The lab (upper)') connect(world, player, 'Ravenlord\'s Lair', 'The lab (upper)')
connect(world, player, 'Library top', 'Ifrit\'s Lair', lambda state: state.has('Kobo', player) and state.can_reach('Refugee Camp', 'Region', player), "Refugee Camp") connect(world, player, 'Library top', 'Ifrit\'s Lair', lambda state: state.has('Kobo', player) and state.can_reach('Refugee Camp', 'Region', player), "Refugee Camp")
@@ -222,12 +220,12 @@ def create_region(world: MultiWorld, player: int, locations_per_region: Dict[str
return region return region
def connectStartingRegion(world: MultiWorld, player: int, options: TimespinnerOptions): def connectStartingRegion(world: MultiWorld, player: int):
menu = world.get_region('Menu', player) menu = world.get_region('Menu', player)
tutorial = world.get_region('Tutorial', player) tutorial = world.get_region('Tutorial', player)
space_time_continuum = world.get_region('Space time continuum', player) space_time_continuum = world.get_region('Space time continuum', player)
if options.inverted: if is_option_enabled(world, player, "Inverted"):
starting_region = world.get_region('Refugee Camp', player) starting_region = world.get_region('Refugee Camp', player)
else: else:
starting_region = world.get_region('Lake desolation', player) starting_region = world.get_region('Lake desolation', player)

View File

@@ -1,13 +1,12 @@
from typing import Dict, List, Set, Tuple, TextIO from typing import Dict, List, Set, Tuple, TextIO, Union
from BaseClasses import Item, Tutorial, ItemClassification from BaseClasses import Item, MultiWorld, Tutorial, ItemClassification
from .Items import get_item_names_per_category from .Items import get_item_names_per_category
from .Items import item_table, starter_melee_weapons, starter_spells, filler_items, starter_progression_items from .Items import item_table, starter_melee_weapons, starter_spells, filler_items, starter_progression_items
from .Locations import get_location_datas, EventId from .Locations import get_location_datas, EventId
from .Options import BackwardsCompatiableTimespinnerOptions, Toggle from .Options import is_option_enabled, get_option_value, timespinner_options
from .PreCalculatedWeights import PreCalculatedWeights from .PreCalculatedWeights import PreCalculatedWeights
from .Regions import create_regions_and_locations from .Regions import create_regions_and_locations
from worlds.AutoWorld import World, WebWorld from worlds.AutoWorld import World, WebWorld
import logging
class TimespinnerWebWorld(WebWorld): class TimespinnerWebWorld(WebWorld):
theme = "ice" theme = "ice"
@@ -36,34 +35,32 @@ class TimespinnerWorld(World):
Timespinner is a beautiful metroidvania inspired by classic 90s action-platformers. Timespinner is a beautiful metroidvania inspired by classic 90s action-platformers.
Travel back in time to change fate itself. Join timekeeper Lunais on her quest for revenge against the empire that killed her family. Travel back in time to change fate itself. Join timekeeper Lunais on her quest for revenge against the empire that killed her family.
""" """
options_dataclass = BackwardsCompatiableTimespinnerOptions
options: BackwardsCompatiableTimespinnerOptions option_definitions = timespinner_options
game = "Timespinner" game = "Timespinner"
topology_present = True topology_present = True
web = TimespinnerWebWorld() web = TimespinnerWebWorld()
required_client_version = (0, 4, 2) required_client_version = (0, 4, 2)
item_name_to_id = {name: data.code for name, data in item_table.items()} item_name_to_id = {name: data.code for name, data in item_table.items()}
location_name_to_id = {location.name: location.code for location in get_location_datas(-1, None, None)} location_name_to_id = {location.name: location.code for location in get_location_datas(None, None, None)}
item_name_groups = get_item_names_per_category() item_name_groups = get_item_names_per_category()
precalculated_weights: PreCalculatedWeights precalculated_weights: PreCalculatedWeights
def generate_early(self) -> None: def generate_early(self) -> None:
self.options.handle_backward_compatibility() self.precalculated_weights = PreCalculatedWeights(self.multiworld, self.player)
self.precalculated_weights = PreCalculatedWeights(self.options, self.random)
# in generate_early the start_inventory isnt copied over to precollected_items yet, so we can still modify the options directly # in generate_early the start_inventory isnt copied over to precollected_items yet, so we can still modify the options directly
if self.options.start_inventory.value.pop('Meyef', 0) > 0: if self.multiworld.start_inventory[self.player].value.pop('Meyef', 0) > 0:
self.options.start_with_meyef.value = Toggle.option_true self.multiworld.StartWithMeyef[self.player].value = self.multiworld.StartWithMeyef[self.player].option_true
if self.options.start_inventory.value.pop('Talaria Attachment', 0) > 0: if self.multiworld.start_inventory[self.player].value.pop('Talaria Attachment', 0) > 0:
self.options.quick_seed.value = Toggle.option_true self.multiworld.QuickSeed[self.player].value = self.multiworld.QuickSeed[self.player].option_true
if self.options.start_inventory.value.pop('Jewelry Box', 0) > 0: if self.multiworld.start_inventory[self.player].value.pop('Jewelry Box', 0) > 0:
self.options.start_with_jewelry_box.value = Toggle.option_true self.multiworld.StartWithJewelryBox[self.player].value = self.multiworld.StartWithJewelryBox[self.player].option_true
def create_regions(self) -> None: def create_regions(self) -> None:
create_regions_and_locations(self.multiworld, self.player, self.options, self.precalculated_weights) create_regions_and_locations(self.multiworld, self.player, self.precalculated_weights)
def create_items(self) -> None: def create_items(self) -> None:
self.create_and_assign_event_items() self.create_and_assign_event_items()
@@ -77,7 +74,7 @@ class TimespinnerWorld(World):
def set_rules(self) -> None: def set_rules(self) -> None:
final_boss: str final_boss: str
if self.options.dad_percent: if self.is_option_enabled("DadPercent"):
final_boss = "Killed Emperor" final_boss = "Killed Emperor"
else: else:
final_boss = "Killed Nightmare" final_boss = "Killed Nightmare"
@@ -85,74 +82,48 @@ class TimespinnerWorld(World):
self.multiworld.completion_condition[self.player] = lambda state: state.has(final_boss, self.player) self.multiworld.completion_condition[self.player] = lambda state: state.has(final_boss, self.player)
def fill_slot_data(self) -> Dict[str, object]: def fill_slot_data(self) -> Dict[str, object]:
return { slot_data: Dict[str, object] = {}
# options
"StartWithJewelryBox": self.options.start_with_jewelry_box.value, ap_specific_settings: Set[str] = {"RisingTidesOverrides", "TrapChance"}
"DownloadableItems": self.options.downloadable_items.value,
"EyeSpy": self.options.eye_spy.value, for option_name in timespinner_options:
"StartWithMeyef": self.options.start_with_meyef.value, if (option_name not in ap_specific_settings):
"QuickSeed": self.options.quick_seed.value, slot_data[option_name] = self.get_option_value(option_name)
"SpecificKeycards": self.options.specific_keycards.value,
"Inverted": self.options.inverted.value, slot_data["StinkyMaw"] = True
"GyreArchives": self.options.gyre_archives.value, slot_data["ProgressiveVerticalMovement"] = False
"Cantoran": self.options.cantoran.value, slot_data["ProgressiveKeycards"] = False
"LoreChecks": self.options.lore_checks.value, slot_data["PersonalItems"] = self.get_personal_items()
"BossRando": self.options.boss_rando.value, slot_data["PyramidKeysGate"] = self.precalculated_weights.pyramid_keys_unlock
"DamageRando": self.options.damage_rando.value, slot_data["PresentGate"] = self.precalculated_weights.present_key_unlock
"DamageRandoOverrides": self.options.damage_rando_overrides.value, slot_data["PastGate"] = self.precalculated_weights.past_key_unlock
"HpCap": self.options.hp_cap.value, slot_data["TimeGate"] = self.precalculated_weights.time_key_unlock
"LevelCap": self.options.level_cap.value, slot_data["Basement"] = int(self.precalculated_weights.flood_basement) + \
"ExtraEarringsXP": self.options.extra_earrings_xp.value, int(self.precalculated_weights.flood_basement_high)
"BossHealing": self.options.boss_healing.value, slot_data["Xarion"] = self.precalculated_weights.flood_xarion
"ShopFill": self.options.shop_fill.value, slot_data["Maw"] = self.precalculated_weights.flood_maw
"ShopWarpShards": self.options.shop_warp_shards.value, slot_data["PyramidShaft"] = self.precalculated_weights.flood_pyramid_shaft
"ShopMultiplier": self.options.shop_multiplier.value, slot_data["BackPyramid"] = self.precalculated_weights.flood_pyramid_back
"LootPool": self.options.loot_pool.value, slot_data["CastleMoat"] = self.precalculated_weights.flood_moat
"DropRateCategory": self.options.drop_rate_category.value, slot_data["CastleCourtyard"] = self.precalculated_weights.flood_courtyard
"FixedDropRate": self.options.fixed_drop_rate.value, slot_data["LakeDesolation"] = self.precalculated_weights.flood_lake_desolation
"LootTierDistro": self.options.loot_tier_distro.value, slot_data["DryLakeSerene"] = not self.precalculated_weights.flood_lake_serene
"ShowBestiary": self.options.show_bestiary.value, slot_data["LakeSereneBridge"] = self.precalculated_weights.flood_lake_serene_bridge
"ShowDrops": self.options.show_drops.value, slot_data["Lab"] = self.precalculated_weights.flood_lab
"EnterSandman": self.options.enter_sandman.value,
"DadPercent": self.options.dad_percent.value, return slot_data
"RisingTides": self.options.rising_tides.value,
"UnchainedKeys": self.options.unchained_keys.value,
"PresentAccessWithWheelAndSpindle": self.options.back_to_the_future.value,
"Traps": self.options.traps.value,
"DeathLink": self.options.death_link.value,
"StinkyMaw": True,
# data
"PersonalItems": self.get_personal_items(),
"PyramidKeysGate": self.precalculated_weights.pyramid_keys_unlock,
"PresentGate": self.precalculated_weights.present_key_unlock,
"PastGate": self.precalculated_weights.past_key_unlock,
"TimeGate": self.precalculated_weights.time_key_unlock,
# rising tides
"Basement": int(self.precalculated_weights.flood_basement) + \
int(self.precalculated_weights.flood_basement_high),
"Xarion": self.precalculated_weights.flood_xarion,
"Maw": self.precalculated_weights.flood_maw,
"PyramidShaft": self.precalculated_weights.flood_pyramid_shaft,
"BackPyramid": self.precalculated_weights.flood_pyramid_back,
"CastleMoat": self.precalculated_weights.flood_moat,
"CastleCourtyard": self.precalculated_weights.flood_courtyard,
"LakeDesolation": self.precalculated_weights.flood_lake_desolation,
"DryLakeSerene": not self.precalculated_weights.flood_lake_serene,
"LakeSereneBridge": self.precalculated_weights.flood_lake_serene_bridge,
"Lab": self.precalculated_weights.flood_lab
}
def write_spoiler_header(self, spoiler_handle: TextIO) -> None: def write_spoiler_header(self, spoiler_handle: TextIO) -> None:
if self.options.unchained_keys: if self.is_option_enabled("UnchainedKeys"):
spoiler_handle.write(f'Modern Warp Beacon unlock: {self.precalculated_weights.present_key_unlock}\n') spoiler_handle.write(f'Modern Warp Beacon unlock: {self.precalculated_weights.present_key_unlock}\n')
spoiler_handle.write(f'Timeworn Warp Beacon unlock: {self.precalculated_weights.past_key_unlock}\n') spoiler_handle.write(f'Timeworn Warp Beacon unlock: {self.precalculated_weights.past_key_unlock}\n')
if self.options.enter_sandman: if self.is_option_enabled("EnterSandman"):
spoiler_handle.write(f'Mysterious Warp Beacon unlock: {self.precalculated_weights.time_key_unlock}\n') spoiler_handle.write(f'Mysterious Warp Beacon unlock: {self.precalculated_weights.time_key_unlock}\n')
else: else:
spoiler_handle.write(f'Twin Pyramid Keys unlock: {self.precalculated_weights.pyramid_keys_unlock}\n') spoiler_handle.write(f'Twin Pyramid Keys unlock: {self.precalculated_weights.pyramid_keys_unlock}\n')
if self.options.rising_tides: if self.is_option_enabled("RisingTides"):
flooded_areas: List[str] = [] flooded_areas: List[str] = []
if self.precalculated_weights.flood_basement: if self.precalculated_weights.flood_basement:
@@ -188,15 +159,6 @@ class TimespinnerWorld(World):
spoiler_handle.write(f'Flooded Areas: {flooded_areas_string}\n') spoiler_handle.write(f'Flooded Areas: {flooded_areas_string}\n')
if self.options.has_replaced_options:
warning = \
f"NOTICE: Timespinner options for player '{self.player_name}' where renamed from PasCalCase to snake_case, " \
"please update your yaml"
spoiler_handle.write("\n")
spoiler_handle.write(warning)
logging.warning(warning)
def create_item(self, name: str) -> Item: def create_item(self, name: str) -> Item:
data = item_table[name] data = item_table[name]
@@ -214,41 +176,41 @@ class TimespinnerWorld(World):
if not item.advancement: if not item.advancement:
return item return item
if (name == 'Tablet' or name == 'Library Keycard V') and not self.options.downloadable_items: if (name == 'Tablet' or name == 'Library Keycard V') and not self.is_option_enabled("DownloadableItems"):
item.classification = ItemClassification.filler item.classification = ItemClassification.filler
elif name == 'Oculus Ring' and not self.options.eye_spy: elif name == 'Oculus Ring' and not self.is_option_enabled("EyeSpy"):
item.classification = ItemClassification.filler item.classification = ItemClassification.filler
elif (name == 'Kobo' or name == 'Merchant Crow') and not self.options.gyre_archives: elif (name == 'Kobo' or name == 'Merchant Crow') and not self.is_option_enabled("GyreArchives"):
item.classification = ItemClassification.filler item.classification = ItemClassification.filler
elif name in {"Timeworn Warp Beacon", "Modern Warp Beacon", "Mysterious Warp Beacon"} \ elif name in {"Timeworn Warp Beacon", "Modern Warp Beacon", "Mysterious Warp Beacon"} \
and not self.options.unchained_keys: and not self.is_option_enabled("UnchainedKeys"):
item.classification = ItemClassification.filler item.classification = ItemClassification.filler
return item return item
def get_filler_item_name(self) -> str: def get_filler_item_name(self) -> str:
trap_chance: int = self.options.trap_chance.value trap_chance: int = self.get_option_value("TrapChance")
enabled_traps: List[str] = self.options.traps.value enabled_traps: List[str] = self.get_option_value("Traps")
if self.random.random() < (trap_chance / 100) and enabled_traps: if self.multiworld.random.random() < (trap_chance / 100) and enabled_traps:
return self.random.choice(enabled_traps) return self.multiworld.random.choice(enabled_traps)
else: else:
return self.random.choice(filler_items) return self.multiworld.random.choice(filler_items)
def get_excluded_items(self) -> Set[str]: def get_excluded_items(self) -> Set[str]:
excluded_items: Set[str] = set() excluded_items: Set[str] = set()
if self.options.start_with_jewelry_box: if self.is_option_enabled("StartWithJewelryBox"):
excluded_items.add('Jewelry Box') excluded_items.add('Jewelry Box')
if self.options.start_with_meyef: if self.is_option_enabled("StartWithMeyef"):
excluded_items.add('Meyef') excluded_items.add('Meyef')
if self.options.quick_seed: if self.is_option_enabled("QuickSeed"):
excluded_items.add('Talaria Attachment') excluded_items.add('Talaria Attachment')
if self.options.unchained_keys: if self.is_option_enabled("UnchainedKeys"):
excluded_items.add('Twin Pyramid Key') excluded_items.add('Twin Pyramid Key')
if not self.options.enter_sandman: if not self.is_option_enabled("EnterSandman"):
excluded_items.add('Mysterious Warp Beacon') excluded_items.add('Mysterious Warp Beacon')
else: else:
excluded_items.add('Timeworn Warp Beacon') excluded_items.add('Timeworn Warp Beacon')
@@ -262,8 +224,8 @@ class TimespinnerWorld(World):
return excluded_items return excluded_items
def assign_starter_items(self, excluded_items: Set[str]) -> None: def assign_starter_items(self, excluded_items: Set[str]) -> None:
non_local_items: Set[str] = self.options.non_local_items.value non_local_items: Set[str] = self.multiworld.non_local_items[self.player].value
local_items: Set[str] = self.options.local_items.value local_items: Set[str] = self.multiworld.local_items[self.player].value
local_starter_melee_weapons = tuple(item for item in starter_melee_weapons if local_starter_melee_weapons = tuple(item for item in starter_melee_weapons if
item in local_items or not item in non_local_items) item in local_items or not item in non_local_items)
@@ -285,26 +247,27 @@ class TimespinnerWorld(World):
self.assign_starter_item(excluded_items, 'Tutorial: Yo Momma 2', local_starter_spells) self.assign_starter_item(excluded_items, 'Tutorial: Yo Momma 2', local_starter_spells)
def assign_starter_item(self, excluded_items: Set[str], location: str, item_list: Tuple[str, ...]) -> None: def assign_starter_item(self, excluded_items: Set[str], location: str, item_list: Tuple[str, ...]) -> None:
item_name = self.random.choice(item_list) item_name = self.multiworld.random.choice(item_list)
self.place_locked_item(excluded_items, location, item_name) self.place_locked_item(excluded_items, location, item_name)
def place_first_progression_item(self, excluded_items: Set[str]) -> None: def place_first_progression_item(self, excluded_items: Set[str]) -> None:
if self.options.quick_seed or self.options.inverted or self.precalculated_weights.flood_lake_desolation: if self.is_option_enabled("QuickSeed") or self.is_option_enabled("Inverted") \
or self.precalculated_weights.flood_lake_desolation:
return return
for item_name in self.options.start_inventory.value.keys(): for item in self.multiworld.precollected_items[self.player]:
if item_name in starter_progression_items: if item.name in starter_progression_items and not item.name in excluded_items:
return return
local_starter_progression_items = tuple( local_starter_progression_items = tuple(
item for item in starter_progression_items item for item in starter_progression_items
if item not in excluded_items and item not in self.options.non_local_items.value) if item not in excluded_items and item not in self.multiworld.non_local_items[self.player].value)
if not local_starter_progression_items: if not local_starter_progression_items:
return return
progression_item = self.random.choice(local_starter_progression_items) progression_item = self.multiworld.random.choice(local_starter_progression_items)
self.multiworld.local_early_items[self.player][progression_item] = 1 self.multiworld.local_early_items[self.player][progression_item] = 1
@@ -344,3 +307,9 @@ class TimespinnerWorld(World):
personal_items[location.address] = location.item.code personal_items[location.address] = location.item.code
return personal_items return personal_items
def is_option_enabled(self, option: str) -> bool:
return is_option_enabled(self.multiworld, self.player, option)
def get_option_value(self, option: str) -> Union[int, Dict, List]:
return get_option_value(self.multiworld, self.player, option)

View File

@@ -121,7 +121,7 @@ class TunicWorld(World):
cls.seed_groups[group] = SeedGroup(logic_rules=tunic.options.logic_rules.value, cls.seed_groups[group] = SeedGroup(logic_rules=tunic.options.logic_rules.value,
laurels_at_10_fairies=tunic.options.laurels_location == 3, laurels_at_10_fairies=tunic.options.laurels_location == 3,
fixed_shop=bool(tunic.options.fixed_shop), fixed_shop=bool(tunic.options.fixed_shop),
plando=tunic.options.plando_connections) plando=multiworld.plando_connections[tunic.player])
continue continue
# lower value is more restrictive # lower value is more restrictive
@@ -134,9 +134,9 @@ class TunicWorld(World):
if tunic.options.fixed_shop: if tunic.options.fixed_shop:
cls.seed_groups[group]["fixed_shop"] = True cls.seed_groups[group]["fixed_shop"] = True
if tunic.options.plando_connections: if multiworld.plando_connections[tunic.player]:
# loop through the connections in the player's yaml # loop through the connections in the player's yaml
for cxn in tunic.options.plando_connections: for cxn in multiworld.plando_connections[tunic.player]:
new_cxn = True new_cxn = True
for group_cxn in cls.seed_groups[group]["plando"]: for group_cxn in cls.seed_groups[group]["plando"]:
# if neither entrance nor exit match anything in the group, add to group # if neither entrance nor exit match anything in the group, add to group