diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-04 01:40:17 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-04 08:40:17 +0200 | 
| commit | fc18d0c9cab015dc242450821bcc70d99d48c669 (patch) | |
| tree | ae915a448de788b01a3f6b479ca129cc5504c1d5 /player_logic.py | |
| parent | 1979067701c475c0607d6f240362d8489242800e (diff) | |
| download | lingo-apworld-fc18d0c9cab015dc242450821bcc70d99d48c669.tar.gz lingo-apworld-fc18d0c9cab015dc242450821bcc70d99d48c669.tar.bz2 lingo-apworld-fc18d0c9cab015dc242450821bcc70d99d48c669.zip | |
Lingo: Started using OptionError (#3251)
Diffstat (limited to 'player_logic.py')
| -rw-r--r-- | player_logic.py | 11 | 
1 files changed, 6 insertions, 5 deletions
| diff --git a/player_logic.py b/player_logic.py index 7019269..19583bc 100644 --- a/player_logic.py +++ b/player_logic.py | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | from enum import Enum | 1 | from enum import Enum | 
| 2 | from typing import Dict, List, NamedTuple, Optional, Set, Tuple, TYPE_CHECKING | 2 | from typing import Dict, List, NamedTuple, Optional, Set, Tuple, TYPE_CHECKING | 
| 3 | 3 | ||
| 4 | from Options import OptionError | ||
| 4 | from .datatypes import Door, DoorType, RoomAndDoor, RoomAndPanel | 5 | from .datatypes import Door, DoorType, RoomAndDoor, RoomAndPanel | 
| 5 | from .items import ALL_ITEM_TABLE, ItemType | 6 | from .items import ALL_ITEM_TABLE, ItemType | 
| 6 | from .locations import ALL_LOCATION_TABLE, LocationClassification | 7 | from .locations import ALL_LOCATION_TABLE, LocationClassification | 
| @@ -149,8 +150,8 @@ class LingoPlayerLogic: | |||
| 149 | early_color_hallways = world.options.early_color_hallways | 150 | early_color_hallways = world.options.early_color_hallways | 
| 150 | 151 | ||
| 151 | if location_checks == LocationChecks.option_reduced and door_shuffle != ShuffleDoors.option_none: | 152 | if location_checks == LocationChecks.option_reduced and door_shuffle != ShuffleDoors.option_none: | 
| 152 | raise Exception("You cannot have reduced location checks when door shuffle is on, because there would not " | 153 | raise OptionError("You cannot have reduced location checks when door shuffle is on, because there would not" | 
| 153 | "be enough locations for all of the door items.") | 154 | " be enough locations for all of the door items.") | 
| 154 | 155 | ||
| 155 | # Create door items, where needed. | 156 | # Create door items, where needed. | 
| 156 | door_groups: Set[str] = set() | 157 | door_groups: Set[str] = set() | 
| @@ -219,7 +220,7 @@ class LingoPlayerLogic: | |||
| 219 | self.event_loc_to_item[self.level_2_location] = "Victory" | 220 | self.event_loc_to_item[self.level_2_location] = "Victory" | 
| 220 | 221 | ||
| 221 | if world.options.level_2_requirement == 1: | 222 | if world.options.level_2_requirement == 1: | 
| 222 | raise Exception("The Level 2 requirement must be at least 2 when LEVEL 2 is the victory condition.") | 223 | raise OptionError("The Level 2 requirement must be at least 2 when LEVEL 2 is the victory condition.") | 
| 223 | elif victory_condition == VictoryCondition.option_pilgrimage: | 224 | elif victory_condition == VictoryCondition.option_pilgrimage: | 
| 224 | self.victory_condition = "Pilgrim Antechamber - PILGRIM" | 225 | self.victory_condition = "Pilgrim Antechamber - PILGRIM" | 
| 225 | self.add_location("Pilgrim Antechamber", "PILGRIM (Solved)", None, | 226 | self.add_location("Pilgrim Antechamber", "PILGRIM (Solved)", None, | 
| @@ -248,11 +249,11 @@ class LingoPlayerLogic: | |||
| 248 | self.real_locations.append(location_name) | 249 | self.real_locations.append(location_name) | 
| 249 | 250 | ||
| 250 | if world.options.enable_pilgrimage and world.options.sunwarp_access == SunwarpAccess.option_disabled: | 251 | if world.options.enable_pilgrimage and world.options.sunwarp_access == SunwarpAccess.option_disabled: | 
| 251 | raise Exception("Sunwarps cannot be disabled when pilgrimage is enabled.") | 252 | raise OptionError("Sunwarps cannot be disabled when pilgrimage is enabled.") | 
| 252 | 253 | ||
| 253 | if world.options.shuffle_sunwarps: | 254 | if world.options.shuffle_sunwarps: | 
| 254 | if world.options.sunwarp_access == SunwarpAccess.option_disabled: | 255 | if world.options.sunwarp_access == SunwarpAccess.option_disabled: | 
| 255 | raise Exception("Sunwarps cannot be shuffled if they are disabled.") | 256 | raise OptionError("Sunwarps cannot be shuffled if they are disabled.") | 
| 256 | 257 | ||
| 257 | self.sunwarp_mapping = list(range(0, 12)) | 258 | self.sunwarp_mapping = list(range(0, 12)) | 
| 258 | world.random.shuffle(self.sunwarp_mapping) | 259 | world.random.shuffle(self.sunwarp_mapping) | 
