2023-11-24 06:27:03 +01:00
from dataclasses import dataclass
2024-02-29 07:40:08 +01:00
2024-04-12 00:27:42 +02:00
from schema import And , Schema
2024-02-29 07:40:08 +01:00
2024-05-22 00:17:12 +02:00
from Options import Choice , DefaultOnToggle , OptionDict , OptionGroup , PerGameCommonOptions , Range , Toggle
2024-02-29 07:40:08 +01:00
2024-04-12 00:27:42 +02:00
from . data import static_logic as static_witness_logic
from . data . item_definition_classes import ItemCategory , WeightedItemDefinition
2022-04-29 00:42:11 +02:00
2022-10-09 04:13:52 +02:00
class DisableNonRandomizedPuzzles ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
Disables puzzles that cannot be randomized .
2022-07-17 12:56:22 +02:00
This includes many puzzles that heavily involve the environment , such as Shadows , Monastery or Orchard .
2024-03-21 16:51:29 +01:00
2023-11-24 06:27:03 +01:00
The lasers for those areas will activate as you solve optional puzzles , such as Discarded Panels .
2024-03-21 16:51:29 +01:00
Additionally , the panel activating the Jungle Popup Wall will be on from the start .
"""
2022-04-29 00:42:11 +02:00
display_name = " Disable non randomized puzzles "
2023-11-24 06:27:03 +01:00
class EarlyCaves ( Choice ) :
2024-03-21 16:51:29 +01:00
"""
Adds an item that opens the Caves Shortcuts to Swamp and Mountain , allowing early access to the Caves even if you are not playing a remote Door Shuffle mode .
You can either add this item to the pool to be found in the multiworld , or you can outright start with it and have immediate access to the Caves .
If you choose " Add To Pool " and you are already playing a remote Door Shuffle mode , this option will do nothing .
"""
2022-09-18 04:20:59 +02:00
display_name = " Early Caves "
2023-11-24 06:27:03 +01:00
option_off = 0
2024-03-12 14:51:10 +01:00
alias_false = 0
2023-11-24 06:27:03 +01:00
option_add_to_pool = 1
option_starting_inventory = 2
2024-03-12 14:51:10 +01:00
alias_true = 2
alias_on = 2
2022-06-16 03:04:45 +02:00
class ShuffleSymbols ( DefaultOnToggle ) :
2024-03-21 16:51:29 +01:00
"""
If on , you will need to unlock puzzle symbols as items to be able to solve the panels that contain those symbols .
Please note that there is no minimum set of progression items in this randomizer .
If you turn this option off and don ' t turn on door shuffle or obelisk keys, there will be no progression items, which will disallow you from adding your yaml to a multiworld generation.
"""
2022-06-16 03:04:45 +02:00
display_name = " Shuffle Symbols "
2024-01-16 15:14:06 +01:00
class ShuffleLasers ( Choice ) :
2024-03-21 16:51:29 +01:00
"""
If on , the 11 lasers are turned into items and will activate on their own upon receiving them .
"""
2022-07-17 12:56:22 +02:00
display_name = " Shuffle Lasers "
2024-01-16 15:14:06 +01:00
option_off = 0
2024-03-12 14:51:10 +01:00
alias_false = 0
2024-01-16 15:14:06 +01:00
option_local = 1
option_anywhere = 2
2024-03-12 14:51:10 +01:00
alias_true = 2
alias_on = 2
2022-07-17 12:56:22 +02:00
class ShuffleDoors ( Choice ) :
2024-03-21 16:51:29 +01:00
"""
If on , opening doors , moving bridges etc . will require a " key " .
2024-05-22 00:17:12 +02:00
- Panels : The panel on the door will be locked until receiving its corresponding key .
- Doors : The door will open immediately upon receiving its key . Door panels are added as location checks .
- Mixed : Includes all doors from " doors " , and all control panels ( bridges , elevators etc . ) from " panels " .
2024-03-21 16:51:29 +01:00
"""
2022-06-16 03:04:45 +02:00
display_name = " Shuffle Doors "
2023-11-24 06:27:03 +01:00
option_off = 0
2022-07-17 12:56:22 +02:00
option_panels = 1
2023-11-24 06:27:03 +01:00
option_doors = 2
option_mixed = 3
class DoorGroupings ( Choice ) :
2024-03-21 16:51:29 +01:00
"""
2024-05-22 00:17:12 +02:00
Controls how door items are grouped .
2024-05-24 13:32:23 -04:00
- Off : There will be one key for each door , potentially resulting in upwards of 120 keys being added to the item pool .
- Regional : All doors in the same general region will open at once with a single key , reducing the amount of door items and complexity .
2024-03-21 16:51:29 +01:00
"""
2023-11-24 06:27:03 +01:00
display_name = " Door Groupings "
option_off = 0
option_regional = 1
class ShuffleBoat ( DefaultOnToggle ) :
2024-03-21 16:51:29 +01:00
"""
If on , adds a " Boat " item to the item pool . Before receiving this item , you will not be able to use the boat .
"""
2023-11-24 06:27:03 +01:00
display_name = " Shuffle Boat "
2022-06-16 03:04:45 +02:00
2022-04-29 00:42:11 +02:00
class ShuffleDiscardedPanels ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
Adds Discarded Panels into the location pool .
2022-07-17 12:56:22 +02:00
2024-03-21 16:51:29 +01:00
Even if this is off , solving certain Discarded Panels may still be necessary to beat the game - The main example of this being the alternate activation triggers in " Disable non randomized puzzles " .
"""
2022-04-29 00:42:11 +02:00
display_name = " Shuffle Discarded Panels "
class ShuffleVaultBoxes ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
Adds Vault Boxes to the location pool .
"""
2022-04-29 00:42:11 +02:00
display_name = " Shuffle Vault Boxes "
2023-02-01 21:18:07 +01:00
class ShuffleEnvironmentalPuzzles ( Choice ) :
"""
2024-03-21 16:51:29 +01:00
Adds Environmental / Obelisk Puzzles into the location pool .
2024-05-22 00:17:12 +02:00
- Individual : Every Environmental Puzzle sends an item .
- Obelisk Sides : Completing every puzzle on one side of an Obelisk sends an item .
2024-03-21 16:51:29 +01:00
Note : In Obelisk Sides , any EPs excluded through another option will be pre - completed on their Obelisk .
2023-02-01 21:18:07 +01:00
"""
display_name = " Shuffle Environmental Puzzles "
option_off = 0
option_individual = 1
option_obelisk_sides = 2
class ShuffleDog ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
Adds petting the Town dog into the location pool .
"""
2023-02-01 21:18:07 +01:00
display_name = " Pet the Dog "
class EnvironmentalPuzzlesDifficulty ( Choice ) :
2023-02-03 19:38:54 +01:00
"""
When " Shuffle Environmental Puzzles " is on , this setting governs which EPs are eligible for the location pool .
2024-05-22 00:17:12 +02:00
- Eclipse : Every EP in the game is eligible , including the 1 - hour - long " Theater Eclipse EP " .
- Tedious Theater Eclipse EP is excluded from the location pool .
- Normal : several other difficult or long EPs are excluded as well .
2023-02-03 19:38:54 +01:00
"""
2023-02-01 21:18:07 +01:00
display_name = " Environmental Puzzles Difficulty "
option_normal = 0
option_tedious = 1
option_eclipse = 2
2024-03-12 20:04:13 +01:00
class ObeliskKeys ( DefaultOnToggle ) :
"""
Add one Obelisk Key item per Obelisk , locking you out of solving any of the associated Environmental Puzzles .
2024-03-21 16:51:29 +01:00
2024-03-12 20:04:13 +01:00
Does nothing if " Shuffle Environmental Puzzles " is set to " off " .
"""
display_name = " Obelisk Keys "
2022-07-17 12:56:22 +02:00
class ShufflePostgame ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
Adds locations into the pool that are guaranteed to become accessible after or at the same time as your goal .
Use this if you don ' t play with release on victory.
"""
2022-07-17 12:56:22 +02:00
display_name = " Shuffle Postgame "
2022-04-29 00:42:11 +02:00
2022-06-16 03:04:45 +02:00
class VictoryCondition ( Choice ) :
2024-03-21 16:51:29 +01:00
"""
Set the victory condition for this world .
2024-05-22 00:17:12 +02:00
- Elevator : Start the elevator at the bottom of the mountain ( requires Mountain Lasers ) .
- Challenge : Beat the secret Challenge ( requires Challenge Lasers ) .
- Mountain Box Short : Input the short solution to the Mountaintop Box ( requires Mountain Lasers ) .
- Mountain Box Long : Input the long solution to the Mountaintop Box ( requires Challenge Lasers ) .
2024-03-21 16:51:29 +01:00
2024-01-16 13:13:44 +01:00
It is important to note that while the Mountain Box requires Desert Laser to be redirected in Town for that laser
2024-03-21 16:51:29 +01:00
to count , the laser locks on the Elevator and Challenge Timer panels do not .
"""
2022-06-16 03:04:45 +02:00
display_name = " Victory Condition "
option_elevator = 0
option_challenge = 1
option_mountain_box_short = 2
option_mountain_box_long = 3
2022-10-09 04:13:52 +02:00
class PuzzleRandomization ( Choice ) :
2024-03-21 16:51:29 +01:00
"""
Puzzles in this randomizer are randomly generated . This option changes the difficulty / types of puzzles .
"""
2022-10-09 04:13:52 +02:00
display_name = " Puzzle Randomization "
option_sigma_normal = 0
option_sigma_expert = 1
2023-02-01 21:18:07 +01:00
option_none = 2
2022-10-09 04:13:52 +02:00
2022-06-16 03:04:45 +02:00
class MountainLasers ( Range ) :
2024-03-21 16:51:29 +01:00
"""
Sets the number of lasers required to enter the Mountain .
If set to a higher number than 7 , the mountaintop box will be slightly rotated to make it possible to solve without the hatch being opened .
This change will also be applied logically to the long solution ( " Challenge Lasers " option ) .
"""
2022-06-16 03:04:45 +02:00
display_name = " Required Lasers for Mountain Entry "
range_start = 1
2024-01-16 15:27:09 +01:00
range_end = 11
2022-06-16 03:04:45 +02:00
default = 7
class ChallengeLasers ( Range ) :
2024-03-21 16:51:29 +01:00
"""
Sets the number of lasers required to enter the Caves through the Mountain Bottom Floor Discard and to unlock the Challenge Timer Panel .
"""
2022-06-16 03:04:45 +02:00
display_name = " Required Lasers for Challenge "
range_start = 1
range_end = 11
default = 11
2022-04-29 00:42:11 +02:00
2023-11-24 06:27:03 +01:00
class ElevatorsComeToYou ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
If on , the Quarry Elevator , Bunker Elevator and Swamp Long Bridge will " come to you " if you approach them .
This does actually affect logic as it allows unintended backwards / early access into these areas .
"""
2023-11-24 06:27:03 +01:00
display_name = " All Bridges & Elevators come to you "
2022-05-09 07:20:28 +02:00
class TrapPercentage ( Range ) :
2024-03-21 16:51:29 +01:00
"""
Replaces junk items with traps , at the specified rate .
"""
2022-05-09 07:20:28 +02:00
display_name = " Trap Percentage "
range_start = 0
range_end = 100
default = 20
2024-02-29 07:40:08 +01:00
class TrapWeights ( OptionDict ) :
2024-03-21 16:51:29 +01:00
"""
Specify the weights determining how many copies of each trap item will be in your itempool .
2024-02-29 07:40:08 +01:00
If you don ' t want a specific type of trap, you can set the weight for it to 0 (Do not delete the entry outright!).
2024-03-21 16:51:29 +01:00
If you set all trap weights to 0 , you will get no traps , bypassing the " Trap Percentage " option .
"""
2024-02-29 07:40:08 +01:00
display_name = " Trap Weights "
schema = Schema ( {
trap_name : And ( int , lambda n : n > = 0 )
2024-04-12 00:27:42 +02:00
for trap_name , item_definition in static_witness_logic . ALL_ITEMS . items ( )
2024-02-29 07:40:08 +01:00
if isinstance ( item_definition , WeightedItemDefinition ) and item_definition . category is ItemCategory . TRAP
} )
default = {
trap_name : item_definition . weight
2024-04-12 00:27:42 +02:00
for trap_name , item_definition in static_witness_logic . ALL_ITEMS . items ( )
2024-02-29 07:40:08 +01:00
if isinstance ( item_definition , WeightedItemDefinition ) and item_definition . category is ItemCategory . TRAP
}
2022-06-16 03:04:45 +02:00
class PuzzleSkipAmount ( Range ) :
2024-03-21 16:51:29 +01:00
"""
Adds this many Puzzle Skips into the pool , if there is room . Puzzle Skips let you skip one panel .
"""
2022-06-16 03:04:45 +02:00
display_name = " Puzzle Skips "
range_start = 0
2022-10-20 05:05:36 +02:00
range_end = 30
default = 10
2022-06-16 03:04:45 +02:00
2022-10-09 04:13:52 +02:00
class HintAmount ( Range ) :
2024-03-21 16:51:29 +01:00
"""
Adds hints to Audio Logs . If set to a low amount , up to 2 additional duplicates of each hint will be added .
Remaining Audio Logs will have junk hints .
"""
2022-10-09 04:13:52 +02:00
display_name = " Hints on Audio Logs "
range_start = 0
range_end = 49
2024-02-28 04:44:22 +01:00
default = 12
class AreaHintPercentage ( Range ) :
2024-03-21 16:51:29 +01:00
"""
There are two types of hints for The Witness .
" Location hints " hint one location in your world or one location containing an item for your world .
" Area hints " tell you some general info about the items you can find in one of the main geographic areas on the island .
Use this option to specify how many of your hints you want to be area hints . The rest will be location hints .
"""
2024-02-28 04:44:22 +01:00
display_name = " Area Hint Percentage "
range_start = 0
range_end = 100
default = 33
2022-10-09 04:13:52 +02:00
2024-03-05 22:54:02 +01:00
class LaserHints ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
If on , lasers will tell you where their items are if you walk close to them in - game .
Only applies if Laser Shuffle is enabled .
"""
2024-03-05 22:54:02 +01:00
display_name = " Laser Hints "
2023-03-10 07:58:00 +01:00
class DeathLink ( Toggle ) :
2024-03-21 16:51:29 +01:00
"""
If on , whenever you fail a puzzle ( with some exceptions ) , you and everyone who is also on Death Link dies .
The effect of a " death " in The Witness is a Bonk Trap .
"""
2023-03-10 07:58:00 +01:00
display_name = " Death Link "
2024-01-16 15:24:10 +01:00
class DeathLinkAmnesty ( Range ) :
2024-03-21 16:51:29 +01:00
"""
The number of panel fails to allow before sending a death through Death Link .
0 means every panel fail will send a death , 1 means every other panel fail will send a death , etc .
"""
2024-01-16 15:24:10 +01:00
display_name = " Death Link Amnesty "
range_start = 0
range_end = 5
default = 1
2023-11-24 06:27:03 +01:00
@dataclass
class TheWitnessOptions ( PerGameCommonOptions ) :
puzzle_randomization : PuzzleRandomization
shuffle_symbols : ShuffleSymbols
shuffle_doors : ShuffleDoors
door_groupings : DoorGroupings
shuffle_boat : ShuffleBoat
shuffle_lasers : ShuffleLasers
disable_non_randomized_puzzles : DisableNonRandomizedPuzzles
shuffle_discarded_panels : ShuffleDiscardedPanels
shuffle_vault_boxes : ShuffleVaultBoxes
2024-03-12 20:04:13 +01:00
obelisk_keys : ObeliskKeys
2024-04-12 00:27:42 +02:00
shuffle_EPs : ShuffleEnvironmentalPuzzles # noqa: N815
2023-11-24 06:27:03 +01:00
EP_difficulty : EnvironmentalPuzzlesDifficulty
shuffle_postgame : ShufflePostgame
victory_condition : VictoryCondition
mountain_lasers : MountainLasers
challenge_lasers : ChallengeLasers
early_caves : EarlyCaves
elevators_come_to_you : ElevatorsComeToYou
trap_percentage : TrapPercentage
2024-02-29 07:40:08 +01:00
trap_weights : TrapWeights
2023-11-24 06:27:03 +01:00
puzzle_skip_amount : PuzzleSkipAmount
hint_amount : HintAmount
2024-02-28 04:44:22 +01:00
area_hint_percentage : AreaHintPercentage
2024-03-05 22:54:02 +01:00
laser_hints : LaserHints
2023-11-24 06:27:03 +01:00
death_link : DeathLink
2024-01-16 15:24:10 +01:00
death_link_amnesty : DeathLinkAmnesty
2024-05-22 00:17:12 +02:00
witness_option_groups = [
OptionGroup ( " Puzzles & Goal " , [
PuzzleRandomization ,
VictoryCondition ,
MountainLasers ,
ChallengeLasers ,
] ) ,
OptionGroup ( " Locations " , [
ShuffleDiscardedPanels ,
ShuffleVaultBoxes ,
ShuffleEnvironmentalPuzzles ,
EnvironmentalPuzzlesDifficulty ,
ShufflePostgame ,
DisableNonRandomizedPuzzles ,
] ) ,
OptionGroup ( " Progression Items " , [
ShuffleSymbols ,
ShuffleDoors ,
DoorGroupings ,
ShuffleLasers ,
ShuffleBoat ,
ObeliskKeys ,
] ) ,
OptionGroup ( " Filler Items " , [
PuzzleSkipAmount ,
TrapPercentage ,
TrapWeights
] ) ,
OptionGroup ( " Hints " , [
HintAmount ,
AreaHintPercentage ,
LaserHints
] ) ,
OptionGroup ( " Misc " , [
EarlyCaves ,
ElevatorsComeToYou ,
DeathLink ,
DeathLinkAmnesty ,
] )
]