Skip to content

Commit a262ffb

Browse files
committed
Yeah that makes sense thanks Violet
1 parent e243470 commit a262ffb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

worlds/lingo/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ def create_items(self):
8989
pool.append(self.create_item("Puzzle Skip"))
9090

9191
if traps:
92-
trap_weights = {name: self.options.trap_weights.get(name, 0) for name in TRAP_ITEMS}
93-
total_weight = sum(trap_weights.values())
92+
total_weight = sum(self.options.trap_weights.values())
9493

9594
if total_weight == 0:
9695
raise Exception("Sum of trap weights must be at least one.")
9796

98-
trap_counts = {name: int(weight * traps / total_weight) for name, weight in trap_weights.items()}
97+
trap_counts = {name: int(weight * traps / total_weight)
98+
for name, weight in self.options.trap_weights.items()}
9999

100100
trap_difference = traps - sum(trap_counts.values())
101101
if trap_difference > 0:
102-
allowed_traps = [name for name in TRAP_ITEMS if trap_weights[name] > 0]
102+
allowed_traps = [name for name in TRAP_ITEMS if self.options.trap_weights[name] > 0]
103103
for i in range(0, trap_difference):
104104
trap_counts[allowed_traps[i % len(allowed_traps)]] += 1
105105

0 commit comments

Comments
 (0)