Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RandomEnemyPresetOption compatible with ArchipelagoMW#3280 #31

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions worlds/dark_souls_3/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import json
from typing import Any, Dict

from Options import Choice, DeathLink, DefaultOnToggle, ExcludeLocations, NamedRange, Option, OptionGroup, \
PerGameCommonOptions, Range, Removed, Toggle, VerifyKeys
from Options import Choice, DeathLink, DefaultOnToggle, ExcludeLocations, NamedRange, OptionDict, \
OptionGroup, PerGameCommonOptions, Range, Removed, Toggle

## Game Options

Expand Down Expand Up @@ -293,10 +293,17 @@ class ImpatientMimicsOption(Toggle):
display_name = "Impatient Mimics"


class RandomEnemyPresetOption(Option[Dict[str, Any]], VerifyKeys):
class RandomEnemyPresetOption(OptionDict):
"""The YAML preset for the static enemy randomizer.

See the static randomizer documentation in `randomizer\\presets\\README.txt` for details.
Include this as nested YAML. For example:

.. code-block:: YAML

random_enemy_preset:
RemoveSource: Ancient Wyvern; Darkeater Midir
DontRandomize: Iudex Gundyr
"""
display_name = "Random Enemy Preset"
supports_weighting = False
Expand All @@ -313,14 +320,6 @@ def __init__(self, value: Dict[str, Any]):
def get_option_name(cls, value: Dict[str, Any]) -> str:
return json.dumps(value)

@classmethod
def from_any(cls, data: Dict[str, Any]) -> "RandomEnemyPresetOption":
if isinstance(data, dict):
cls.verify_keys(data)
return cls(data)
else:
raise NotImplementedError(f"Must be a dictionary, got {type(data)}")


## Item & Location

Expand Down
Loading