Core: Introduce new Option class NamedRange (#2330)

Co-authored-by: Chris Wilson <chris@legendserver.info>
Co-authored-by: Zach Parks <zach@alliware.com>
This commit is contained in:
el-u
2023-11-25 00:10:52 +01:00
committed by GitHub
parent e64c7b1cbb
commit c944ecf628
18 changed files with 290 additions and 254 deletions

View File

@@ -7,8 +7,8 @@ from dataclasses import dataclass
from itertools import accumulate, chain, combinations
from typing import Any, cast, Dict, Iterator, List, Mapping, Optional, Set, Tuple, Type, TYPE_CHECKING, Union
from Options import AssembleOptions, Choice, DeathLink, ItemDict, OptionDict, PerGameCommonOptions, Range, \
SpecialRange, TextChoice, Toggle
from Options import AssembleOptions, Choice, DeathLink, ItemDict, NamedRange, OptionDict, PerGameCommonOptions, Range, \
TextChoice, Toggle
from .Enemies import enemy_name_to_sprite
from .Items import ItemType, l2ac_item_table
@@ -255,7 +255,7 @@ class CapsuleCravingsJPStyle(Toggle):
display_name = "Capsule cravings JP style"
class CapsuleStartingForm(SpecialRange):
class CapsuleStartingForm(NamedRange):
"""The starting form of your capsule monsters.
Supported values: 1 4, m
@@ -266,7 +266,6 @@ class CapsuleStartingForm(SpecialRange):
range_start = 1
range_end = 5
default = 1
special_range_cutoff = 1
special_range_names = {
"default": 1,
"m": 5,
@@ -280,7 +279,7 @@ class CapsuleStartingForm(SpecialRange):
return self.value - 1
class CapsuleStartingLevel(LevelMixin, SpecialRange):
class CapsuleStartingLevel(LevelMixin, NamedRange):
"""The starting level of your capsule monsters.
Can be set to the special value party_starting_level to make it the same value as the party_starting_level option.
@@ -289,10 +288,9 @@ class CapsuleStartingLevel(LevelMixin, SpecialRange):
"""
display_name = "Capsule monster starting level"
range_start = 0
range_start = 1
range_end = 99
default = 1
special_range_cutoff = 1
special_range_names = {
"default": 1,
"party_starting_level": 0,
@@ -685,7 +683,7 @@ class RunSpeed(Choice):
default = option_disabled
class ShopInterval(SpecialRange):
class ShopInterval(NamedRange):
"""Place shops after a certain number of floors.
E.g., if you set this to 5, then you will be given the opportunity to shop after completing B5, B10, B15, etc.,
@@ -698,10 +696,9 @@ class ShopInterval(SpecialRange):
"""
display_name = "Shop interval"
range_start = 0
range_start = 1
range_end = 10
default = 0
special_range_cutoff = 1
special_range_names = {
"disabled": 0,
}