Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lingo: Add speed boost mode #3989

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions worlds/lingo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,21 @@ def create_items(self):
pool.append(self.create_item("Puzzle Skip"))

if traps:
total_weight = sum(self.options.trap_weights.values())
trap_weights = self.options.trap_weights.value.copy()
if self.options.speed_boost_mode:
trap_weights["Slowness Trap"] = 0
hatkirby marked this conversation as resolved.
Show resolved Hide resolved

total_weight = sum(trap_weights.values())

if total_weight == 0:
raise OptionError("Sum of trap weights must be at least one.")

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

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

Expand Down Expand Up @@ -171,7 +175,7 @@ def fill_slot_data(self):
"death_link", "victory_condition", "shuffle_colors", "shuffle_doors", "shuffle_paintings", "shuffle_panels",
"enable_pilgrimage", "sunwarp_access", "mastery_achievements", "level_2_requirement", "location_checks",
"early_color_hallways", "pilgrimage_allows_roof_access", "pilgrimage_allows_paintings", "shuffle_sunwarps",
"group_doors"
"group_doors", "speed_boost_mode"
]

slot_data = {
Expand All @@ -188,5 +192,8 @@ def fill_slot_data(self):
return slot_data

def get_filler_item_name(self) -> str:
filler_list = [":)", "The Feeling of Being Lost", "Wanderlust", "Empty White Hallways"]
return self.random.choice(filler_list)
if self.options.speed_boost_mode:
return "Speed Boost"
else:
filler_list = [":)", "The Feeling of Being Lost", "Wanderlust", "Empty White Hallways"]
return self.random.choice(filler_list)
Binary file modified worlds/lingo/data/generated.dat
Binary file not shown.
1 change: 1 addition & 0 deletions worlds/lingo/data/ids.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ special_items:
Iceland Trap: 444411
Atbash Trap: 444412
Puzzle Skip: 444413
Speed Boost: 444680
panels:
Starting Room:
HI: 444400
Expand Down
1 change: 1 addition & 0 deletions worlds/lingo/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def load_item_data():
"The Feeling of Being Lost": ItemClassification.filler,
"Wanderlust": ItemClassification.filler,
"Empty White Hallways": ItemClassification.filler,
"Speed Boost": ItemClassification.filler,
**{trap_name: ItemClassification.trap for trap_name in TRAP_ITEMS},
"Puzzle Skip": ItemClassification.useful,
}
Expand Down
10 changes: 10 additions & 0 deletions worlds/lingo/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ class TrapWeights(OptionDict):
default = {trap_name: 1 for trap_name in TRAP_ITEMS}


class SpeedBoostMode(Toggle):
"""
If on, the player's default speed is halved, as if affected by a Slowness Trap. Speed Boosts are added to
the item pool, which temporarily return the player to normal speed. Slowness Traps are removed from the pool.
"""
display_name = "Speed Boost Mode"


class PuzzleSkipPercentage(Range):
"""Replaces junk items with puzzle skips, at the specified rate."""
display_name = "Puzzle Skip Percentage"
Expand Down Expand Up @@ -255,6 +263,7 @@ class DeathLink(Toggle):
Level2Requirement,
TrapPercentage,
TrapWeights,
SpeedBoostMode,
PuzzleSkipPercentage,
])
]
Expand Down Expand Up @@ -282,6 +291,7 @@ class LingoOptions(PerGameCommonOptions):
shuffle_postgame: ShufflePostgame
trap_percentage: TrapPercentage
trap_weights: TrapWeights
speed_boost_mode: SpeedBoostMode
puzzle_skip_percentage: PuzzleSkipPercentage
death_link: DeathLink
start_inventory_from_pool: StartInventoryPool
7 changes: 7 additions & 0 deletions worlds/lingo/test/TestOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ class TestShuffleSunwarpsAccess(LingoTestBase):
"victory_condition": "pilgrimage",
"shuffle_sunwarps": "true",
"sunwarp_access": "individual"
}


class TestSpeedBoostMode(LingoTestBase):
options = {
"location_checks": "insanity",
"speed_boost_mode": "true",
}
hatkirby marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions worlds/lingo/utils/assign_ids.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,6 @@
end

File.write(outputpath, old_generated.to_yaml)

puts "Next item ID: #{next_item_id}"
puts "Next location ID: #{next_location_id}"
Loading