Skip to content

Commit

Permalink
Input Sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
PoryGone committed Dec 25, 2024
1 parent 40954e4 commit 835b2d8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions worlds/sa2b/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(self, name, classification: ItemClassification, code: int = None, p
ItemName.pinball_trap: ItemData(0xFF0058, False, True),
ItemName.math_quiz_trap: ItemData(0xFF0059, False, True),
ItemName.snake_trap: ItemData(0xFF005A, False, True),
ItemName.input_sequence_trap: ItemData(0xFF005B, False, True),
}

emeralds_table = {
Expand Down
1 change: 1 addition & 0 deletions worlds/sa2b/Names/ItemName.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
pinball_trap = "Pinball Trap"
math_quiz_trap = "Math Quiz Trap"
snake_trap = "Snake Trap"
input_sequence_trap = "Input Sequence Trap"


# Chaos Emeralds
Expand Down
9 changes: 9 additions & 0 deletions worlds/sa2b/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ class SnakeTrapWeight(BaseTrapWeight):
display_name = "Snake Trap Weight"


class InputSequenceTrapWeight(BaseTrapWeight):
"""
Likelihood of receiving a trap which forces you to press a sequence of inputs
"""
display_name = "Input Sequence Trap Weight"


class MinigameTrapDifficulty(Choice):
"""
How difficult any Minigame-style traps are
Expand Down Expand Up @@ -1174,6 +1181,7 @@ class LogicDifficulty(Choice):
PinballTrapWeight,
MathQuizTrapWeight,
SnakeTrapWeight,
InputSequenceTrapWeight,
MinigameTrapDifficulty,
]),
OptionGroup("Sonic Missions", [
Expand Down Expand Up @@ -1308,6 +1316,7 @@ class SA2BOptions(PerGameCommonOptions):
pinball_trap_weight: PinballTrapWeight
math_quiz_trap_weight: MathQuizTrapWeight
snake_trap_weight: SnakeTrapWeight
input_sequence_trap_weight: InputSequenceTrapWeight
minigame_trap_difficulty: MinigameTrapDifficulty

sadx_music: SADXMusic
Expand Down
6 changes: 5 additions & 1 deletion worlds/sa2b/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def generate_early(self):
self.options.light_up_path_trap_weight.value + \
self.options.pinball_trap_weight.value + \
self.options.math_quiz_trap_weight.value + \
self.options.snake_trap_weight.value
self.options.snake_trap_weight.value + \
self.options.input_sequence_trap_weight.value

if valid_trap_weights == 0:
self.options.exposition_trap_weight.value = 4
Expand All @@ -190,6 +191,7 @@ def generate_early(self):
self.options.pinball_trap_weight.value = 4
self.options.math_quiz_trap_weight.value = 4
self.options.snake_trap_weight.value = 4
self.options.input_sequence_trap_weight.value = 4

if self.options.kart_race_checks.value == 0:
self.options.kart_race_checks.value = 2
Expand Down Expand Up @@ -343,6 +345,7 @@ def create_regions(self):
trap_weights += ([ItemName.pinball_trap] * self.options.pinball_trap_weight.value)
trap_weights += ([ItemName.math_quiz_trap] * self.options.math_quiz_trap_weight.value)
trap_weights += ([ItemName.snake_trap] * self.options.snake_trap_weight.value)
trap_weights += ([ItemName.input_sequence_trap] * self.options.input_sequence_trap_weight.value)

junk_count += extra_junk_count
trap_count = 0 if (len(trap_weights) == 0) else math.ceil(junk_count * (self.options.trap_fill_percentage.value / 100.0))
Expand Down Expand Up @@ -571,6 +574,7 @@ def output_active_traps(self) -> typing.Dict[int, int]:
trap_data[0x58] = self.options.pinball_trap_weight.value
trap_data[0x59] = self.options.math_quiz_trap_weight.value
trap_data[0x5A] = self.options.snake_trap_weight.value
trap_data[0x5B] = self.options.input_sequence_trap_weight.value

return trap_data

Expand Down

0 comments on commit 835b2d8

Please sign in to comment.