Pokemon Emerald: Use OptionError (#3264)

This commit is contained in:
Bryce Wilson 2024-05-04 00:38:24 -06:00 committed by GitHub
parent 879c3407d8
commit 660b068f5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ from typing import Any, Set, List, Dict, Optional, Tuple, ClassVar, TextIO, Unio
from BaseClasses import ItemClassification, MultiWorld, Tutorial, LocationProgressType from BaseClasses import ItemClassification, MultiWorld, Tutorial, LocationProgressType
from Fill import FillError, fill_restrictive from Fill import FillError, fill_restrictive
from Options import Toggle from Options import OptionError, Toggle
import settings import settings
from worlds.AutoWorld import WebWorld, World from worlds.AutoWorld import WebWorld, World
@ -183,7 +183,7 @@ class PokemonEmeraldWorld(World):
if self.options.goal == Goal.option_legendary_hunt: if self.options.goal == Goal.option_legendary_hunt:
# Prevent turning off all legendary encounters # Prevent turning off all legendary encounters
if len(self.options.allowed_legendary_hunt_encounters.value) == 0: if len(self.options.allowed_legendary_hunt_encounters.value) == 0:
raise ValueError(f"Pokemon Emerald: Player {self.player} ({self.multiworld.player_name[self.player]}) " raise OptionError(f"Pokemon Emerald: Player {self.player} ({self.multiworld.player_name[self.player]}) "
"needs to allow at least one legendary encounter when goal is legendary hunt.") "needs to allow at least one legendary encounter when goal is legendary hunt.")
# Prevent setting the number of required legendaries higher than the number of enabled legendaries # Prevent setting the number of required legendaries higher than the number of enabled legendaries
@ -195,7 +195,7 @@ class PokemonEmeraldWorld(World):
# Require random wild encounters if dexsanity is enabled # Require random wild encounters if dexsanity is enabled
if self.options.dexsanity and self.options.wild_pokemon == RandomizeWildPokemon.option_vanilla: if self.options.dexsanity and self.options.wild_pokemon == RandomizeWildPokemon.option_vanilla:
raise ValueError(f"Pokemon Emerald: Player {self.player} ({self.multiworld.player_name[self.player]}) must " raise OptionError(f"Pokemon Emerald: Player {self.player} ({self.multiworld.player_name[self.player]}) must "
"not leave wild encounters vanilla if enabling dexsanity.") "not leave wild encounters vanilla if enabling dexsanity.")
# If badges or HMs are vanilla, Norman locks you from using Surf, # If badges or HMs are vanilla, Norman locks you from using Surf,