Zillion: remove old option access from item link validation (#2673)

* Zillion: remove old option access from item link validation
and a little bit a cleaning in other stuff nearby

* one option access missed
This commit is contained in:
Doug Hoskisson
2024-01-14 06:48:30 -08:00
committed by GitHub
parent 6904bd5885
commit ed6b7b2670
3 changed files with 33 additions and 30 deletions

View File

@@ -1,13 +1,14 @@
from collections import Counter
from dataclasses import dataclass
from typing import Dict, Tuple
from typing import ClassVar, Dict, Tuple
from typing_extensions import TypeGuard # remove when Python >= 3.10
from Options import DefaultOnToggle, NamedRange, PerGameCommonOptions, Range, Toggle, Choice
from zilliandomizer.options import \
Options as ZzOptions, char_to_gun, char_to_jump, ID, \
VBLR as ZzVBLR, chars, Chars, ItemCounts as ZzItemCounts
from zilliandomizer.options import (
Options as ZzOptions, char_to_gun, char_to_jump, ID,
VBLR as ZzVBLR, Chars, ItemCounts as ZzItemCounts
)
from zilliandomizer.options.parsing import validate as zz_validate
@@ -107,6 +108,15 @@ class ZillionStartChar(Choice):
display_name = "start character"
default = "random"
_name_capitalization: ClassVar[Dict[int, Chars]] = {
option_jj: "JJ",
option_apple: "Apple",
option_champ: "Champ",
}
def get_char(self) -> Chars:
return ZillionStartChar._name_capitalization[self.value]
class ZillionIDCardCount(Range):
"""
@@ -348,16 +358,6 @@ def validate(options: ZillionOptions) -> "Tuple[ZzOptions, Counter[str]]":
# that should be all of the level requirements met
name_capitalization: Dict[str, Chars] = {
"jj": "JJ",
"apple": "Apple",
"champ": "Champ",
}
start_char = options.start_char
start_char_name = name_capitalization[start_char.current_key]
assert start_char_name in chars
starting_cards = options.starting_cards
room_gen = options.room_gen
@@ -371,7 +371,7 @@ def validate(options: ZillionOptions) -> "Tuple[ZzOptions, Counter[str]]":
max_level.value,
False, # tutorial
skill,
start_char_name,
options.start_char.get_char(),
floppy_req.value,
options.continues.value,
bool(options.randomize_alarms.value),