Skip to content

Commit

Permalink
Allow variable Minigame Madness trap amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
PoryGone committed Dec 27, 2024
1 parent 4a4c5ce commit 38ddfcb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
16 changes: 16 additions & 0 deletions worlds/sa2b/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ def can_place_boss(cls, boss: str, location: str) -> bool:
option_plando = 0


class MinigameMadnessAmount(Range):
"""
Determines how many of each Minigame Trap must be won (for Minigame Madness goal)
At least this many of each trap will be created as "Progression Traps", regardless of other trap option selections
Receiving this many of a Minigame Trap will allow you to replay that minigame at-will in the Chao World lobby
"""
display_name = "Minigame Madness Trap Amount"
range_start = 1
range_end = 10
default = 3


class BaseTrapWeight(Choice):
"""
Base Class for Trap Weights
Expand Down Expand Up @@ -1113,6 +1127,7 @@ class LogicDifficulty(Choice):
OptionGroup("General Options", [
Goal,
BossRushShuffle,
MinigameMadnessAmount,
LogicDifficulty,
RequiredRank,
MaximumEmblemCap,
Expand Down Expand Up @@ -1252,6 +1267,7 @@ class LogicDifficulty(Choice):
class SA2BOptions(PerGameCommonOptions):
goal: Goal
boss_rush_shuffle: BossRushShuffle
minigame_madness_amount: MinigameMadnessAmount
gate_boss_plando: GateBossPlando
logic_difficulty: LogicDifficulty
required_rank: RequiredRank
Expand Down
3 changes: 2 additions & 1 deletion worlds/sa2b/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2394,8 +2394,9 @@ def connect_regions(multiworld: MultiWorld, world: World, player: int, gates: ty
connect(multiworld, player, names, LocationName.gate_0_region, LocationName.chaos_chao,
lambda state: (state.has_all(chao_animal_event_location_table.keys(), player)))
elif world.options.goal == 8:
trap_item_mapping = { minigame: world.options.minigame_madness_amount.value for minigame in minigame_trap_table.keys() }
connect(multiworld, player, names, LocationName.gate_0_region, LocationName.biolizard_region,
lambda state: (state.has_all(minigame_trap_table.keys(), player)))
lambda state: (state.has_all_counts(trap_item_mapping, player)))

for i in range(len(gates[0].gate_levels)):
connect(multiworld, player, names, LocationName.gate_0_region, shuffleable_regions[gates[0].gate_levels[i]])
Expand Down
9 changes: 8 additions & 1 deletion worlds/sa2b/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def fill_slot_data(self) -> dict:
"RingLink": self.options.ring_link.value,
"TrapLink": self.options.trap_link.value,
"RequiredRank": self.options.required_rank.value,
"MinigameMadnessAmount": self.options.minigame_madness_amount.value,
"LogicDifficulty": self.options.logic_difficulty.value,
"ChaoKeys": self.options.keysanity.value,
"Whistlesanity": self.options.whistlesanity.value,
Expand Down Expand Up @@ -245,9 +246,15 @@ def create_regions(self):
itempool.append(self.create_item(item))

if self.options.goal.value in [8]:
available_locations: int = total_required_locations - len(itempool) - self.options.number_of_level_gates.value

while (self.options.minigame_madness_amount.value * len(minigame_trap_table)) > available_locations:
self.options.minigame_madness_amount.value -= 1

# Minigame Madness
for item in {**minigame_trap_table}:
itempool.append(self.create_item(item, ItemClassification.progression | ItemClassification.trap))
for _ in range(self.options.minigame_madness_amount.value):
itempool.append(self.create_item(item, ItemClassification.progression | ItemClassification.trap))

# Black Market
itempool += [self.create_item(ItemName.market_token) for _ in range(self.options.black_market_slots.value)]
Expand Down

0 comments on commit 38ddfcb

Please sign in to comment.