mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
TUNIC: Add Hidden all_random Option (#4635)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
from dataclasses import fields
|
||||||
from typing import Dict, List, Any, Tuple, TypedDict, ClassVar, Union, Set, TextIO
|
from typing import Dict, List, Any, Tuple, TypedDict, ClassVar, Union, Set, TextIO
|
||||||
from logging import warning
|
from logging import warning
|
||||||
from BaseClasses import Region, Location, Item, Tutorial, ItemClassification, MultiWorld, CollectionState
|
from BaseClasses import Region, Location, Item, Tutorial, ItemClassification, MultiWorld, CollectionState
|
||||||
@@ -16,7 +17,7 @@ from .options import (TunicOptions, EntranceRando, tunic_option_groups, tunic_op
|
|||||||
from .breakables import breakable_location_name_to_id, breakable_location_groups, breakable_location_table
|
from .breakables import breakable_location_name_to_id, breakable_location_groups, breakable_location_table
|
||||||
from .combat_logic import area_data, CombatState
|
from .combat_logic import area_data, CombatState
|
||||||
from worlds.AutoWorld import WebWorld, World
|
from worlds.AutoWorld import WebWorld, World
|
||||||
from Options import PlandoConnection, OptionError
|
from Options import PlandoConnection, OptionError, PerGameCommonOptions, Removed, Range
|
||||||
from settings import Group, Bool
|
from settings import Group, Bool
|
||||||
|
|
||||||
|
|
||||||
@@ -121,6 +122,20 @@ class TunicWorld(World):
|
|||||||
"This would cause an error at the end of generation.\n"
|
"This would cause an error at the end of generation.\n"
|
||||||
"Please remove one of them, most likely the one in lib/worlds.")
|
"Please remove one of them, most likely the one in lib/worlds.")
|
||||||
|
|
||||||
|
if self.options.all_random:
|
||||||
|
for option_name in (attr.name for attr in fields(TunicOptions)
|
||||||
|
if attr not in fields(PerGameCommonOptions)):
|
||||||
|
option = getattr(self.options, option_name)
|
||||||
|
if option_name == "all_random":
|
||||||
|
continue
|
||||||
|
if isinstance(option, Removed):
|
||||||
|
continue
|
||||||
|
if option.supports_weighting:
|
||||||
|
if isinstance(option, Range):
|
||||||
|
option.value = self.random.randint(option.range_start, option.range_end)
|
||||||
|
else:
|
||||||
|
option.value = self.random.choice(list(option.name_lookup))
|
||||||
|
|
||||||
check_options(self)
|
check_options(self)
|
||||||
|
|
||||||
self.er_regions = tunic_er_regions.copy()
|
self.er_regions = tunic_er_regions.copy()
|
||||||
|
@@ -332,6 +332,16 @@ class LadderStorageWithoutItems(Toggle):
|
|||||||
display_name = "Ladder Storage without Items"
|
display_name = "Ladder Storage without Items"
|
||||||
|
|
||||||
|
|
||||||
|
class HiddenAllRandom(Toggle):
|
||||||
|
"""
|
||||||
|
Sets all options that can be random to random.
|
||||||
|
For test gens.
|
||||||
|
"""
|
||||||
|
internal_name = "all_random"
|
||||||
|
display_name = "All Random Debug"
|
||||||
|
visibility = Visibility.none
|
||||||
|
|
||||||
|
|
||||||
class LogicRules(Choice):
|
class LogicRules(Choice):
|
||||||
"""
|
"""
|
||||||
This option has been superseded by the individual trick options.
|
This option has been superseded by the individual trick options.
|
||||||
@@ -393,6 +403,8 @@ class TunicOptions(PerGameCommonOptions):
|
|||||||
ladder_storage: LadderStorage
|
ladder_storage: LadderStorage
|
||||||
ladder_storage_without_items: LadderStorageWithoutItems
|
ladder_storage_without_items: LadderStorageWithoutItems
|
||||||
|
|
||||||
|
all_random: HiddenAllRandom
|
||||||
|
|
||||||
fixed_shop: FixedShop # will be removed at a later date
|
fixed_shop: FixedShop # will be removed at a later date
|
||||||
logic_rules: Removed # fully removed in the direction pairs update
|
logic_rules: Removed # fully removed in the direction pairs update
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user