option groups + lambda capture cringe + typo

This commit is contained in:
CookieCat
2024-05-18 02:48:27 -04:00
parent b299d96c85
commit 3b75bb0eba
4 changed files with 44 additions and 7 deletions

View File

@@ -292,7 +292,7 @@ def set_candle_dw_rules(name: str, world: "HatInTimeWorld"):
coins: List[str] = []
for coin in required_snatcher_coins[name]:
coins.append(coin)
add_rule(full_clear, lambda state: state.has(coin, world.player))
add_rule(full_clear, lambda state, c=coin: state.has(c, world.player))
# any coin works for the main objective
add_rule(main_objective, lambda state: state.has(coins[0], world.player)

View File

@@ -964,7 +964,7 @@ snatcher_coins = {
dlc_flags=HatDLC.dlc2_dw),
"Snatcher Coin - Bluefin Cat Train": LocData(0, "Bluefin Tunnel",
snatcher_coin="Snatcher Coin - Bluefin Tunnel",
snatcher_coin="Snatcher Coin - Bluefin Cat Train",
dlc_flags=HatDLC.dlc2_dw),
"Snatcher Coin - Pink Paw Fence": LocData(0, "Pink Paw Station",

View File

@@ -1,12 +1,21 @@
from typing import List, TYPE_CHECKING
from typing import List, TYPE_CHECKING, Dict, Any
from schema import Schema, Optional
from dataclasses import dataclass
from worlds.AutoWorld import PerGameCommonOptions
from Options import Range, Toggle, DeathLink, Choice, OptionDict, DefaultOnToggle
from BaseClasses import OptionGroup
if TYPE_CHECKING:
from . import HatInTimeWorld
def create_option_groups() -> List[OptionGroup]:
option_group_list: List[OptionGroup] = []
for name, options in ahit_option_groups.items():
option_group_list.append(OptionGroup(name=name, options=options))
return option_group_list
def adjust_options(world: "HatInTimeWorld"):
if world.options.HighestChapterCost < world.options.LowestChapterCost:
@@ -342,7 +351,7 @@ class HatItems(Toggle):
class MinPonCost(Range):
"""The minimum number of Pons that any shop item can cost."""
"""The minimum number of Pons that any item in the Badge Seller's shop can cost."""
display_name = "Minimum Shop Pon Cost"
range_start = 10
range_end = 800
@@ -350,7 +359,7 @@ class MinPonCost(Range):
class MaxPonCost(Range):
"""The maximum number of Pons that any shop item can cost."""
"""The maximum number of Pons that any item in the Badge Seller's shop can cost."""
display_name = "Maximum Shop Pon Cost"
range_start = 10
range_end = 800
@@ -692,6 +701,33 @@ class AHITOptions(PerGameCommonOptions):
death_link: DeathLink
ahit_option_groups: Dict[str, List[Any]] = {
"General Options": [EndGoal, ShuffleStorybookPages, ShuffleAlpineZiplines, ShuffleSubconPaintings,
MinPonCost, MaxPonCost, BadgeSellerMinItems, BadgeSellerMaxItems, LogicDifficulty,
NoPaintingSkips, CTRLogic],
"Act Shuffle Options": [ActRandomizer, StartingChapter, LowestChapterCost, HighestChapterCost,
ChapterCostIncrement, ChapterCostMinDifference, FinalChapterMinCost, FinalChapterMaxCost,
FinaleShuffle, ActPlando, ActBlacklist],
"Item Options": [StartWithCompassBadge, CompassBadgeMode, RandomizeHatOrder, YarnAvailable, YarnCostMin,
YarnCostMax, MinExtraYarn, HatItems, UmbrellaLogic, MaxExtraTimePieces, YarnBalancePercent,
TimePieceBalancePercent],
"Arctic Cruise Options": [EnableDLC1, Tasksanity, TasksanityTaskStep, TasksanityCheckCount,
ShipShapeCustomTaskGoal, ExcludeTour],
"Nyakuza Metro Options": [EnableDLC2, MetroMinPonCost, MetroMaxPonCost, NyakuzaThugMinShopItems,
NyakuzaThugMaxShopItems, BaseballBat, NoTicketSkips],
"Death Wish Options": [EnableDeathWish, DWTimePieceRequirement, DWShuffle, DWShuffleCountMin, DWShuffleCountMax,
DWEnableBonus, DWAutoCompleteBonuses, DWExcludeAnnoyingContracts, DWExcludeAnnoyingBonuses,
DWExcludeCandles, DeathWishOnly],
"Trap Options": [TrapChance, BabyTrapWeight, LaserTrapWeight, ParadeTrapWeight]
}
slot_data_options: List[str] = [
"EndGoal",
"ActRandomizer",

View File

@@ -5,7 +5,7 @@ from .Regions import create_regions, randomize_act_entrances, chapter_act_info,
from .Locations import location_table, contract_locations, is_location_valid, get_location_names, TASKSANITY_START_ID, \
get_total_locations
from .Rules import set_rules
from .Options import AHITOptions, slot_data_options, adjust_options, RandomizeHatOrder, EndGoal
from .Options import AHITOptions, slot_data_options, adjust_options, RandomizeHatOrder, EndGoal, create_option_groups
from .Types import HatType, ChapterIndex, HatInTimeItem, hat_type_to_item
from .DeathWishLocations import create_dw_regions, dw_classes, death_wishes
from .DeathWishRules import set_dw_rules, create_enemy_events, hit_list, bosses
@@ -28,6 +28,7 @@ icon_paths['yatta'] = local_path('data', 'yatta.png')
class AWebInTime(WebWorld):
theme = "partyTime"
option_groups = create_option_groups()
tutorials = [Tutorial(
"Multiworld Setup Guide",
"A guide for setting up A Hat in Time to be played in Archipelago.",