Files
dockipelago/worlds/cluster_truck/Options.py
Jonathan Tinney 7971961166
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
add schedule I, sonic 1/frontiers/heroes, spirit island
2026-04-02 23:46:36 -07:00

200 lines
4.9 KiB
Python

import random
from dataclasses import dataclass
from Options import Choice, Range, OptionSet, Toggle, PerGameCommonOptions, T, TextChoice
from .Helpers import format_level_name, parse_level_name
class CTLevelChoice(TextChoice):
randomized: bool
option_1_1 = 0
option_1_2 = 1
option_1_3 = 2
option_1_4 = 3
option_1_5 = 4
option_1_6 = 5
option_1_7 = 6
option_1_8 = 7
option_1_9 = 8
option_1_10 = 9
option_2_1 = 10
option_2_2 = 11
option_2_3 = 12
option_2_4 = 13
option_2_5 = 14
option_2_6 = 15
option_2_7 = 16
option_2_8 = 17
option_2_9 = 18
option_2_10 = 19
option_3_1 = 20
option_3_2 = 21
option_3_3 = 22
option_3_4 = 23
option_3_5 = 24
option_3_6 = 25
option_3_7 = 26
option_3_8 = 27
option_3_9 = 28
option_3_10 = 29
option_4_1 = 30
option_4_2 = 31
option_4_3 = 32
option_4_4 = 33
option_4_5 = 34
option_4_6 = 35
option_4_7 = 36
option_4_8 = 37
option_4_9 = 38
option_4_10 = 39
option_5_1 = 40
option_5_2 = 41
option_5_3 = 42
option_5_4 = 43
option_5_5 = 44
option_5_6 = 45
option_5_7 = 46
option_5_8 = 47
option_5_9 = 48
option_5_10 = 49
option_6_1 = 50
option_6_2 = 51
option_6_3 = 52
option_6_4 = 53
option_6_5 = 54
option_6_6 = 55
option_6_7 = 56
option_6_8 = 57
option_6_9 = 58
option_6_10 = 59
option_7_1 = 60
option_7_2 = 61
option_7_3 = 62
option_7_4 = 63
option_7_5 = 64
option_7_6 = 65
option_7_7 = 66
option_7_8 = 67
option_7_9 = 68
option_7_10 = 69
option_8_1 = 70
option_8_2 = 71
option_8_3 = 72
option_8_4 = 73
option_8_5 = 74
option_8_6 = 75
option_8_7 = 76
option_8_8 = 77
option_8_9 = 78
option_8_10 = 79
option_9_1 = 80
option_9_2 = 81
option_9_3 = 82
option_9_4 = 83
option_9_5 = 84
option_9_6 = 85
option_9_7 = 86
option_9_8 = 87
option_9_9 = 88
option_9_10 = 89
option_h_1 = 90
option_h_2 = 91
option_h_3 = 92
option_h_4 = 93
option_h_5 = 94
option_h_6 = 95
option_h_7 = 96
option_h_8 = 97
option_h_9 = 98
option_h_10 = 99
option_c_1 = 100
option_c_2 = 101
option_c_3 = 102
option_c_4 = 103
option_c_5 = 104
def __init__(self, value: int, randomized: bool = False):
super().__init__(value)
self.randomized = randomized
@classmethod
def get_option_name(cls, value: T) -> str:
return cls.name_lookup[value].replace('_', '-')
@classmethod
def from_text(cls, text: str) -> Choice:
text = text.lower()
if text == "random":
return cls(random.choice(list(cls.name_lookup)),True)
for value, option_name in cls.name_lookup.items():
if option_name == text:
return cls(value)
raise KeyError(
f"Could not find option \"{text}\" for \"{cls.__name__}\", "
f'known option are {", ".join(f"{option}" for option in cls.name_lookup.values())}'
)
class StartLevel(CTLevelChoice):
"""
Choose the level to start in
Valid options: /([1-9hc]-(10|[1-9])|random)/
random will select a random level with equal probability
"""
display_name = "Start Level"
default = 0
class GoalLevel(CTLevelChoice):
"""
Choose level to complete to finish the game
Valid options: /([1-9hc]-(10|[1-9])|random)/
random will select a random level with equal probability
"""
display_name = "Goal Level"
default = 89
class GoalRequirement(Range):
"""Choose the number of levels required to unlock the goal"""
display_name = "Goal Requirement"
range_start = 5
range_end = 103
default = 40
class SkipLevels(OptionSet):
"""
List as many levels as you would like to skip completing
Valid options: /[1-9hc]-(10|[1-9])/
"""
display_name = "Skipped Levels"
valid_keys = {format_level_name(i) for i in range(105)}
class PointMultiplier(Range):
"""Multiplies the amount of points earned to reduce grinding"""
display_name = "Point Multiplier"
range_start = 1
range_end = 20
default = 5
class DeathlinkAmnesty(Range):
"""
The number of deaths needed to send out a deathlink event
Deathlink can be disabled entirely in-game
"""
display_name = "Deathlink Amnesty"
range_start = 1
range_end = 100
default = 10
class TrapPercentage(Range):
"""Choose the percentage of trap items that will appear when filling the pool with filler"""
display_name = "Trap Percentage"
range_start = 0
range_end = 100
default = 25
@dataclass
class ClusterTruckOptions(PerGameCommonOptions):
start_level: StartLevel
goal_level: GoalLevel
goal_requirement: GoalRequirement
skipped_levels: SkipLevels
point_multiplier: PointMultiplier
deathlink_amnesty: DeathlinkAmnesty
trap_percentage: TrapPercentage