diff options
Diffstat (limited to 'apworld/__init__.py')
| -rw-r--r-- | apworld/__init__.py | 26 |
1 files changed, 22 insertions, 4 deletions
| diff --git a/apworld/__init__.py b/apworld/__init__.py index 1d12050..3d2f075 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py | |||
| @@ -4,6 +4,7 @@ Archipelago init file for Lingo 2 | |||
| 4 | from typing import ClassVar | 4 | from typing import ClassVar |
| 5 | 5 | ||
| 6 | from BaseClasses import ItemClassification, Item, Tutorial | 6 | from BaseClasses import ItemClassification, Item, Tutorial |
| 7 | from Options import OptionError | ||
| 7 | from settings import Group, UserFilePath | 8 | from settings import Group, UserFilePath |
| 8 | from worlds.AutoWorld import WebWorld, World | 9 | from worlds.AutoWorld import WebWorld, World |
| 9 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS | 10 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS |
| @@ -33,6 +34,7 @@ class Lingo2Settings(Group): | |||
| 33 | is_exe = True | 34 | is_exe = True |
| 34 | 35 | ||
| 35 | exe_file: ExecutableFile = ExecutableFile() | 36 | exe_file: ExecutableFile = ExecutableFile() |
| 37 | start_game: bool = True | ||
| 36 | 38 | ||
| 37 | 39 | ||
| 38 | class Lingo2World(World): | 40 | class Lingo2World(World): |
| @@ -75,15 +77,18 @@ class Lingo2World(World): | |||
| 75 | if self.options.shuffle_worldports: | 77 | if self.options.shuffle_worldports: |
| 76 | if hasattr(self.multiworld, "re_gen_passthrough") and "Lingo 2" in self.multiworld.re_gen_passthrough: | 78 | if hasattr(self.multiworld, "re_gen_passthrough") and "Lingo 2" in self.multiworld.re_gen_passthrough: |
| 77 | slot_value = self.multiworld.re_gen_passthrough["Lingo 2"]["port_pairings"] | 79 | slot_value = self.multiworld.re_gen_passthrough["Lingo 2"]["port_pairings"] |
| 78 | self.port_pairings = {int(fp): int(tp) for fp, tp in slot_value.items()} | 80 | self.port_pairings = { |
| 81 | self.static_logic.port_id_by_ap_id[int(fp)]: self.static_logic.port_id_by_ap_id[int(tp)] | ||
| 82 | for fp, tp in slot_value.items() | ||
| 83 | } | ||
| 79 | 84 | ||
| 80 | connect_ports_from_ut(self.port_pairings, self) | 85 | connect_ports_from_ut(self.port_pairings, self) |
| 81 | else: | 86 | else: |
| 82 | shuffle_entrances(self) | 87 | shuffle_entrances(self) |
| 83 | 88 | ||
| 84 | from Utils import visualize_regions | 89 | #from Utils import visualize_regions |
| 85 | 90 | ||
| 86 | visualize_regions(self.multiworld.get_region("Menu", self.player), "my_world.puml") | 91 | #visualize_regions(self.multiworld.get_region("Menu", self.player), "my_world.puml") |
| 87 | 92 | ||
| 88 | def create_items(self): | 93 | def create_items(self): |
| 89 | pool = [self.create_item(name) for name in self.player_logic.real_items] | 94 | pool = [self.create_item(name) for name in self.player_logic.real_items] |
| @@ -108,6 +113,11 @@ class Lingo2World(World): | |||
| 108 | for i in range(0, item_difference): | 113 | for i in range(0, item_difference): |
| 109 | pool.append(self.create_item(self.get_filler_item_name())) | 114 | pool.append(self.create_item(self.get_filler_item_name())) |
| 110 | 115 | ||
| 116 | if not any(ItemClassification.progression in item.classification for item in pool): | ||
| 117 | raise OptionError(f"Lingo 2 player {self.player} has no progression items. Please enable at least one " | ||
| 118 | f"option that would add progression gating to your world, such as Shuffle Doors or " | ||
| 119 | f"Shuffle Letters.") | ||
| 120 | |||
| 111 | self.multiworld.itempool += pool | 121 | self.multiworld.itempool += pool |
| 112 | 122 | ||
| 113 | def create_item(self, name: str) -> Item: | 123 | def create_item(self, name: str) -> Item: |
| @@ -123,7 +133,11 @@ class Lingo2World(World): | |||
| 123 | slot_options = [ | 133 | slot_options = [ |
| 124 | "cyan_door_behavior", | 134 | "cyan_door_behavior", |
| 125 | "daedalus_roof_access", | 135 | "daedalus_roof_access", |
| 136 | "enable_gift_maps", | ||
| 137 | "enable_icarus", | ||
| 138 | "endings_requirement", | ||
| 126 | "keyholder_sanity", | 139 | "keyholder_sanity", |
| 140 | "masteries_requirement", | ||
| 127 | "shuffle_control_center_colors", | 141 | "shuffle_control_center_colors", |
| 128 | "shuffle_doors", | 142 | "shuffle_doors", |
| 129 | "shuffle_gallery_paintings", | 143 | "shuffle_gallery_paintings", |
| @@ -141,7 +155,11 @@ class Lingo2World(World): | |||
| 141 | } | 155 | } |
| 142 | 156 | ||
| 143 | if self.options.shuffle_worldports: | 157 | if self.options.shuffle_worldports: |
| 144 | slot_data["port_pairings"] = self.port_pairings | 158 | def get_port_ap_id(port_id): |
| 159 | return self.static_logic.objects.ports[port_id].ap_id | ||
| 160 | |||
| 161 | slot_data["port_pairings"] = {get_port_ap_id(from_id): get_port_ap_id(to_id) | ||
| 162 | for from_id, to_id in self.port_pairings.items()} | ||
| 145 | 163 | ||
| 146 | return slot_data | 164 | return slot_data |
| 147 | 165 | ||
