From a8c309cd0d9014993603df44b045012a96d38e99 Mon Sep 17 00:00:00 2001 From: massimilianodelliubaldini <8584296+massimilianodelliubaldini@users.noreply.github.com> Date: Thu, 24 Apr 2025 23:28:12 -0400 Subject: [PATCH] Switch trap dictionary to OptionCounter. --- worlds/jakanddaxter/Options.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/worlds/jakanddaxter/Options.py b/worlds/jakanddaxter/Options.py index 421b0f28af..296caacc63 100644 --- a/worlds/jakanddaxter/Options.py +++ b/worlds/jakanddaxter/Options.py @@ -1,6 +1,6 @@ from dataclasses import dataclass from functools import cached_property -from Options import PerGameCommonOptions, StartInventoryPool, Toggle, Choice, Range, DefaultOnToggle, OptionDict +from Options import PerGameCommonOptions, StartInventoryPool, Toggle, Choice, Range, DefaultOnToggle, OptionCounter from .Items import trap_item_table @@ -196,21 +196,20 @@ class TrapEffectDuration(Range): default = 30 -# TODO - Revisit once ArchipelagoMW/Archipelago#3756 is merged. -class TrapWeights(OptionDict): +class TrapWeights(OptionCounter): """ The list of traps and corresponding weights that will be randomly added to the item pool. A trap with weight 10 is twice as likely to appear as a trap with weight 5. Set a weight to 0 to prevent that trap from appearing altogether. If all weights are 0, no traps are created, overriding the values of "Filler * Replaced With Traps." """ display_name = "Trap Weights" + min = 0 default = {trap: 1 for trap in trap_item_table.values()} valid_keys = sorted({trap for trap in trap_item_table.values()}) @cached_property def weights_pair(self) -> tuple[list[str], list[int]]: - return (list(self.value.keys()), - list(max(0, v) for v in self.value.values())) + return list(self.value.keys()), list(self.value.values()) class CompletionCondition(Choice):