Compare commits

..

14 Commits

Author SHA1 Message Date
NewSoupVi
2522350ea5 Update docs/world maintainer.md
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
2024-09-05 18:11:27 +02:00
NewSoupVi
773ed6ba99 Rewrite by BadMagic 2024-09-05 12:56:04 +02:00
NewSoupVi
6ea7c8654a Update world maintainer.md 2024-09-05 12:39:37 +02:00
NewSoupVi
351917b9fe Update world maintainer.md 2024-09-05 12:39:21 +02:00
NewSoupVi
505c514253 Update world maintainer.md 2024-09-05 12:37:12 +02:00
NewSoupVi
f8b59ffdad Update world maintainer.md 2024-09-05 12:34:12 +02:00
NewSoupVi
d89166a16f Update world maintainer.md 2024-09-05 12:33:46 +02:00
NewSoupVi
ec11530b08 Update world maintainer.md 2024-09-05 11:59:55 +02:00
NewSoupVi
cb469fb1bd Update world maintainer.md 2024-09-05 11:51:24 +02:00
NewSoupVi
b881a63727 Update world maintainer.md 2024-09-05 11:51:04 +02:00
NewSoupVi
5563e97fa6 Update world maintainer.md 2024-09-05 11:50:02 +02:00
NewSoupVi
3f031af119 Update world maintainer.md 2024-09-05 11:49:34 +02:00
NewSoupVi
6c401aa5a1 Update world maintainer.md 2024-09-05 11:47:02 +02:00
NewSoupVi
f6456b6e1f Docs: Specify process for adding a world maintainer to an existing world 2024-09-05 11:45:41 +02:00
70 changed files with 3329 additions and 4224 deletions

View File

@@ -335,13 +335,6 @@ class MultiWorld():
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)
# Make sure this item is picked up even if it is not progression
# (Monkeypatching a property is kind of hard, this is one of the only ways)
class AdvancementTrue(new_item.__class__):
advancement = True
new_item.__class__ = AdvancementTrue
# mangle together all original classification bits
new_item.classification |= classifications[item_name]
new_itempool.append(new_item)
@@ -699,25 +692,17 @@ class CollectionState():
def update_reachable_regions(self, player: int):
self.stale[player] = False
world: AutoWorld.World = self.multiworld.worlds[player]
reachable_regions = self.reachable_regions[player]
blocked_connections = self.blocked_connections[player]
queue = deque(self.blocked_connections[player])
start: Region = world.get_region(world.origin_region_name)
start = self.multiworld.get_region("Menu", player)
# init on first call - this can't be done on construction since the regions don't exist yet
if start not in reachable_regions:
reachable_regions.add(start)
self.blocked_connections[player].update(start.exits)
blocked_connections.update(start.exits)
queue.extend(start.exits)
if world.explicit_indirect_conditions:
self._update_reachable_regions_explicit_indirect_conditions(player, queue)
else:
self._update_reachable_regions_auto_indirect_conditions(player, queue)
def _update_reachable_regions_explicit_indirect_conditions(self, player: int, queue: deque):
reachable_regions = self.reachable_regions[player]
blocked_connections = self.blocked_connections[player]
# run BFS on all connections, and keep track of those blocked by missing items
while queue:
connection = queue.popleft()
@@ -737,29 +722,6 @@ class CollectionState():
if new_entrance in blocked_connections and new_entrance not in queue:
queue.append(new_entrance)
def _update_reachable_regions_auto_indirect_conditions(self, player: int, queue: deque):
reachable_regions = self.reachable_regions[player]
blocked_connections = self.blocked_connections[player]
new_connection: bool = True
# run BFS on all connections, and keep track of those blocked by missing items
while new_connection:
new_connection = False
while queue:
connection = queue.popleft()
new_region = connection.connected_region
if new_region in reachable_regions:
blocked_connections.remove(connection)
elif connection.can_reach(self):
assert new_region, f"tried to search through an Entrance \"{connection}\" with no Region"
reachable_regions.add(new_region)
blocked_connections.remove(connection)
blocked_connections.update(new_region.exits)
queue.extend(new_region.exits)
self.path[new_region] = (new_region.name, self.path.get(connection, None))
new_connection = True
# sweep for indirect connections, mostly Entrance.can_reach(unrelated_Region)
queue.extend(blocked_connections)
def copy(self) -> CollectionState:
ret = CollectionState(self.multiworld)
ret.prog_items = {player: counter.copy() for player, counter in self.prog_items.items()}
@@ -1214,7 +1176,7 @@ class ItemClassification(IntFlag):
filler = 0b0000 # aka trash, as in filler items like ammo, currency etc,
progression = 0b0001 # Item that is logically relevant
useful = 0b0010 # Item that is generally quite useful, but not required for anything logical
trap = 0b0100 # detrimental item
trap = 0b0100 # detrimental or entirely useless (nothing) item
skip_balancing = 0b1000 # should technically never occur on its own
# Item that is logically relevant, but progression balancing should not touch.
# Typically currency or other counted items.

View File

@@ -662,19 +662,17 @@ class CommonContext:
logger.exception(msg, exc_info=exc_info, extra={'compact_gui': True})
self._messagebox_connection_loss = self.gui_error(msg, exc_info[1])
def make_gui(self) -> typing.Type["kvui.GameManager"]:
"""To return the Kivy App class needed for run_gui so it can be overridden before being built"""
def run_gui(self):
"""Import kivy UI system and start running it as self.ui_task."""
from kvui import GameManager
class TextManager(GameManager):
logging_pairs = [
("Client", "Archipelago")
]
base_title = "Archipelago Text Client"
return TextManager
def run_gui(self):
"""Import kivy UI system from make_gui() and start running it as self.ui_task."""
ui_class = self.make_gui()
self.ui = ui_class(self)
self.ui = TextManager(self)
self.ui_task = asyncio.create_task(self.ui.async_run(), name="UI")
def run_cli(self):
@@ -996,7 +994,7 @@ def get_base_parser(description: typing.Optional[str] = None):
return parser
def run_as_textclient(*args):
def run_as_textclient():
class TextContext(CommonContext):
# Text Mode to use !hint and such with games that have no text entry
tags = CommonContext.tags | {"TextOnly"}
@@ -1035,18 +1033,15 @@ def run_as_textclient(*args):
parser = get_base_parser(description="Gameless Archipelago Client, for text interfacing.")
parser.add_argument('--name', default=None, help="Slot Name to connect as.")
parser.add_argument("url", nargs="?", help="Archipelago connection url")
args = parser.parse_args(args)
args = parser.parse_args()
if args.url:
url = urllib.parse.urlparse(args.url)
if url.scheme == "archipelago":
args.connect = url.netloc
if url.username:
args.name = urllib.parse.unquote(url.username)
if url.password:
args.password = urllib.parse.unquote(url.password)
else:
parser.error(f"bad url, found {args.url}, expected url in form of archipelago://archipelago.gg:38281")
args.connect = url.netloc
if url.username:
args.name = urllib.parse.unquote(url.username)
if url.password:
args.password = urllib.parse.unquote(url.password)
colorama.init()
@@ -1056,4 +1051,4 @@ def run_as_textclient(*args):
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO) # force log-level to work around log level resetting to WARNING
run_as_textclient(*sys.argv[1:]) # default value for parse_args
run_as_textclient()

View File

@@ -155,7 +155,6 @@ def main(args=None) -> Tuple[argparse.Namespace, int]:
erargs.outputpath = args.outputpath
erargs.skip_prog_balancing = args.skip_prog_balancing
erargs.skip_output = args.skip_output
erargs.name = {}
settings_cache: Dict[str, Tuple[argparse.Namespace, ...]] = \
{fname: (tuple(roll_settings(yaml, args.plando) for yaml in yamls) if args.sameoptions else None)
@@ -203,7 +202,7 @@ def main(args=None) -> Tuple[argparse.Namespace, int]:
if path == args.weights_file_path: # if name came from the weights file, just use base player name
erargs.name[player] = f"Player{player}"
elif player not in erargs.name: # if name was not specified, generate it from filename
elif not erargs.name[player]: # if name was not specified, generate it from filename
erargs.name[player] = os.path.splitext(os.path.split(path)[-1])[0]
erargs.name[player] = handle_name(erargs.name[player], player, name_counter)

View File

@@ -16,11 +16,10 @@ import multiprocessing
import shlex
import subprocess
import sys
import urllib.parse
import webbrowser
from os.path import isfile
from shutil import which
from typing import Callable, Optional, Sequence, Tuple, Union
from typing import Callable, Sequence, Union, Optional
import Utils
import settings
@@ -108,81 +107,7 @@ components.extend([
])
def handle_uri(path: str, launch_args: Tuple[str, ...]) -> None:
url = urllib.parse.urlparse(path)
queries = urllib.parse.parse_qs(url.query)
launch_args = (path, *launch_args)
client_component = None
text_client_component = None
if "game" in queries:
game = queries["game"][0]
else: # TODO around 0.6.0 - this is for pre this change webhost uri's
game = "Archipelago"
for component in components:
if component.supports_uri and component.game_name == game:
client_component = component
elif component.display_name == "Text Client":
text_client_component = component
from kvui import App, Button, BoxLayout, Label, Clock, Window
class Popup(App):
timer_label: Label
remaining_time: Optional[int]
def __init__(self):
self.title = "Connect to Multiworld"
self.icon = r"data/icon.png"
super().__init__()
def build(self):
layout = BoxLayout(orientation="vertical")
if client_component is None:
self.remaining_time = 7
label_text = (f"A game client able to parse URIs was not detected for {game}.\n"
f"Launching Text Client in 7 seconds...")
self.timer_label = Label(text=label_text)
layout.add_widget(self.timer_label)
Clock.schedule_interval(self.update_label, 1)
else:
layout.add_widget(Label(text="Select client to open and connect with."))
button_row = BoxLayout(orientation="horizontal", size_hint=(1, 0.4))
text_client_button = Button(
text=text_client_component.display_name,
on_release=lambda *args: run_component(text_client_component, *launch_args)
)
button_row.add_widget(text_client_button)
game_client_button = Button(
text=client_component.display_name,
on_release=lambda *args: run_component(client_component, *launch_args)
)
button_row.add_widget(game_client_button)
layout.add_widget(button_row)
return layout
def update_label(self, dt):
if self.remaining_time > 1:
# countdown the timer and string replace the number
self.remaining_time -= 1
self.timer_label.text = self.timer_label.text.replace(
str(self.remaining_time + 1), str(self.remaining_time)
)
else:
# our timer is finished so launch text client and close down
run_component(text_client_component, *launch_args)
Clock.unschedule(self.update_label)
App.get_running_app().stop()
Window.close()
Popup().run()
def identify(path: Union[None, str]) -> Tuple[Union[None, str], Union[None, Component]]:
def identify(path: Union[None, str]):
if path is None:
return None, None
for component in components:
@@ -374,24 +299,20 @@ def main(args: Optional[Union[argparse.Namespace, dict]] = None):
elif not args:
args = {}
path = args.get("Patch|Game|Component|url", None)
if path is not None:
if path.startswith("archipelago://"):
handle_uri(path, args.get("args", ()))
return
file, component = identify(path)
if args.get("Patch|Game|Component", None) is not None:
file, component = identify(args["Patch|Game|Component"])
if file:
args['file'] = file
if component:
args['component'] = component
if not component:
logging.warning(f"Could not identify Component responsible for {path}")
logging.warning(f"Could not identify Component responsible for {args['Patch|Game|Component']}")
if args["update_settings"]:
update_settings()
if "file" in args:
if 'file' in args:
run_component(args["component"], args["file"], *args["args"])
elif "component" in args:
elif 'component' in args:
run_component(args["component"], *args["args"])
elif not args["update_settings"]:
run_gui()
@@ -401,16 +322,12 @@ if __name__ == '__main__':
init_logging('Launcher')
Utils.freeze_support()
multiprocessing.set_start_method("spawn") # if launched process uses kivy, fork won't work
parser = argparse.ArgumentParser(
description='Archipelago Launcher',
usage="[-h] [--update_settings] [Patch|Game|Component] [-- component args here]"
)
parser = argparse.ArgumentParser(description='Archipelago Launcher')
run_group = parser.add_argument_group("Run")
run_group.add_argument("--update_settings", action="store_true",
help="Update host.yaml and exit.")
run_group.add_argument("Patch|Game|Component|url", type=str, nargs="?",
help="Pass either a patch file, a generated game, the component name to run, or a url to "
"connect with.")
run_group.add_argument("Patch|Game|Component", type=str, nargs="?",
help="Pass either a patch file, a generated game or the name of a component to run.")
run_group.add_argument("args", nargs="*",
help="Arguments to pass to component.")
main(parser.parse_args())

View File

@@ -973,19 +973,7 @@ class PlandoTexts(Option[typing.List[PlandoText]], VerifyKeys):
if random.random() < float(text.get("percentage", 100)/100):
at = text.get("at", None)
if at is not None:
if isinstance(at, dict):
if at:
at = random.choices(list(at.keys()),
weights=list(at.values()), k=1)[0]
else:
raise OptionError("\"at\" must be a valid string or weighted list of strings!")
given_text = text.get("text", [])
if isinstance(given_text, dict):
if not given_text:
given_text = []
else:
given_text = random.choices(list(given_text.keys()),
weights=list(given_text.values()), k=1)
if isinstance(given_text, str):
given_text = [given_text]
texts.append(PlandoText(
@@ -993,8 +981,6 @@ class PlandoTexts(Option[typing.List[PlandoText]], VerifyKeys):
given_text,
text.get("percentage", 100)
))
else:
raise OptionError("\"at\" must be a valid string or weighted list of strings!")
elif isinstance(text, PlandoText):
if random.random() < float(text.percentage/100):
texts.append(text)

View File

@@ -77,4 +77,4 @@ There, you will find examples of games in the `worlds` folder:
You may also find developer documentation in the `docs` folder:
[/docs Folder in Archipelago Code](https://github.com/ArchipelagoMW/Archipelago/tree/main/docs).
If you have more questions, feel free to ask in the **#ap-world-dev** channel on our Discord.
If you have more questions, feel free to ask in the **#archipelago-dev** channel on our Discord.

View File

@@ -22,7 +22,7 @@
{% for patch in room.seed.slots|list|sort(attribute="player_id") %}
<tr>
<td>{{ patch.player_id }}</td>
<td data-tooltip="Connect via Game Client"><a href="archipelago://{{ patch.player_name | e}}:None@{{ config['HOST_ADDRESS'] }}:{{ room.last_port }}?game={{ patch.game }}&room={{ room.id | suuid }}">{{ patch.player_name }}</a></td>
<td data-tooltip="Connect via TextClient"><a href="archipelago://{{ patch.player_name | e}}:None@{{ config['HOST_ADDRESS'] }}:{{ room.last_port }}">{{ patch.player_name }}</a></td>
<td>{{ patch.game }}</td>
<td>
{% if patch.data %}

View File

@@ -69,7 +69,7 @@
</tbody>
</table>
{% else %}
You have not generated any seeds yet!
You have no generated any seeds yet!
{% endif %}
</div>
</div>

View File

@@ -46,7 +46,7 @@
/worlds/clique/ @ThePhar
# Dark Souls III
/worlds/dark_souls_3/ @Marechal-L @nex3
/worlds/dark_souls_3/ @Marechal-L
# Donkey Kong Country 3
/worlds/dkc3/ @PoryGone
@@ -118,6 +118,9 @@
# Noita
/worlds/noita/ @ScipioWright @heinermann
# Ocarina of Time
/worlds/oot/ @espeon65536
# Old School Runescape
/worlds/osrs @digiholic
@@ -227,9 +230,6 @@
# Links Awakening DX
# /worlds/ladx/
# Ocarina of Time
# /worlds/oot/
## Disabled Unmaintained Worlds
# The following worlds in this repo are currently unmaintained and disabled as they do not work in core. If you are

View File

@@ -24,7 +24,7 @@ display as `Value1` on the webhost.
files, and both will resolve as `value1`. This should be used when changing options around, i.e. changing a Toggle to a
Choice, and defining `alias_true = option_full`.
- All options with a fixed set of possible values (i.e. those which inherit from `Toggle`, `(Text)Choice` or
`(Named)Range`) support `random` as a generic option. `random` chooses from any of the available values for that
`(Named/Special)Range`) support `random` as a generic option. `random` chooses from any of the available values for that
option, and is reserved by AP. You can set this as your default value, but you cannot define your own `option_random`.
However, you can override `from_text` and handle `text == "random"` to customize its behavior or
implement it for additional option types.
@@ -129,23 +129,6 @@ class Difficulty(Choice):
default = 1
```
### Option Visibility
Every option has a Visibility IntFlag, defaulting to `all` (`0b1111`). This lets you choose where the option will be
displayed. This only impacts where options are displayed, not how they can be used. Hidden options are still valid
options in a yaml. The flags are as follows:
* `none` (`0b0000`): This option is not shown anywhere
* `template` (`0b0001`): This option shows up in template yamls
* `simple_ui` (`0b0010`): This option shows up on the options page
* `complex_ui` (`0b0100`): This option shows up on the advanced/weighted options page
* `spoiler` (`0b1000`): This option shows up in spoiler logs
```python
from Options import Choice, Visibility
class HiddenChoiceOption(Choice):
visibility = Visibility.none
```
### Option Groups
Options may be categorized into groups for display on the WebHost. Option groups are displayed in the order specified
by your world on the player-options and weighted-options pages. In the generated template files, there will be a comment

View File

@@ -38,7 +38,7 @@ Recommended steps
* Refer to [Windows Compilers on the python wiki](https://wiki.python.org/moin/WindowsCompilers) for details.
Generally, selecting the box for "Desktop Development with C++" will provide what you need.
* Build tools are not required if all modules are installed pre-compiled. Pre-compiled modules are pinned on
[Discord in #ap-core-dev](https://discord.com/channels/731205301247803413/731214280439103580/905154456377757808)
[Discord in #archipelago-dev](https://discord.com/channels/731205301247803413/731214280439103580/905154456377757808)
* It is recommended to use [PyCharm IDE](https://www.jetbrains.com/pycharm/)
* Run Generate.py which will prompt installation of missing modules, press enter to confirm

View File

@@ -303,31 +303,6 @@ generation (entrance randomization).
An access rule is a function that returns `True` or `False` for a `Location` or `Entrance` based on the current `state`
(items that have been collected).
The two possible ways to make a [CollectionRule](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/generic/Rules.py#L10) are:
- `def rule(state: CollectionState) -> bool:`
- `lambda state: ... boolean expression ...`
An access rule can be assigned through `set_rule(location, rule)`.
Access rules usually check for one of two things.
- Items that have been collected (e.g. `state.has("Sword", player)`)
- Locations, Regions or Entrances that have been reached (e.g. `state.can_reach_region("Boss Room")`)
Keep in mind that entrances and locations implicitly check for the accessibility of their parent region, so you do not need to check explicitly for it.
#### An important note on Entrance access rules:
When using `state.can_reach` within an entrance access condition, you must also use `multiworld.register_indirect_condition`.
For efficiency reasons, every time reachable regions are searched, every entrance is only checked once in a somewhat non-deterministic order.
This is fine when checking for items using `state.has`, because items do not change during a region sweep.
However, `state.can_reach` checks for the very same thing we are updating: Regions.
This can lead to non-deterministic behavior and, in the worst case, even generation failures.
Even doing `state.can_reach_location` or `state.can_reach_entrance` is problematic, as these functions call `state.can_reach_region` on the respective parent region.
**Therefore, it is considered unsafe to perform `state.can_reach` from within an access condition for an entrance**, unless you are checking for something that sits in the source region of the entrance.
You can use `multiworld.register_indirect_condition(region, entrance)` to explicitly tell the generator that, when a given region becomes accessible, it is necessary to re-check a specific entrance.
You **must** use `multiworld.register_indirect_condition` if you perform this kind of `can_reach` from an entrance access rule, unless you have a **very** good technical understanding of the relevant code and can reason why it will never lead to problems in your case.
### Item Rules
An item rule is a function that returns `True` or `False` for a `Location` based on a single item. It can be used to
@@ -655,7 +630,7 @@ def set_rules(self) -> None:
Custom methods can be defined for your logic rules. The access rule that ultimately gets assigned to the Location or
Entrance should be
a [`CollectionRule`](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/generic/Rules.py#L10).
a [`CollectionRule`](https://github.com/ArchipelagoMW/Archipelago/blob/main/worlds/generic/Rules.py#L9).
Typically, this is done by defining a lambda expression on demand at the relevant bit, typically calling other
functions, but this can also be achieved by defining a method with the appropriate format and assigning it directly.
For an example, see [The Messenger](/worlds/messenger/rules.py).

View File

@@ -44,7 +44,7 @@ When a world is unmaintained, the [core maintainers](https://github.com/orgs/Arc
can vote for a new maintainer if there is a candidate.
For a vote to pass, the majority of participating core maintainers must vote in the affirmative.
The time limit is 1 week, but can end early if the majority is reached earlier.
Voting shall be conducted on Discord in #ap-core-dev.
Voting shall be conducted on Discord in #archipelago-dev.
## Dropping out
@@ -60,7 +60,7 @@ for example when they become unreachable.
For a vote to pass, the majority of participating core maintainers must vote in the affirmative.
The time limit is 2 weeks, but can end early if the majority is reached earlier AND the world maintainer was pinged and
made their case or was pinged and has been unreachable for more than 2 weeks already.
Voting shall be conducted on Discord in #ap-core-dev. Commits that are a direct result of the voting shall include
Voting shall be conducted on Discord in #archipelago-dev. Commits that are a direct result of the voting shall include
date, voting members and final result in the commit message.
## Handling of Unmaintained Worlds

View File

@@ -228,8 +228,8 @@ Root: HKCR; Subkey: "{#MyAppName}worlddata\shell\open\command"; ValueData: """{a
Root: HKCR; Subkey: "archipelago"; ValueType: "string"; ValueData: "Archipegalo Protocol"; Flags: uninsdeletekey;
Root: HKCR; Subkey: "archipelago"; ValueType: "string"; ValueName: "URL Protocol"; ValueData: "";
Root: HKCR; Subkey: "archipelago\DefaultIcon"; ValueType: "string"; ValueData: "{app}\ArchipelagoLauncher.exe,0";
Root: HKCR; Subkey: "archipelago\shell\open\command"; ValueType: "string"; ValueData: """{app}\ArchipelagoLauncher.exe"" ""%1""";
Root: HKCR; Subkey: "archipelago\DefaultIcon"; ValueType: "string"; ValueData: "{app}\ArchipelagoTextClient.exe,0";
Root: HKCR; Subkey: "archipelago\shell\open\command"; ValueType: "string"; ValueData: """{app}\ArchipelagoTextClient.exe"" ""%1""";
[Code]
// See: https://stackoverflow.com/a/51614652/2287576

View File

@@ -292,14 +292,6 @@ class World(metaclass=AutoWorldRegister):
web: ClassVar[WebWorld] = WebWorld()
"""see WebWorld for options"""
origin_region_name: str = "Menu"
"""Name of the Region from which accessibility is tested."""
explicit_indirect_conditions: bool = True
"""If True, the world implementation is supposed to use MultiWorld.register_indirect_condition() correctly.
If False, everything is rechecked at every step, which is slower computationally,
but may be desirable in complex/dynamic worlds."""
multiworld: "MultiWorld"
"""autoset on creation. The MultiWorld object for the currently generating multiworld."""
player: int

View File

@@ -26,13 +26,10 @@ class Component:
cli: bool
func: Optional[Callable]
file_identifier: Optional[Callable[[str], bool]]
game_name: Optional[str]
supports_uri: Optional[bool]
def __init__(self, display_name: str, script_name: Optional[str] = None, frozen_name: Optional[str] = None,
cli: bool = False, icon: str = 'icon', component_type: Optional[Type] = None,
func: Optional[Callable] = None, file_identifier: Optional[Callable[[str], bool]] = None,
game_name: Optional[str] = None, supports_uri: Optional[bool] = False):
func: Optional[Callable] = None, file_identifier: Optional[Callable[[str], bool]] = None):
self.display_name = display_name
self.script_name = script_name
self.frozen_name = frozen_name or f'Archipelago{script_name}' if script_name else None
@@ -48,8 +45,6 @@ class Component:
Type.ADJUSTER if "Adjuster" in display_name else Type.MISC)
self.func = func
self.file_identifier = file_identifier
self.game_name = game_name
self.supports_uri = supports_uri
def handles_file(self, path: str):
return self.file_identifier(path) if self.file_identifier else False
@@ -61,10 +56,10 @@ class Component:
processes = weakref.WeakSet()
def launch_subprocess(func: Callable, name: str = None, args: Tuple[str, ...] = ()) -> None:
def launch_subprocess(func: Callable, name: str = None):
global processes
import multiprocessing
process = multiprocessing.Process(target=func, name=name, args=args)
process = multiprocessing.Process(target=func, name=name)
process.start()
processes.add(process)
@@ -83,9 +78,9 @@ class SuffixIdentifier:
return False
def launch_textclient(*args):
def launch_textclient():
import CommonClient
launch_subprocess(CommonClient.run_as_textclient, name="TextClient", args=args)
launch_subprocess(CommonClient.run_as_textclient, name="TextClient")
def _install_apworld(apworld_src: str = "") -> Optional[Tuple[pathlib.Path, pathlib.Path]]:

View File

@@ -59,10 +59,14 @@ class BizHawkClientContext(CommonContext):
self.bizhawk_ctx = BizHawkContext()
self.watcher_timeout = 0.5
def make_gui(self):
ui = super().make_gui()
ui.base_title = "Archipelago BizHawk Client"
return ui
def run_gui(self):
from kvui import GameManager
class BizHawkManager(GameManager):
base_title = "Archipelago BizHawk Client"
self.ui = BizHawkManager(self)
self.ui_task = asyncio.create_task(self.ui.async_run(), name="UI")
def on_package(self, cmd, args):
if cmd == "Connected":

View File

@@ -728,7 +728,7 @@ class ALttPPlandoConnections(PlandoConnections):
entrances = set([connection[0] for connection in (
*default_connections, *default_dungeon_connections, *inverted_default_connections,
*inverted_default_dungeon_connections)])
exits = set([connection[0] for connection in (
exits = set([connection[1] for connection in (
*default_connections, *default_dungeon_connections, *inverted_default_connections,
*inverted_default_dungeon_connections)])

View File

@@ -101,7 +101,6 @@ class Factorio(World):
tech_tree_layout_prerequisites: typing.Dict[FactorioScienceLocation, typing.Set[FactorioScienceLocation]]
tech_mix: int = 0
skip_silo: bool = False
origin_region_name = "Nauvis"
science_locations: typing.List[FactorioScienceLocation]
settings: typing.ClassVar[FactorioSettings]
@@ -126,6 +125,9 @@ class Factorio(World):
def create_regions(self):
player = self.player
random = self.multiworld.random
menu = Region("Menu", player, self.multiworld)
crash = Entrance(player, "Crash Land", menu)
menu.exits.append(crash)
nauvis = Region("Nauvis", player, self.multiworld)
location_count = len(base_tech_table) - len(useless_technologies) - self.skip_silo + \
@@ -182,7 +184,8 @@ class Factorio(World):
event = FactorioItem(f"Automated {ingredient}", ItemClassification.progression, None, player)
location.place_locked_item(event)
self.multiworld.regions.append(nauvis)
crash.connect(nauvis)
self.multiworld.regions += [menu, nauvis]
def create_items(self) -> None:
player = self.player

View File

@@ -601,11 +601,11 @@ class HKWorld(World):
if change:
for effect_name, effect_value in item_effects.get(item.name, {}).items():
state.prog_items[item.player][effect_name] += effect_value
if item.name in {"Left_Mothwing_Cloak", "Right_Mothwing_Cloak"}:
if state.prog_items[item.player].get('RIGHTDASH', 0) and \
state.prog_items[item.player].get('LEFTDASH', 0):
(state.prog_items[item.player]["RIGHTDASH"], state.prog_items[item.player]["LEFTDASH"]) = \
([max(state.prog_items[item.player]["RIGHTDASH"], state.prog_items[item.player]["LEFTDASH"])] * 2)
if item.name in {"Left_Mothwing_Cloak", "Right_Mothwing_Cloak"}:
if state.prog_items[item.player].get('RIGHTDASH', 0) and \
state.prog_items[item.player].get('LEFTDASH', 0):
(state.prog_items[item.player]["RIGHTDASH"], state.prog_items[item.player]["LEFTDASH"]) = \
([max(state.prog_items[item.player]["RIGHTDASH"], state.prog_items[item.player]["LEFTDASH"])] * 2)
return change
def remove(self, state, item: HKItem) -> bool:

View File

@@ -19,7 +19,7 @@ from .shop import FIGURINES, PROG_SHOP_ITEMS, SHOP_ITEMS, USEFUL_SHOP_ITEMS, shu
from .subclasses import MessengerEntrance, MessengerItem, MessengerRegion, MessengerShopLocation
components.append(
Component("The Messenger", component_type=Type.CLIENT, func=launch_game, game_name="The Messenger", supports_uri=True)
Component("The Messenger", component_type=Type.CLIENT, func=launch_game)#, game_name="The Messenger", supports_uri=True)
)
@@ -27,7 +27,6 @@ class MessengerSettings(Group):
class GamePath(FilePath):
description = "The Messenger game executable"
is_exe = True
md5s = ["1b53534569060bc06179356cd968ed1d"]
game_path: GamePath = GamePath("TheMessenger.exe")

View File

@@ -1,10 +1,10 @@
import argparse
import io
import logging
import os.path
import subprocess
import urllib.request
from shutil import which
from tkinter.messagebox import askyesnocancel
from typing import Any, Optional
from zipfile import ZipFile
from Utils import open_file
@@ -17,33 +17,11 @@ from Utils import is_windows, messagebox, tuplize_version
MOD_URL = "https://api.github.com/repos/alwaysintreble/TheMessengerRandomizerModAP/releases/latest"
def ask_yes_no_cancel(title: str, text: str) -> Optional[bool]:
"""
Wrapper for tkinter.messagebox.askyesnocancel, that creates a popup dialog box with yes, no, and cancel buttons.
:param title: Title to be displayed at the top of the message box.
:param text: Text to be displayed inside the message box.
:return: Returns True if yes, False if no, None if cancel.
"""
from tkinter import Tk, messagebox
root = Tk()
root.withdraw()
ret = messagebox.askyesnocancel(title, text)
root.update()
return ret
def launch_game(*args) -> None:
def launch_game(url: Optional[str] = None) -> None:
"""Check the game installation, then launch it"""
def courier_installed() -> bool:
"""Check if Courier is installed"""
assembly_path = os.path.join(game_folder, "TheMessenger_Data", "Managed", "Assembly-CSharp.dll")
with open(assembly_path, "rb") as assembly:
for line in assembly:
if b"Courier" in line:
return True
return False
return os.path.exists(os.path.join(game_folder, "TheMessenger_Data", "Managed", "Assembly-CSharp.Courier.mm.dll"))
def mod_installed() -> bool:
"""Check if the mod is installed"""
@@ -78,34 +56,27 @@ def launch_game(*args) -> None:
if not is_windows:
mono_exe = which("mono")
if not mono_exe:
# download and use mono kickstart
# this allows steam deck support
mono_kick_url = "https://github.com/flibitijibibo/MonoKickstart/archive/716f0a2bd5d75138969090494a76328f39a6dd78.zip"
files = []
with urllib.request.urlopen(mono_kick_url) as download:
with ZipFile(io.BytesIO(download.read()), "r") as zf:
for member in zf.infolist():
if "precompiled/" not in member.filename or member.filename.endswith("/"):
continue
member.filename = member.filename.split("/")[-1]
if member.filename.endswith("bin.x86_64"):
member.filename = "MiniInstaller.bin.x86_64"
zf.extract(member, path=game_folder)
files.append(member.filename)
mono_installer = os.path.join(game_folder, "MiniInstaller.bin.x86_64")
os.chmod(mono_installer, 0o755)
installer = subprocess.Popen(mono_installer, shell=False)
failure = installer.wait()
for file in files:
os.remove(file)
# steam deck support but doesn't currently work
messagebox("Failure", "Failed to install Courier", True)
raise RuntimeError("Failed to install Courier")
# # download and use mono kickstart
# # this allows steam deck support
# mono_kick_url = "https://github.com/flibitijibibo/MonoKickstart/archive/refs/heads/master.zip"
# target = os.path.join(folder, "monoKickstart")
# os.makedirs(target, exist_ok=True)
# with urllib.request.urlopen(mono_kick_url) as download:
# with ZipFile(io.BytesIO(download.read()), "r") as zf:
# for member in zf.infolist():
# zf.extract(member, path=target)
# installer = subprocess.Popen([os.path.join(target, "precompiled"),
# os.path.join(folder, "MiniInstaller.exe")], shell=False)
# os.remove(target)
else:
installer = subprocess.Popen([mono_exe, os.path.join(game_folder, "MiniInstaller.exe")], shell=True)
failure = installer.wait()
installer = subprocess.Popen([mono_exe, os.path.join(game_folder, "MiniInstaller.exe")], shell=False)
else:
installer = subprocess.Popen(os.path.join(game_folder, "MiniInstaller.exe"), shell=True)
failure = installer.wait()
installer = subprocess.Popen(os.path.join(game_folder, "MiniInstaller.exe"), shell=False)
print(failure)
failure = installer.wait()
if failure:
messagebox("Failure", "Failed to install Courier", True)
os.chdir(working_directory)
@@ -153,35 +124,18 @@ def launch_game(*args) -> None:
return "alpha" in latest_version or tuplize_version(latest_version) > tuplize_version(installed_version)
from . import MessengerWorld
try:
game_folder = os.path.dirname(MessengerWorld.settings.game_path)
except ValueError as e:
logging.error(e)
messagebox("Invalid File", "Selected file did not match expected hash. "
"Please try again and ensure you select The Messenger.exe.")
return
game_folder = os.path.dirname(MessengerWorld.settings.game_path)
working_directory = os.getcwd()
# setup ssl context
try:
import certifi
import ssl
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=certifi.where())
context.set_alpn_protocols(["http/1.1"])
https_handler = urllib.request.HTTPSHandler(context=context)
opener = urllib.request.build_opener(https_handler)
urllib.request.install_opener(opener)
except ImportError:
pass
if not courier_installed():
should_install = ask_yes_no_cancel("Install Courier",
"No Courier installation detected. Would you like to install now?")
should_install = askyesnocancel("Install Courier",
"No Courier installation detected. Would you like to install now?")
if not should_install:
return
logging.info("Installing Courier")
install_courier()
if not mod_installed():
should_install = ask_yes_no_cancel("Install Mod",
"No randomizer mod detected. Would you like to install now?")
should_install = askyesnocancel("Install Mod",
"No randomizer mod detected. Would you like to install now?")
if not should_install:
return
logging.info("Installing Mod")
@@ -189,33 +143,22 @@ def launch_game(*args) -> None:
else:
latest = request_data(MOD_URL)["tag_name"]
if available_mod_update(latest):
should_update = ask_yes_no_cancel("Update Mod",
f"New mod version detected. Would you like to update to {latest} now?")
should_update = askyesnocancel("Update Mod",
f"New mod version detected. Would you like to update to {latest} now?")
if should_update:
logging.info("Updating mod")
install_mod()
elif should_update is None:
return
if not args:
should_launch = ask_yes_no_cancel("Launch Game",
"Mod installed and up to date. Would you like to launch the game now?")
if not should_launch:
return
parser = argparse.ArgumentParser(description="Messenger Client Launcher")
parser.add_argument("url", type=str, nargs="?", help="Archipelago Webhost uri to auto connect to.")
args = parser.parse_args(args)
if not is_windows:
if args.url:
open_file(f"steam://rungameid/764790//{args.url}/")
if url:
open_file(f"steam://rungameid/764790//{url}/")
else:
open_file("steam://rungameid/764790")
else:
os.chdir(game_folder)
if args.url:
subprocess.Popen([MessengerWorld.settings.game_path, str(args.url)])
if url:
subprocess.Popen([MessengerWorld.settings.game_path, str(url)])
else:
subprocess.Popen(MessengerWorld.settings.game_path)
os.chdir(working_directory)

View File

@@ -711,7 +711,6 @@ class PokemonEmeraldWorld(World):
"trainersanity",
"modify_118",
"death_link",
"normalize_encounter_rates",
)
slot_data["free_fly_location_id"] = self.free_fly_location_id
slot_data["hm_requirements"] = self.hm_requirements

View File

@@ -276,13 +276,15 @@ def _str_to_pokemon_data_type(string: str) -> TrainerPokemonDataTypeEnum:
return TrainerPokemonDataTypeEnum.ITEM_CUSTOM_MOVES
class TrainerPokemonData(NamedTuple):
@dataclass
class TrainerPokemonData:
species_id: int
level: int
moves: Optional[Tuple[int, int, int, int]]
class TrainerPartyData(NamedTuple):
@dataclass
class TrainerPartyData:
pokemon: List[TrainerPokemonData]
pokemon_data_type: TrainerPokemonDataTypeEnum
address: int

View File

@@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, Dict, List, Set
from .data import NUM_REAL_SPECIES, UNEVOLVED_POKEMON, data
from .data import NUM_REAL_SPECIES, UNEVOLVED_POKEMON, TrainerPokemonData, data
from .options import RandomizeTrainerParties
from .pokemon import filter_species_by_nearby_bst
from .util import int_to_bool_array
@@ -111,6 +111,6 @@ def randomize_opponent_parties(world: "PokemonEmeraldWorld") -> None:
hm_moves[3] if world.random.random() < 0.25 else level_up_moves[3]
)
new_party.append(pokemon._replace(species_id=new_species.species_id, moves=new_moves))
new_party.append(TrainerPokemonData(new_species.species_id, pokemon.level, new_moves))
trainer.party = trainer.party._replace(pokemon=new_party)
trainer.party.pokemon = new_party

View File

@@ -4,7 +4,8 @@ Functions related to pokemon species and moves
import functools
from typing import TYPE_CHECKING, Dict, List, Set, Optional, Tuple
from .data import (NUM_REAL_SPECIES, OUT_OF_LOGIC_MAPS, EncounterTableData, LearnsetMove, SpeciesData, data)
from .data import (NUM_REAL_SPECIES, OUT_OF_LOGIC_MAPS, EncounterTableData, LearnsetMove, MiscPokemonData,
SpeciesData, data)
from .options import (Goal, HmCompatibility, LevelUpMoves, RandomizeAbilities, RandomizeLegendaryEncounters,
RandomizeMiscPokemon, RandomizeStarters, RandomizeTypes, RandomizeWildPokemon,
TmTutorCompatibility)
@@ -460,7 +461,7 @@ def randomize_learnsets(world: "PokemonEmeraldWorld") -> None:
type_bias, normal_bias, species.types)
else:
new_move = 0
new_learnset.append(old_learnset[cursor]._replace(move_id=new_move))
new_learnset.append(LearnsetMove(old_learnset[cursor].level, new_move))
cursor += 1
# All moves from here onward are actual moves.
@@ -472,7 +473,7 @@ def randomize_learnsets(world: "PokemonEmeraldWorld") -> None:
new_move = get_random_move(world.random,
{move.move_id for move in new_learnset} | world.blacklisted_moves,
type_bias, normal_bias, species.types)
new_learnset.append(old_learnset[cursor]._replace(move_id=new_move))
new_learnset.append(LearnsetMove(old_learnset[cursor].level, new_move))
cursor += 1
species.learnset = new_learnset
@@ -580,10 +581,8 @@ def randomize_starters(world: "PokemonEmeraldWorld") -> None:
picked_evolution = world.random.choice(potential_evolutions)
for trainer_name, starter_position, is_evolved in rival_teams[i]:
new_species_id = picked_evolution if is_evolved else starter.species_id
trainer_data = world.modified_trainers[data.constants[trainer_name]]
trainer_data.party.pokemon[starter_position] = \
trainer_data.party.pokemon[starter_position]._replace(species_id=new_species_id)
trainer_data.party.pokemon[starter_position].species_id = picked_evolution if is_evolved else starter.species_id
def randomize_legendary_encounters(world: "PokemonEmeraldWorld") -> None:
@@ -595,7 +594,10 @@ def randomize_legendary_encounters(world: "PokemonEmeraldWorld") -> None:
world.random.shuffle(shuffled_species)
for i, encounter in enumerate(data.legendary_encounters):
world.modified_legendary_encounters.append(encounter._replace(species_id=shuffled_species[i]))
world.modified_legendary_encounters.append(MiscPokemonData(
shuffled_species[i],
encounter.address
))
else:
should_match_bst = world.options.legendary_encounters in {
RandomizeLegendaryEncounters.option_match_base_stats,
@@ -619,8 +621,9 @@ def randomize_legendary_encounters(world: "PokemonEmeraldWorld") -> None:
if should_match_bst:
candidates = filter_species_by_nearby_bst(candidates, sum(original_species.base_stats))
world.modified_legendary_encounters.append(encounter._replace(
species_id=world.random.choice(candidates).species_id
world.modified_legendary_encounters.append(MiscPokemonData(
world.random.choice(candidates).species_id,
encounter.address
))
@@ -634,7 +637,10 @@ def randomize_misc_pokemon(world: "PokemonEmeraldWorld") -> None:
world.modified_misc_pokemon = []
for i, encounter in enumerate(data.misc_pokemon):
world.modified_misc_pokemon.append(encounter._replace(species_id=shuffled_species[i]))
world.modified_misc_pokemon.append(MiscPokemonData(
shuffled_species[i],
encounter.address
))
else:
should_match_bst = world.options.misc_pokemon in {
RandomizeMiscPokemon.option_match_base_stats,
@@ -666,8 +672,9 @@ def randomize_misc_pokemon(world: "PokemonEmeraldWorld") -> None:
if len(player_filtered_candidates) > 0:
candidates = player_filtered_candidates
world.modified_misc_pokemon.append(encounter._replace(
species_id=world.random.choice(candidates).species_id
world.modified_misc_pokemon.append(MiscPokemonData(
world.random.choice(candidates).species_id,
encounter.address
))

View File

@@ -19,20 +19,20 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
hm_rules: Dict[str, Callable[[CollectionState], bool]] = {}
for hm, badges in world.hm_requirements.items():
if isinstance(badges, list):
hm_rules[hm] = lambda state, hm=hm, badges=badges: \
state.has(hm, world.player) and state.has_all(badges, world.player)
hm_rules[hm] = lambda state, hm=hm, badges=badges: state.has(hm, world.player) \
and state.has_all(badges, world.player)
else:
hm_rules[hm] = lambda state, hm=hm, badges=badges: \
state.has(hm, world.player) and state.has_group_unique("Badges", world.player, badges)
hm_rules[hm] = lambda state, hm=hm, badges=badges: state.has(hm, world.player) \
and state.has_group("Badges", world.player, badges)
def has_acro_bike(state: CollectionState):
return state.has("Acro Bike", world.player)
def has_mach_bike(state: CollectionState):
return state.has("Mach Bike", world.player)
def defeated_n_gym_leaders(state: CollectionState, n: int) -> bool:
return state.has_from_list_unique([
return sum([state.has(event, world.player) for event in [
"EVENT_DEFEAT_ROXANNE",
"EVENT_DEFEAT_BRAWLY",
"EVENT_DEFEAT_WATTSON",
@@ -41,7 +41,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
"EVENT_DEFEAT_WINONA",
"EVENT_DEFEAT_TATE_AND_LIZA",
"EVENT_DEFEAT_JUAN",
], world.player, n)
]]) >= n
huntable_legendary_events = [
f"EVENT_ENCOUNTER_{key}"
@@ -61,9 +61,8 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
}.items()
if name in world.options.allowed_legendary_hunt_encounters.value
]
def encountered_n_legendaries(state: CollectionState, n: int) -> bool:
return state.has_from_list_unique(huntable_legendary_events, world.player, n)
return sum(int(state.has(event, world.player)) for event in huntable_legendary_events) >= n
def get_entrance(entrance: str):
return world.multiworld.get_entrance(entrance, world.player)
@@ -236,11 +235,11 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
if world.options.norman_requirement == NormanRequirement.option_badges:
set_rule(
get_entrance("MAP_PETALBURG_CITY_GYM:2/MAP_PETALBURG_CITY_GYM:3"),
lambda state: state.has_group_unique("Badges", world.player, world.options.norman_count.value)
lambda state: state.has_group("Badges", world.player, world.options.norman_count.value)
)
set_rule(
get_entrance("MAP_PETALBURG_CITY_GYM:5/MAP_PETALBURG_CITY_GYM:6"),
lambda state: state.has_group_unique("Badges", world.player, world.options.norman_count.value)
lambda state: state.has_group("Badges", world.player, world.options.norman_count.value)
)
else:
set_rule(
@@ -300,15 +299,15 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_ROUTE116/EAST -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_116_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_116_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_ROUTE116/WEST -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_116_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_116_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
# Rusturf Tunnel
@@ -348,19 +347,19 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_ROUTE115/NORTH_BELOW_SLOPE -> REGION_ROUTE115/NORTH_ABOVE_SLOPE"),
has_mach_bike
lambda state: has_mach_bike(state)
)
set_rule(
get_entrance("REGION_ROUTE115/NORTH_BELOW_SLOPE -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_115_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_115_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_ROUTE115/NORTH_ABOVE_SLOPE -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_115_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_115_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
if world.options.extra_boulders:
@@ -376,7 +375,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
if world.options.extra_bumpy_slope:
set_rule(
get_entrance("REGION_ROUTE115/SOUTH_BELOW_LEDGE -> REGION_ROUTE115/SOUTH_ABOVE_LEDGE"),
has_acro_bike
lambda state: has_acro_bike(state)
)
else:
set_rule(
@@ -387,17 +386,17 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
# Route 105
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE105/MARINE_CAVE_ENTRANCE_1 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_105_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_105_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE105/MARINE_CAVE_ENTRANCE_2 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_105_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_105_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("MAP_ROUTE105:0/MAP_ISLAND_CAVE:0"),
@@ -440,7 +439,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_GRANITE_CAVE_B1F/LOWER -> REGION_GRANITE_CAVE_B1F/UPPER"),
has_mach_bike
lambda state: has_mach_bike(state)
)
# Route 107
@@ -644,15 +643,15 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_ROUTE114/ABOVE_WATERFALL -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_114_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_114_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_ROUTE114/MAIN -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_114_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_114_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
# Meteor Falls
@@ -700,11 +699,11 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
# Jagged Pass
set_rule(
get_entrance("REGION_JAGGED_PASS/BOTTOM -> REGION_JAGGED_PASS/MIDDLE"),
has_acro_bike
lambda state: has_acro_bike(state)
)
set_rule(
get_entrance("REGION_JAGGED_PASS/MIDDLE -> REGION_JAGGED_PASS/TOP"),
has_acro_bike
lambda state: has_acro_bike(state)
)
set_rule(
get_entrance("MAP_JAGGED_PASS:4/MAP_MAGMA_HIDEOUT_1F:0"),
@@ -720,11 +719,11 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
# Mirage Tower
set_rule(
get_entrance("REGION_MIRAGE_TOWER_2F/TOP -> REGION_MIRAGE_TOWER_2F/BOTTOM"),
has_mach_bike
lambda state: has_mach_bike(state)
)
set_rule(
get_entrance("REGION_MIRAGE_TOWER_2F/BOTTOM -> REGION_MIRAGE_TOWER_2F/TOP"),
has_mach_bike
lambda state: has_mach_bike(state)
)
set_rule(
get_entrance("REGION_MIRAGE_TOWER_3F/TOP -> REGION_MIRAGE_TOWER_3F/BOTTOM"),
@@ -813,15 +812,15 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_ROUTE118/EAST -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_118_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_118_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_ROUTE118/WEST -> REGION_TERRA_CAVE_ENTRANCE/MAIN"),
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("TERRA_CAVE_ROUTE_118_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("TERRA_CAVE_ROUTE_118_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
# Route 119
@@ -831,11 +830,11 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_ROUTE119/LOWER -> REGION_ROUTE119/LOWER_ACROSS_RAILS"),
has_acro_bike
lambda state: has_acro_bike(state)
)
set_rule(
get_entrance("REGION_ROUTE119/LOWER_ACROSS_RAILS -> REGION_ROUTE119/LOWER"),
has_acro_bike
lambda state: has_acro_bike(state)
)
set_rule(
get_entrance("REGION_ROUTE119/UPPER -> REGION_ROUTE119/MIDDLE_RIVER"),
@@ -851,7 +850,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_ROUTE119/ABOVE_WATERFALL -> REGION_ROUTE119/ABOVE_WATERFALL_ACROSS_RAILS"),
has_acro_bike
lambda state: has_acro_bike(state)
)
if "Route 119 Aqua Grunts" not in world.options.remove_roadblocks.value:
set_rule(
@@ -928,11 +927,11 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_SAFARI_ZONE_SOUTH/MAIN -> REGION_SAFARI_ZONE_NORTH/MAIN"),
has_acro_bike
lambda state: has_acro_bike(state)
)
set_rule(
get_entrance("REGION_SAFARI_ZONE_SOUTHWEST/MAIN -> REGION_SAFARI_ZONE_NORTHWEST/MAIN"),
has_mach_bike
lambda state: has_mach_bike(state)
)
set_rule(
get_entrance("REGION_SAFARI_ZONE_SOUTHWEST/MAIN -> REGION_SAFARI_ZONE_SOUTHWEST/POND"),
@@ -1116,17 +1115,17 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
# Route 125
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE125/MARINE_CAVE_ENTRANCE_1 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_125_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_125_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE125/MARINE_CAVE_ENTRANCE_2 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_125_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_125_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
# Shoal Cave
@@ -1258,17 +1257,17 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
)
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE127/MARINE_CAVE_ENTRANCE_1 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_127_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_127_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE127/MARINE_CAVE_ENTRANCE_2 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_127_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_127_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
# Route 128
@@ -1375,17 +1374,17 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
# Route 129
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE129/MARINE_CAVE_ENTRANCE_1 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_129_1", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_129_1", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
set_rule(
get_entrance("REGION_UNDERWATER_ROUTE129/MARINE_CAVE_ENTRANCE_2 -> REGION_UNDERWATER_MARINE_CAVE/MAIN"),
lambda state: hm_rules["HM08 Dive"](state)
and state.has("EVENT_DEFEAT_CHAMPION", world.player)
and state.has("MARINE_CAVE_ROUTE_129_2", world.player)
and state.has("EVENT_DEFEAT_SHELLY", world.player)
lambda state: hm_rules["HM08 Dive"](state) and \
state.has("EVENT_DEFEAT_CHAMPION", world.player) and \
state.has("MARINE_CAVE_ROUTE_129_2", world.player) and \
state.has("EVENT_DEFEAT_SHELLY", world.player)
)
# Pacifidlog Town
@@ -1506,7 +1505,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
if world.options.elite_four_requirement == EliteFourRequirement.option_badges:
set_rule(
get_entrance("REGION_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F/MAIN -> REGION_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F/BEHIND_BADGE_CHECKERS"),
lambda state: state.has_group_unique("Badges", world.player, world.options.elite_four_count.value)
lambda state: state.has_group("Badges", world.player, world.options.elite_four_count.value)
)
else:
set_rule(

View File

@@ -1,6 +1,6 @@
from Options import Choice, Range, Toggle, DeathLink, DefaultOnToggle, OptionSet, PerGameCommonOptions
from typing import Dict
from dataclasses import dataclass
from Options import Choice, Range, Option, Toggle, DeathLink, DefaultOnToggle, OptionSet
class StartingGender(Choice):
@@ -175,21 +175,13 @@ class NumberOfChildren(Range):
default = 3
class AdditionalLadyNames(OptionSet):
class AdditionalNames(OptionSet):
"""
Set of additional names your potential offspring can have. If Allow Default Names is disabled, this is the only list
of names your children can have. The first value will also be your initial character's name depending on Starting
Gender.
"""
display_name = "Additional Lady Names"
class AdditionalSirNames(OptionSet):
"""
Set of additional names your potential offspring can have. If Allow Default Names is disabled, this is the only list
of names your children can have. The first value will also be your initial character's name depending on Starting
Gender.
"""
display_name = "Additional Sir Names"
display_name = "Additional Names"
class AllowDefaultNames(DefaultOnToggle):
@@ -344,44 +336,42 @@ class AvailableClasses(OptionSet):
The upgraded form of your starting class will be available regardless.
"""
display_name = "Available Classes"
default = frozenset(
{"Knight", "Mage", "Barbarian", "Knave", "Shinobi", "Miner", "Spellthief", "Lich", "Dragon", "Traitor"}
)
default = {"Knight", "Mage", "Barbarian", "Knave", "Shinobi", "Miner", "Spellthief", "Lich", "Dragon", "Traitor"}
valid_keys = {"Knight", "Mage", "Barbarian", "Knave", "Shinobi", "Miner", "Spellthief", "Lich", "Dragon", "Traitor"}
@dataclass
class RLOptions(PerGameCommonOptions):
starting_gender: StartingGender
starting_class: StartingClass
available_classes: AvailableClasses
new_game_plus: NewGamePlus
fairy_chests_per_zone: FairyChestsPerZone
chests_per_zone: ChestsPerZone
universal_fairy_chests: UniversalFairyChests
universal_chests: UniversalChests
vendors: Vendors
architect: Architect
architect_fee: ArchitectFee
disable_charon: DisableCharon
require_purchasing: RequirePurchasing
progressive_blueprints: ProgressiveBlueprints
gold_gain_multiplier: GoldGainMultiplier
number_of_children: NumberOfChildren
free_diary_on_generation: FreeDiaryOnGeneration
khidr: ChallengeBossKhidr
alexander: ChallengeBossAlexander
leon: ChallengeBossLeon
herodotus: ChallengeBossHerodotus
health_pool: HealthUpPool
mana_pool: ManaUpPool
attack_pool: AttackUpPool
magic_damage_pool: MagicDamageUpPool
armor_pool: ArmorUpPool
equip_pool: EquipUpPool
crit_chance_pool: CritChanceUpPool
crit_damage_pool: CritDamageUpPool
allow_default_names: AllowDefaultNames
additional_lady_names: AdditionalLadyNames
additional_sir_names: AdditionalSirNames
death_link: DeathLink
rl_options: Dict[str, type(Option)] = {
"starting_gender": StartingGender,
"starting_class": StartingClass,
"available_classes": AvailableClasses,
"new_game_plus": NewGamePlus,
"fairy_chests_per_zone": FairyChestsPerZone,
"chests_per_zone": ChestsPerZone,
"universal_fairy_chests": UniversalFairyChests,
"universal_chests": UniversalChests,
"vendors": Vendors,
"architect": Architect,
"architect_fee": ArchitectFee,
"disable_charon": DisableCharon,
"require_purchasing": RequirePurchasing,
"progressive_blueprints": ProgressiveBlueprints,
"gold_gain_multiplier": GoldGainMultiplier,
"number_of_children": NumberOfChildren,
"free_diary_on_generation": FreeDiaryOnGeneration,
"khidr": ChallengeBossKhidr,
"alexander": ChallengeBossAlexander,
"leon": ChallengeBossLeon,
"herodotus": ChallengeBossHerodotus,
"health_pool": HealthUpPool,
"mana_pool": ManaUpPool,
"attack_pool": AttackUpPool,
"magic_damage_pool": MagicDamageUpPool,
"armor_pool": ArmorUpPool,
"equip_pool": EquipUpPool,
"crit_chance_pool": CritChanceUpPool,
"crit_damage_pool": CritDamageUpPool,
"allow_default_names": AllowDefaultNames,
"additional_lady_names": AdditionalNames,
"additional_sir_names": AdditionalNames,
"death_link": DeathLink,
}

View File

@@ -1,18 +1,15 @@
from typing import Dict, List, NamedTuple, Optional, TYPE_CHECKING
from typing import Dict, List, NamedTuple, Optional
from BaseClasses import MultiWorld, Region, Entrance
from .Locations import RLLocation, location_table, get_locations_by_category
if TYPE_CHECKING:
from . import RLWorld
class RLRegionData(NamedTuple):
locations: Optional[List[str]]
region_exits: Optional[List[str]]
def create_regions(world: "RLWorld"):
def create_regions(multiworld: MultiWorld, player: int):
regions: Dict[str, RLRegionData] = {
"Menu": RLRegionData(None, ["Castle Hamson"]),
"The Manor": RLRegionData([], []),
@@ -59,9 +56,9 @@ def create_regions(world: "RLWorld"):
regions["The Fountain Room"].locations.append("Fountain Room")
# Chests
chests = int(world.options.chests_per_zone)
chests = int(multiworld.chests_per_zone[player])
for i in range(0, chests):
if world.options.universal_chests:
if multiworld.universal_chests[player]:
regions["Castle Hamson"].locations.append(f"Chest {i + 1}")
regions["Forest Abkhazia"].locations.append(f"Chest {i + 1 + chests}")
regions["The Maya"].locations.append(f"Chest {i + 1 + (chests * 2)}")
@@ -73,9 +70,9 @@ def create_regions(world: "RLWorld"):
regions["Land of Darkness"].locations.append(f"Land of Darkness - Chest {i + 1}")
# Fairy Chests
chests = int(world.options.fairy_chests_per_zone)
chests = int(multiworld.fairy_chests_per_zone[player])
for i in range(0, chests):
if world.options.universal_fairy_chests:
if multiworld.universal_fairy_chests[player]:
regions["Castle Hamson"].locations.append(f"Fairy Chest {i + 1}")
regions["Forest Abkhazia"].locations.append(f"Fairy Chest {i + 1 + chests}")
regions["The Maya"].locations.append(f"Fairy Chest {i + 1 + (chests * 2)}")
@@ -88,14 +85,14 @@ def create_regions(world: "RLWorld"):
# Set up the regions correctly.
for name, data in regions.items():
world.multiworld.regions.append(create_region(world.multiworld, world.player, name, data))
multiworld.regions.append(create_region(multiworld, player, name, data))
world.get_entrance("Castle Hamson").connect(world.get_region("Castle Hamson"))
world.get_entrance("The Manor").connect(world.get_region("The Manor"))
world.get_entrance("Forest Abkhazia").connect(world.get_region("Forest Abkhazia"))
world.get_entrance("The Maya").connect(world.get_region("The Maya"))
world.get_entrance("Land of Darkness").connect(world.get_region("Land of Darkness"))
world.get_entrance("The Fountain Room").connect(world.get_region("The Fountain Room"))
multiworld.get_entrance("Castle Hamson", player).connect(multiworld.get_region("Castle Hamson", player))
multiworld.get_entrance("The Manor", player).connect(multiworld.get_region("The Manor", player))
multiworld.get_entrance("Forest Abkhazia", player).connect(multiworld.get_region("Forest Abkhazia", player))
multiworld.get_entrance("The Maya", player).connect(multiworld.get_region("The Maya", player))
multiworld.get_entrance("Land of Darkness", player).connect(multiworld.get_region("Land of Darkness", player))
multiworld.get_entrance("The Fountain Room", player).connect(multiworld.get_region("The Fountain Room", player))
def create_region(multiworld: MultiWorld, player: int, name: str, data: RLRegionData):

View File

@@ -1,13 +1,9 @@
from BaseClasses import CollectionState
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from . import RLWorld
from BaseClasses import CollectionState, MultiWorld
def get_upgrade_total(world: "RLWorld") -> int:
return int(world.options.health_pool) + int(world.options.mana_pool) + \
int(world.options.attack_pool) + int(world.options.magic_damage_pool)
def get_upgrade_total(multiworld: MultiWorld, player: int) -> int:
return int(multiworld.health_pool[player]) + int(multiworld.mana_pool[player]) + \
int(multiworld.attack_pool[player]) + int(multiworld.magic_damage_pool[player])
def get_upgrade_count(state: CollectionState, player: int) -> int:
@@ -23,8 +19,8 @@ def has_upgrade_amount(state: CollectionState, player: int, amount: int) -> bool
return get_upgrade_count(state, player) >= amount
def has_upgrades_percentage(state: CollectionState, world: "RLWorld", percentage: float) -> bool:
return has_upgrade_amount(state, world.player, round(get_upgrade_total(world) * (percentage / 100)))
def has_upgrades_percentage(state: CollectionState, player: int, percentage: float) -> bool:
return has_upgrade_amount(state, player, round(get_upgrade_total(state.multiworld, player) * (percentage / 100)))
def has_movement_rune(state: CollectionState, player: int) -> bool:
@@ -51,15 +47,15 @@ def has_defeated_dungeon(state: CollectionState, player: int) -> bool:
return state.has("Defeat Herodotus", player) or state.has("Defeat Astrodotus", player)
def set_rules(world: "RLWorld", player: int):
def set_rules(multiworld: MultiWorld, player: int):
# If 'vendors' are 'normal', then expect it to show up in the first half(ish) of the spheres.
if world.options.vendors == "normal":
world.get_location("Forest Abkhazia Boss Reward").access_rule = \
if multiworld.vendors[player] == "normal":
multiworld.get_location("Forest Abkhazia Boss Reward", player).access_rule = \
lambda state: has_vendors(state, player)
# Gate each manor location so everything isn't dumped into sphere 1.
manor_rules = {
"Defeat Khidr" if world.options.khidr == "vanilla" else "Defeat Neo Khidr": [
"Defeat Khidr" if multiworld.khidr[player] == "vanilla" else "Defeat Neo Khidr": [
"Manor - Left Wing Window",
"Manor - Left Wing Rooftop",
"Manor - Right Wing Window",
@@ -70,7 +66,7 @@ def set_rules(world: "RLWorld", player: int):
"Manor - Left Tree 2",
"Manor - Right Tree",
],
"Defeat Alexander" if world.options.alexander == "vanilla" else "Defeat Alexander IV": [
"Defeat Alexander" if multiworld.alexander[player] == "vanilla" else "Defeat Alexander IV": [
"Manor - Left Big Upper 1",
"Manor - Left Big Upper 2",
"Manor - Left Big Windows",
@@ -82,7 +78,7 @@ def set_rules(world: "RLWorld", player: int):
"Manor - Right Big Rooftop",
"Manor - Right Extension",
],
"Defeat Ponce de Leon" if world.options.leon == "vanilla" else "Defeat Ponce de Freon": [
"Defeat Ponce de Leon" if multiworld.leon[player] == "vanilla" else "Defeat Ponce de Freon": [
"Manor - Right High Base",
"Manor - Right High Upper",
"Manor - Right High Tower",
@@ -94,24 +90,24 @@ def set_rules(world: "RLWorld", player: int):
# Set rules for manor locations.
for event, locations in manor_rules.items():
for location in locations:
world.get_location(location).access_rule = lambda state: state.has(event, player)
multiworld.get_location(location, player).access_rule = lambda state: state.has(event, player)
# Set rules for fairy chests to decrease headache of expectation to find non-movement fairy chests.
for fairy_location in [location for location in world.multiworld.get_locations(player) if "Fairy" in location.name]:
for fairy_location in [location for location in multiworld.get_locations(player) if "Fairy" in location.name]:
fairy_location.access_rule = lambda state: has_fairy_progression(state, player)
# Region rules.
world.get_entrance("Forest Abkhazia").access_rule = \
lambda state: has_upgrades_percentage(state, world, 12.5) and has_defeated_castle(state, player)
multiworld.get_entrance("Forest Abkhazia", player).access_rule = \
lambda state: has_upgrades_percentage(state, player, 12.5) and has_defeated_castle(state, player)
world.get_entrance("The Maya").access_rule = \
lambda state: has_upgrades_percentage(state, world, 25) and has_defeated_forest(state, player)
multiworld.get_entrance("The Maya", player).access_rule = \
lambda state: has_upgrades_percentage(state, player, 25) and has_defeated_forest(state, player)
world.get_entrance("Land of Darkness").access_rule = \
lambda state: has_upgrades_percentage(state, world, 37.5) and has_defeated_tower(state, player)
multiworld.get_entrance("Land of Darkness", player).access_rule = \
lambda state: has_upgrades_percentage(state, player, 37.5) and has_defeated_tower(state, player)
world.get_entrance("The Fountain Room").access_rule = \
lambda state: has_upgrades_percentage(state, world, 50) and has_defeated_dungeon(state, player)
multiworld.get_entrance("The Fountain Room", player).access_rule = \
lambda state: has_upgrades_percentage(state, player, 50) and has_defeated_dungeon(state, player)
# Win condition.
world.multiworld.completion_condition[player] = lambda state: state.has("Defeat The Fountain", player)
multiworld.completion_condition[player] = lambda state: state.has("Defeat The Fountain", player)

View File

@@ -4,7 +4,7 @@ from BaseClasses import Tutorial
from worlds.AutoWorld import WebWorld, World
from .Items import RLItem, RLItemData, event_item_table, get_items_by_category, item_table
from .Locations import RLLocation, location_table
from .Options import RLOptions
from .Options import rl_options
from .Presets import rl_options_presets
from .Regions import create_regions
from .Rules import set_rules
@@ -33,17 +33,20 @@ class RLWorld(World):
But that's OK, because no one is perfect, and you don't have to be to succeed.
"""
game = "Rogue Legacy"
options_dataclass = RLOptions
options: RLOptions
option_definitions = rl_options
topology_present = True
required_client_version = (0, 3, 5)
web = RLWeb()
item_name_to_id = {name: data.code for name, data in item_table.items() if data.code is not None}
location_name_to_id = {name: data.code for name, data in location_table.items() if data.code is not None}
item_name_to_id = {name: data.code for name, data in item_table.items()}
location_name_to_id = {name: data.code for name, data in location_table.items()}
# TODO: Replace calls to this function with "options-dict", once that PR is completed and merged.
def get_setting(self, name: str):
return getattr(self.multiworld, name)[self.player]
def fill_slot_data(self) -> dict:
return self.options.as_dict(*[name for name in self.options_dataclass.type_hints.keys()])
return {option_name: self.get_setting(option_name).value for option_name in rl_options}
def generate_early(self):
location_ids_used_per_game = {
@@ -71,18 +74,18 @@ class RLWorld(World):
)
# Check validation of names.
additional_lady_names = len(self.options.additional_lady_names.value)
additional_sir_names = len(self.options.additional_sir_names.value)
if not self.options.allow_default_names:
if additional_lady_names < int(self.options.number_of_children):
additional_lady_names = len(self.get_setting("additional_lady_names").value)
additional_sir_names = len(self.get_setting("additional_sir_names").value)
if not self.get_setting("allow_default_names"):
if additional_lady_names < int(self.get_setting("number_of_children")):
raise Exception(
f"allow_default_names is off, but not enough names are defined in additional_lady_names. "
f"Expected {int(self.options.number_of_children)}, Got {additional_lady_names}")
f"Expected {int(self.get_setting('number_of_children'))}, Got {additional_lady_names}")
if additional_sir_names < int(self.options.number_of_children):
if additional_sir_names < int(self.get_setting("number_of_children")):
raise Exception(
f"allow_default_names is off, but not enough names are defined in additional_sir_names. "
f"Expected {int(self.options.number_of_children)}, Got {additional_sir_names}")
f"Expected {int(self.get_setting('number_of_children'))}, Got {additional_sir_names}")
def create_items(self):
item_pool: List[RLItem] = []
@@ -92,110 +95,110 @@ class RLWorld(World):
# Architect
if name == "Architect":
if self.options.architect == "disabled":
if self.get_setting("architect") == "disabled":
continue
if self.options.architect == "start_unlocked":
if self.get_setting("architect") == "start_unlocked":
self.multiworld.push_precollected(self.create_item(name))
continue
if self.options.architect == "early":
if self.get_setting("architect") == "early":
self.multiworld.local_early_items[self.player]["Architect"] = 1
# Blacksmith and Enchantress
if name == "Blacksmith" or name == "Enchantress":
if self.options.vendors == "start_unlocked":
if self.get_setting("vendors") == "start_unlocked":
self.multiworld.push_precollected(self.create_item(name))
continue
if self.options.vendors == "early":
if self.get_setting("vendors") == "early":
self.multiworld.local_early_items[self.player]["Blacksmith"] = 1
self.multiworld.local_early_items[self.player]["Enchantress"] = 1
# Haggling
if name == "Haggling" and self.options.disable_charon:
if name == "Haggling" and self.get_setting("disable_charon"):
continue
# Blueprints
if data.category == "Blueprints":
# No progressive blueprints if progressive_blueprints are disabled.
if name == "Progressive Blueprints" and not self.options.progressive_blueprints:
if name == "Progressive Blueprints" and not self.get_setting("progressive_blueprints"):
continue
# No distinct blueprints if progressive_blueprints are enabled.
elif name != "Progressive Blueprints" and self.options.progressive_blueprints:
elif name != "Progressive Blueprints" and self.get_setting("progressive_blueprints"):
continue
# Classes
if data.category == "Classes":
if name == "Progressive Knights":
if "Knight" not in self.options.available_classes:
if "Knight" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "knight":
if self.get_setting("starting_class") == "knight":
quantity = 1
if name == "Progressive Mages":
if "Mage" not in self.options.available_classes:
if "Mage" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "mage":
if self.get_setting("starting_class") == "mage":
quantity = 1
if name == "Progressive Barbarians":
if "Barbarian" not in self.options.available_classes:
if "Barbarian" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "barbarian":
if self.get_setting("starting_class") == "barbarian":
quantity = 1
if name == "Progressive Knaves":
if "Knave" not in self.options.available_classes:
if "Knave" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "knave":
if self.get_setting("starting_class") == "knave":
quantity = 1
if name == "Progressive Miners":
if "Miner" not in self.options.available_classes:
if "Miner" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "miner":
if self.get_setting("starting_class") == "miner":
quantity = 1
if name == "Progressive Shinobis":
if "Shinobi" not in self.options.available_classes:
if "Shinobi" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "shinobi":
if self.get_setting("starting_class") == "shinobi":
quantity = 1
if name == "Progressive Liches":
if "Lich" not in self.options.available_classes:
if "Lich" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "lich":
if self.get_setting("starting_class") == "lich":
quantity = 1
if name == "Progressive Spellthieves":
if "Spellthief" not in self.options.available_classes:
if "Spellthief" not in self.get_setting("available_classes"):
continue
if self.options.starting_class == "spellthief":
if self.get_setting("starting_class") == "spellthief":
quantity = 1
if name == "Dragons":
if "Dragon" not in self.options.available_classes:
if "Dragon" not in self.get_setting("available_classes"):
continue
if name == "Traitors":
if "Traitor" not in self.options.available_classes:
if "Traitor" not in self.get_setting("available_classes"):
continue
# Skills
if name == "Health Up":
quantity = self.options.health_pool.value
quantity = self.get_setting("health_pool")
elif name == "Mana Up":
quantity = self.options.mana_pool.value
quantity = self.get_setting("mana_pool")
elif name == "Attack Up":
quantity = self.options.attack_pool.value
quantity = self.get_setting("attack_pool")
elif name == "Magic Damage Up":
quantity = self.options.magic_damage_pool.value
quantity = self.get_setting("magic_damage_pool")
elif name == "Armor Up":
quantity = self.options.armor_pool.value
quantity = self.get_setting("armor_pool")
elif name == "Equip Up":
quantity = self.options.equip_pool.value
quantity = self.get_setting("equip_pool")
elif name == "Crit Chance Up":
quantity = self.options.crit_chance_pool.value
quantity = self.get_setting("crit_chance_pool")
elif name == "Crit Damage Up":
quantity = self.options.crit_damage_pool.value
quantity = self.get_setting("crit_damage_pool")
# Ignore filler, it will be added in a later stage.
if data.category == "Filler":
@@ -212,7 +215,7 @@ class RLWorld(World):
def get_filler_item_name(self) -> str:
fillers = get_items_by_category("Filler")
weights = [data.weight for data in fillers.values()]
return self.random.choices([filler for filler in fillers.keys()], weights, k=1)[0]
return self.multiworld.random.choices([filler for filler in fillers.keys()], weights, k=1)[0]
def create_item(self, name: str) -> RLItem:
data = item_table[name]
@@ -223,10 +226,10 @@ class RLWorld(World):
return RLItem(name, data.classification, data.code, self.player)
def set_rules(self):
set_rules(self, self.player)
set_rules(self.multiworld, self.player)
def create_regions(self):
create_regions(self)
create_regions(self.multiworld, self.player)
self._place_events()
def _place_events(self):
@@ -235,7 +238,7 @@ class RLWorld(World):
self.create_event("Defeat The Fountain"))
# Khidr / Neo Khidr
if self.options.khidr == "vanilla":
if self.get_setting("khidr") == "vanilla":
self.multiworld.get_location("Castle Hamson Boss Room", self.player).place_locked_item(
self.create_event("Defeat Khidr"))
else:
@@ -243,7 +246,7 @@ class RLWorld(World):
self.create_event("Defeat Neo Khidr"))
# Alexander / Alexander IV
if self.options.alexander == "vanilla":
if self.get_setting("alexander") == "vanilla":
self.multiworld.get_location("Forest Abkhazia Boss Room", self.player).place_locked_item(
self.create_event("Defeat Alexander"))
else:
@@ -251,7 +254,7 @@ class RLWorld(World):
self.create_event("Defeat Alexander IV"))
# Ponce de Leon / Ponce de Freon
if self.options.leon == "vanilla":
if self.get_setting("leon") == "vanilla":
self.multiworld.get_location("The Maya Boss Room", self.player).place_locked_item(
self.create_event("Defeat Ponce de Leon"))
else:
@@ -259,7 +262,7 @@ class RLWorld(World):
self.create_event("Defeat Ponce de Freon"))
# Herodotus / Astrodotus
if self.options.herodotus == "vanilla":
if self.get_setting("herodotus") == "vanilla":
self.multiworld.get_location("Land of Darkness Boss Room", self.player).place_locked_item(
self.create_event("Defeat Herodotus"))
else:

View File

@@ -1,4 +1,4 @@
from test.bases import WorldTestBase
from test.TestBase import WorldTestBase
class RLTestBase(WorldTestBase):

View File

@@ -1,4 +1,4 @@
# StarCraft 2
# Starcraft 2
## Game page in other languages:
* [Français](/games/Starcraft%202/info/fr)
@@ -7,11 +7,9 @@
The following unlocks are randomized as items:
1. Your ability to build any non-worker unit.
2. Unit specific upgrades including some combinations not available in the vanilla campaigns, such as both strain
choices simultaneously for Zerg and every Spear of Adun upgrade simultaneously for Protoss!
2. Unit specific upgrades including some combinations not available in the vanilla campaigns, such as both strain choices simultaneously for Zerg and every Spear of Adun upgrade simultaneously for Protoss!
3. Your ability to get the generic unit upgrades, such as attack and armour upgrades.
4. Other miscellaneous upgrades such as laboratory upgrades and mercenaries for Terran, Kerrigan levels and upgrades
for Zerg, and Spear of Adun upgrades for Protoss.
4. Other miscellaneous upgrades such as laboratory upgrades and mercenaries for Terran, Kerrigan levels and upgrades for Zerg, and Spear of Adun upgrades for Protoss.
5. Small boosts to your starting mineral, vespene gas, and supply totals on each mission.
You find items by making progress in these categories:
@@ -20,91 +18,50 @@ You find items by making progress in these categories:
* Reaching milestones in the mission, such as completing part of a main objective
* Completing challenges based on achievements in the base game, such as clearing all Zerg on Devil's Playground
In Archipelago's nomenclature, these are the locations where items can be found.
Each location, including mission completion, has a set of rules that specify the items required to access it.
These rules were designed assuming that StarCraft 2 is played on the Brutal difficulty.
Since each location has its own rule, it's possible that an item required for progression is in a mission where you
can't reach all of its locations or complete it.
However, mission completion is always required to gain access to new missions.
Aside from mission completion, the other location categories can be disabled in the player options.
For instance, you can disable getting items for reaching required milestones.
Except for mission completion, these categories can be disabled in the game's settings. For instance, you can disable getting items for reaching required milestones.
When you receive items, they will immediately become available, even during a mission, and you will be
notified via a text box in the top-right corner of the game screen.
Item unlocks are also logged in the Archipelago client.
notified via a text box in the top-right corner of the game screen. Item unlocks are also logged in the Archipelago client.
Missions are launched through the StarCraft 2 Archipelago client, through the StarCraft 2 Launcher tab.
The between mission segments on the Hyperion, the Leviathan, and the Spear of Adun are not included.
Additionally, metaprogression currencies such as credits and Solarite are not used.
Missions are launched through the Starcraft 2 Archipelago client, through the Starcraft 2 Launcher tab. The between mission segments on the Hyperion, the Leviathan, and the Spear of Adun are not included. Additionally, metaprogression currencies such as credits and Solarite are not used.
## What is the goal of this game when randomized?
The goal is to beat the final mission in the mission order.
The yaml configuration file controls the mission order (e.g. blitz, grid, etc.), which combination of the four
StarCraft 2 campaigns can be used to populate the mission order and how missions are shuffled.
Since the first two options determine the number of missions in a StarCraft 2 world, they can be used to customize the
expected time to complete the world.
Note that the evolution missions from Heart of the Swarm are not included in the randomizer.
The goal is to beat the final mission in the mission order. The yaml configuration file controls the mission order and how missions are shuffled.
## What non-randomized changes are there from vanilla StarCraft 2?
## What non-randomized changes are there from vanilla Starcraft 2?
1. Some missions have more vespene geysers available to allow a wider variety of units.
2. Many new units and upgrades have been added as items, coming from co-op, melee, later campaigns, later expansions,
brood war, and original ideas.
3. Higher-tech production structures, including Factories, Starports, Robotics Facilities, and Stargates, no longer
have tech requirements.
2. Many new units and upgrades have been added as items, coming from co-op, melee, later campaigns, later expansions, brood war, and original ideas.
3. Higher-tech production structures, including Factories, Starports, Robotics Facilities, and Stargates, no longer have tech requirements.
4. Zerg missions have been adjusted to give the player a starting Lair where they would only have Hatcheries.
5. Upgrades with a downside have had the downside removed, such as automated refineries costing more or tech reactors
taking longer to build.
6. Unit collision within the vents in Enemy Within has been adjusted to allow larger units to travel through them
without getting stuck in odd places.
5. Upgrades with a downside have had the downside removed, such as automated refineries costing more or tech reactors taking longer to build.
6. Unit collision within the vents in Enemy Within has been adjusted to allow larger units to travel through them without getting stuck in odd places.
7. Several vanilla bugs have been fixed.
## Which of my items can be in another player's world?
By default, any of StarCraft 2's items (specified above) can be in another player's world.
See the [Advanced YAML Guide](/tutorial/Archipelago/advanced_settings/en) for more information on how to change this.
By default, any of StarCraft 2's items (specified above) can be in another player's world. See the
[Advanced YAML Guide](/tutorial/Archipelago/advanced_settings/en)
for more information on how to change this.
## Unique Local Commands
The following commands are only available when using the StarCraft 2 Client to play with Archipelago.
You can list them any time in the client with `/help`.
The following commands are only available when using the Starcraft 2 Client to play with Archipelago. You can list them any time in the client with `/help`.
* `/download_data` Download the most recent release of the necessary files for playing SC2 with Archipelago.
Will overwrite existing files
* `/download_data` Download the most recent release of the necessary files for playing SC2 with Archipelago. Will overwrite existing files
* `/difficulty [difficulty]` Overrides the difficulty set for the world.
* Options: casual, normal, hard, brutal
* `/game_speed [game_speed]` Overrides the game speed for the world
* Options: default, slower, slow, normal, fast, faster
* `/color [faction] [color]` Changes your color for one of your playable factions.
* Faction options: raynor, kerrigan, primal, protoss, nova
* Color options: white, red, blue, teal, purple, yellow, orange, green, lightpink, violet, lightgrey, darkgreen,
brown, lightgreen, darkgrey, pink, rainbow, random, default
* Color options: white, red, blue, teal, purple, yellow, orange, green, lightpink, violet, lightgrey, darkgreen, brown, lightgreen, darkgrey, pink, rainbow, random, default
* `/option [option_name] [option_value]` Sets an option normally controlled by your yaml after generation.
* Run without arguments to list all options.
* Options pertain to automatic cutscene skipping, Kerrigan presence, Spear of Adun presence, starting resource
amounts, controlling AI allies, etc.
* `/disable_mission_check` Disables the check to see if a mission is available to play.
Meant for co-op runs where one player can play the next mission in a chain the other player is doing.
* `/play [mission_id]` Starts a StarCraft 2 mission based off of the mission_id provided
* Options pertain to automatic cutscene skipping, Kerrigan presence, Spear of Adun presence, starting resource amounts, controlling AI allies, etc.
* `/disable_mission_check` Disables the check to see if a mission is available to play. Meant for co-op runs where one player can play the next mission in a chain the other player is doing.
* `/play [mission_id]` Starts a Starcraft 2 mission based off of the mission_id provided
* `/available` Get what missions are currently available to play
* `/unfinished` Get what missions are currently available to play and have not had all locations checked
* `/set_path [path]` Manually set the SC2 install directory (if the automatic detection fails)
Note that the behavior of the command `/received` was modified in the StarCraft 2 client.
In the Common client of Archipelago, the command returns the list of items received in the reverse order they were
received.
In the StarCraft 2 client, the returned list will be divided by races (i.e., Any, Protoss, Terran, and Zerg).
Additionally, upgrades are grouped beneath their corresponding units or buildings.
A filter parameter can be provided, e.g., `/received Thor`, to limit the number of items shown.
Every item whose name, race, or group name contains the provided parameter will be shown.
## Known issues
- StarCraft 2 Archipelago does not support loading a saved game.
For this reason, it is recommended to play on a difficulty level lower than what you are normally comfortable with.
- StarCraft 2 Archipelago does not support the restart of a mission from the StarCraft 2 menu.
To restart a mission, use the StarCraft 2 Client.
- A crash report is often generated when a mission is closed.
This does not affect the game and can be ignored.

View File

@@ -21,14 +21,6 @@ Les *items* sont trouvés en accomplissant du progrès dans les catégories suiv
* Réussir des défis basés sur les succès du jeu de base, e.g. éliminer tous les *Zerg* dans la mission
*Devil's Playground*
Dans la nomenclature d'Archipelago, il s'agit des *locations* où l'on peut trouver des *items*.
Pour chaque *location*, incluant le fait de terminer une mission, il y a des règles qui définissent les *items*
nécessaires pour y accéder.
Ces règles ont été conçues en assumant que *StarCraft 2* est joué à la difficulté *Brutal*.
Étant donné que chaque *location* a ses propres règles, il est possible qu'un *item* nécessaire à la progression se
trouve dans une mission dont vous ne pouvez pas atteindre toutes les *locations* ou que vous ne pouvez pas terminer.
Cependant, il est toujours nécessaire de terminer une mission pour pouvoir accéder à de nouvelles missions.
Ces catégories, outre la première, peuvent être désactivées dans les options du jeu.
Par exemple, vous pouvez désactiver le fait d'obtenir des *items* lorsque des étapes importantes d'une mission sont
accomplies.
@@ -45,13 +37,8 @@ Archipelago*.
## Quel est le but de ce jeu quand il est *randomized*?
Le but est de réussir la mission finale du *mission order* (e.g. *blitz*, *grid*, etc.).
Le fichier de configuration yaml permet de spécifier le *mission order*, lesquelles des quatre campagnes de
*StarCraft 2* peuvent être utilisées pour remplir le *mission order* et comment les missions sont distribuées dans le
*mission order*.
Étant donné que les deux premières options déterminent le nombre de missions dans un monde de *StarCraft 2*, elles
peuvent être utilisées pour moduler le temps nécessaire pour terminer le monde.
Notez que les missions d'évolution de Heart of the Swarm ne sont pas incluses dans le *randomizer*.
Le but est de réussir la mission finale dans la disposition des missions (e.g. *blitz*, *grid*, etc.).
Les choix faits dans le fichier *yaml* définissent la disposition des missions et comment elles sont mélangées.
## Quelles sont les modifications non aléatoires comparativement à la version de base de *StarCraft 2*
@@ -106,20 +93,3 @@ mission de la chaîne qu'un autre joueur est en train d'entamer.
l'accès à un *item* n'ont pas été accomplis.
* `/set_path [path]` Permet de définir manuellement où *StarCraft 2* est installé ce qui est pertinent seulement si la
détection automatique de cette dernière échoue.
Notez que le comportement de la commande `/received` a été modifié dans le client *StarCraft 2*.
Dans le client *Common* d'Archipelago, elle renvoie la liste des *items* reçus dans l'ordre inverse de leur réception.
Dans le client de *StarCraft 2*, la liste est divisée par races (i.e., *Any*, *Protoss*, *Terran*, et *Zerg*).
De plus, les améliorations sont regroupées sous leurs unités/bâtiments correspondants.
Un paramètre de filtrage peut aussi être fourni, e.g., `/received Thor`, pour limiter le nombre d'*items* affichés.
Tous les *items* dont le nom, la race ou le nom de groupe contient le paramètre fourni seront affichés.
## Problèmes connus
- *StarCraft 2 Archipelago* ne supporte pas le chargement d'une sauvegarde.
Pour cette raison, il est recommandé de jouer à un niveau de difficulté inférieur à celui avec lequel vous êtes
normalement à l'aise.
- *StarCraft 2 Archipelago* ne supporte pas le redémarrage d'une mission depuis le menu de *StarCraft 2*.
Pour redémarrer une mission, utilisez le client de *StarCraft 2 Archipelago*.
- Un rapport d'erreur est souvent généré lorsqu'une mission est fermée.
Cela n'affecte pas le jeu et peut être ignoré.

View File

@@ -1,39 +1,30 @@
# StarCraft 2 Randomizer Setup Guide
This guide contains instructions on how to install and troubleshoot the StarCraft 2 Archipelago client, as well as
where to obtain a config file for StarCraft 2.
This guide contains instructions on how to install and troubleshoot the StarCraft 2 Archipelago client, as well as where
to obtain a config file for StarCraft 2.
## Required Software
- [StarCraft 2](https://starcraft2.com/en-us/)
- While StarCraft 2 Archipelago supports all four campaigns, they are not mandatory to play the randomizer.
If you do not own certain campaigns, you only need to exclude them in the configuration file of your world.
- [The most recent Archipelago release](https://github.com/ArchipelagoMW/Archipelago/releases)
## How do I install this randomizer?
1. Install StarCraft 2 and Archipelago using the links above. The StarCraft 2 Archipelago client is downloaded by the
Archipelago installer.
1. Install StarCraft 2 and Archipelago using the links above. The StarCraft 2 Archipelago client is downloaded by the Archipelago installer.
- Linux users should also follow the instructions found at the bottom of this page
(["Running in Linux"](#running-in-linux)).
2. Run ArchipelagoStarcraft2Client.exe.
- macOS users should instead follow the instructions found at ["Running in macOS"](#running-in-macos) for this step
only.
3. Type the command `/download_data`.
This will automatically install the Maps and Data files needed to play StarCraft 2 Archipelago.
- macOS users should instead follow the instructions found at ["Running in macOS"](#running-in-macos) for this step only.
3. Type the command `/download_data`. This will automatically install the Maps and Data files from the third link above.
## Where do I get a config file (aka "YAML") for this game?
Yaml files are configuration files that tell Archipelago how you'd like your game to be randomized, even if you're only
using default options.
Yaml files are configuration files that tell Archipelago how you'd like your game to be randomized, even if you're only using default options.
When you're setting up a multiworld, every world needs its own yaml file.
There are three basic ways to get a yaml:
* You can go to the [Player Options](/games/Starcraft%202/player-options) page, set your options in the GUI, and export
the yaml.
* You can generate a template, either by downloading it from the [Player Options](/games/Starcraft%202/player-options)
page or by generating it from the Launcher (`ArchipelagoLauncher.exe`).
The template includes descriptions of each option, you just have to edit it in your text editor of choice.
* You can go to the [Player Options](/games/Starcraft%202/player-options) page, set your options in the GUI, and export the yaml.
* You can generate a template, either by downloading it from the [Player Options](/games/Starcraft%202/player-options) page or by generating it from the Launcher (ArchipelagoLauncher.exe). The template includes descriptions of each option, you just have to edit it in your text editor of choice.
* You can ask someone else to share their yaml to use it for yourself or adjust it as you wish.
Remember the name you enter in the options page or in the yaml file, you'll need it to connect later!
@@ -45,31 +36,15 @@ Check out [Creating a YAML](/tutorial/Archipelago/setup/en#creating-a-yaml) for
The simplest way to check is to use the website [validator](/check).
You can also test it by attempting to generate a multiworld with your yaml. Save your yaml to the `Players/` folder
within your Archipelago installation and run `ArchipelagoGenerate.exe`.
You should see a new `.zip` file within the `output/` folder of your Archipelago installation if things worked
correctly.
It's advisable to run `ArchipelagoGenerate.exe` through a terminal so that you can see the printout, which will include
any errors and the precise output file name if it's successful.
If you don't like terminals, you can also check the log file in the `logs/` folder.
You can also test it by attempting to generate a multiworld with your yaml. Save your yaml to the Players/ folder within your Archipelago installation and run ArchipelagoGenerate.exe. You should see a new .zip file within the output/ folder of your Archipelago installation if things worked correctly. It's advisable to run ArchipelagoGenerate through a terminal so that you can see the printout, which will include any errors and the precise output file name if it's successful. If you don't like terminals, you can also check the log file in the logs/ folder.
#### What does Progression Balancing do?
For StarCraft 2, this option doesn't have much impact.
It is an Archipelago option designed to balance world progression by swapping items in spheres.
If the Progression Balancing of one world is greater than that of others, items in that world are more likely to be
obtained early, and vice versa if its value is smaller.
However, StarCraft 2 is more permissive regarding the items that can be used to progress, so this option has little
influence on progression in a StarCraft 2 world.
StarCraft 2.
Since this option increases the time required to generate a MultiWorld, we recommend deactivating it (i.e., setting it
to zero) for a StarCraft 2 world.
For Starcraft 2, not much. It's an Archipelago-wide option meant to shift required items earlier in the playthrough, but Starcraft 2 tends to be much more open in what items you can use. As such, this adjustment isn't very noticeable. It can also increase generation times, so we generally recommend turning it off.
#### How do I specify items in a list, like in excluded items?
You can look up the syntax for yaml collections in the
[YAML specification](https://yaml.org/spec/1.2.2/#21-collections).
For lists, every item goes on its own line, started with a hyphen:
You can look up the syntax for yaml collections in the [YAML specification](https://yaml.org/spec/1.2.2/#21-collections). For lists, every item goes on its own line, started with a hyphen:
```yaml
excluded_items:
@@ -77,13 +52,11 @@ excluded_items:
- Drop-Pods (Kerrigan Tier 7)
```
An empty list is just a matching pair of square brackets: `[]`.
That's the default value in the template, which should let you know to use this syntax.
An empty list is just a matching pair of square brackets: `[]`. That's the default value in the template, which should let you know to use this syntax.
#### How do I specify items for the starting inventory?
The starting inventory is a YAML mapping rather than a list, which associates an item with the amount you start with.
The syntax looks like the item name, followed by a colon, then a whitespace character, and then the value:
The starting inventory is a YAML mapping rather than a list, which associates an item with the amount you start with. The syntax looks like the item name, followed by a colon, then a whitespace character, and then the value:
```yaml
start_inventory:
@@ -91,61 +64,37 @@ start_inventory:
Additional Starting Vespene: 5
```
An empty mapping is just a matching pair of curly braces: `{}`.
That's the default value in the template, which should let you know to use this syntax.
An empty mapping is just a matching pair of curly braces: `{}`. That's the default value in the template, which should let you know to use this syntax.
#### How do I know the exact names of items and locations?
The [*datapackage*](/datapackage) page of the Archipelago website provides a complete list of the items and locations
for each game that it currently supports, including StarCraft 2.
The [*datapackage*](/datapackage) page of the Archipelago website provides a complete list of the items and locations for each game that it currently supports, including StarCraft 2.
You can also look up a complete list of the item names in the
[Icon Repository](https://matthewmarinets.github.io/ap_sc2_icons/) page.
You can also look up a complete list of the item names in the [Icon Repository](https://matthewmarinets.github.io/ap_sc2_icons/) page.
This page also contains supplementary information of each item.
However, the items shown in that page might differ from those shown in the datapackage page of Archipelago since the
former is generated, most of the time, from beta versions of StarCraft 2 Archipelago undergoing development.
However, the items shown in that page might differ from those shown in the datapackage page of Archipelago since the former is generated, most of the time, from beta versions of StarCraft 2 Archipelago undergoing development.
As for the locations, you can see all the locations associated to a mission in your world by placing your cursor over
the mission in the 'StarCraft 2 Launcher' tab in the client.
As for the locations, you can see all the locations associated to a mission in your world by placing your cursor over the mission in the 'StarCraft 2 Launcher' tab in the client.
## How do I join a MultiWorld game?
1. Run ArchipelagoStarcraft2Client.exe.
- macOS users should instead follow the instructions found at ["Running in macOS"](#running-in-macos) for this step
only.
- macOS users should instead follow the instructions found at ["Running in macOS"](#running-in-macos) for this step only.
2. Type `/connect [server ip]`.
- If you're running through the website, the server IP should be displayed near the top of the room page.
3. Type your slot name from your YAML when prompted.
4. If the server has a password, enter that when prompted.
5. Once connected, switch to the 'StarCraft 2 Launcher' tab in the client. There, you can see all the missions in your
world.
Unreachable missions will have greyed-out text. Just click on an available mission to start it!
5. Once connected, switch to the 'StarCraft 2 Launcher' tab in the client. There, you can see all the missions in your world. Unreachable missions will have greyed-out text. Just click on an available mission to start it!
## The game isn't launching when I try to start a mission.
First, check the log file for issues (stored at `[Archipelago Directory]/logs/SC2Client.txt`).
If you can't figure out the log file, visit our [Discord's](https://discord.com/invite/8Z65BR2) tech-support channel
for help.
Please include a specific description of what's going wrong and attach your log file to your message.
## My keyboard shortcuts profile is not available when I play *StarCraft 2 Archipelago*.
For your keyboard shortcuts profile to work in Archipelago, you need to copy your shortcuts file from
`Documents/StarCraft II/Accounts/######/Hotkeys` to `Documents/StarCraft II/Hotkeys`.
If the folder doesn't exist, create it.
To enable StarCraft 2 Archipelago to use your profile, follow these steps:
1. Launch StarCraft 2 via the Battle.net application.
2. Change your hotkey profile to the standard mode and accept.
3. Select your custom profile and accept.
You will only need to do this once.
First, check the log file for issues (stored at `[Archipelago Directory]/logs/SC2Client.txt`). If you can't figure out
the log file, visit our [Discord's](https://discord.com/invite/8Z65BR2) tech-support channel for help. Please include a
specific description of what's going wrong and attach your log file to your message.
## Running in macOS
To run StarCraft 2 through Archipelago in macOS, you will need to run the client via source as seen here:
[macOS Guide](/tutorial/Archipelago/mac/en).
Note: to launch the client, you will need to run the command `python3 Starcraft2Client.py`.
To run StarCraft 2 through Archipelago in macOS, you will need to run the client via source as seen here: [macOS Guide](/tutorial/Archipelago/mac/en). Note: to launch the client, you will need to run the command `python3 Starcraft2Client.py`.
## Running in Linux
@@ -153,9 +102,9 @@ To run StarCraft 2 through Archipelago in Linux, you will need to install the ga
of the Archipelago client.
Make sure you have StarCraft 2 installed using Wine, and that you have followed the
[installation procedures](#how-do-i-install-this-randomizer?) to add the Archipelago maps to the correct location.
You will not need to copy the `.dll` files.
If you're having trouble installing or running StarCraft 2 on Linux, it is recommend to use the Lutris installer.
[installation procedures](#how-do-i-install-this-randomizer?) to add the Archipelago maps to the correct location. You will not
need to copy the .dll files. If you're having trouble installing or running StarCraft 2 on Linux, I recommend using the
Lutris installer.
Copy the following into a .sh file, replacing the values of **WINE** and **SC2PATH** variables with the relevant
locations, as well as setting **PATH_TO_ARCHIPELAGO** to the directory containing the AppImage if it is not in the same
@@ -190,5 +139,5 @@ below, replacing **${ID}** with the numerical ID.
lutris lutris:rungameid/${ID} --output-script sc2.sh
This will get all of the relevant environment variables Lutris sets to run StarCraft 2 in a script, including the path
to the Wine binary that Lutris uses.
You can then remove the line that runs the Battle.Net launcher and copy the code above into the existing script.
to the Wine binary that Lutris uses. You can then remove the line that runs the Battle.Net launcher and copy the code
above into the existing script.

View File

@@ -6,10 +6,6 @@ indications pour obtenir un fichier de configuration de *StarCraft 2 Archipelago
## Logiciels requis
- [*StarCraft 2*](https://starcraft2.com/en-us/)
- Bien que *StarCraft 2 Archipelago* supporte les quatre campagnes, elles ne sont pas obligatoires pour jouer au
*randomizer*.
Si vous ne possédez pas certaines campagnes, il vous suffit de les exclure dans le fichier de configuration de
votre monde.
- [La version la plus récente d'Archipelago](https://github.com/ArchipelagoMW/Archipelago/releases)
## Comment est-ce que j'installe ce *randomizer*?
@@ -45,6 +41,10 @@ préférences.
Prenez soin de vous rappeler du nom de joueur que vous avez inscrit dans la page à options ou dans le fichier *yaml*
puisque vous en aurez besoin pour vous connecter à votre monde!
Notez que la page *Player options* ne permet pas de définir certaines des options avancées, e.g., l'exclusion de
certaines unités ou de leurs améliorations.
Utilisez la page [*Weighted Options*](/weighted-options) pour avoir accès à ces dernières.
Si vous désirez des informations et/ou instructions générales sur l'utilisation d'un fichier *yaml* pour Archipelago,
veuillez consulter [*Creating a YAML*](/tutorial/Archipelago/setup/en#creating-a-yaml).
@@ -66,15 +66,15 @@ dans le dossier `logs/`.
#### À quoi sert l'option *Progression Balancing*?
Pour *StarCraft 2*, cette option ne fait pas grand-chose.
Pour *Starcraft 2*, cette option ne fait pas grand-chose.
Il s'agit d'une option d'Archipelago permettant d'équilibrer la progression des mondes en interchangeant les *items*
dans les *spheres*.
Si le *Progression Balancing* d'un monde est plus grand que ceux des autres, les *items* de progression de ce monde ont
plus de chance d'être obtenus tôt et vice-versa si sa valeur est plus petite que celle des autres mondes.
Cependant, *StarCraft 2* est beaucoup plus permissif en termes d'*items* qui permettent de progresser, ce réglage à
Cependant, *Starcraft 2* est beaucoup plus permissif en termes d'*items* qui permettent de progresser, ce réglage à
donc peu d'influence sur la progression dans *StarCraft 2*.
Vu qu'il augmente le temps de génération d'un *MultiWorld*, nous recommandons de le désactiver, c-à-d le définir à
zéro, pour *StarCraft 2*.
zéro, pour *Starcraft 2*.
#### Comment est-ce que je définis une liste d'*items*, e.g. pour l'option *excluded items*?
@@ -122,10 +122,6 @@ Cependant, l'information présente dans cette dernière peut différer de celle
puisqu'elle est générée, habituellement, à partir de la version en développement de *StarCraft 2 Archipelago* qui
n'ont peut-être pas encore été inclus dans le site web d'Archipelago.
Pour ce qui concerne les *locations*, vous pouvez consulter tous les *locations* associés à une mission dans votre
monde en plaçant votre curseur sur la case correspondante dans l'onglet *StarCraft 2 Launcher* du client.
## Comment est-ce que je peux joindre un *MultiWorld*?
1. Exécuter `ArchipelagoStarcraft2Client.exe`.
@@ -156,7 +152,7 @@ qui se trouve dans `Documents/StarCraft II/Accounts/######/Hotkeys` vers `Docume
Si le dossier n'existe pas, créez-le.
Pour que *StarCraft 2 Archipelago* utilise votre profil, suivez les étapes suivantes.
Lancez *StarCraft 2* via l'application *Battle.net*.
Lancez *Starcraft 2* via l'application *Battle.net*.
Changez votre profil de raccourcis clavier pour le mode standard et acceptez, puis sélectionnez votre profil
personnalisé et acceptez.
Vous n'aurez besoin de faire ça qu'une seule fois.

View File

@@ -15,13 +15,13 @@ from .. import options
from ..data.harvest import HarvestCropSource
from ..mods.logic.magic_logic import MagicLogicMixin
from ..mods.logic.mod_skills_levels import get_mod_skill_levels
from ..stardew_rule import StardewRule, true_, True_, False_
from ..stardew_rule import StardewRule, True_, False_, true_, And
from ..strings.craftable_names import Fishing
from ..strings.machine_names import Machine
from ..strings.performance_names import Performance
from ..strings.quality_names import ForageQuality
from ..strings.region_names import Region
from ..strings.skill_names import Skill, all_mod_skills, all_vanilla_skills
from ..strings.skill_names import Skill, all_mod_skills
from ..strings.tool_names import ToolMaterial, Tool
from ..strings.wallet_item_names import Wallet
@@ -43,17 +43,22 @@ CombatLogicMixin, MagicLogicMixin, HarvestingLogicMixin]]):
if level <= 0:
return True_()
tool_level = min(4, (level - 1) // 2)
tool_level = (level - 1) // 2
tool_material = ToolMaterial.tiers[tool_level]
months = max(1, level - 1)
months_rule = self.logic.time.has_lived_months(months)
previous_level_rule = self.logic.skill.has_previous_level(skill, level)
if self.options.skill_progression != options.SkillProgression.option_vanilla:
previous_level_rule = self.logic.skill.has_level(skill, level - 1)
else:
previous_level_rule = true_
if skill == Skill.fishing:
xp_rule = self.logic.tool.has_fishing_rod(max(tool_level, 3))
elif skill == Skill.farming:
xp_rule = self.can_get_farming_xp & self.logic.tool.has_tool(Tool.hoe, tool_material) & self.logic.tool.can_water(tool_level)
elif skill == Skill.foraging:
xp_rule = (self.can_get_foraging_xp & self.logic.tool.has_tool(Tool.axe, tool_material)) | \
xp_rule = (self.can_get_foraging_xp & self.logic.tool.has_tool(Tool.axe, tool_material)) |\
self.logic.magic.can_use_clear_debris_instead_of_tool_level(tool_level)
elif skill == Skill.mining:
xp_rule = self.logic.tool.has_tool(Tool.pickaxe, tool_material) | \
@@ -65,34 +70,22 @@ CombatLogicMixin, MagicLogicMixin, HarvestingLogicMixin]]):
xp_rule = xp_rule & self.logic.region.can_reach(Region.mines_floor_5)
elif skill in all_mod_skills:
# Ideal solution would be to add a logic registry, but I'm too lazy.
return previous_level_rule & self.logic.mod.skill.can_earn_mod_skill_level(skill, level)
return previous_level_rule & months_rule & self.logic.mod.skill.can_earn_mod_skill_level(skill, level)
else:
raise Exception(f"Unknown skill: {skill}")
return previous_level_rule & xp_rule
return previous_level_rule & months_rule & xp_rule
# Should be cached
def has_level(self, skill: str, level: int) -> StardewRule:
assert level >= 0, f"There is no level before level 0."
if level == 0:
return true_
if level <= 0:
return True_()
if self.options.skill_progression == options.SkillProgression.option_vanilla:
return self.logic.skill.can_earn_level(skill, level)
return self.logic.received(f"{skill} Level", level)
def has_previous_level(self, skill: str, level: int) -> StardewRule:
assert level > 0, f"There is no level before level 0."
if level == 1:
return true_
if self.options.skill_progression == options.SkillProgression.option_vanilla:
months = max(1, level - 1)
return self.logic.time.has_lived_months(months)
return self.logic.received(f"{skill} Level", level - 1)
@cache_self1
def has_farming_level(self, level: int) -> StardewRule:
return self.logic.skill.has_level(Skill.farming, level)
@@ -115,9 +108,18 @@ CombatLogicMixin, MagicLogicMixin, HarvestingLogicMixin]]):
return rule_with_fishing
return self.logic.time.has_lived_months(months_with_4_skills) | rule_with_fishing
def has_any_skills_maxed(self, included_modded_skills: bool = True) -> StardewRule:
skills = self.content.skills.keys() if included_modded_skills else sorted(all_vanilla_skills)
return self.logic.or_(*(self.logic.skill.has_level(skill, 10) for skill in skills))
def has_all_skills_maxed(self, included_modded_skills: bool = True) -> StardewRule:
if self.options.skill_progression == options.SkillProgression.option_vanilla:
return self.has_total_level(50)
skills_items = vanilla_skill_items
if included_modded_skills:
skills_items += get_mod_skill_levels(self.options.mods)
return And(*[self.logic.received(skill, 10) for skill in skills_items])
def can_enter_mastery_cave(self) -> StardewRule:
if self.options.skill_progression == options.SkillProgression.option_progressive_with_masteries:
return self.logic.received(Wallet.mastery_of_the_five_ways)
return self.has_all_skills_maxed()
@cached_property
def can_get_farming_xp(self) -> StardewRule:
@@ -195,19 +197,13 @@ CombatLogicMixin, MagicLogicMixin, HarvestingLogicMixin]]):
return self.has_level(Skill.foraging, 9)
return False_()
def can_earn_mastery(self, skill: str) -> StardewRule:
# Checking for level 11, so it includes having level 10 and being able to earn xp.
return self.logic.skill.can_earn_level(skill, 11) & self.logic.region.can_reach(Region.mastery_cave)
@cached_property
def can_earn_mastery_experience(self) -> StardewRule:
if self.options.skill_progression != options.SkillProgression.option_progressive_with_masteries:
return self.has_all_skills_maxed() & self.logic.time.has_lived_max_months
return self.logic.time.has_lived_max_months
def has_mastery(self, skill: str) -> StardewRule:
if self.options.skill_progression == options.SkillProgression.option_progressive_with_masteries:
return self.logic.received(f"{skill} Mastery")
return self.logic.skill.can_earn_mastery(skill)
@cached_property
def can_enter_mastery_cave(self) -> StardewRule:
if self.options.skill_progression == options.SkillProgression.option_progressive_with_masteries:
return self.logic.received(Wallet.mastery_of_the_five_ways)
return self.has_any_skills_maxed(included_modded_skills=False)
if self.options.skill_progression != options.SkillProgression.option_progressive_with_masteries:
return self.can_earn_mastery_experience and self.logic.region.can_reach(Region.mastery_cave)
return self.logic.received(f"{skill} Mastery")

View File

@@ -154,7 +154,7 @@ def set_bundle_rules(bundle_rooms: List[BundleRoom], logic: StardewLogic, multiw
extra_raccoons = extra_raccoons + num
bundle_rules = logic.received(CommunityUpgrade.raccoon, extra_raccoons) & bundle_rules
if num > 1:
previous_bundle_name = f"Raccoon Request {num - 1}"
previous_bundle_name = f"Raccoon Request {num-1}"
bundle_rules = bundle_rules & logic.region.can_reach_location(previous_bundle_name)
room_rules.append(bundle_rules)
MultiWorldRules.set_rule(location, bundle_rules)
@@ -168,16 +168,13 @@ def set_skills_rules(logic: StardewLogic, multiworld, player, world_options: Sta
mods = world_options.mods
if world_options.skill_progression == SkillProgression.option_vanilla:
return
for i in range(1, 11):
set_vanilla_skill_rule_for_level(logic, multiworld, player, i)
set_modded_skill_rule_for_level(logic, multiworld, player, mods, i)
if world_options.skill_progression == SkillProgression.option_progressive:
if world_options.skill_progression != SkillProgression.option_progressive_with_masteries:
return
for skill in [Skill.farming, Skill.fishing, Skill.foraging, Skill.mining, Skill.combat]:
MultiWorldRules.set_rule(multiworld.get_location(f"{skill} Mastery", player), logic.skill.can_earn_mastery(skill))
MultiWorldRules.set_rule(multiworld.get_location(f"{skill} Mastery", player), logic.skill.can_earn_mastery_experience)
def set_vanilla_skill_rule_for_level(logic: StardewLogic, multiworld, player, level: int):
@@ -259,7 +256,8 @@ def set_entrance_rules(logic: StardewLogic, multiworld, player, world_options: S
set_entrance_rule(multiworld, player, LogicEntrance.farmhouse_cooking, logic.cooking.can_cook_in_kitchen)
set_entrance_rule(multiworld, player, LogicEntrance.shipping, logic.shipping.can_use_shipping_bin)
set_entrance_rule(multiworld, player, LogicEntrance.watch_queen_of_sauce, logic.action.can_watch(Channel.queen_of_sauce))
set_entrance_rule(multiworld, player, Entrance.forest_to_mastery_cave, logic.skill.can_enter_mastery_cave)
set_entrance_rule(multiworld, player, Entrance.forest_to_mastery_cave, logic.skill.can_enter_mastery_cave())
set_entrance_rule(multiworld, player, Entrance.forest_to_mastery_cave, logic.skill.can_enter_mastery_cave())
set_entrance_rule(multiworld, player, LogicEntrance.buy_experience_books, logic.time.has_lived_months(2))
set_entrance_rule(multiworld, player, LogicEntrance.buy_year1_books, logic.time.has_year_two)
set_entrance_rule(multiworld, player, LogicEntrance.buy_year3_books, logic.time.has_year_three)

View File

@@ -85,7 +85,7 @@ def allsanity_no_mods_6_x_x():
options.QuestLocations.internal_name: 56,
options.SeasonRandomization.internal_name: options.SeasonRandomization.option_randomized,
options.Shipsanity.internal_name: options.Shipsanity.option_everything,
options.SkillProgression.internal_name: options.SkillProgression.option_progressive_with_masteries,
options.SkillProgression.internal_name: options.SkillProgression.option_progressive,
options.SpecialOrderLocations.internal_name: options.SpecialOrderLocations.option_board_qi,
options.ToolProgression.internal_name: options.ToolProgression.option_progressive,
options.TrapItems.internal_name: options.TrapItems.option_nightmare,
@@ -310,12 +310,6 @@ class SVTestBase(RuleAssertMixin, WorldTestBase, SVTestCase):
self.multiworld.worlds[self.player].total_progression_items -= 1
return created_item
def remove_one_by_name(self, item: str) -> None:
self.remove(self.create_item(item))
def reset_collection_state(self):
self.multiworld.state = self.original_state.copy()
pre_generated_worlds = {}

View File

@@ -1,30 +1,23 @@
from ... import HasProgressionPercent, StardewLogic
from ... import HasProgressionPercent
from ...options import ToolProgression, SkillProgression, Mods
from ...strings.skill_names import all_skills, all_vanilla_skills, Skill
from ...strings.skill_names import all_skills
from ...test import SVTestBase
class TestSkillProgressionVanilla(SVTestBase):
class TestVanillaSkillLogicSimplification(SVTestBase):
options = {
SkillProgression.internal_name: SkillProgression.option_vanilla,
ToolProgression.internal_name: ToolProgression.option_progressive,
}
def test_skill_logic_has_level_only_uses_one_has_progression_percent(self):
rule = self.multiworld.worlds[1].logic.skill.has_level(Skill.farming, 8)
self.assertEqual(1, sum(1 for i in rule.current_rules if type(i) is HasProgressionPercent))
def test_has_mastery_requires_month_equivalent_to_10_levels(self):
logic: StardewLogic = self.multiworld.worlds[1].logic
rule = logic.skill.has_mastery(Skill.farming)
time_rule = logic.time.has_lived_months(10)
self.assertIn(time_rule, rule.current_rules)
rule = self.multiworld.worlds[1].logic.skill.has_level("Farming", 8)
self.assertEqual(1, sum(1 for i in rule.current_rules if type(i) == HasProgressionPercent))
class TestSkillProgressionProgressive(SVTestBase):
class TestAllSkillsRequirePrevious(SVTestBase):
options = {
SkillProgression.internal_name: SkillProgression.option_progressive,
SkillProgression.internal_name: SkillProgression.option_progressive_with_masteries,
Mods.internal_name: frozenset(Mods.valid_keys),
}
@@ -32,82 +25,16 @@ class TestSkillProgressionProgressive(SVTestBase):
for skill in all_skills:
self.collect_everything()
self.remove_by_name(f"{skill} Level")
for level in range(1, 11):
location_name = f"Level {level} {skill}"
location = self.multiworld.get_location(location_name, self.player)
with self.subTest(location_name):
can_reach = self.can_reach_location(location_name)
if level > 1:
self.assert_reach_location_false(location, self.multiworld.state)
self.assertFalse(can_reach)
self.collect(f"{skill} Level")
self.assert_reach_location_true(location, self.multiworld.state)
self.reset_collection_state()
def test_has_level_requires_exact_amount_of_levels(self):
logic: StardewLogic = self.multiworld.worlds[1].logic
rule = logic.skill.has_level(Skill.farming, 8)
level_rule = logic.received("Farming Level", 8)
self.assertEqual(level_rule, rule)
def test_has_previous_level_requires_one_less_level_than_requested(self):
logic: StardewLogic = self.multiworld.worlds[1].logic
rule = logic.skill.has_previous_level(Skill.farming, 8)
level_rule = logic.received("Farming Level", 7)
self.assertEqual(level_rule, rule)
def test_has_mastery_requires_10_levels(self):
logic: StardewLogic = self.multiworld.worlds[1].logic
rule = logic.skill.has_mastery(Skill.farming)
level_rule = logic.received("Farming Level", 10)
self.assertIn(level_rule, rule.current_rules)
can_reach = self.can_reach_location(location_name)
self.assertTrue(can_reach)
self.multiworld.state = self.original_state.copy()
class TestSkillProgressionProgressiveWithMasteryWithoutMods(SVTestBase):
options = {
SkillProgression.internal_name: SkillProgression.option_progressive_with_masteries,
ToolProgression.internal_name: ToolProgression.option_progressive,
Mods.internal_name: frozenset(),
}
def test_has_mastery_requires_the_item(self):
logic: StardewLogic = self.multiworld.worlds[1].logic
rule = logic.skill.has_mastery(Skill.farming)
received_mastery = logic.received("Farming Mastery")
self.assertEqual(received_mastery, rule)
def test_given_all_levels_when_can_earn_mastery_then_can_earn_mastery(self):
self.collect_everything()
for skill in all_vanilla_skills:
with self.subTest(skill):
location = self.multiworld.get_location(f"{skill} Mastery", self.player)
self.assert_reach_location_true(location, self.multiworld.state)
self.reset_collection_state()
def test_given_one_level_missing_when_can_earn_mastery_then_cannot_earn_mastery(self):
for skill in all_vanilla_skills:
with self.subTest(skill):
self.collect_everything()
self.remove_one_by_name(f"{skill} Level")
location = self.multiworld.get_location(f"{skill} Mastery", self.player)
self.assert_reach_location_false(location, self.multiworld.state)
self.reset_collection_state()
def test_given_one_tool_missing_when_can_earn_mastery_then_cannot_earn_mastery(self):
self.collect_everything()
self.remove_one_by_name(f"Progressive Pickaxe")
location = self.multiworld.get_location("Mining Mastery", self.player)
self.assert_reach_location_false(location, self.multiworld.state)
self.reset_collection_state()

View File

@@ -45,7 +45,7 @@ class SubnauticaWorld(World):
options_dataclass = options.SubnauticaOptions
options: options.SubnauticaOptions
required_client_version = (0, 5, 0)
origin_region_name = "Planet 4546B"
creatures_to_scan: List[str]
def generate_early(self) -> None:
@@ -66,9 +66,13 @@ class SubnauticaWorld(World):
creature_pool, self.options.creature_scans.value)
def create_regions(self):
# Create Region
# Create Regions
menu_region = Region("Menu", self.player, self.multiworld)
planet_region = Region("Planet 4546B", self.player, self.multiworld)
# Link regions together
menu_region.connect(planet_region, "Lifepod 5")
# Create regular locations
location_names = itertools.chain((location["name"] for location in locations.location_table.values()),
(creature + creatures.suffix for creature in self.creatures_to_scan))
@@ -89,8 +93,11 @@ class SubnauticaWorld(World):
# make the goal event the victory "item"
location.item.name = "Victory"
# Register region to multiworld
self.multiworld.regions.append(planet_region)
# Register regions to multiworld
self.multiworld.regions += [
menu_region,
planet_region
]
# refer to rules.py
set_rules = set_rules

View File

@@ -7,9 +7,8 @@ from .rules import set_location_rules, set_region_rules, randomize_ability_unloc
from .er_rules import set_er_location_rules
from .regions import tunic_regions
from .er_scripts import create_er_regions
from .er_data import portal_mapping, RegionInfo, tunic_er_regions
from .options import (TunicOptions, EntranceRando, tunic_option_groups, tunic_option_presets, TunicPlandoConnections,
LaurelsLocation, LogicRules, LaurelsZips, IceGrappling, LadderStorage)
from .er_data import portal_mapping
from .options import TunicOptions, EntranceRando, tunic_option_groups, tunic_option_presets, TunicPlandoConnections
from worlds.AutoWorld import WebWorld, World
from Options import PlandoConnection
from decimal import Decimal, ROUND_HALF_UP
@@ -49,12 +48,10 @@ class TunicLocation(Location):
class SeedGroup(TypedDict):
laurels_zips: bool # laurels_zips value
ice_grappling: int # ice_grappling value
ladder_storage: int # ls value
logic_rules: int # logic rules value
laurels_at_10_fairies: bool # laurels location value
fixed_shop: bool # fixed shop value
plando: TunicPlandoConnections # consolidated plando connections for the seed group
plando: TunicPlandoConnections # consolidated of plando connections for the seed group
class TunicWorld(World):
@@ -80,17 +77,8 @@ class TunicWorld(World):
tunic_portal_pairs: Dict[str, str]
er_portal_hints: Dict[int, str]
seed_groups: Dict[str, SeedGroup] = {}
shop_num: int = 1 # need to make it so that you can walk out of shops, but also that they aren't all connected
er_regions: Dict[str, RegionInfo] # absolutely needed so outlet regions work
def generate_early(self) -> None:
if self.options.logic_rules >= LogicRules.option_no_major_glitches:
self.options.laurels_zips.value = LaurelsZips.option_true
self.options.ice_grappling.value = IceGrappling.option_medium
if self.options.logic_rules.value == LogicRules.option_unrestricted:
self.options.ladder_storage.value = LadderStorage.option_medium
self.er_regions = tunic_er_regions.copy()
if self.options.plando_connections:
for index, cxn in enumerate(self.options.plando_connections):
# making shops second to simplify other things later
@@ -111,10 +99,7 @@ class TunicWorld(World):
self.options.keys_behind_bosses.value = passthrough["keys_behind_bosses"]
self.options.sword_progression.value = passthrough["sword_progression"]
self.options.ability_shuffling.value = passthrough["ability_shuffling"]
self.options.laurels_zips.value = passthrough["laurels_zips"]
self.options.ice_grappling.value = passthrough["ice_grappling"]
self.options.ladder_storage.value = passthrough["ladder_storage"]
self.options.ladder_storage_without_items = passthrough["ladder_storage_without_items"]
self.options.logic_rules.value = passthrough["logic_rules"]
self.options.lanternless.value = passthrough["lanternless"]
self.options.maskless.value = passthrough["maskless"]
self.options.hexagon_quest.value = passthrough["hexagon_quest"]
@@ -133,28 +118,19 @@ class TunicWorld(World):
group = tunic.options.entrance_rando.value
# if this is the first world in the group, set the rules equal to its rules
if group not in cls.seed_groups:
cls.seed_groups[group] = \
SeedGroup(laurels_zips=bool(tunic.options.laurels_zips),
ice_grappling=tunic.options.ice_grappling.value,
ladder_storage=tunic.options.ladder_storage.value,
laurels_at_10_fairies=tunic.options.laurels_location == LaurelsLocation.option_10_fairies,
fixed_shop=bool(tunic.options.fixed_shop),
plando=tunic.options.plando_connections)
cls.seed_groups[group] = SeedGroup(logic_rules=tunic.options.logic_rules.value,
laurels_at_10_fairies=tunic.options.laurels_location == 3,
fixed_shop=bool(tunic.options.fixed_shop),
plando=tunic.options.plando_connections)
continue
# off is more restrictive
if not tunic.options.laurels_zips:
cls.seed_groups[group]["laurels_zips"] = False
# lower value is more restrictive
if tunic.options.ice_grappling < cls.seed_groups[group]["ice_grappling"]:
cls.seed_groups[group]["ice_grappling"] = tunic.options.ice_grappling.value
# lower value is more restrictive
if tunic.options.ladder_storage.value < cls.seed_groups[group]["ladder_storage"]:
cls.seed_groups[group]["ladder_storage"] = tunic.options.ladder_storage.value
if tunic.options.logic_rules.value < cls.seed_groups[group]["logic_rules"]:
cls.seed_groups[group]["logic_rules"] = tunic.options.logic_rules.value
# laurels at 10 fairies changes logic for secret gathering place placement
if tunic.options.laurels_location == 3:
cls.seed_groups[group]["laurels_at_10_fairies"] = True
# more restrictive, overrides the option for others in the same group, which is better than failing imo
# fewer shops, one at windmill
if tunic.options.fixed_shop:
cls.seed_groups[group]["fixed_shop"] = True
@@ -390,10 +366,7 @@ class TunicWorld(World):
"ability_shuffling": self.options.ability_shuffling.value,
"hexagon_quest": self.options.hexagon_quest.value,
"fool_traps": self.options.fool_traps.value,
"laurels_zips": self.options.laurels_zips.value,
"ice_grappling": self.options.ice_grappling.value,
"ladder_storage": self.options.ladder_storage.value,
"ladder_storage_without_items": self.options.ladder_storage_without_items.value,
"logic_rules": self.options.logic_rules.value,
"lanternless": self.options.lanternless.value,
"maskless": self.options.maskless.value,
"entrance_rando": int(bool(self.options.entrance_rando.value)),

View File

@@ -83,6 +83,8 @@ Notes:
- The `direction` field is not supported. Connections are always coupled.
- For a list of entrance names, check `er_data.py` in the TUNIC world folder or generate a game with the Entrance Randomizer option enabled and check the spoiler log.
- There is no limit to the number of Shops you can plando.
- If you have more than one shop in a scene, you may be wrong warped when exiting a shop.
- If you have a shop in every scene, and you have an odd number of shops, it will error out.
See the [Archipelago Plando Guide](../../../tutorial/Archipelago/plando/en) for more information on Plando and Connection Plando.

View File

@@ -1,9 +1,6 @@
from typing import Dict, NamedTuple, List, TYPE_CHECKING, Optional
from typing import Dict, NamedTuple, List
from enum import IntEnum
if TYPE_CHECKING:
from . import TunicWorld
class Portal(NamedTuple):
name: str # human-readable name
@@ -12,8 +9,6 @@ class Portal(NamedTuple):
tag: str # vanilla tag
def scene(self) -> str: # the actual scene name in Tunic
if self.region.startswith("Shop"):
return tunic_er_regions["Shop"].game_scene
return tunic_er_regions[self.region].game_scene
def scene_destination(self) -> str: # full, nonchanging name to interpret by the mod
@@ -463,7 +458,7 @@ portal_mapping: List[Portal] = [
Portal(name="Cathedral Main Exit", region="Cathedral",
destination="Swamp Redux 2", tag="_main"),
Portal(name="Cathedral Elevator", region="Cathedral to Gauntlet",
Portal(name="Cathedral Elevator", region="Cathedral",
destination="Cathedral Arena", tag="_"),
Portal(name="Cathedral Secret Legend Room Exit", region="Cathedral Secret Legend Room",
destination="Swamp Redux 2", tag="_secret"),
@@ -522,13 +517,6 @@ portal_mapping: List[Portal] = [
class RegionInfo(NamedTuple):
game_scene: str # the name of the scene in the actual game
dead_end: int = 0 # if a region has only one exit
outlet_region: Optional[str] = None
is_fake_region: bool = False
# gets the outlet region name if it exists, the region if it doesn't
def get_portal_outlet_region(portal: Portal, world: "TunicWorld") -> str:
return world.er_regions[portal.region].outlet_region or portal.region
class DeadEnd(IntEnum):
@@ -570,11 +558,11 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Overworld Ruined Passage Door": RegionInfo("Overworld Redux"), # the small space betweeen the door and the portal
"Overworld Old House Door": RegionInfo("Overworld Redux"), # the too-small space between the door and the portal
"Overworld Southeast Cross Door": RegionInfo("Overworld Redux"), # the small space betweeen the door and the portal
"Overworld Fountain Cross Door": RegionInfo("Overworld Redux", outlet_region="Overworld"),
"Overworld Fountain Cross Door": RegionInfo("Overworld Redux"), # the small space between the door and the portal
"Overworld Temple Door": RegionInfo("Overworld Redux"), # the small space betweeen the door and the portal
"Overworld Town Portal": RegionInfo("Overworld Redux", outlet_region="Overworld"),
"Overworld Spawn Portal": RegionInfo("Overworld Redux", outlet_region="Overworld"),
"Cube Cave Entrance Region": RegionInfo("Overworld Redux", outlet_region="Overworld"), # other side of the bomb wall
"Overworld Town Portal": RegionInfo("Overworld Redux"), # being able to go to or come from the portal
"Overworld Spawn Portal": RegionInfo("Overworld Redux"), # being able to go to or come from the portal
"Cube Cave Entrance Region": RegionInfo("Overworld Redux"), # other side of the bomb wall
"Stick House": RegionInfo("Sword Cave", dead_end=DeadEnd.all_cats),
"Windmill": RegionInfo("Windmill"),
"Old House Back": RegionInfo("Overworld Interiors"), # part with the hc door
@@ -603,7 +591,7 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Forest Belltower Lower": RegionInfo("Forest Belltower"),
"East Forest": RegionInfo("East Forest Redux"),
"East Forest Dance Fox Spot": RegionInfo("East Forest Redux"),
"East Forest Portal": RegionInfo("East Forest Redux", outlet_region="East Forest"),
"East Forest Portal": RegionInfo("East Forest Redux"),
"Lower Forest": RegionInfo("East Forest Redux"), # bottom of the forest
"Guard House 1 East": RegionInfo("East Forest Redux Laddercave"),
"Guard House 1 West": RegionInfo("East Forest Redux Laddercave"),
@@ -613,7 +601,7 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Forest Grave Path Main": RegionInfo("Sword Access"),
"Forest Grave Path Upper": RegionInfo("Sword Access"),
"Forest Grave Path by Grave": RegionInfo("Sword Access"),
"Forest Hero's Grave": RegionInfo("Sword Access", outlet_region="Forest Grave Path by Grave"),
"Forest Hero's Grave": RegionInfo("Sword Access"),
"Dark Tomb Entry Point": RegionInfo("Crypt Redux"), # both upper exits
"Dark Tomb Upper": RegionInfo("Crypt Redux"), # the part with the casket and the top of the ladder
"Dark Tomb Main": RegionInfo("Crypt Redux"),
@@ -626,19 +614,18 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Beneath the Well Back": RegionInfo("Sewer"), # the back two portals, and all 4 upper chests
"West Garden": RegionInfo("Archipelagos Redux"),
"Magic Dagger House": RegionInfo("archipelagos_house", dead_end=DeadEnd.all_cats),
"West Garden Portal": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted, outlet_region="West Garden by Portal"),
"West Garden by Portal": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted),
"West Garden Portal": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted),
"West Garden Portal Item": RegionInfo("Archipelagos Redux", dead_end=DeadEnd.restricted),
"West Garden Laurels Exit Region": RegionInfo("Archipelagos Redux"),
"West Garden after Boss": RegionInfo("Archipelagos Redux"),
"West Garden Hero's Grave Region": RegionInfo("Archipelagos Redux", outlet_region="West Garden"),
"West Garden Hero's Grave Region": RegionInfo("Archipelagos Redux"),
"Ruined Atoll": RegionInfo("Atoll Redux"),
"Ruined Atoll Lower Entry Area": RegionInfo("Atoll Redux"),
"Ruined Atoll Ladder Tops": RegionInfo("Atoll Redux"), # at the top of the 5 ladders in south Atoll
"Ruined Atoll Frog Mouth": RegionInfo("Atoll Redux"),
"Ruined Atoll Frog Eye": RegionInfo("Atoll Redux"),
"Ruined Atoll Portal": RegionInfo("Atoll Redux", outlet_region="Ruined Atoll"),
"Ruined Atoll Statue": RegionInfo("Atoll Redux", outlet_region="Ruined Atoll"),
"Ruined Atoll Portal": RegionInfo("Atoll Redux"),
"Ruined Atoll Statue": RegionInfo("Atoll Redux"),
"Frog Stairs Eye Exit": RegionInfo("Frog Stairs"),
"Frog Stairs Upper": RegionInfo("Frog Stairs"),
"Frog Stairs Lower": RegionInfo("Frog Stairs"),
@@ -646,20 +633,18 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Frog's Domain Entry": RegionInfo("frog cave main"),
"Frog's Domain": RegionInfo("frog cave main"),
"Frog's Domain Back": RegionInfo("frog cave main"),
"Library Exterior Tree Region": RegionInfo("Library Exterior", outlet_region="Library Exterior by Tree"),
"Library Exterior by Tree": RegionInfo("Library Exterior"),
"Library Exterior Tree Region": RegionInfo("Library Exterior"),
"Library Exterior Ladder Region": RegionInfo("Library Exterior"),
"Library Hall Bookshelf": RegionInfo("Library Hall"),
"Library Hall": RegionInfo("Library Hall"),
"Library Hero's Grave Region": RegionInfo("Library Hall", outlet_region="Library Hall"),
"Library Hero's Grave Region": RegionInfo("Library Hall"),
"Library Hall to Rotunda": RegionInfo("Library Hall"),
"Library Rotunda to Hall": RegionInfo("Library Rotunda"),
"Library Rotunda": RegionInfo("Library Rotunda"),
"Library Rotunda to Lab": RegionInfo("Library Rotunda"),
"Library Lab": RegionInfo("Library Lab"),
"Library Lab Lower": RegionInfo("Library Lab"),
"Library Portal": RegionInfo("Library Lab", outlet_region="Library Lab on Portal Pad"),
"Library Lab on Portal Pad": RegionInfo("Library Lab"),
"Library Portal": RegionInfo("Library Lab"),
"Library Lab to Librarian": RegionInfo("Library Lab"),
"Library Arena": RegionInfo("Library Arena", dead_end=DeadEnd.all_cats),
"Fortress Exterior from East Forest": RegionInfo("Fortress Courtyard"),
@@ -678,22 +663,22 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Fortress Grave Path": RegionInfo("Fortress Reliquary"),
"Fortress Grave Path Upper": RegionInfo("Fortress Reliquary", dead_end=DeadEnd.restricted),
"Fortress Grave Path Dusty Entrance Region": RegionInfo("Fortress Reliquary"),
"Fortress Hero's Grave Region": RegionInfo("Fortress Reliquary", outlet_region="Fortress Grave Path"),
"Fortress Hero's Grave Region": RegionInfo("Fortress Reliquary"),
"Fortress Leaf Piles": RegionInfo("Dusty", dead_end=DeadEnd.all_cats),
"Fortress Arena": RegionInfo("Fortress Arena"),
"Fortress Arena Portal": RegionInfo("Fortress Arena", outlet_region="Fortress Arena"),
"Fortress Arena Portal": RegionInfo("Fortress Arena"),
"Lower Mountain": RegionInfo("Mountain"),
"Lower Mountain Stairs": RegionInfo("Mountain"),
"Top of the Mountain": RegionInfo("Mountaintop", dead_end=DeadEnd.all_cats),
"Quarry Connector": RegionInfo("Darkwoods Tunnel"),
"Quarry Entry": RegionInfo("Quarry Redux"),
"Quarry": RegionInfo("Quarry Redux"),
"Quarry Portal": RegionInfo("Quarry Redux", outlet_region="Quarry Entry"),
"Quarry Portal": RegionInfo("Quarry Redux"),
"Quarry Back": RegionInfo("Quarry Redux"),
"Quarry Monastery Entry": RegionInfo("Quarry Redux"),
"Monastery Front": RegionInfo("Monastery"),
"Monastery Back": RegionInfo("Monastery"),
"Monastery Hero's Grave Region": RegionInfo("Monastery", outlet_region="Monastery Back"),
"Monastery Hero's Grave Region": RegionInfo("Monastery"),
"Monastery Rope": RegionInfo("Quarry Redux"),
"Lower Quarry": RegionInfo("Quarry Redux"),
"Even Lower Quarry": RegionInfo("Quarry Redux"),
@@ -706,21 +691,19 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Rooted Ziggurat Middle Bottom": RegionInfo("ziggurat2020_2"),
"Rooted Ziggurat Lower Front": RegionInfo("ziggurat2020_3"), # the vanilla entry point side
"Rooted Ziggurat Lower Back": RegionInfo("ziggurat2020_3"), # the boss side
"Zig Skip Exit": RegionInfo("ziggurat2020_3", dead_end=DeadEnd.special, outlet_region="Rooted Ziggurat Lower Front"), # the exit from zig skip, for use with fixed shop on
"Rooted Ziggurat Portal Room Entrance": RegionInfo("ziggurat2020_3", outlet_region="Rooted Ziggurat Lower Back"), # the door itself on the zig 3 side
"Rooted Ziggurat Portal": RegionInfo("ziggurat2020_FTRoom", outlet_region="Rooted Ziggurat Portal Room"),
"Rooted Ziggurat Portal Room": RegionInfo("ziggurat2020_FTRoom"),
"Zig Skip Exit": RegionInfo("ziggurat2020_3", dead_end=DeadEnd.special), # the exit from zig skip, for use with fixed shop on
"Rooted Ziggurat Portal Room Entrance": RegionInfo("ziggurat2020_3"), # the door itself on the zig 3 side
"Rooted Ziggurat Portal": RegionInfo("ziggurat2020_FTRoom"),
"Rooted Ziggurat Portal Room Exit": RegionInfo("ziggurat2020_FTRoom"),
"Swamp Front": RegionInfo("Swamp Redux 2"), # from the main entry to the top of the ladder after south
"Swamp Mid": RegionInfo("Swamp Redux 2"), # from the bottom of the ladder to the cathedral door
"Swamp Ledge under Cathedral Door": RegionInfo("Swamp Redux 2"), # the ledge with the chest and secret door
"Swamp to Cathedral Treasure Room": RegionInfo("Swamp Redux 2", outlet_region="Swamp Ledge under Cathedral Door"), # just the door
"Swamp to Cathedral Treasure Room": RegionInfo("Swamp Redux 2"), # just the door
"Swamp to Cathedral Main Entrance Region": RegionInfo("Swamp Redux 2"), # just the door
"Back of Swamp": RegionInfo("Swamp Redux 2"), # the area with hero grave and gauntlet entrance
"Swamp Hero's Grave Region": RegionInfo("Swamp Redux 2", outlet_region="Back of Swamp"),
"Swamp Hero's Grave Region": RegionInfo("Swamp Redux 2"),
"Back of Swamp Laurels Area": RegionInfo("Swamp Redux 2"), # the spots you need laurels to traverse
"Cathedral": RegionInfo("Cathedral Redux"),
"Cathedral to Gauntlet": RegionInfo("Cathedral Redux"), # the elevator
"Cathedral Secret Legend Room": RegionInfo("Cathedral Redux", dead_end=DeadEnd.all_cats),
"Cathedral Gauntlet Checkpoint": RegionInfo("Cathedral Arena"),
"Cathedral Gauntlet": RegionInfo("Cathedral Arena"),
@@ -728,10 +711,10 @@ tunic_er_regions: Dict[str, RegionInfo] = {
"Far Shore": RegionInfo("Transit"),
"Far Shore to Spawn Region": RegionInfo("Transit"),
"Far Shore to East Forest Region": RegionInfo("Transit"),
"Far Shore to Quarry Region": RegionInfo("Transit", outlet_region="Far Shore"),
"Far Shore to Fortress Region": RegionInfo("Transit", outlet_region="Far Shore"),
"Far Shore to Library Region": RegionInfo("Transit", outlet_region="Far Shore"),
"Far Shore to West Garden Region": RegionInfo("Transit", outlet_region="Far Shore"),
"Far Shore to Quarry Region": RegionInfo("Transit"),
"Far Shore to Fortress Region": RegionInfo("Transit"),
"Far Shore to Library Region": RegionInfo("Transit"),
"Far Shore to West Garden Region": RegionInfo("Transit"),
"Hero Relic - Fortress": RegionInfo("RelicVoid", dead_end=DeadEnd.all_cats),
"Hero Relic - Quarry": RegionInfo("RelicVoid", dead_end=DeadEnd.all_cats),
"Hero Relic - West Garden": RegionInfo("RelicVoid", dead_end=DeadEnd.all_cats),
@@ -745,16 +728,6 @@ tunic_er_regions: Dict[str, RegionInfo] = {
}
# this is essentially a pared down version of the region connections in rules.py, with some minor differences
# the main purpose of this is to make it so that you can access every region
# most items are excluded from the rules here, since we can assume Archipelago will properly place them
# laurels (hyperdash) can be locked at 10 fairies, requiring access to secret gathering place
# so until secret gathering place has been paired, you do not have hyperdash, so you cannot use hyperdash entrances
# Zip means you need the laurels zips option enabled
# IG# refers to ice grappling difficulties
# LS# refers to ladder storage difficulties
# LS rules are used for region connections here regardless of whether you have being knocked out of the air in logic
# this is because it just means you can reach the entrances in that region via ladder storage
traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Overworld": {
"Overworld Beach":
@@ -762,13 +735,13 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Overworld to Atoll Upper":
[["Hyperdash"]],
"Overworld Belltower":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
"Overworld Swamp Upper Entry":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
"Overworld Swamp Lower Entry":
[],
"Overworld Special Shop Entry":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
"Overworld Well Ladder":
[],
"Overworld Ruined Passage Door":
@@ -786,11 +759,11 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Overworld after Envoy":
[],
"Overworld Quarry Entry":
[["IG2"], ["LS1"]],
[["NMG"]],
"Overworld Tunnel Turret":
[["IG1"], ["LS1"], ["Hyperdash"]],
[["NMG"], ["Hyperdash"]],
"Overworld Temple Door":
[["IG2"], ["LS3"], ["Forest Belltower Upper", "Overworld Belltower"]],
[["NMG"], ["Forest Belltower Upper", "Overworld Belltower"]],
"Overworld Southeast Cross Door":
[],
"Overworld Fountain Cross Door":
@@ -800,28 +773,25 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Overworld Spawn Portal":
[],
"Overworld Well to Furnace Rail":
[["LS2"]],
[["UR"]],
"Overworld Old House Door":
[],
"Cube Cave Entrance Region":
[],
# drop a rudeling, icebolt or ice bomb
"Overworld to West Garden from Furnace":
[["IG3"]],
},
"East Overworld": {
"Above Ruined Passage":
[],
"After Ruined Passage":
[["IG1"], ["LS1"]],
# "Overworld":
# [],
[["NMG"]],
"Overworld":
[],
"Overworld at Patrol Cave":
[],
"Overworld above Patrol Cave":
[],
"Overworld Special Shop Entry":
[["Hyperdash"], ["LS1"]]
[["Hyperdash"], ["UR"]]
},
"Overworld Special Shop Entry": {
"East Overworld":
@@ -830,8 +800,8 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Overworld Belltower": {
"Overworld Belltower at Bell":
[],
# "Overworld":
# [],
"Overworld":
[],
"Overworld to West Garden Upper":
[],
},
@@ -839,19 +809,19 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Overworld Belltower":
[],
},
# "Overworld Swamp Upper Entry": {
# "Overworld":
# [],
# },
# "Overworld Swamp Lower Entry": {
# "Overworld":
# [],
# },
"Overworld Swamp Upper Entry": {
"Overworld":
[],
},
"Overworld Swamp Lower Entry": {
"Overworld":
[],
},
"Overworld Beach": {
# "Overworld":
# [],
"Overworld":
[],
"Overworld West Garden Laurels Entry":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"]],
"Overworld to Atoll Upper":
[],
"Overworld Tunnel Turret":
@@ -862,37 +832,38 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
[["Hyperdash"]],
},
"Overworld to Atoll Upper": {
# "Overworld":
# [],
"Overworld":
[],
"Overworld Beach":
[],
},
"Overworld Tunnel Turret": {
# "Overworld":
# [],
"Overworld":
[],
"Overworld Beach":
[],
},
"Overworld Well Ladder": {
# "Overworld":
# [],
"Overworld":
[],
},
"Overworld at Patrol Cave": {
"East Overworld":
[["Hyperdash"], ["LS1"], ["IG1"]],
[["Hyperdash"]],
"Overworld above Patrol Cave":
[],
},
"Overworld above Patrol Cave": {
# "Overworld":
# [],
"Overworld":
[],
"East Overworld":
[],
"Upper Overworld":
[],
"Overworld at Patrol Cave":
[],
# readd long dong if we ever do a misc tricks option
"Overworld Belltower at Bell":
[["NMG"]],
},
"Upper Overworld": {
"Overworld above Patrol Cave":
@@ -907,49 +878,51 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
[],
},
"Overworld above Quarry Entrance": {
# "Overworld":
# [],
"Overworld":
[],
"Upper Overworld":
[],
},
"Overworld Quarry Entry": {
"Overworld after Envoy":
[],
# "Overworld":
# [["IG1"]],
"Overworld":
[["NMG"]],
},
"Overworld after Envoy": {
# "Overworld":
# [],
"Overworld":
[],
"Overworld Quarry Entry":
[],
},
"After Ruined Passage": {
# "Overworld":
# [],
"Overworld":
[],
"Above Ruined Passage":
[],
"East Overworld":
[["NMG"]],
},
"Above Ruined Passage": {
# "Overworld":
# [],
"Overworld":
[],
"After Ruined Passage":
[],
"East Overworld":
[],
},
# "Overworld Ruined Passage Door": {
# "Overworld":
# [["Hyperdash", "Zip"]],
# },
# "Overworld Town Portal": {
# "Overworld":
# [],
# },
# "Overworld Spawn Portal": {
# "Overworld":
# [],
# },
"Overworld Ruined Passage Door": {
"Overworld":
[["Hyperdash", "NMG"]],
},
"Overworld Town Portal": {
"Overworld":
[],
},
"Overworld Spawn Portal": {
"Overworld":
[],
},
"Cube Cave Entrance Region": {
"Overworld":
[],
@@ -960,7 +933,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Old House Back": {
"Old House Front":
[["Hyperdash", "Zip"]],
[["Hyperdash", "NMG"]],
},
"Furnace Fuse": {
"Furnace Ladder Area":
@@ -968,9 +941,9 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Furnace Ladder Area": {
"Furnace Fuse":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
"Furnace Walking Path":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
},
"Furnace Walking Path": {
"Furnace Ladder Area":
@@ -998,7 +971,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"East Forest": {
"East Forest Dance Fox Spot":
[["Hyperdash"], ["IG1"], ["LS1"]],
[["Hyperdash"], ["NMG"]],
"East Forest Portal":
[],
"Lower Forest":
@@ -1006,7 +979,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"East Forest Dance Fox Spot": {
"East Forest":
[["Hyperdash"], ["IG1"]],
[["Hyperdash"], ["NMG"]],
},
"East Forest Portal": {
"East Forest":
@@ -1022,7 +995,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Guard House 1 West": {
"Guard House 1 East":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
},
"Guard House 2 Upper": {
"Guard House 2 Lower":
@@ -1034,19 +1007,19 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Forest Grave Path Main": {
"Forest Grave Path Upper":
[["Hyperdash"], ["LS2"], ["IG3"]],
[["Hyperdash"], ["UR"]],
"Forest Grave Path by Grave":
[],
},
"Forest Grave Path Upper": {
"Forest Grave Path Main":
[["Hyperdash"], ["IG1"]],
[["Hyperdash"], ["NMG"]],
},
"Forest Grave Path by Grave": {
"Forest Hero's Grave":
[],
"Forest Grave Path Main":
[["IG1"]],
[["NMG"]],
},
"Forest Hero's Grave": {
"Forest Grave Path by Grave":
@@ -1078,7 +1051,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Dark Tomb Checkpoint": {
"Well Boss":
[["Hyperdash", "Zip"]],
[["Hyperdash", "NMG"]],
},
"Dark Tomb Entry Point": {
"Dark Tomb Upper":
@@ -1102,13 +1075,13 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"West Garden": {
"West Garden Laurels Exit Region":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
"West Garden after Boss":
[],
"West Garden Hero's Grave Region":
[],
"West Garden Portal Item":
[["IG2"]],
[["NMG"]],
},
"West Garden Laurels Exit Region": {
"West Garden":
@@ -1120,19 +1093,13 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"West Garden Portal Item": {
"West Garden":
[["IG1"]],
"West Garden by Portal":
[["Hyperdash"]],
},
"West Garden by Portal": {
"West Garden Portal Item":
[["Hyperdash"]],
[["NMG"]],
"West Garden Portal":
[["West Garden"]],
[["Hyperdash", "West Garden"]],
},
"West Garden Portal": {
"West Garden by Portal":
[],
"West Garden Portal Item":
[["Hyperdash"]],
},
"West Garden Hero's Grave Region": {
"West Garden":
@@ -1140,7 +1107,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Ruined Atoll": {
"Ruined Atoll Lower Entry Area":
[["Hyperdash"], ["LS1"]],
[["Hyperdash"], ["UR"]],
"Ruined Atoll Ladder Tops":
[],
"Ruined Atoll Frog Mouth":
@@ -1207,17 +1174,11 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
[],
},
"Library Exterior Ladder Region": {
"Library Exterior by Tree":
[],
},
"Library Exterior by Tree": {
"Library Exterior Tree Region":
[],
"Library Exterior Ladder Region":
[],
},
"Library Exterior Tree Region": {
"Library Exterior by Tree":
"Library Exterior Ladder Region":
[],
},
"Library Hall Bookshelf": {
@@ -1262,19 +1223,13 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Library Lab": {
"Library Lab Lower":
[["Hyperdash"]],
"Library Lab on Portal Pad":
"Library Portal":
[],
"Library Lab to Librarian":
[],
},
"Library Lab on Portal Pad": {
"Library Portal":
[],
"Library Lab":
[],
},
"Library Portal": {
"Library Lab on Portal Pad":
"Library Lab":
[],
},
"Library Lab to Librarian": {
@@ -1285,9 +1240,11 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Fortress Exterior from Overworld":
[],
"Fortress Courtyard Upper":
[["LS2"]],
[["UR"]],
"Fortress Exterior near cave":
[["UR"]],
"Fortress Courtyard":
[["LS1"]],
[["UR"]],
},
"Fortress Exterior from Overworld": {
"Fortress Exterior from East Forest":
@@ -1295,15 +1252,15 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Fortress Exterior near cave":
[],
"Fortress Courtyard":
[["Hyperdash"], ["IG1"], ["LS1"]],
[["Hyperdash"], ["NMG"]],
},
"Fortress Exterior near cave": {
"Fortress Exterior from Overworld":
[["Hyperdash"], ["LS1"]],
"Fortress Courtyard": # ice grapple hard: shoot far fire pot, it aggros one of the enemies over to you
[["IG3"], ["LS1"]],
[["Hyperdash"], ["UR"]],
"Fortress Courtyard":
[["UR"]],
"Fortress Courtyard Upper":
[["LS2"]],
[["UR"]],
"Beneath the Vault Entry":
[],
},
@@ -1313,7 +1270,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Fortress Courtyard": {
"Fortress Courtyard Upper":
[["IG1"]],
[["NMG"]],
"Fortress Exterior from Overworld":
[["Hyperdash"]],
},
@@ -1339,7 +1296,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Fortress East Shortcut Lower": {
"Fortress East Shortcut Upper":
[["IG1"]],
[["NMG"]],
},
"Fortress East Shortcut Upper": {
"Fortress East Shortcut Lower":
@@ -1347,11 +1304,11 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Eastern Vault Fortress": {
"Eastern Vault Fortress Gold Door":
[["IG2"], ["Fortress Exterior from Overworld", "Beneath the Vault Back", "Fortress Courtyard Upper"]],
[["NMG"], ["Fortress Exterior from Overworld", "Beneath the Vault Back", "Fortress Courtyard Upper"]],
},
"Eastern Vault Fortress Gold Door": {
"Eastern Vault Fortress":
[["IG1"]],
[["NMG"]],
},
"Fortress Grave Path": {
"Fortress Hero's Grave Region":
@@ -1361,7 +1318,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Fortress Grave Path Upper": {
"Fortress Grave Path":
[["IG1"]],
[["NMG"]],
},
"Fortress Grave Path Dusty Entrance Region": {
"Fortress Grave Path":
@@ -1389,7 +1346,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Monastery Back": {
"Monastery Front":
[["Hyperdash", "Zip"]],
[["Hyperdash", "NMG"]],
"Monastery Hero's Grave Region":
[],
},
@@ -1406,8 +1363,6 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
[["Quarry Connector"]],
"Quarry":
[],
"Monastery Rope":
[["LS2"]],
},
"Quarry Portal": {
"Quarry Entry":
@@ -1419,7 +1374,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Quarry Back":
[["Hyperdash"]],
"Monastery Rope":
[["LS2"]],
[["UR"]],
},
"Quarry Back": {
"Quarry":
@@ -1437,7 +1392,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Quarry Monastery Entry":
[],
"Lower Quarry Zig Door":
[["IG3"]],
[["NMG"]],
},
"Lower Quarry": {
"Even Lower Quarry":
@@ -1447,7 +1402,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
"Lower Quarry":
[],
"Lower Quarry Zig Door":
[["Quarry", "Quarry Connector"], ["IG3"]],
[["Quarry", "Quarry Connector"], ["NMG"]],
},
"Monastery Rope": {
"Quarry Back":
@@ -1475,7 +1430,7 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Rooted Ziggurat Lower Back": {
"Rooted Ziggurat Lower Front":
[["Hyperdash"], ["LS2"], ["IG1"]],
[["Hyperdash"], ["UR"]],
"Rooted Ziggurat Portal Room Entrance":
[],
},
@@ -1488,35 +1443,26 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
[],
},
"Rooted Ziggurat Portal Room Exit": {
"Rooted Ziggurat Portal Room":
[],
},
"Rooted Ziggurat Portal Room": {
"Rooted Ziggurat Portal":
[],
"Rooted Ziggurat Portal Room Exit":
[["Rooted Ziggurat Lower Back"]],
},
"Rooted Ziggurat Portal": {
"Rooted Ziggurat Portal Room":
[],
"Rooted Ziggurat Portal Room Exit":
[["Rooted Ziggurat Lower Back"]],
},
"Swamp Front": {
"Swamp Mid":
[],
# get one pillar from the gate, then dash onto the gate, very tricky
"Back of Swamp Laurels Area":
[["Hyperdash", "Zip"]],
},
"Swamp Mid": {
"Swamp Front":
[],
"Swamp to Cathedral Main Entrance Region":
[["Hyperdash"], ["IG2"], ["LS3"]],
[["Hyperdash"], ["NMG"]],
"Swamp Ledge under Cathedral Door":
[],
"Back of Swamp":
[["LS1"]], # ig3 later?
[["UR"]],
},
"Swamp Ledge under Cathedral Door": {
"Swamp Mid":
@@ -1530,41 +1476,24 @@ traversal_requirements: Dict[str, Dict[str, List[List[str]]]] = {
},
"Swamp to Cathedral Main Entrance Region": {
"Swamp Mid":
[["IG1"]],
[["NMG"]],
},
"Back of Swamp": {
"Back of Swamp Laurels Area":
[["Hyperdash"], ["LS2"]],
[["Hyperdash"], ["UR"]],
"Swamp Hero's Grave Region":
[],
"Swamp Mid":
[["LS2"]],
"Swamp Front":
[["LS1"]],
"Swamp to Cathedral Main Entrance Region":
[["LS3"]],
"Swamp to Cathedral Treasure Room":
[["LS3"]]
},
"Back of Swamp Laurels Area": {
"Back of Swamp":
[["Hyperdash"]],
# get one pillar from the gate, then dash onto the gate, very tricky
"Swamp Mid":
[["IG1", "Hyperdash"], ["Hyperdash", "Zip"]],
[["NMG", "Hyperdash"]],
},
"Swamp Hero's Grave Region": {
"Back of Swamp":
[],
},
"Cathedral": {
"Cathedral to Gauntlet":
[],
},
"Cathedral to Gauntlet": {
"Cathedral":
[],
},
"Cathedral Gauntlet Checkpoint": {
"Cathedral Gauntlet":
[],

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
from typing import Dict, List, Set, Tuple, TYPE_CHECKING
from typing import Dict, List, Set, TYPE_CHECKING
from BaseClasses import Region, ItemClassification, Item, Location
from .locations import location_table
from .er_data import Portal, portal_mapping, traversal_requirements, DeadEnd, RegionInfo
from .er_data import Portal, tunic_er_regions, portal_mapping, traversal_requirements, DeadEnd
from .er_rules import set_er_region_rules
from Options import PlandoConnection
from .options import EntranceRando
@@ -22,18 +22,17 @@ class TunicERLocation(Location):
def create_er_regions(world: "TunicWorld") -> Dict[Portal, Portal]:
regions: Dict[str, Region] = {}
for region_name, region_data in world.er_regions.items():
regions[region_name] = Region(region_name, world.player, world.multiworld)
if world.options.entrance_rando:
portal_pairs = pair_portals(world, regions)
portal_pairs = pair_portals(world)
# output the entrances to the spoiler log here for convenience
sorted_portal_pairs = sort_portals(portal_pairs)
for portal1, portal2 in sorted_portal_pairs.items():
world.multiworld.spoiler.set_entrance(portal1, portal2, "both", world.player)
else:
portal_pairs = vanilla_portals(world, regions)
portal_pairs = vanilla_portals()
for region_name, region_data in tunic_er_regions.items():
regions[region_name] = Region(region_name, world.player, world.multiworld)
set_er_region_rules(world, regions, portal_pairs)
@@ -94,18 +93,7 @@ def place_event_items(world: "TunicWorld", regions: Dict[str, Region]) -> None:
region.locations.append(location)
# all shops are the same shop. however, you cannot get to all shops from the same shop entrance.
# so, we need a bunch of shop regions that connect to the actual shop, but the actual shop cannot connect back
def create_shop_region(world: "TunicWorld", regions: Dict[str, Region]) -> None:
new_shop_name = f"Shop {world.shop_num}"
world.er_regions[new_shop_name] = RegionInfo("Shop", dead_end=DeadEnd.all_cats)
new_shop_region = Region(new_shop_name, world.player, world.multiworld)
new_shop_region.connect(regions["Shop"])
regions[new_shop_name] = new_shop_region
world.shop_num += 1
def vanilla_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal, Portal]:
def vanilla_portals() -> Dict[Portal, Portal]:
portal_pairs: Dict[Portal, Portal] = {}
# we don't want the zig skip exit for vanilla portals, since it shouldn't be considered for logic here
portal_map = [portal for portal in portal_mapping if portal.name != "Ziggurat Lower Falling Entrance"]
@@ -117,9 +105,8 @@ def vanilla_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Por
portal2_sdt = portal1.destination_scene()
if portal2_sdt.startswith("Shop,"):
portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}",
portal2 = Portal(name="Shop", region="Shop",
destination="Previous Region", tag="_")
create_shop_region(world, regions)
elif portal2_sdt == "Purgatory, Purgatory_bottom":
portal2_sdt = "Purgatory, Purgatory_top"
@@ -138,15 +125,14 @@ def vanilla_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Por
# pairing off portals, starting with dead ends
def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal, Portal]:
def pair_portals(world: "TunicWorld") -> Dict[Portal, Portal]:
# separate the portals into dead ends and non-dead ends
portal_pairs: Dict[Portal, Portal] = {}
dead_ends: List[Portal] = []
two_plus: List[Portal] = []
player_name = world.player_name
portal_map = portal_mapping.copy()
laurels_zips = world.options.laurels_zips.value
ice_grappling = world.options.ice_grappling.value
ladder_storage = world.options.ladder_storage.value
logic_rules = world.options.logic_rules.value
fixed_shop = world.options.fixed_shop
laurels_location = world.options.laurels_location
traversal_reqs = deepcopy(traversal_requirements)
@@ -156,21 +142,19 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
# if it's not one of the EntranceRando options, it's a custom seed
if world.options.entrance_rando.value not in EntranceRando.options.values():
seed_group = world.seed_groups[world.options.entrance_rando.value]
laurels_zips = seed_group["laurels_zips"]
ice_grappling = seed_group["ice_grappling"]
ladder_storage = seed_group["ladder_storage"]
logic_rules = seed_group["logic_rules"]
fixed_shop = seed_group["fixed_shop"]
laurels_location = "10_fairies" if seed_group["laurels_at_10_fairies"] is True else False
logic_tricks: Tuple[bool, int, int] = (laurels_zips, ice_grappling, ladder_storage)
# marking that you don't immediately have laurels
if laurels_location == "10_fairies" and not hasattr(world.multiworld, "re_gen_passthrough"):
has_laurels = False
shop_scenes: Set[str] = set()
shop_count = 6
if fixed_shop:
shop_count = 0
shop_scenes.add("Overworld Redux")
else:
# if fixed shop is off, remove this portal
for portal in portal_map:
@@ -185,13 +169,13 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
# create separate lists for dead ends and non-dead ends
for portal in portal_map:
dead_end_status = world.er_regions[portal.region].dead_end
dead_end_status = tunic_er_regions[portal.region].dead_end
if dead_end_status == DeadEnd.free:
two_plus.append(portal)
elif dead_end_status == DeadEnd.all_cats:
dead_ends.append(portal)
elif dead_end_status == DeadEnd.restricted:
if ice_grappling:
if logic_rules:
two_plus.append(portal)
else:
dead_ends.append(portal)
@@ -212,7 +196,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
# make better start region stuff when/if implementing random start
start_region = "Overworld"
connected_regions.add(start_region)
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_tricks)
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_rules)
if world.options.entrance_rando.value in EntranceRando.options.values():
plando_connections = world.options.plando_connections.value
@@ -241,14 +225,12 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
plando_connections.append(PlandoConnection(portal_name1, portal_name2, "both"))
non_dead_end_regions = set()
for region_name, region_info in world.er_regions.items():
for region_name, region_info in tunic_er_regions.items():
if not region_info.dead_end:
non_dead_end_regions.add(region_name)
# if ice grappling to places is in logic, both places stop being dead ends
elif region_info.dead_end == DeadEnd.restricted and ice_grappling:
elif region_info.dead_end == 2 and logic_rules:
non_dead_end_regions.add(region_name)
# secret gathering place and zig skip get weird, special handling
elif region_info.dead_end == DeadEnd.special:
elif region_info.dead_end == 3:
if (region_name == "Secret Gathering Place" and laurels_location == "10_fairies") \
or (region_name == "Zig Skip Exit" and fixed_shop):
non_dead_end_regions.add(region_name)
@@ -257,9 +239,6 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
for connection in plando_connections:
p_entrance = connection.entrance
p_exit = connection.exit
# if you plando secret gathering place, need to know that during portal pairing
if "Secret Gathering Place Exit" in [p_entrance, p_exit]:
waterfall_plando = True
portal1_dead_end = True
portal2_dead_end = True
@@ -306,13 +285,16 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
break
# if it's not a dead end, it might be a shop
if p_exit == "Shop Portal":
portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}",
portal2 = Portal(name="Shop Portal", region="Shop",
destination="Previous Region", tag="_")
create_shop_region(world, regions)
shop_count -= 1
# need to maintain an even number of portals total
if shop_count < 0:
shop_count += 2
for p in portal_mapping:
if p.name == p_entrance:
shop_scenes.add(p.scene())
break
# and if it's neither shop nor dead end, it just isn't correct
else:
if not portal2:
@@ -345,10 +327,11 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
else:
raise Exception(f"{player_name} paired a dead end to a dead end in their "
"plando connections.")
waterfall_plando = True
portal_pairs[portal1] = portal2
# if we have plando connections, our connected regions may change somewhat
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_tricks)
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_rules)
if fixed_shop and not hasattr(world.multiworld, "re_gen_passthrough"):
portal1 = None
@@ -360,9 +343,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
raise Exception(f"Failed to do Fixed Shop option. "
f"Did {player_name} plando connection the Windmill Shop entrance?")
portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}",
destination="Previous Region", tag="_")
create_shop_region(world, regions)
portal2 = Portal(name="Shop Portal", region="Shop", destination="Previous Region", tag="_")
portal_pairs[portal1] = portal2
two_plus.remove(portal1)
@@ -412,7 +393,7 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
if waterfall_plando:
cr = connected_regions.copy()
cr.add(portal.region)
if "Secret Gathering Place" not in update_reachable_regions(cr, traversal_reqs, has_laurels, logic_tricks):
if "Secret Gathering Place" not in update_reachable_regions(cr, traversal_reqs, has_laurels, logic_rules):
continue
elif portal.region != "Secret Gathering Place":
continue
@@ -424,9 +405,9 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
# once we have both portals, connect them and add the new region(s) to connected_regions
if check_success == 2:
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_rules)
if "Secret Gathering Place" in connected_regions:
has_laurels = True
connected_regions = update_reachable_regions(connected_regions, traversal_reqs, has_laurels, logic_tricks)
portal_pairs[portal1] = portal2
check_success = 0
random_object.shuffle(two_plus)
@@ -437,12 +418,16 @@ def pair_portals(world: "TunicWorld", regions: Dict[str, Region]) -> Dict[Portal
shop_count = 0
for i in range(shop_count):
portal1 = two_plus.pop()
portal1 = None
for portal in two_plus:
if portal.scene() not in shop_scenes:
shop_scenes.add(portal.scene())
portal1 = portal
two_plus.remove(portal)
break
if portal1 is None:
raise Exception("TUNIC: Too many shops in the pool, or something else went wrong.")
portal2 = Portal(name=f"Shop Portal {world.shop_num}", region=f"Shop {world.shop_num}",
destination="Previous Region", tag="_")
create_shop_region(world, regions)
raise Exception("Too many shops in the pool, or something else went wrong.")
portal2 = Portal(name="Shop Portal", region="Shop", destination="Previous Region", tag="_")
portal_pairs[portal1] = portal2
@@ -475,12 +460,13 @@ def create_randomized_entrances(portal_pairs: Dict[Portal, Portal], regions: Dic
region1 = regions[portal1.region]
region2 = regions[portal2.region]
region1.connect(connecting_region=region2, name=portal1.name)
region2.connect(connecting_region=region1, name=portal2.name)
# prevent the logic from thinking you can get to any shop-connected region from the shop
if portal2.name not in {"Shop", "Shop Portal"}:
region2.connect(connecting_region=region1, name=portal2.name)
def update_reachable_regions(connected_regions: Set[str], traversal_reqs: Dict[str, Dict[str, List[List[str]]]],
has_laurels: bool, logic: Tuple[bool, int, int]) -> Set[str]:
zips, ice_grapples, ls = logic
has_laurels: bool, logic: int) -> Set[str]:
# starting count, so we can run it again if this changes
region_count = len(connected_regions)
for origin, destinations in traversal_reqs.items():
@@ -499,15 +485,11 @@ def update_reachable_regions(connected_regions: Set[str], traversal_reqs: Dict[s
if req == "Hyperdash":
if not has_laurels:
break
elif req == "Zip":
if not zips:
elif req == "NMG":
if not logic:
break
# if req is higher than logic option, then it breaks since it's not a valid connection
elif req.startswith("IG"):
if int(req[-1]) > ice_grapples:
break
elif req.startswith("LS"):
if int(req[-1]) > ls:
elif req == "UR":
if logic < 2:
break
elif req not in connected_regions:
break

View File

@@ -166,7 +166,6 @@ item_table: Dict[str, TunicItemData] = {
"Ladders in Swamp": TunicItemData(ItemClassification.progression, 0, 150, "Ladders"),
}
# items to be replaced by fool traps
fool_tiers: List[List[str]] = [
[],
["Money x1", "Money x10", "Money x15", "Money x16"],
@@ -174,7 +173,6 @@ fool_tiers: List[List[str]] = [
["Money x1", "Money x10", "Money x15", "Money x16", "Money x20", "Money x25", "Money x30"],
]
# items we'll want the location of in slot data, for generating in-game hints
slot_data_item_names = [
"Stick",
"Sword",

View File

@@ -1,186 +0,0 @@
from typing import Dict, List, Set, NamedTuple, Optional
# ladders in overworld, since it is the most complex area for ladder storage
class OWLadderInfo(NamedTuple):
ladders: Set[str] # ladders where the top or bottom is at the same elevation
portals: List[str] # portals at the same elevation, only those without doors
regions: List[str] # regions where a melee enemy can hit you out of ladder storage
# groups for ladders at the same elevation, for use in determing whether you can ls to entrances in diff rulesets
ow_ladder_groups: Dict[str, OWLadderInfo] = {
# lowest elevation
"LS Elev 0": OWLadderInfo({"Ladders in Overworld Town", "Ladder to Ruined Atoll", "Ladder to Swamp"},
["Swamp Redux 2_conduit", "Overworld Cave_", "Atoll Redux_lower", "Maze Room_",
"Town Basement_beach", "Archipelagos Redux_lower", "Archipelagos Redux_lowest"],
["Overworld Beach"]),
# also the east filigree room
"LS Elev 1": OWLadderInfo({"Ladders near Weathervane", "Ladders in Overworld Town", "Ladder to Swamp"},
["Furnace_gyro_lower", "Swamp Redux 2_wall"],
["Overworld Tunnel Turret"]),
# also the fountain filigree room and ruined passage door
"LS Elev 2": OWLadderInfo({"Ladders near Weathervane", "Ladders to West Bell"},
["Archipelagos Redux_upper", "Ruins Passage_east"],
["After Ruined Passage"]),
# also old house door
"LS Elev 3": OWLadderInfo({"Ladders near Weathervane", "Ladder to Quarry", "Ladders to West Bell",
"Ladders in Overworld Town"},
[],
["Overworld after Envoy", "East Overworld"]),
# skip top of top ladder next to weathervane level, does not provide logical access to anything
"LS Elev 4": OWLadderInfo({"Ladders near Dark Tomb", "Ladder to Quarry", "Ladders to West Bell", "Ladders in Well",
"Ladders in Overworld Town"},
["Darkwoods Tunnel_"],
[]),
"LS Elev 5": OWLadderInfo({"Ladders near Overworld Checkpoint", "Ladders near Patrol Cave"},
["PatrolCave_", "Forest Belltower_", "Fortress Courtyard_", "ShopSpecial_"],
["East Overworld"]),
# skip top of belltower, middle of dark tomb ladders, and top of checkpoint, does not grant access to anything
"LS Elev 6": OWLadderInfo({"Ladders near Patrol Cave", "Ladder near Temple Rafters"},
["Temple_rafters"],
["Overworld above Patrol Cave"]),
# in-line with the chest above dark tomb, gets you up the mountain stairs
"LS Elev 7": OWLadderInfo({"Ladders near Patrol Cave", "Ladder near Temple Rafters", "Ladders near Dark Tomb"},
["Mountain_"],
["Upper Overworld"]),
}
# ladders accessible within different regions of overworld, only those that are relevant
# other scenes will just have them hardcoded since this type of structure is not necessary there
region_ladders: Dict[str, Set[str]] = {
"Overworld": {"Ladders near Weathervane", "Ladders near Overworld Checkpoint", "Ladders near Dark Tomb",
"Ladders in Overworld Town", "Ladder to Swamp", "Ladders in Well"},
"Overworld Beach": {"Ladder to Ruined Atoll"},
"Overworld at Patrol Cave": {"Ladders near Patrol Cave"},
"Overworld Quarry Entry": {"Ladder to Quarry"},
"Overworld Belltower": {"Ladders to West Bell"},
"Overworld after Temple Rafters": {"Ladders near Temple Rafters"},
}
class LadderInfo(NamedTuple):
origin: str # origin region
destination: str # destination portal
ladders_req: Optional[str] = None # ladders required to do this
dest_is_region: bool = False # whether it is a region that you are going to
easy_ls: List[LadderInfo] = [
# In the furnace
# Furnace ladder to the fuse entrance
LadderInfo("Furnace Ladder Area", "Furnace, Overworld Redux_gyro_upper_north"),
# Furnace ladder to Dark Tomb
LadderInfo("Furnace Ladder Area", "Furnace, Crypt Redux_"),
# Furnace ladder to the West Garden connector
LadderInfo("Furnace Ladder Area", "Furnace, Overworld Redux_gyro_west"),
# West Garden
# exit after Garden Knight
LadderInfo("West Garden", "Archipelagos Redux, Overworld Redux_upper"),
# West Garden laurels exit
LadderInfo("West Garden", "Archipelagos Redux, Overworld Redux_lowest"),
# Atoll, use the little ladder you fix at the beginning
LadderInfo("Ruined Atoll", "Atoll Redux, Overworld Redux_lower"),
LadderInfo("Ruined Atoll", "Atoll Redux, Frog Stairs_mouth"), # special case
# East Forest
# Entrance by the dancing fox holy cross spot
LadderInfo("East Forest", "East Forest Redux, East Forest Redux Laddercave_upper"),
# From the west side of Guard House 1 to the east side
LadderInfo("Guard House 1 West", "East Forest Redux Laddercave, East Forest Redux_gate"),
LadderInfo("Guard House 1 West", "East Forest Redux Laddercave, Forest Boss Room_"),
# Fortress Exterior
# shop, ls at the ladder by the telescope
LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Shop_"),
# Fortress main entry and grave path lower entry, ls at the ladder by the telescope
LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Main_Big Door"),
LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Reliquary_Lower"),
# Use the top of the ladder by the telescope
LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress Reliquary_Upper"),
LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard, Fortress East_"),
# same as above, except from the east side of the area
LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Overworld Redux_"),
LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Shop_"),
LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Main_Big Door"),
LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Reliquary_Lower"),
# same as above, except from the Beneath the Vault entrance ladder
LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Overworld Redux_", "Ladder to Beneath the Vault"),
LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress Main_Big Door",
"Ladder to Beneath the Vault"),
LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress Reliquary_Lower",
"Ladder to Beneath the Vault"),
# Swamp to Gauntlet
LadderInfo("Swamp Mid", "Swamp Redux 2, Cathedral Arena_", "Ladders in Swamp"),
# Ladder by the hero grave
LadderInfo("Back of Swamp", "Swamp Redux 2, Overworld Redux_conduit"),
LadderInfo("Back of Swamp", "Swamp Redux 2, Shop_"),
]
# if we can gain elevation or get knocked down, add the harder ones
medium_ls: List[LadderInfo] = [
# region-destination versions of easy ls spots
LadderInfo("East Forest", "East Forest Dance Fox Spot", dest_is_region=True),
# fortress courtyard knockdowns are never logically relevant, the fuse requires upper
LadderInfo("Back of Swamp", "Swamp Mid", dest_is_region=True),
LadderInfo("Back of Swamp", "Swamp Front", dest_is_region=True),
# gain height off the northeast fuse ramp
LadderInfo("Ruined Atoll", "Atoll Redux, Frog Stairs_eye"),
# Upper exit from the Forest Grave Path, use LS at the ladder by the gate switch
LadderInfo("Forest Grave Path Main", "Sword Access, East Forest Redux_upper"),
# Upper exits from the courtyard. Use the ramp in the courtyard, then the blocks north of the first fuse
LadderInfo("Fortress Exterior from Overworld", "Fortress Courtyard Upper", dest_is_region=True),
LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress Reliquary_Upper"),
LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard, Fortress East_"),
LadderInfo("Fortress Exterior from East Forest", "Fortress Courtyard Upper", dest_is_region=True),
LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress Reliquary_Upper",
"Ladder to Beneath the Vault"),
LadderInfo("Fortress Exterior near cave", "Fortress Courtyard, Fortress East_", "Ladder to Beneath the Vault"),
LadderInfo("Fortress Exterior near cave", "Fortress Courtyard Upper", "Ladder to Beneath the Vault",
dest_is_region=True),
# need to gain height to get up the stairs
LadderInfo("Lower Mountain", "Mountain, Mountaintop_"),
# Where the rope is behind Monastery
LadderInfo("Quarry Entry", "Quarry Redux, Monastery_back"),
LadderInfo("Quarry Monastery Entry", "Quarry Redux, Monastery_back"),
LadderInfo("Quarry Back", "Quarry Redux, Monastery_back"),
LadderInfo("Rooted Ziggurat Lower Back", "ziggurat2020_3, ziggurat2020_2_"),
LadderInfo("Rooted Ziggurat Lower Back", "Rooted Ziggurat Lower Front", dest_is_region=True),
# Swamp to Overworld upper
LadderInfo("Swamp Mid", "Swamp Redux 2, Overworld Redux_wall", "Ladders in Swamp"),
LadderInfo("Back of Swamp", "Swamp Redux 2, Overworld Redux_wall"),
]
hard_ls: List[LadderInfo] = [
# lower ladder, go into the waterfall then above the bonfire, up a ramp, then through the right wall
LadderInfo("Beneath the Well Front", "Sewer, Sewer_Boss_", "Ladders in Well"),
LadderInfo("Beneath the Well Front", "Sewer, Overworld Redux_west_aqueduct", "Ladders in Well"),
LadderInfo("Beneath the Well Front", "Beneath the Well Back", "Ladders in Well", dest_is_region=True),
# go through the hexagon engraving above the vault door
LadderInfo("Frog's Domain", "frog cave main, Frog Stairs_Exit", "Ladders to Frog's Domain"),
# the turret at the end here is not affected by enemy rando
LadderInfo("Frog's Domain", "Frog's Domain Back", "Ladders to Frog's Domain", dest_is_region=True),
# todo: see if we can use that new laurels strat here
# LadderInfo("Rooted Ziggurat Lower Back", "ziggurat2020_3, ziggurat2020_FTRoom_"),
# go behind the cathedral to reach the door, pretty easily doable
LadderInfo("Swamp Mid", "Swamp Redux 2, Cathedral Redux_main", "Ladders in Swamp"),
LadderInfo("Back of Swamp", "Swamp Redux 2, Cathedral Redux_main"),
# need to do hc midair, probably cannot get into this without hc
LadderInfo("Swamp Mid", "Swamp Redux 2, Cathedral Redux_secret", "Ladders in Swamp"),
LadderInfo("Back of Swamp", "Swamp Redux 2, Cathedral Redux_secret"),
]

View File

@@ -47,7 +47,7 @@ location_table: Dict[str, TunicLocationData] = {
"Guardhouse 1 - Upper Floor": TunicLocationData("East Forest", "Guard House 1 East"),
"East Forest - Dancing Fox Spirit Holy Cross": TunicLocationData("East Forest", "East Forest Dance Fox Spot", location_group="Holy Cross"),
"East Forest - Golden Obelisk Holy Cross": TunicLocationData("East Forest", "Lower Forest", location_group="Holy Cross"),
"East Forest - Ice Rod Grapple Chest": TunicLocationData("East Forest", "Lower Forest"),
"East Forest - Ice Rod Grapple Chest": TunicLocationData("East Forest", "East Forest"),
"East Forest - Above Save Point": TunicLocationData("East Forest", "East Forest"),
"East Forest - Above Save Point Obscured": TunicLocationData("East Forest", "East Forest"),
"East Forest - From Guardhouse 1 Chest": TunicLocationData("East Forest", "East Forest Dance Fox Spot"),
@@ -205,7 +205,7 @@ location_table: Dict[str, TunicLocationData] = {
"Fountain Cross Door - Page Pickup": TunicLocationData("Overworld Holy Cross", "Fountain Cross Room", location_group="Holy Cross"),
"Secret Gathering Place - Holy Cross Chest": TunicLocationData("Overworld Holy Cross", "Secret Gathering Place", location_group="Holy Cross"),
"Top of the Mountain - Page At The Peak": TunicLocationData("Overworld Holy Cross", "Top of the Mountain", location_group="Holy Cross"),
"Monastery - Monastery Chest": TunicLocationData("Monastery", "Monastery Back"),
"Monastery - Monastery Chest": TunicLocationData("Quarry", "Monastery Back"),
"Quarry - [Back Entrance] Bushes Holy Cross": TunicLocationData("Quarry Back", "Quarry Back", location_group="Holy Cross"),
"Quarry - [Back Entrance] Chest": TunicLocationData("Quarry Back", "Quarry Back"),
"Quarry - [Central] Near Shortcut Ladder": TunicLocationData("Quarry Back", "Quarry Back"),
@@ -224,7 +224,7 @@ location_table: Dict[str, TunicLocationData] = {
"Quarry - [Central] Above Ladder Dash Chest": TunicLocationData("Quarry", "Quarry Monastery Entry"),
"Quarry - [West] Upper Area Bombable Wall": TunicLocationData("Quarry Back", "Quarry Back"),
"Quarry - [East] Bombable Wall": TunicLocationData("Quarry", "Quarry"),
"Hero's Grave - Ash Relic": TunicLocationData("Monastery", "Hero Relic - Quarry"),
"Hero's Grave - Ash Relic": TunicLocationData("Quarry", "Hero Relic - Quarry"),
"Quarry - [West] Shooting Range Secret Path": TunicLocationData("Lower Quarry", "Lower Quarry"),
"Quarry - [West] Near Shooting Range": TunicLocationData("Lower Quarry", "Lower Quarry"),
"Quarry - [West] Below Shooting Range": TunicLocationData("Lower Quarry", "Lower Quarry"),

View File

@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import Dict, Any
from Options import (DefaultOnToggle, Toggle, StartInventoryPool, Choice, Range, TextChoice, PlandoConnections,
PerGameCommonOptions, OptionGroup, Visibility)
PerGameCommonOptions, OptionGroup)
from .er_data import portal_mapping
@@ -39,6 +39,27 @@ class AbilityShuffling(Toggle):
display_name = "Shuffle Abilities"
class LogicRules(Choice):
"""
Set which logic rules to use for your world.
Restricted: Standard logic, no glitches.
No Major Glitches: Sneaky Laurels zips, ice grapples through doors, shooting the west bell, and boss quick kills are included in logic.
* Ice grappling through the Ziggurat door is not in logic since you will get stuck in there without Prayer.
Unrestricted: Logic in No Major Glitches, as well as ladder storage to get to certain places early.
* Torch is given to the player at the start of the game due to the high softlock potential with various tricks. Using the torch is not required in logic.
* Using Ladder Storage to get to individual chests is not in logic to avoid tedium.
* Getting knocked out of the air by enemies during Ladder Storage to reach places is not in logic, except for in Rooted Ziggurat Lower. This is so you're not punished for playing with enemy rando on.
"""
internal_name = "logic_rules"
display_name = "Logic Rules"
option_restricted = 0
option_no_major_glitches = 1
alias_nmg = 1
option_unrestricted = 2
alias_ur = 2
default = 0
class Lanternless(Toggle):
"""
Choose whether you require the Lantern for dark areas.
@@ -152,8 +173,8 @@ class ShuffleLadders(Toggle):
"""
internal_name = "shuffle_ladders"
display_name = "Shuffle Ladders"
class TunicPlandoConnections(PlandoConnections):
"""
Generic connection plando. Format is:
@@ -168,82 +189,6 @@ class TunicPlandoConnections(PlandoConnections):
duplicate_exits = True
class LaurelsZips(Toggle):
"""
Choose whether to include using the Hero's Laurels to zip through gates, doors, and tricky spots.
Notable inclusions are the Monastery gate, Ruined Passage door, Old House gate, Forest Grave Path gate, and getting from the Back of Swamp to the Middle of Swamp.
"""
internal_name = "laurels_zips"
display_name = "Laurels Zips Logic"
class IceGrappling(Choice):
"""
Choose whether grappling frozen enemies is in logic.
Easy includes ice grappling enemies that are in range without luring them. May include clips through terrain.
Medium includes using ice grapples to push enemies through doors or off ledges without luring them. Also includes bringing an enemy over to the Temple Door to grapple through it.
Hard includes luring or grappling enemies to get to where you want to go.
The Medium and Hard options will give the player the Torch to return to the Overworld checkpoint to avoid softlocks. Using the Torch is considered in logic.
Note: You will still be expected to ice grapple to the slime in East Forest from below with this option off.
"""
internal_name = "ice_grappling"
display_name = "Ice Grapple Logic"
option_off = 0
option_easy = 1
option_medium = 2
option_hard = 3
default = 0
class LadderStorage(Choice):
"""
Choose whether Ladder Storage is in logic.
Easy includes uses of Ladder Storage to get to open doors over a long distance without too much difficulty. May include convenient elevation changes (going up Mountain stairs, stairs in front of Special Shop, etc.).
Medium includes the above as well as changing your elevation using the environment and getting knocked down by melee enemies mid-LS.
Hard includes the above as well as going behind the map to enter closed doors from behind, shooting a fuse with the magic wand to knock yourself down at close range, and getting into the Cathedral Secret Legend room mid-LS.
Enabling any of these difficulty options will give the player the Torch item to return to the Overworld checkpoint to avoid softlocks. Using the Torch is considered in logic.
Opening individual chests while doing ladder storage is excluded due to tedium.
Knocking yourself out of LS with a bomb is excluded due to the problematic nature of consumables in logic.
"""
internal_name = "ladder_storage"
display_name = "Ladder Storage Logic"
option_off = 0
option_easy = 1
option_medium = 2
option_hard = 3
default = 0
class LadderStorageWithoutItems(Toggle):
"""
If disabled, you logically require Stick, Sword, or Magic Orb to perform Ladder Storage.
If enabled, you will be expected to perform Ladder Storage without progression items.
This can be done with the plushie code, a Golden Coin, Prayer, and many other options.
This option has no effect if you do not have Ladder Storage Logic enabled.
"""
internal_name = "ladder_storage_without_items"
display_name = "Ladder Storage without Items"
class LogicRules(Choice):
"""
This option has been superseded by the individual trick options.
If set to nmg, it will set Ice Grappling to medium and Laurels Zips on.
If set to ur, it will do nmg as well as set Ladder Storage to medium.
It is here to avoid breaking old yamls, and will be removed at a later date.
"""
visibility = Visibility.none
internal_name = "logic_rules"
display_name = "Logic Rules"
option_restricted = 0
option_no_major_glitches = 1
alias_nmg = 1
option_unrestricted = 2
alias_ur = 2
default = 0
@dataclass
class TunicOptions(PerGameCommonOptions):
start_inventory_from_pool: StartInventoryPool
@@ -254,30 +199,22 @@ class TunicOptions(PerGameCommonOptions):
shuffle_ladders: ShuffleLadders
entrance_rando: EntranceRando
fixed_shop: FixedShop
logic_rules: LogicRules
fool_traps: FoolTraps
hexagon_quest: HexagonQuest
hexagon_goal: HexagonGoal
extra_hexagon_percentage: ExtraHexagonPercentage
laurels_location: LaurelsLocation
lanternless: Lanternless
maskless: Maskless
laurels_zips: LaurelsZips
ice_grappling: IceGrappling
ladder_storage: LadderStorage
ladder_storage_without_items: LadderStorageWithoutItems
laurels_location: LaurelsLocation
plando_connections: TunicPlandoConnections
logic_rules: LogicRules
tunic_option_groups = [
OptionGroup("Logic Options", [
LogicRules,
Lanternless,
Maskless,
LaurelsZips,
IceGrappling,
LadderStorage,
LadderStorageWithoutItems
])
]
@@ -294,12 +231,9 @@ tunic_option_presets: Dict[str, Dict[str, Any]] = {
"Glace Mode": {
"accessibility": "minimal",
"ability_shuffling": True,
"entrance_rando": True,
"entrance_rando": "yes",
"fool_traps": "onslaught",
"laurels_zips": True,
"ice_grappling": "hard",
"ladder_storage": "hard",
"ladder_storage_without_items": True,
"logic_rules": "unrestricted",
"maskless": True,
"lanternless": True,
},

View File

@@ -16,8 +16,7 @@ tunic_regions: Dict[str, Set[str]] = {
"Eastern Vault Fortress": {"Beneath the Vault"},
"Beneath the Vault": {"Eastern Vault Fortress"},
"Quarry Back": {"Quarry"},
"Quarry": {"Monastery", "Lower Quarry"},
"Monastery": set(),
"Quarry": {"Lower Quarry"},
"Lower Quarry": {"Rooted Ziggurat"},
"Rooted Ziggurat": set(),
"Swamp": {"Cathedral"},

View File

@@ -3,7 +3,7 @@ from typing import Dict, TYPE_CHECKING
from worlds.generic.Rules import set_rule, forbid_item, add_rule
from BaseClasses import CollectionState
from .options import TunicOptions, LadderStorage, IceGrappling
from .options import TunicOptions
if TYPE_CHECKING:
from . import TunicWorld
@@ -27,10 +27,10 @@ green_hexagon = "Green Questagon"
blue_hexagon = "Blue Questagon"
gold_hexagon = "Gold Questagon"
# "Quarry - [East] Bombable Wall" is excluded from this list since it has slightly different rules
bomb_walls = ["East Forest - Bombable Wall", "Eastern Vault Fortress - [East Wing] Bombable Wall",
"Overworld - [Central] Bombable Wall", "Overworld - [Southwest] Bombable Wall Near Fountain",
"Quarry - [West] Upper Area Bombable Wall", "Ruined Atoll - [Northwest] Bombable Wall"]
"Quarry - [West] Upper Area Bombable Wall", "Quarry - [East] Bombable Wall",
"Ruined Atoll - [Northwest] Bombable Wall"]
def randomize_ability_unlocks(random: Random, options: TunicOptions) -> Dict[str, int]:
@@ -64,33 +64,32 @@ def has_sword(state: CollectionState, player: int) -> bool:
return state.has("Sword", player) or state.has("Sword Upgrade", player, 2)
def laurels_zip(state: CollectionState, world: "TunicWorld") -> bool:
return world.options.laurels_zips and state.has(laurels, world.player)
def has_ice_grapple_logic(long_range: bool, difficulty: IceGrappling, state: CollectionState, world: "TunicWorld") -> bool:
if world.options.ice_grappling < difficulty:
def has_ice_grapple_logic(long_range: bool, state: CollectionState, world: "TunicWorld") -> bool:
player = world.player
if not world.options.logic_rules:
return False
if not long_range:
return state.has_all({ice_dagger, grapple}, world.player)
return state.has_all({ice_dagger, grapple}, player)
else:
return state.has_all({ice_dagger, fire_wand, grapple}, world.player) and has_ability(icebolt, state, world)
return state.has_all({ice_dagger, fire_wand, grapple}, player) and has_ability(icebolt, state, world)
def can_ladder_storage(state: CollectionState, world: "TunicWorld") -> bool:
if not world.options.ladder_storage:
return False
if world.options.ladder_storage_without_items:
return True
return has_stick(state, world.player) or state.has(grapple, world.player)
return world.options.logic_rules == "unrestricted" and has_stick(state, world.player)
def has_mask(state: CollectionState, world: "TunicWorld") -> bool:
return world.options.maskless or state.has(mask, world.player)
if world.options.maskless:
return True
else:
return state.has(mask, world.player)
def has_lantern(state: CollectionState, world: "TunicWorld") -> bool:
return world.options.lanternless or state.has(lantern, world.player)
if world.options.lanternless:
return True
else:
return state.has(lantern, world.player)
def set_region_rules(world: "TunicWorld") -> None:
@@ -103,14 +102,12 @@ def set_region_rules(world: "TunicWorld") -> None:
lambda state: has_stick(state, player) or state.has(fire_wand, player)
world.get_entrance("Overworld -> Dark Tomb").access_rule = \
lambda state: has_lantern(state, world)
# laurels in, ladder storage in through the furnace, or ice grapple down the belltower
world.get_entrance("Overworld -> West Garden").access_rule = \
lambda state: (state.has(laurels, player)
or can_ladder_storage(state, world)
or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world))
lambda state: state.has(laurels, player) \
or can_ladder_storage(state, world)
world.get_entrance("Overworld -> Eastern Vault Fortress").access_rule = \
lambda state: state.has(laurels, player) \
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world) \
or has_ice_grapple_logic(True, state, world) \
or can_ladder_storage(state, world)
# using laurels or ls to get in is covered by the -> Eastern Vault Fortress rules
world.get_entrance("Overworld -> Beneath the Vault").access_rule = \
@@ -127,8 +124,8 @@ def set_region_rules(world: "TunicWorld") -> None:
world.get_entrance("Lower Quarry -> Rooted Ziggurat").access_rule = \
lambda state: state.has(grapple, player) and has_ability(prayer, state, world)
world.get_entrance("Swamp -> Cathedral").access_rule = \
lambda state: (state.has(laurels, player) and has_ability(prayer, state, world)) \
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
lambda state: state.has(laurels, player) and has_ability(prayer, state, world) \
or has_ice_grapple_logic(False, state, world)
world.get_entrance("Overworld -> Spirit Arena").access_rule = \
lambda state: ((state.has(gold_hexagon, player, options.hexagon_goal.value) if options.hexagon_quest.value
else state.has_all({red_hexagon, green_hexagon, blue_hexagon}, player)
@@ -136,18 +133,10 @@ def set_region_rules(world: "TunicWorld") -> None:
and has_ability(prayer, state, world) and has_sword(state, player)
and state.has_any({lantern, laurels}, player))
world.get_region("Quarry").connect(world.get_region("Rooted Ziggurat"),
rule=lambda state: has_ice_grapple_logic(True, IceGrappling.option_hard, state, world)
and has_ability(prayer, state, world))
if options.ladder_storage >= LadderStorage.option_medium:
# ls at any ladder in a safe spot in quarry to get to the monastery rope entrance
world.get_region("Quarry Back").connect(world.get_region("Monastery"),
rule=lambda state: can_ladder_storage(state, world))
def set_location_rules(world: "TunicWorld") -> None:
player = world.player
options = world.options
forbid_item(world.get_location("Secret Gathering Place - 20 Fairy Reward"), fairies, player)
@@ -158,13 +147,11 @@ def set_location_rules(world: "TunicWorld") -> None:
lambda state: has_ability(prayer, state, world)
or state.has(laurels, player)
or can_ladder_storage(state, world)
or (has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)
and has_lantern(state, world)))
or (has_ice_grapple_logic(True, state, world) and has_lantern(state, world)))
set_rule(world.get_location("Fortress Courtyard - Page Near Cave"),
lambda state: has_ability(prayer, state, world) or state.has(laurels, player)
or can_ladder_storage(state, world)
or (has_ice_grapple_logic(True, IceGrappling.option_easy, state, world)
and has_lantern(state, world)))
or (has_ice_grapple_logic(True, state, world) and has_lantern(state, world)))
set_rule(world.get_location("East Forest - Dancing Fox Spirit Holy Cross"),
lambda state: has_ability(holy_cross, state, world))
set_rule(world.get_location("Forest Grave Path - Holy Cross Code by Grave"),
@@ -199,17 +186,17 @@ def set_location_rules(world: "TunicWorld") -> None:
lambda state: state.has(laurels, player))
set_rule(world.get_location("Old House - Normal Chest"),
lambda state: state.has(house_key, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
or laurels_zip(state, world))
or has_ice_grapple_logic(False, state, world)
or (state.has(laurels, player) and options.logic_rules))
set_rule(world.get_location("Old House - Holy Cross Chest"),
lambda state: has_ability(holy_cross, state, world) and (
state.has(house_key, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
or laurels_zip(state, world)))
or has_ice_grapple_logic(False, state, world)
or (state.has(laurels, player) and options.logic_rules)))
set_rule(world.get_location("Old House - Shield Pickup"),
lambda state: state.has(house_key, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)
or laurels_zip(state, world))
or has_ice_grapple_logic(False, state, world)
or (state.has(laurels, player) and options.logic_rules))
set_rule(world.get_location("Overworld - [Northwest] Page on Pillar by Dark Tomb"),
lambda state: state.has(laurels, player))
set_rule(world.get_location("Overworld - [Southwest] From West Garden"),
@@ -219,7 +206,7 @@ def set_location_rules(world: "TunicWorld") -> None:
or (has_lantern(state, world) and has_sword(state, player))
or can_ladder_storage(state, world))
set_rule(world.get_location("Overworld - [Northwest] Chest Beneath Quarry Gate"),
lambda state: state.has_any({grapple, laurels}, player))
lambda state: state.has_any({grapple, laurels}, player) or options.logic_rules)
set_rule(world.get_location("Overworld - [East] Grapple Chest"),
lambda state: state.has(grapple, player))
set_rule(world.get_location("Special Shop - Secret Page Pickup"),
@@ -228,11 +215,11 @@ def set_location_rules(world: "TunicWorld") -> None:
lambda state: has_ability(holy_cross, state, world)
and (state.has(laurels, player) or (has_lantern(state, world) and (has_sword(state, player)
or state.has(fire_wand, player)))
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)))
or has_ice_grapple_logic(False, state, world)))
set_rule(world.get_location("Sealed Temple - Page Pickup"),
lambda state: state.has(laurels, player)
or (has_lantern(state, world) and (has_sword(state, player) or state.has(fire_wand, player)))
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
or has_ice_grapple_logic(False, state, world))
set_rule(world.get_location("West Furnace - Lantern Pickup"),
lambda state: has_stick(state, player) or state.has_any({fire_wand, laurels}, player))
@@ -267,7 +254,7 @@ def set_location_rules(world: "TunicWorld") -> None:
lambda state: state.has(laurels, player) and has_ability(holy_cross, state, world))
set_rule(world.get_location("West Garden - [East Lowlands] Page Behind Ice Dagger House"),
lambda state: (state.has(laurels, player) and has_ability(prayer, state, world))
or has_ice_grapple_logic(True, IceGrappling.option_easy, state, world))
or has_ice_grapple_logic(True, state, world))
set_rule(world.get_location("West Garden - [Central Lowlands] Below Left Walkway"),
lambda state: state.has(laurels, player))
set_rule(world.get_location("West Garden - [Central Highlands] After Garden Knight"),
@@ -278,15 +265,12 @@ def set_location_rules(world: "TunicWorld") -> None:
# Ruined Atoll
set_rule(world.get_location("Ruined Atoll - [West] Near Kevin Block"),
lambda state: state.has(laurels, player))
# ice grapple push a crab through the door
set_rule(world.get_location("Ruined Atoll - [East] Locked Room Lower Chest"),
lambda state: state.has(laurels, player) or state.has(key, player, 2)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
lambda state: state.has(laurels, player) or state.has(key, player, 2))
set_rule(world.get_location("Ruined Atoll - [East] Locked Room Upper Chest"),
lambda state: state.has(laurels, player) or state.has(key, player, 2)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world))
lambda state: state.has(laurels, player) or state.has(key, player, 2))
set_rule(world.get_location("Librarian - Hexagon Green"),
lambda state: has_sword(state, player))
lambda state: has_sword(state, player) or options.logic_rules)
# Frog's Domain
set_rule(world.get_location("Frog's Domain - Side Room Grapple Secret"),
@@ -301,12 +285,10 @@ def set_location_rules(world: "TunicWorld") -> None:
lambda state: state.has(laurels, player))
set_rule(world.get_location("Fortress Arena - Siege Engine/Vault Key Pickup"),
lambda state: has_sword(state, player)
and (has_ability(prayer, state, world)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)))
and (has_ability(prayer, state, world) or has_ice_grapple_logic(False, state, world)))
set_rule(world.get_location("Fortress Arena - Hexagon Red"),
lambda state: state.has(vault_key, player)
and (has_ability(prayer, state, world)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)))
and (has_ability(prayer, state, world) or has_ice_grapple_logic(False, state, world)))
# Beneath the Vault
set_rule(world.get_location("Beneath the Fortress - Bridge"),
@@ -319,14 +301,14 @@ def set_location_rules(world: "TunicWorld") -> None:
lambda state: state.has(laurels, player))
set_rule(world.get_location("Rooted Ziggurat Upper - Near Bridge Switch"),
lambda state: has_sword(state, player) or state.has_all({fire_wand, laurels}, player))
# nmg - kill boss scav with orb + firecracker, or similar
set_rule(world.get_location("Rooted Ziggurat Lower - Hexagon Blue"),
lambda state: has_sword(state, player))
lambda state: has_sword(state, player) or (state.has(grapple, player) and options.logic_rules))
# Swamp
set_rule(world.get_location("Cathedral Gauntlet - Gauntlet Reward"),
lambda state: (state.has(fire_wand, player) and has_sword(state, player))
and (state.has(laurels, player)
or has_ice_grapple_logic(False, IceGrappling.option_medium, state, world)))
and (state.has(laurels, player) or has_ice_grapple_logic(False, state, world)))
set_rule(world.get_location("Swamp - [Entrance] Above Entryway"),
lambda state: state.has(laurels, player))
set_rule(world.get_location("Swamp - [South Graveyard] Upper Walkway Dash Chest"),
@@ -353,16 +335,8 @@ def set_location_rules(world: "TunicWorld") -> None:
# Bombable Walls
for location_name in bomb_walls:
# has_sword is there because you can buy bombs in the shop
set_rule(world.get_location(location_name),
lambda state: state.has(gun, player)
or has_sword(state, player)
or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world))
set_rule(world.get_location(location_name), lambda state: state.has(gun, player) or has_sword(state, player))
add_rule(world.get_location("Cube Cave - Holy Cross Chest"),
lambda state: state.has(gun, player)
or has_sword(state, player)
or has_ice_grapple_logic(False, IceGrappling.option_hard, state, world))
# can't ice grapple to this one, not enough space
set_rule(world.get_location("Quarry - [East] Bombable Wall"),
lambda state: state.has(gun, player) or has_sword(state, player))
# Shop

View File

@@ -68,57 +68,3 @@ class TestER(TunicTestBase):
self.assertFalse(self.can_reach_location("Overworld - [Southwest] Flowers Holy Cross"))
self.collect_by_name(["Pages 42-43 (Holy Cross)"])
self.assertTrue(self.can_reach_location("Overworld - [Southwest] Flowers Holy Cross"))
class TestERSpecial(TunicTestBase):
options = {options.EntranceRando.internal_name: options.EntranceRando.option_yes,
options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true,
options.HexagonQuest.internal_name: options.HexagonQuest.option_false,
options.FixedShop.internal_name: options.FixedShop.option_false,
options.IceGrappling.internal_name: options.IceGrappling.option_easy,
"plando_connections": [
{
"entrance": "Stick House Entrance",
"exit": "Ziggurat Portal Room Entrance"
},
{
"entrance": "Ziggurat Lower to Ziggurat Tower",
"exit": "Secret Gathering Place Exit"
}
]}
# with these plando connections, you need to ice grapple from the back of lower zig to the front to get laurels
# ensure that ladder storage connections connect to the outlet region, not the portal's region
class TestLadderStorage(TunicTestBase):
options = {options.EntranceRando.internal_name: options.EntranceRando.option_yes,
options.AbilityShuffling.internal_name: options.AbilityShuffling.option_true,
options.HexagonQuest.internal_name: options.HexagonQuest.option_false,
options.FixedShop.internal_name: options.FixedShop.option_false,
options.LadderStorage.internal_name: options.LadderStorage.option_hard,
options.LadderStorageWithoutItems.internal_name: options.LadderStorageWithoutItems.option_false,
"plando_connections": [
{
"entrance": "Fortress Courtyard Shop",
# "exit": "Ziggurat Portal Room Exit"
"exit": "Spawn to Far Shore"
},
{
"entrance": "Fortress Courtyard to Beneath the Vault",
"exit": "Stick House Exit"
},
{
"entrance": "Stick House Entrance",
"exit": "Fortress Courtyard to Overworld"
},
{
"entrance": "Old House Waterfall Entrance",
"exit": "Ziggurat Portal Room Entrance"
},
]}
def test_ls_to_shop_entrance(self) -> None:
self.collect_by_name(["Magic Orb"])
self.assertFalse(self.can_reach_location("Fortress Courtyard - Page Near Cave"))
self.collect_by_name(["Pages 24-25 (Prayer)"])
self.assertTrue(self.can_reach_location("Fortress Courtyard - Page Near Cave"))

View File

@@ -61,7 +61,7 @@ class WitnessWorld(World):
item_name_groups = static_witness_items.ITEM_GROUPS
location_name_groups = static_witness_locations.AREA_LOCATION_GROUPS
required_client_version = (0, 5, 1)
required_client_version = (0, 4, 5)
player_logic: WitnessPlayerLogic
player_locations: WitnessPlayerLocations
@@ -204,10 +204,11 @@ class WitnessWorld(World):
]
if early_items:
random_early_item = self.random.choice(early_items)
mode = self.options.puzzle_randomization
if mode == "sigma_expert" or mode == "umbra_variety" or self.options.victory_condition == "panel_hunt":
# In Expert and Variety, only tag the item as early, rather than forcing it onto the gate.
# Same with panel hunt, since the Tutorial Gate Open panel is used for something else
if (
self.options.puzzle_randomization == "sigma_expert"
or self.options.victory_condition == "panel_hunt"
):
# In Expert and Panel Hunt, only tag the item as early, rather than forcing it onto the gate.
self.multiworld.local_early_items[self.player][random_early_item] = 1
else:
# Force the item onto the tutorial gate check and remove it from our random pool.
@@ -254,7 +255,7 @@ class WitnessWorld(World):
self.get_region(region).add_locations({loc: self.location_name_to_id[loc]})
warning(
f"""Location "{loc}" had to be added to {self.player_name}'s world
f"""Location "{loc}" had to be added to {self.player_name}'s world
due to insufficient sphere 1 size."""
)

File diff suppressed because it is too large Load Diff

View File

@@ -13,22 +13,6 @@ ITEM_GROUPS: Dict[str, Set[str]] = {}
# item list during get_progression_items.
_special_usefuls: List[str] = ["Puzzle Skip"]
ALWAYS_GOOD_SYMBOL_ITEMS: Set[str] = {"Dots", "Black/White Squares", "Symmetry", "Shapers", "Stars"}
MODE_SPECIFIC_GOOD_ITEMS: Dict[str, Set[str]] = {
"none": set(),
"sigma_normal": set(),
"sigma_expert": {"Triangles"},
"umbra_variety": {"Triangles"}
}
MODE_SPECIFIC_GOOD_DISCARD_ITEMS: Dict[str, Set[str]] = {
"none": {"Triangles"},
"sigma_normal": {"Triangles"},
"sigma_expert": {"Arrows"},
"umbra_variety": set() # Variety Discards use both Arrows and Triangles, so neither of them are that useful alone
}
def populate_items() -> None:
for item_name, definition in static_witness_logic.ALL_ITEMS.items():

View File

@@ -17,7 +17,6 @@ from .utils import (
get_items,
get_sigma_expert_logic,
get_sigma_normal_logic,
get_umbra_variety_logic,
get_vanilla_logic,
logical_or_witness_rules,
parse_lambda,
@@ -293,11 +292,6 @@ def get_sigma_expert() -> StaticWitnessLogicObj:
return StaticWitnessLogicObj(get_sigma_expert_logic())
@cache_argsless
def get_umbra_variety() -> StaticWitnessLogicObj:
return StaticWitnessLogicObj(get_umbra_variety_logic())
def __getattr__(name: str) -> StaticWitnessLogicObj:
if name == "vanilla":
return get_vanilla()
@@ -305,8 +299,6 @@ def __getattr__(name: str) -> StaticWitnessLogicObj:
return get_sigma_normal()
if name == "sigma_expert":
return get_sigma_expert()
if name == "umbra_variety":
return get_umbra_variety()
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

View File

@@ -215,10 +215,6 @@ def get_sigma_expert_logic() -> List[str]:
return get_adjustment_file("WitnessLogicExpert.txt")
def get_umbra_variety_logic() -> List[str]:
return get_adjustment_file("WitnessLogicVariety.txt")
def get_vanilla_logic() -> List[str]:
return get_adjustment_file("WitnessLogicVanilla.txt")

View File

@@ -145,7 +145,7 @@ class EntityHuntPicker:
remaining_entities, remaining_entity_weights = [], []
for area, eligible_entities in self.ELIGIBLE_ENTITIES_PER_AREA.items():
for panel in sorted(eligible_entities - self.HUNT_ENTITIES):
for panel in eligible_entities - self.HUNT_ENTITIES:
remaining_entities.append(panel)
remaining_entity_weights.append(allowance_per_area[area])

View File

@@ -53,7 +53,7 @@ def get_always_hint_items(world: "WitnessWorld") -> List[str]:
wincon = world.options.victory_condition
if discards:
if difficulty == "sigma_expert" or difficulty == "umbra_variety":
if difficulty == "sigma_expert":
always.append("Arrows")
else:
always.append("Triangles")
@@ -220,7 +220,7 @@ def try_getting_location_group_for_location(world: "WitnessWorld", hint_loc: Loc
def word_direct_hint(world: "WitnessWorld", hint: WitnessLocationHint) -> WitnessWordedHint:
location_name = hint.location.name
if hint.location.player != world.player:
location_name += " (" + world.multiworld.get_player_name(hint.location.player) + ")"
location_name += " (" + world.player_name + ")"
item = hint.location.item
@@ -229,7 +229,7 @@ def word_direct_hint(world: "WitnessWorld", hint: WitnessLocationHint) -> Witnes
item_name = item.name
if item.player != world.player:
item_name += " (" + world.multiworld.get_player_name(item.player) + ")"
item_name += " (" + world.player_name + ")"
hint_text = ""
area: Optional[str] = None

View File

@@ -250,15 +250,10 @@ class PanelHuntDiscourageSameAreaFactor(Range):
class PuzzleRandomization(Choice):
"""
Puzzles in this randomizer are randomly generated. This option changes the difficulty/types of puzzles.
"Sigma Normal" randomizes puzzles close to their original mechanics and difficulty.
"Sigma Expert" is an entirely new experience with extremely difficult random puzzles. Do not underestimate this mode, it is brutal.
"Umbra Variety" focuses on unique symbol combinations not featured in the original game. It is harder than Sigma Normal, but easier than Sigma Expert.
"None" means that the puzzles are unchanged from the original game.
"""
display_name = "Puzzle Randomization"
option_sigma_normal = 0
option_sigma_expert = 1
option_umbra_variety = 3
option_none = 2

View File

@@ -7,6 +7,7 @@ from typing import TYPE_CHECKING, Dict, List, Set, cast
from BaseClasses import Item, ItemClassification, MultiWorld
from .data import static_items as static_witness_items
from .data import static_logic as static_witness_logic
from .data.item_definition_classes import (
DoorItemDefinition,
ItemCategory,
@@ -154,12 +155,16 @@ class WitnessPlayerItems:
"""
output: Set[str] = set()
if self._world.options.shuffle_symbols:
discards_on = self._world.options.shuffle_discarded_panels
mode = self._world.options.puzzle_randomization.current_key
output = {"Dots", "Black/White Squares", "Symmetry", "Shapers", "Stars"}
output = static_witness_items.ALWAYS_GOOD_SYMBOL_ITEMS | static_witness_items.MODE_SPECIFIC_GOOD_ITEMS[mode]
if discards_on:
output |= static_witness_items.MODE_SPECIFIC_GOOD_DISCARD_ITEMS[mode]
if self._world.options.shuffle_discarded_panels:
if self._world.options.puzzle_randomization == "sigma_expert":
output.add("Arrows")
else:
output.add("Triangles")
# Replace progressive items with their parents.
output = {static_witness_logic.get_parent_progressive_item(item) for item in output}
# Remove items that are mentioned in any plando options. (Hopefully, in the future, plando will get resolved
# before create_items so that we'll be able to check placed items instead of just removing all items mentioned

View File

@@ -87,14 +87,12 @@ class WitnessPlayerLogic:
self.DIFFICULTY = world.options.puzzle_randomization
self.REFERENCE_LOGIC: StaticWitnessLogicObj
if self.DIFFICULTY == "sigma_normal":
self.REFERENCE_LOGIC = static_witness_logic.sigma_normal
elif self.DIFFICULTY == "sigma_expert":
if self.DIFFICULTY == "sigma_expert":
self.REFERENCE_LOGIC = static_witness_logic.sigma_expert
elif self.DIFFICULTY == "umbra_variety":
self.REFERENCE_LOGIC = static_witness_logic.umbra_variety
elif self.DIFFICULTY == "none":
self.REFERENCE_LOGIC = static_witness_logic.vanilla
else:
self.REFERENCE_LOGIC = static_witness_logic.sigma_normal
self.CONNECTIONS_BY_REGION_NAME_THEORETICAL: Dict[str, Set[Tuple[str, WitnessRule]]] = copy.deepcopy(
self.REFERENCE_LOGIC.STATIC_CONNECTIONS_BY_REGION_NAME

View File

@@ -30,8 +30,6 @@ class WitnessPlayerRegions:
self.reference_logic = static_witness_logic.sigma_normal
elif difficulty == "sigma_expert":
self.reference_logic = static_witness_logic.sigma_expert
elif difficulty == "umbra_variety":
self.reference_logic = static_witness_logic.umbra_variety
else:
self.reference_logic = static_witness_logic.vanilla

View File

@@ -96,39 +96,6 @@ class TestSymbolsRequiredToWinElevatorVanilla(WitnessTestBase):
self.assert_can_beat_with_minimally(exact_requirement)
class TestSymbolsRequiredToWinElevatorVariety(WitnessTestBase):
options = {
"shuffle_lasers": True,
"mountain_lasers": 1,
"victory_condition": "elevator",
"early_symbol_item": False,
"puzzle_randomization": "umbra_variety",
}
def test_symbols_to_win(self) -> None:
"""
In symbol shuffle, the only way to reach the Elevator is through Mountain Entry by descending the Mountain.
This requires a very specific set of symbol items per puzzle randomization mode.
In this case, we check Variety Puzzles.
"""
exact_requirement = {
"Monastery Laser": 1,
"Progressive Dots": 2,
"Progressive Stars": 2,
"Progressive Symmetry": 1,
"Black/White Squares": 1,
"Colored Squares": 1,
"Shapers": 1,
"Rotated Shapers": 1,
"Eraser": 1,
"Triangles": 1,
"Arrows": 1,
}
self.assert_can_beat_with_minimally(exact_requirement)
class TestPanelsRequiredToWinElevator(WitnessTestBase):
options = {
"shuffle_lasers": True,

View File

@@ -54,7 +54,6 @@ class TestMaxEntityShuffle(WitnessTestBase):
class TestPostgameGroupedDoors(WitnessTestBase):
options = {
"puzzle_randomization": "umbra_variety",
"shuffle_postgame": True,
"shuffle_discarded_panels": True,
"shuffle_doors": "doors",

View File

@@ -46,9 +46,6 @@ class TestSymbolRequirementsMultiworld(WitnessMultiworldTestBase):
{
"puzzle_randomization": "none",
},
{
"puzzle_randomization": "umbra_variety",
}
]
common_options = {
@@ -66,15 +63,12 @@ class TestSymbolRequirementsMultiworld(WitnessMultiworldTestBase):
self.assertFalse(self.get_items_by_name("Arrows", 1))
self.assertTrue(self.get_items_by_name("Arrows", 2))
self.assertFalse(self.get_items_by_name("Arrows", 3))
self.assertTrue(self.get_items_by_name("Arrows", 4))
with self.subTest("Test that Discards ask for Triangles in normal, but Arrows in expert."):
desert_discard = "0x17CE7"
triangles = frozenset({frozenset({"Triangles"})})
arrows = frozenset({frozenset({"Arrows"})})
both = frozenset({frozenset({"Triangles", "Arrows"})})
self.assertEqual(self.multiworld.worlds[1].player_logic.REQUIREMENTS_BY_HEX[desert_discard], triangles)
self.assertEqual(self.multiworld.worlds[2].player_logic.REQUIREMENTS_BY_HEX[desert_discard], arrows)
self.assertEqual(self.multiworld.worlds[3].player_logic.REQUIREMENTS_BY_HEX[desert_discard], triangles)
self.assertEqual(self.multiworld.worlds[4].player_logic.REQUIREMENTS_BY_HEX[desert_discard], both)

View File

@@ -29,7 +29,7 @@ class Category:
mean_score = 0
for key, value in yacht_weights[self.name, min(8, num_dice), min(8, num_rolls)].items():
mean_score += key * value / 100000
return mean_score
return mean_score * self.quantity
class ListState:

File diff suppressed because it is too large Load Diff

View File

@@ -56,7 +56,7 @@ class YachtDiceWorld(World):
item_name_groups = item_groups
ap_world_version = "2.1.2"
ap_world_version = "2.1.1"
def _get_yachtdice_data(self):
return {
@@ -190,6 +190,7 @@ class YachtDiceWorld(World):
if self.frags_per_roll == 1:
self.itempool += ["Roll"] * num_of_rolls_to_add # minus one because one is in start inventory
else:
self.itempool.append("Roll") # always add a full roll to make generation easier (will be early)
self.itempool += ["Roll Fragment"] * (self.frags_per_roll * num_of_rolls_to_add)
already_items = len(self.itempool)
@@ -230,10 +231,13 @@ class YachtDiceWorld(World):
weights["Dice"] = weights["Dice"] / 5 * self.frags_per_dice
weights["Roll"] = weights["Roll"] / 5 * self.frags_per_roll
extra_points_added = [0] # make it a mutible type so we can change the value in the function
step_score_multipliers_added = [0]
extra_points_added = 0
multipliers_added = 0
items_added = 0
def get_item_to_add(weights, extra_points_added, multipliers_added, items_added):
items_added += 1
def get_item_to_add(weights, extra_points_added, step_score_multipliers_added):
all_items = self.itempool + self.precollected
dice_fragments_in_pool = all_items.count("Dice") * self.frags_per_dice + all_items.count("Dice Fragment")
if dice_fragments_in_pool + 1 >= 9 * self.frags_per_dice:
@@ -242,18 +246,21 @@ class YachtDiceWorld(World):
if roll_fragments_in_pool + 1 >= 6 * self.frags_per_roll:
weights["Roll"] = 0 # don't allow >= 6 rolls
# Don't allow too many extra points
if extra_points_added[0] > 400:
weights["Points"] = 0
if step_score_multipliers_added[0] > 10:
# Don't allow too many multipliers
if multipliers_added > 50:
weights["Fixed Score Multiplier"] = 0
weights["Step Score Multiplier"] = 0
# Don't allow too many extra points
if extra_points_added > 300:
weights["Points"] = 0
# if all weights are zero, allow to add fixed score multiplier, double category, points.
if sum(weights.values()) == 0:
weights["Fixed Score Multiplier"] = 1
if multipliers_added <= 50:
weights["Fixed Score Multiplier"] = 1
weights["Double category"] = 1
if extra_points_added[0] <= 400:
if extra_points_added <= 300:
weights["Points"] = 1
# Next, add the appropriate item. We'll slightly alter weights to avoid too many of the same item
@@ -267,10 +274,11 @@ class YachtDiceWorld(World):
return "Roll" if self.frags_per_roll == 1 else "Roll Fragment"
elif which_item_to_add == "Fixed Score Multiplier":
weights["Fixed Score Multiplier"] /= 1.05
multipliers_added += 1
return "Fixed Score Multiplier"
elif which_item_to_add == "Step Score Multiplier":
weights["Step Score Multiplier"] /= 1.1
step_score_multipliers_added[0] += 1
multipliers_added += 1
return "Step Score Multiplier"
elif which_item_to_add == "Double category":
# Below entries are the weights to add each category.
@@ -295,15 +303,15 @@ class YachtDiceWorld(World):
choice = self.random.choices(list(probs.keys()), weights=list(probs.values()))[0]
if choice == "1 Point":
weights["Points"] /= 1.01
extra_points_added[0] += 1
extra_points_added += 1
return "1 Point"
elif choice == "10 Points":
weights["Points"] /= 1.1
extra_points_added[0] += 10
extra_points_added += 10
return "10 Points"
elif choice == "100 Points":
weights["Points"] /= 2
extra_points_added[0] += 100
extra_points_added += 100
return "100 Points"
else:
raise Exception("Unknown point value (Yacht Dice)")
@@ -312,7 +320,7 @@ class YachtDiceWorld(World):
# adding 17 items as a start seems like the smartest way to get close to 1000 points
for _ in range(17):
self.itempool.append(get_item_to_add(weights, extra_points_added, step_score_multipliers_added))
self.itempool.append(get_item_to_add(weights, extra_points_added, multipliers_added, items_added))
score_in_logic = dice_simulation_fill_pool(
self.itempool + self.precollected,
@@ -340,7 +348,7 @@ class YachtDiceWorld(World):
else:
# Keep adding items until a score of 1000 is in logic
while score_in_logic < 1000:
item_to_add = get_item_to_add(weights, extra_points_added, step_score_multipliers_added)
item_to_add = get_item_to_add(weights, extra_points_added, multipliers_added, items_added)
self.itempool.append(item_to_add)
if item_to_add == "1 Point":
score_in_logic += 1
@@ -466,9 +474,6 @@ class YachtDiceWorld(World):
menu.exits.append(connection)
connection.connect(board)
self.multiworld.regions += [menu, board]
def get_filler_item_name(self) -> str:
return "Good RNG"
def set_rules(self):
"""