summary refs log tree commit diff stats
path: root/__init__.py
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-05-04 01:40:17 -0500
committerGitHub <noreply@github.com>2024-05-04 08:40:17 +0200
commitfc18d0c9cab015dc242450821bcc70d99d48c669 (patch)
treeae915a448de788b01a3f6b479ca129cc5504c1d5 /__init__.py
parent1979067701c475c0607d6f240362d8489242800e (diff)
downloadlingo-apworld-fc18d0c9cab015dc242450821bcc70d99d48c669.tar.gz
lingo-apworld-fc18d0c9cab015dc242450821bcc70d99d48c669.tar.bz2
lingo-apworld-fc18d0c9cab015dc242450821bcc70d99d48c669.zip
Lingo: Started using OptionError (#3251)
Diffstat (limited to '__init__.py')
-rw-r--r--__init__.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/__init__.py b/__init__.py index 537b149..113c392 100644 --- a/__init__.py +++ b/__init__.py
@@ -4,6 +4,7 @@ Archipelago init file for Lingo
4from logging import warning 4from logging import warning
5 5
6from BaseClasses import Item, ItemClassification, Tutorial 6from BaseClasses import Item, ItemClassification, Tutorial
7from Options import OptionError
7from worlds.AutoWorld import WebWorld, World 8from worlds.AutoWorld import WebWorld, World
8from .datatypes import Room, RoomEntrance 9from .datatypes import Room, RoomEntrance
9from .items import ALL_ITEM_TABLE, ITEMS_BY_GROUP, TRAP_ITEMS, LingoItem 10from .items import ALL_ITEM_TABLE, ITEMS_BY_GROUP, TRAP_ITEMS, LingoItem
@@ -52,13 +53,14 @@ class LingoWorld(World):
52 player_logic: LingoPlayerLogic 53 player_logic: LingoPlayerLogic
53 54
54 def generate_early(self): 55 def generate_early(self):
55 if not (self.options.shuffle_doors or self.options.shuffle_colors): 56 if not (self.options.shuffle_doors or self.options.shuffle_colors or self.options.shuffle_sunwarps):
56 if self.multiworld.players == 1: 57 if self.multiworld.players == 1:
57 warning(f"{self.multiworld.get_player_name(self.player)}'s Lingo world doesn't have any progression" 58 warning(f"{self.multiworld.get_player_name(self.player)}'s Lingo world doesn't have any progression"
58 f" items. Please turn on Door Shuffle or Color Shuffle if that doesn't seem right.") 59 f" items. Please turn on Door Shuffle, Color Shuffle, or Sunwarp Shuffle if that doesn't seem"
60 f" right.")
59 else: 61 else:
60 raise Exception(f"{self.multiworld.get_player_name(self.player)}'s Lingo world doesn't have any" 62 raise OptionError(f"{self.multiworld.get_player_name(self.player)}'s Lingo world doesn't have any"
61 f" progression items. Please turn on Door Shuffle or Color Shuffle.") 63 f" progression items. Please turn on Door Shuffle, Color Shuffle or Sunwarp Shuffle.")
62 64
63 self.player_logic = LingoPlayerLogic(self) 65 self.player_logic = LingoPlayerLogic(self)
64 66
@@ -94,7 +96,7 @@ class LingoWorld(World):
94 total_weight = sum(self.options.trap_weights.values()) 96 total_weight = sum(self.options.trap_weights.values())
95 97
96 if total_weight == 0: 98 if total_weight == 0:
97 raise Exception("Sum of trap weights must be at least one.") 99 raise OptionError("Sum of trap weights must be at least one.")
98 100
99 trap_counts = {name: int(weight * traps / total_weight) 101 trap_counts = {name: int(weight * traps / total_weight)
100 for name, weight in self.options.trap_weights.items()} 102 for name, weight in self.options.trap_weights.items()}