Skip to content

Commit

Permalink
Added Traps option back in
Browse files Browse the repository at this point in the history
Add option to disable traps
  • Loading branch information
Ehseezed committed Feb 10, 2024
1 parent 32bcc4c commit ef91d28
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 20 deletions.
22 changes: 17 additions & 5 deletions worlds/am2r/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Dict, List, NamedTuple, Set

from BaseClasses import Item, ItemClassification, MultiWorld
from .options import MetroidsAreChecks, MetroidsRequired, get_option_value
from .options import MetroidsAreChecks, MetroidsRequired, get_option_value, TrapFillPercentage, TrapEquipment, TapToss, TrapShort, TrapEMP


class ItemData(NamedTuple):
Expand Down Expand Up @@ -40,6 +40,18 @@ def create_metroid_items(MetroidsRequired: MetroidsRequired, MetroidsAreChecks:
def create_trap_items(multiworld: MultiWorld, player: int, locations_to_trap: int) -> List[str]:
trap_pool = trap_weights.copy()

if multiworld.TrapEquipment[player].value == 1:
del trap_pool["Equipment Trap"]

if multiworld.TapToss[player].value == 1:
del trap_pool["Big Toss Trap"]

if multiworld.TrapShort[player].value == 1:
del trap_pool["Short Beam"]

if multiworld.TrapEMP[player].value == 1:
del trap_pool["EMP Trap"]

return multiworld.random.choices(
population=list(trap_pool.keys()),
weights=list(trap_pool.values()),
Expand Down Expand Up @@ -110,14 +122,14 @@ def create_all_items(multiworld: MultiWorld, player: int) -> None:
}
filler_weights: Dict[str, int] = {
"Missile": 44,
"Super Missile": 10,
"Power Bomb": 10,
"Energy Tank": 10
"Super Missile": 9,
"Power Bomb": 8,
"Energy Tank": 9
}

trap_weights: Dict[str, int] = {
"Equipment Trap": 1,
"Big Toss Trap": 1,
"Big Toss Trap": 1,
"Short Beam": 1,
"EMP Trap": 1
}
Expand Down
43 changes: 28 additions & 15 deletions worlds/am2r/options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Union, List, Dict
from BaseClasses import MultiWorld
from Options import AssembleOptions, Choice, DeathLink, DefaultOnToggle, Range, StartInventoryPool
from Options import AssembleOptions, Choice, DeathLink, DefaultOnToggle, Range, StartInventoryPool, Toggle


class MetroidsRequired(Range):
Expand All @@ -20,14 +20,28 @@ class MetroidsAreChecks(Choice):
option_include_A6 = 2


# class TrapFillPercentage(Range):
# """Adds in Slightly inconvenient Traps into the item pool Equipment Traps disable 1 random item for up to 3 minutes
# depending on the disabled item (more critical items will be disabled for less time). Ice Traps seem rather
# self-explanatory, but they will freeze you upon receiving them with a full fanfare and an actual player freeze"""
# display_name = "Trap Fill Percentage"
# range_start = 0
# range_end = 100
# default = 0
class TrapFillPercentage(Range):
"""Adds in slightly inconvenient traps into the item pool"""
display_name = "Trap Fill Percentage"
range_start = 0
range_end = 100
default = 0


class TrapEquipment(Toggle):
display_name = "Remove Equipment Trap"


class TapToss(Toggle):
display_name = "Remove Toss Trap"


class TrapShort(Toggle):
display_name = "Remove Short Beam"


class TrapEMP(Toggle):
display_name = "Remove EMP Trap"


#class ItemSprites(OptionList):
Expand All @@ -42,11 +56,6 @@ class MetroidsAreChecks(Choice):
# option_lies = 4


#class Visuals(Toggle):
# """"""Re-colours all the visual elements with new fresh palettes. Does not affect gameplay.
# Courtesy of Abyssal""""""


#class StartingWeapons(Choice):
# """Removes your Arm Cannon and makes it a findable item"""
# display_name = "Starting Weapons"
Expand Down Expand Up @@ -87,7 +96,11 @@ class MetroidsAreChecks(Choice):
AM2R_options: Dict[str, AssembleOptions] = {
"MetroidsRequired": MetroidsRequired,
"MetroidsAreChecks": MetroidsAreChecks,
# "TrapFillPercentage": TrapFillPercentage,
"TrapFillPercentage": TrapFillPercentage,
"TrapEquipment": TrapEquipment,
"TapToss": TapToss,
"TrapShort": TrapShort,
"TrapEMP": TrapEMP,
# "Item Sprites": ItemSprites,
# "Starting Weapons": StartingWeapons,
# "Randomize Baby", RandomizeBaby
Expand Down

0 comments on commit ef91d28

Please sign in to comment.