From 3f4f3164be22fe546fd8f5c1296b4846b217ce65 Mon Sep 17 00:00:00 2001 From: jamesbrq Date: Mon, 15 Apr 2024 11:04:34 -0400 Subject: [PATCH] Change tracker locations to serverside, no longer locations. Various code cleanup and logic changes. --- worlds/mlss/Client.py | 15 ++++++++++++--- worlds/mlss/Items.py | 13 ++----------- worlds/mlss/Locations.py | 32 ++++++++++--------------------- worlds/mlss/Names/LocationName.py | 20 +++++++++---------- worlds/mlss/Options.py | 2 +- worlds/mlss/Regions.py | 5 ++--- worlds/mlss/Rom.py | 9 ++++++--- worlds/mlss/Rules.py | 5 +++++ worlds/mlss/__init__.py | 18 ----------------- 9 files changed, 48 insertions(+), 71 deletions(-) diff --git a/worlds/mlss/Client.py b/worlds/mlss/Client.py index aba6741e5e00..a66d44ddff6d 100644 --- a/worlds/mlss/Client.py +++ b/worlds/mlss/Client.py @@ -107,7 +107,7 @@ async def game_watcher(self, ctx: "BizHawkClientContext") -> None: is_buy = (read_state[4][0] != 0) shop_address = (struct.unpack(' None: locs_to_send.add(location) # Loop for recieving items. Item is written as an ID into 0x3057. - # ASM read the ID in a loop and give the player the item before resetting the RAM address to 0x0. + # ASM reads the ID in a loop and give the player the item before resetting the RAM address to 0x0. # If RAM address isn't 0x0 yet break out and try again later to give the rest of the items for i in range(len(ctx.items_received) - received_index): item_data = items_by_id[ctx.items_received[received_index + i].item] @@ -138,7 +138,7 @@ async def game_watcher(self, ctx: "BizHawkClientContext") -> None: if b is None: break await bizhawk.write(ctx.bizhawk_ctx, [(0x3057, [id_to_RAM(item_data.itemID)], "EWRAM"), (0x4808, [(received_index + i + 1) // 0x100, (received_index + i + 1) % 0x100], "EWRAM")]) - await asyncio.sleep(.05) + await asyncio.sleep(.1) # Early return and location send if you are currently in a shop, # since other flags aren't going to change @@ -164,6 +164,15 @@ async def game_watcher(self, ctx: "BizHawkClientContext") -> None: if backup_logo != "MLSSAP": return if flag_byte & mask != 0: + if location >= 0xDA0000: + await ctx.send_msgs([{ + "cmd": "Set", + "key": f"mlss_flag{location - 0xD9FFFF}_{ctx.team}_{ctx.slot}", + "default": 0, + "want_reply": False, + "operations": [{"operation": "replace", "value": 1}] + }]) + continue if location in roomException: if current_room not in roomException[location]: exception = True diff --git a/worlds/mlss/Items.py b/worlds/mlss/Items.py index b4408662fa6b..833724f8be56 100644 --- a/worlds/mlss/Items.py +++ b/worlds/mlss/Items.py @@ -158,17 +158,8 @@ class MLSSItem(Item): ItemData(77771140, "Power Grip", ItemClassification.useful, 0xFC), ItemData(77771141, "Cobalt Necktie", ItemClassification.useful, 0xFD), ItemData(77771142, "Game Boy Horror SP", ItemClassification.useful, 0xFE), - ItemData(77771143, "Dragohoho Defeated", ItemClassification.skip_balancing, 0x0), - ItemData(77771144, "Queen Bean Defeated", ItemClassification.skip_balancing, 0x0), - ItemData(77771145, "Chuckolator Defeated", ItemClassification.skip_balancing, 0x0), - ItemData(77771146, "Oasis Access", ItemClassification.skip_balancing, 0x0), - ItemData(77771147, "Mom Piranha Defeated", ItemClassification.skip_balancing, 0x0), - ItemData(77771148, "Entered Fungitown", ItemClassification.skip_balancing, 0x0), - ItemData(77771149, "Beanstar Complete", ItemClassification.skip_balancing, 0x0), - ItemData(77771150, "Jojora Defeated", ItemClassification.skip_balancing, 0x0), - ItemData(77771151, "Birdo Defeated", ItemClassification.skip_balancing, 0x0), - ItemData(77771152, "Woo Bean", ItemClassification.skip_balancing, 0x1C), - ItemData(77771153, "Hee Bean", ItemClassification.skip_balancing, 0x1F), + ItemData(77771143, "Woo Bean", ItemClassification.skip_balancing, 0x1C), + ItemData(77771144, "Hee Bean", ItemClassification.skip_balancing, 0x1F), ] item_frequencies: typing.Dict[str, int] = { diff --git a/worlds/mlss/Locations.py b/worlds/mlss/Locations.py index 4bb645b6c29e..910a4850e95c 100644 --- a/worlds/mlss/Locations.py +++ b/worlds/mlss/Locations.py @@ -566,16 +566,16 @@ class MLSSLocation(Location): LocationData("Airport Leftside Digspot 3", 0x39e306, 0), LocationData("Airport Leftside Digspot 4", 0x39e30e, 0), LocationData("Airport Leftside Digspot 5", 0x39e316, 0), - LocationData("Airport Middle Digspot 1", 0x39e323, 0), - LocationData("Airport Middle Digspot 2", 0x39e32b, 0), - LocationData("Airport Middle Digspot 3", 0x39e333, 0), - LocationData("Airport Middle Digspot 4", 0x39e33b, 0), - LocationData("Airport Middle Digspot 5", 0x39e343, 0), - LocationData("Airport Right Digspot 1", 0x39e350, 0), - LocationData("Airport Right Digspot 2", 0x39e358, 0), - LocationData("Airport Right Digspot 3", 0x39e360, 0), - LocationData("Airport Right Digspot 4", 0x39e368, 0), - LocationData("Airport Right Digspot 5", 0x39e370, 0) + LocationData("Airport Center Digspot 1", 0x39e323, 0), + LocationData("Airport Center Digspot 2", 0x39e32b, 0), + LocationData("Airport Center Digspot 3", 0x39e333, 0), + LocationData("Airport Center Digspot 4", 0x39e33b, 0), + LocationData("Airport Center Digspot 5", 0x39e343, 0), + LocationData("Airport Rightside Digspot 1", 0x39e350, 0), + LocationData("Airport Rightside Digspot 2", 0x39e358, 0), + LocationData("Airport Rightside Digspot 3", 0x39e360, 0), + LocationData("Airport Rightside Digspot 4", 0x39e368, 0), + LocationData("Airport Rightside Digspot 5", 0x39e370, 0) ] gwarharEntrance: typing.List[LocationData] = [ @@ -774,18 +774,6 @@ class MLSSLocation(Location): LocationData("Oho Oasis Thunderhand", 0x1e9409, 2) ] -event: typing.List[LocationData] = [ - LocationData("Dragohoho", 0xDA0000, 0), - LocationData("Queen Bean", 0xDA0001, 0), - LocationData("Chuckolator", 0xDA0002, 0), - LocationData("Oasis", 0xDA0003, 0), - LocationData("Mom Piranha", 0xDA0004, 0), - LocationData("Fungitown", 0xDA0005, 0), - LocationData("Beanstar", 0xDA0006, 2), - LocationData("Jojora", 0xDA0007, 2), - LocationData("Birdo", 0xDA0008, 2) -] - nonBlock: list[(int, int, int)] = [ (0x434B, 0x1, 0x243844), # Farm Mole 1 (0x434B, 0x1, 0x24387d), # Farm Mole 2 diff --git a/worlds/mlss/Names/LocationName.py b/worlds/mlss/Names/LocationName.py index 5ff39f91275e..c50d86d6265c 100644 --- a/worlds/mlss/Names/LocationName.py +++ b/worlds/mlss/Names/LocationName.py @@ -237,16 +237,16 @@ class LocationName(): AirportLeftsideDigspot3 = "Airport Leftside Digspot 3" AirportLeftsideDigspot4 = "Airport Leftside Digspot 4" AirportLeftsideDigspot5 = "Airport Leftside Digspot 5" - AirportMiddleDigspot1 = "Airport Middle Digspot 1" - AirportMiddleDigspot2 = "Airport Middle Digspot 2" - AirportMiddleDigspot3 = "Airport Middle Digspot 3" - AirportMiddleDigspot4 = "Airport Middle Digspot 4" - AirportMiddleDigspot5 = "Airport Middle Digspot 5" - AirportRightDigspot1 = "Airport Right Digspot 1" - AirportRightDigspot2 = "Airport Right Digspot 2" - AirportRightDigspot3 = "Airport Right Digspot 3" - AirportRightDigspot4 = "Airport Right Digspot 4" - AirportRightDigspot5 = "Airport Right Digspot 5" + AirportCenterDigspot1 = "Airport Center Digspot 1" + AirportCenterDigspot2 = "Airport Center Digspot 2" + AirportCenterDigspot3 = "Airport Center Digspot 3" + AirportCenterDigspot4 = "Airport Center Digspot 4" + AirportCenterDigspot5 = "Airport Center Digspot 5" + AirportRightsideDigspot1 = "Airport Rightside Digspot 1" + AirportRightsideDigspot2 = "Airport Rightside Digspot 2" + AirportRightsideDigspot3 = "Airport Rightside Digspot 3" + AirportRightsideDigspot4 = "Airport Rightside Digspot 4" + AirportRightsideDigspot5 = "Airport Rightside Digspot 5" GwarharLagoonPipeRoomDigspot = "Gwarhar Lagoon Pipe Room Digspot" GwarharLagoonMassageParlorEntranceDigspot = "Gwarhar Lagoon Massage Parlor Entrance Digspot" GwarharLagoonPastHermieDigspot = "Gwarhar Lagoon Past Hermie Digspot" diff --git a/worlds/mlss/Options.py b/worlds/mlss/Options.py index c7b18e698cf3..67d9ce3a21a9 100644 --- a/worlds/mlss/Options.py +++ b/worlds/mlss/Options.py @@ -160,7 +160,7 @@ class RandomizeBosses(Choice): Boss Normal: Bosses can be swapped with normal enemy encounters. """ display_name = "Randomize Bosses" - option_none = 0 + option_disabled = 0 option_bossonly = 1 option_bossnormal = 2 default = 0 diff --git a/worlds/mlss/Regions.py b/worlds/mlss/Regions.py index 63a317cb5e8b..34a62f8406c8 100644 --- a/worlds/mlss/Regions.py +++ b/worlds/mlss/Regions.py @@ -4,7 +4,7 @@ from .Locations import MLSSLocation, mainArea, chucklehuck, castleTown, startingFlag, chuckolatorFlag, piranhaFlag, \ kidnappedFlag, beanstarFlag, birdoFlag, surfable, hooniversity, gwarharEntrance, gwarharMain, \ fungitown, fungitownBeanstar, fungitownBirdo, teeheeValley, winkle, sewers, airport, \ - bowsers, bowsersMini, jokesEntrance, jokesMain, theater, booStatue, oasis, postJokes, baseUltraRocks, event, coins + bowsers, bowsersMini, jokesEntrance, jokesMain, theater, booStatue, oasis, postJokes, baseUltraRocks, coins from . import StateLogic if typing.TYPE_CHECKING: @@ -41,7 +41,6 @@ def create_regions(world: "MLSSWorld", excluded: typing.List[str]): create_region(world, "FungitownBirdo", fungitownBirdo, excluded) create_region(world, "BooStatue", booStatue, excluded) create_region(world, "Oasis", oasis, excluded) - create_region(world, "Event", event, excluded) create_region(world, "BaseUltraRocks", baseUltraRocks, excluded) if world.options.coins: @@ -70,7 +69,7 @@ def connect_regions(world: "MLSSWorld"): connect(world, names, "TeeheeValley", "Fungitown", lambda state: StateLogic.thunder(state, world.player) and StateLogic.castleTown(state, world.player) and StateLogic.rose(state, world.player)) connect(world, names, "Fungitown", "FungitownBeanstar", lambda state: StateLogic.pieces(state, world.player) or state.can_reach("FungitownBirdo", "Region", world.player)) connect(world, names, "Main Area", "Shop Starting Flag", lambda state: StateLogic.brooch(state, world.player) or StateLogic.rose(state, world.player)) - connect(world, names, "Shop Starting Flag", "Shop Chuckolator Flag", lambda state: (StateLogic.brooch(state, world.player) and StateLogic.fruits(state, world.player)) or state.can_reach("Shop Piranha Flag", "Region", world.player)) + connect(world, names, "Shop Starting Flag", "Shop Chuckolator Flag", lambda state: (StateLogic.brooch(state, world.player) and StateLogic.fruits(state, world.player) and (StateLogic.thunder(state, world.player) or StateLogic.fire(state, world.player) or StateLogic.hammers(state, world.player))) or state.can_reach("Shop Piranha Flag", "Region", world.player)) connect(world, names, "Shop Starting Flag", "Shop Piranha Flag", lambda state: StateLogic.thunder(state, world.player) or state.can_reach("Shop Peach Kidnapped Flag", "Region", world.player)) connect(world, names, "Shop Starting Flag", "Shop Peach Kidnapped Flag", lambda state: StateLogic.fungitown(state, world.player) or state.can_reach("Shop Beanstar Complete Flag", "Region", world.player)) connect(world, names, "Shop Starting Flag", "Shop Beanstar Complete Flag", lambda state: (StateLogic.castleTown(state, world.player) and StateLogic.pieces(state, world.player) and StateLogic.rose(state, world.player)) or state.can_reach("Shop Birdo Flag", "Region", world.player)) diff --git a/worlds/mlss/Rom.py b/worlds/mlss/Rom.py index 2a5416bdb5f1..20730ba350ac 100644 --- a/worlds/mlss/Rom.py +++ b/worlds/mlss/Rom.py @@ -257,7 +257,7 @@ def enemy_randomize(self): enemies = [pos for pos in Enemies.enemies if pos not in Enemies.bowsers] if self.world.options.castle_skip else Enemies.enemies bosses = [pos for pos in Enemies.bosses if pos not in Enemies.bowsers] if self.world.options.castle_skip else Enemies.bosses - if self.world.options.randomize_bosses == 1: + if self.world.options.randomize_bosses == 1 or (self.world.options.randomize_bosses == 2 and self.world.options.randomize_enemies == 0): raw = [] for pos in bosses: self.stream.seek(pos + 1) @@ -289,6 +289,9 @@ def enemy_randomize(self): enemies_raw = [] groups = [] + if self.world.options.randomize_enemies == 0: + return + if self.world.options.randomize_bosses == 2: for pos in bosses: self.stream.seek(pos + 1) @@ -343,9 +346,9 @@ def enemy_randomize(self): groups += [raw] self.random.shuffle(groups) - arr = Enemies.enemies + arr = enemies if self.world.options.randomize_bosses == 2: - arr += Enemies.bosses + arr += bosses for pos in arr: self.stream.seek(pos + 1) diff --git a/worlds/mlss/Rules.py b/worlds/mlss/Rules.py index 79325b83a539..3833cf217b3e 100644 --- a/worlds/mlss/Rules.py +++ b/worlds/mlss/Rules.py @@ -249,6 +249,11 @@ def set_rules(world: "MLSSWorld", excluded): lambda state: StateLogic.brooch(state, world.player) and StateLogic.canDig(state, world.player)) add_rule(world.multiworld.get_location(LocationName.ChateauRedGoblet, world.player), lambda state: StateLogic.brooch(state, world.player) and StateLogic.canMini(state, world.player)) + + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonSpangle, world.player), + lambda state: StateLogic.ultra(state, world.player)) + add_rule(world.multiworld.get_location(LocationName.GwarharLagoonSpangleRoomBlock, world.player), + lambda state: StateLogic.ultra(state, world.player)) if world.options.difficult_logic: add_rule(world.multiworld.get_location("Birdo", world.player), lambda state: StateLogic.postJokes(state, world.player)) diff --git a/worlds/mlss/__init__.py b/worlds/mlss/__init__.py index fc4b9b3d3b28..27c067a7473f 100644 --- a/worlds/mlss/__init__.py +++ b/worlds/mlss/__init__.py @@ -98,24 +98,6 @@ def generate_basic(self) -> None: self.multiworld.get_location(LocationName.PantsShopStartingFlag1, self.player).place_locked_item(item) item = self.create_item("Chuckle Bean") self.multiworld.get_location(LocationName.PantsShopStartingFlag2, self.player).place_locked_item(item) - item = self.create_item("Dragohoho Defeated") - self.multiworld.get_location("Dragohoho", self.player).place_locked_item(item) - item = self.create_item("Queen Bean Defeated") - self.multiworld.get_location("Queen Bean", self.player).place_locked_item(item) - item = self.create_item("Chuckolator Defeated") - self.multiworld.get_location("Chuckolator", self.player).place_locked_item(item) - item = self.create_item("Oasis Access") - self.multiworld.get_location("Oasis", self.player).place_locked_item(item) - item = self.create_item("Mom Piranha Defeated") - self.multiworld.get_location("Mom Piranha", self.player).place_locked_item(item) - item = self.create_item("Entered Fungitown") - self.multiworld.get_location("Fungitown", self.player).place_locked_item(item) - item = self.create_item("Beanstar Complete") - self.multiworld.get_location("Beanstar", self.player).place_locked_item(item) - item = self.create_item("Jojora Defeated") - self.multiworld.get_location("Jojora", self.player).place_locked_item(item) - item = self.create_item("Birdo Defeated") - self.multiworld.get_location("Birdo", self.player).place_locked_item(item) def create_items(self) -> None: # First add in all progression and useful items