From 27a67705692e5abafbfc5dbd5753feb81294855c Mon Sep 17 00:00:00 2001 From: Louis M Date: Sat, 14 Jun 2025 07:17:33 -0400 Subject: [PATCH] Aquaria: Fixing open waters urns not breakable with nature forms logic bug (#5072) * Fixing open waters urns not breakable with nature forms logic bug * Using list in comprehension only when useful * Replacing damaging items by a constant * Removing comprehension list creating from lambda --- worlds/aquaria/Regions.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/worlds/aquaria/Regions.py b/worlds/aquaria/Regions.py index 40170e0c..3436374a 100755 --- a/worlds/aquaria/Regions.py +++ b/worlds/aquaria/Regions.py @@ -4,7 +4,7 @@ Date: Fri, 15 Mar 2024 18:41:40 +0000 Description: Used to manage Regions in the Aquaria game multiworld randomizer """ -from typing import Dict, Optional +from typing import Dict, Optional, Iterable from BaseClasses import MultiWorld, Region, Entrance, Item, ItemClassification, CollectionState from .Items import AquariaItem, ItemNames from .Locations import AquariaLocations, AquariaLocation, AquariaLocationNames @@ -34,10 +34,15 @@ def _has_li(state: CollectionState, player: int) -> bool: return state.has(ItemNames.LI_AND_LI_SONG, player) -def _has_damaging_item(state: CollectionState, player: int) -> bool: - """`player` in `state` has the shield song item""" - return state.has_any({ItemNames.ENERGY_FORM, ItemNames.NATURE_FORM, ItemNames.BEAST_FORM, ItemNames.LI_AND_LI_SONG, - ItemNames.BABY_NAUTILUS, ItemNames.BABY_PIRANHA, ItemNames.BABY_BLASTER}, player) +DAMAGING_ITEMS:Iterable[str] = [ + ItemNames.ENERGY_FORM, ItemNames.NATURE_FORM, ItemNames.BEAST_FORM, + ItemNames.LI_AND_LI_SONG, ItemNames.BABY_NAUTILUS, ItemNames.BABY_PIRANHA, + ItemNames.BABY_BLASTER +] + +def _has_damaging_item(state: CollectionState, player: int, damaging_items:Iterable[str] = DAMAGING_ITEMS) -> bool: + """`player` in `state` has the an item that do damage other than the ones in `to_remove`""" + return state.has_any(damaging_items, player) def _has_energy_attack_item(state: CollectionState, player: int) -> bool: @@ -566,9 +571,11 @@ class AquariaRegions: self.__connect_one_way_regions(self.openwater_tr, self.openwater_tr_turtle, lambda state: _has_beast_form_or_arnassi_armor(state, self.player)) self.__connect_one_way_regions(self.openwater_tr_turtle, self.openwater_tr) + damaging_items_minus_nature_form = [item for item in DAMAGING_ITEMS if item != ItemNames.NATURE_FORM] self.__connect_one_way_regions(self.openwater_tr, self.openwater_tr_urns, lambda state: _has_bind_song(state, self.player) or - _has_damaging_item(state, self.player)) + _has_damaging_item(state, self.player, + damaging_items_minus_nature_form)) self.__connect_regions(self.openwater_tr, self.openwater_br) self.__connect_regions(self.openwater_tr, self.mithalas_city) self.__connect_regions(self.openwater_tr, self.veil_b)