diff --git a/worlds/am2r/Client.py b/worlds/am2r/Client.py index 5314054ec993..0eea8c0b6ac5 100644 --- a/worlds/am2r/Client.py +++ b/worlds/am2r/Client.py @@ -2,6 +2,7 @@ import copy import json import time +import random from asyncio import StreamReader, StreamWriter from typing import List from worlds.am2r.items import item_table @@ -112,7 +113,10 @@ def get_payload(ctx: AM2RContext): for locationid, netitem in ctx.locations_info.items(): gamelocation = location_id_to_game_id[locationid] if netitem.item in item_id_to_game_id: - gameitem = item_id_to_game_id[netitem.item] + if netitem.flags & 0b100 != 0: + gameitem = random.randint(0, 20) + else: + gameitem = item_id_to_game_id[netitem.item] else: gameitem = 20 itemdict[gamelocation] = gameitem @@ -206,6 +210,7 @@ def launch(): options = Utils.get_options() async def main(args): + random.seed() ctx = AM2RContext(args.connect, args.password) ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop") if gui_enabled: diff --git a/worlds/am2r/items.py b/worlds/am2r/items.py index c9504bad29b4..c40b9156bc37 100644 --- a/worlds/am2r/items.py +++ b/worlds/am2r/items.py @@ -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, TrapFillPercentage, RemoveEquipmentTrap, RemoveTossTrap, RemoveShortBeam, RemoveEMPTrap +from .options import MetroidsAreChecks, MetroidsRequired, get_option_value, TrapFillPercentage, RemoveFloodTrap, RemoveTossTrap, RemoveShortBeam, RemoveEMPTrap, RemoveOHKOTrap, RemoveTouhouTrap class ItemData(NamedTuple): @@ -40,8 +40,8 @@ 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.RemoveEquipmentTrap[player].value == 1: - del trap_pool["Equipment Trap"] + if multiworld.RemoveFloodTrap[player].value == 1: + del trap_pool["Flood Trap"] if multiworld.RemoveTossTrap[player].value == 1: del trap_pool["Big Toss Trap"] @@ -51,6 +51,12 @@ def create_trap_items(multiworld: MultiWorld, player: int, locations_to_trap: in if multiworld.RemoveEMPTrap[player].value == 1: del trap_pool["EMP Trap"] + + if multiworld.RemoveTouhouTrap[player].value == 1: + del trap_pool["Touhou Trap"] + + if multiworld.RemoveOHKOTrap[player].value == 1: + del trap_pool["OHKO Trap"] return multiworld.random.choices( population=list(trap_pool.keys()), @@ -112,10 +118,12 @@ def create_all_items(multiworld: MultiWorld, player: int) -> None: "Spazer": ItemData(8678018, "Beam", ItemClassification.useful, 13, 1), "Plasma Beam": ItemData(8678019, "Beam", ItemClassification.useful, 14, 1), "Ice Beam": ItemData(8678020, "Beam", ItemClassification.progression, 11, 1), - "Equipment Trap": ItemData(8678021, "Trap", ItemClassification.trap, 21), - "Big Toss Trap": ItemData(8678022, "Trap", ItemClassification.trap, 22), + "Flood Trap": ItemData(8678021, "Trap", ItemClassification.trap, 21), + "Big Toss Trap": ItemData(8678022, "Trap", ItemClassification.trap, 22), "Short Beam": ItemData(8678023, "Trap", ItemClassification.trap, 23), "EMP Trap": ItemData(8678024, "Trap", ItemClassification.trap, 24), + "OHKO Trap": ItemData(8678026, "Trap", ItemClassification.trap, 25), + "Touhou Trap": ItemData(8678027, "Trap", ItemClassification.trap, 26), "Metroid": ItemData(8678025, "MacGuffin", ItemClassification.progression_skip_balancing, 19), "The Galaxy is at Peace": ItemData(None, "Victory", ItemClassification.progression) @@ -128,10 +136,12 @@ def create_all_items(multiworld: MultiWorld, player: int) -> None: } trap_weights: Dict[str, int] = { - "Equipment Trap": 1, - "Big Toss Trap": 3, - "Short Beam": 3, - "EMP Trap": 2 + "Flood Trap": 1, + "Big Toss Trap": 1, + "Short Beam": 1, + "EMP Trap": 1, + "Touhou Trap": 1, + "OHKO Trap": 1 } diff --git a/worlds/am2r/options.py b/worlds/am2r/options.py index c924605002c8..1a483ae4488f 100644 --- a/worlds/am2r/options.py +++ b/worlds/am2r/options.py @@ -29,9 +29,9 @@ class TrapFillPercentage(Range): default = 0 -class RemoveEquipmentTrap(Toggle): - """This one sucks and is generally un-fun, so it is likely to change""" - display_name = "Remove Equipment Trap" +class RemoveFloodTrap(Toggle): + """Removes Flood Traps from trap fill""" + display_name = "Remove Flood Trap" class RemoveTossTrap(Toggle): @@ -48,6 +48,14 @@ class RemoveEMPTrap(Toggle): """Yes we know that it looks weird during the idle animation, but it's a vanilla bug""" display_name = "Remove EMP Trap" +class RemoveTouhouTrap(Toggle): + """Removes Touhou Traps from trap fill""" + display_name = "Remove Touhou Trap" + +class RemoveOHKOTrap(Toggle): + """Removes OHKO Traps from trap fill""" + display_name = "Remove OHKO Trap" + #class ItemSprites(OptionList): # """Changes Item Sprites. Does not affect gameplay @@ -102,10 +110,12 @@ class RemoveEMPTrap(Toggle): "MetroidsRequired": MetroidsRequired, "MetroidsAreChecks": MetroidsAreChecks, "TrapFillPercentage": TrapFillPercentage, - "RemoveEquipmentTrap": RemoveEquipmentTrap, + "RemoveFloodTrap": RemoveFloodTrap, "RemoveTossTrap": RemoveTossTrap, "RemoveShortBeam": RemoveShortBeam, "RemoveEMPTrap": RemoveEMPTrap, + "RemoveTouhouTrap": RemoveTouhouTrap, + "RemoveOHKOTrap": RemoveOHKOTrap, # "Item Sprites": ItemSprites, # "Starting Weapons": StartingWeapons, # "Randomize Baby", RandomizeBaby