mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
The Witness: Allow specifying custom trap weights (#2835)
* Trap weights * Slightly change the way the option works * Wording one more time * Non optional to bring in line with Ixrec's implementation * Be clear that it's not an absolute amount, but a weight * E x c l a m a t i o n p o i n t * Update worlds/witness/items.py Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> * Wait I can just do this now lol --------- Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
from dataclasses import dataclass
|
||||
from Options import Toggle, DefaultOnToggle, Range, Choice, PerGameCommonOptions
|
||||
|
||||
from schema import Schema, And, Optional
|
||||
|
||||
from Options import Toggle, DefaultOnToggle, Range, Choice, PerGameCommonOptions, OptionDict
|
||||
|
||||
from worlds.witness.static_logic import WeightedItemDefinition, ItemCategory, StaticWitnessLogic
|
||||
|
||||
|
||||
class DisableNonRandomizedPuzzles(Toggle):
|
||||
@@ -172,6 +177,24 @@ class TrapPercentage(Range):
|
||||
default = 20
|
||||
|
||||
|
||||
class TrapWeights(OptionDict):
|
||||
"""Specify the weights determining how many copies of each trap item will be in your itempool.
|
||||
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!).
|
||||
If you set all trap weights to 0, you will get no traps, bypassing the "Trap Percentage" option."""
|
||||
|
||||
display_name = "Trap Weights"
|
||||
schema = Schema({
|
||||
trap_name: And(int, lambda n: n >= 0)
|
||||
for trap_name, item_definition in StaticWitnessLogic.all_items.items()
|
||||
if isinstance(item_definition, WeightedItemDefinition) and item_definition.category is ItemCategory.TRAP
|
||||
})
|
||||
default = {
|
||||
trap_name: item_definition.weight
|
||||
for trap_name, item_definition in StaticWitnessLogic.all_items.items()
|
||||
if isinstance(item_definition, WeightedItemDefinition) and item_definition.category is ItemCategory.TRAP
|
||||
}
|
||||
|
||||
|
||||
class PuzzleSkipAmount(Range):
|
||||
"""Adds this number of Puzzle Skips into the pool, if there is room. Puzzle Skips let you skip one panel.
|
||||
Works on most panels in the game - The only big exception is The Challenge."""
|
||||
@@ -237,6 +260,7 @@ class TheWitnessOptions(PerGameCommonOptions):
|
||||
early_caves: EarlyCaves
|
||||
elevators_come_to_you: ElevatorsComeToYou
|
||||
trap_percentage: TrapPercentage
|
||||
trap_weights: TrapWeights
|
||||
puzzle_skip_amount: PuzzleSkipAmount
|
||||
hint_amount: HintAmount
|
||||
area_hint_percentage: AreaHintPercentage
|
||||
|
||||
Reference in New Issue
Block a user