diff --git a/worlds/hk/__init__.py b/worlds/hk/__init__.py index 5a2778500cf2..05603919ab76 100644 --- a/worlds/hk/__init__.py +++ b/worlds/hk/__init__.py @@ -543,14 +543,14 @@ def collect(self, state, item: HKItem) -> bool: prog_items[self.player][effect_name] += effect_value # a directional overflow in dash grants an upgrade for the other side - if item.name == "Right_Mothwing_Cloak" and \ - prog_items[self.player]["RIGHTDASH"] > 2 > prog_items[self.player]["LEFTDASH"]: + if prog_items[self.player]["RIGHTDASH"] > prog_items[self.player]["LEFTDASH"] > 0: prog_items[self.player]["OVERFLOWLEFTDASH"] += 1 prog_items[self.player]["LEFTDASH"] += 1 - elif item.name == "Left_Mothwing_Cloak" and \ - prog_items[self.player]["LEFTDASH"] > 2 > prog_items[self.player]["RIGHTDASH"]: + assert item.name in ("Left_Mothwing_Cloak", "Right_Mothwing_Cloak",) + elif prog_items[self.player]["LEFTDASH"] > prog_items[self.player]["RIGHTDASH"] > 0: prog_items[self.player]["OVERFLOWRIGHTDASH"] += 1 prog_items[self.player]["RIGHTDASH"] += 1 + assert item.name in ("Left_Mothwing_Cloak", "Right_Mothwing_Cloak",) return change @@ -561,12 +561,14 @@ def remove(self, state, item: HKItem) -> bool: prog_items = state.prog_items # a directional overflow in dash grants an upgrade for the other side - if item.name == "Right_Mothwing_Cloak" and prog_items[self.player]["OVERFLOWLEFTDASH"]: - prog_items[self.player]["LEFTDASH"] -= 1 - prog_items[self.player]["OVERFLOWLEFTDASH"] -= 1 - elif item.name == "Left_Mothwing_Cloak" and prog_items[self.player]["OVERFLOWRIGHTDASH"]: - prog_items[self.player]["RIGHTDASH"] -= 1 - prog_items[self.player]["OVERFLOWRIGHTDASH"] -= 1 + if item.name in ("Left_Mothwing_Cloak", "Right_Mothwing_Cloak",) and \ + prog_items[self.player]["RIGHTDASH"] == prog_items[self.player]["LEFTDASH"] > 0: + if prog_items[self.player]["OVERFLOWLEFTDASH"]: + prog_items[self.player]["LEFTDASH"] -= 1 + prog_items[self.player]["OVERFLOWLEFTDASH"] -= 1 + if prog_items[self.player]["OVERFLOWRIGHTDASH"]: + prog_items[self.player]["RIGHTDASH"] -= 1 + prog_items[self.player]["OVERFLOWRIGHTDASH"] -= 1 for effect_name, effect_value in item_effects.get(item.name, {}).items(): prog_items[self.player][effect_name] -= effect_value diff --git a/worlds/hk/test/test_collect.py b/worlds/hk/test/test_collect.py index 0583534a489a..feb013da9684 100644 --- a/worlds/hk/test/test_collect.py +++ b/worlds/hk/test/test_collect.py @@ -111,7 +111,7 @@ def testCollect_cloak_iterations(self): self.cloak_test( ["Left_Mothwing_Cloak", "Left_Mothwing_Cloak", "Right_Mothwing_Cloak"], [], - {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, + {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 1, "RIGHTDASH": 2}, ) with self.subTest("L - L"): self.cloak_test( @@ -155,7 +155,7 @@ def testCollect_cloak_iterations(self): self.cloak_test( ["Left_Mothwing_Cloak", "Right_Mothwing_Cloak", "Left_Mothwing_Cloak"], [], - {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, + {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 1, "RIGHTDASH": 2}, ) with self.subTest("L - L"): self.cloak_test( @@ -199,7 +199,7 @@ def testCollect_cloak_iterations(self): self.cloak_test( ["Right_Mothwing_Cloak", "Left_Mothwing_Cloak", "Left_Mothwing_Cloak"], [], - {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, + {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 1, "RIGHTDASH": 2}, ) # with self.subTest("R - L"): # self.cloak_test( @@ -243,7 +243,7 @@ def testCollect_cloak_iterations(self): self.cloak_test( ["Right_Mothwing_Cloak", "Right_Mothwing_Cloak", "Left_Mothwing_Cloak"], [], - {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, + {"Left_Mothwing_Cloak": 1, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, ) # with self.subTest("R - L"): # self.cloak_test( @@ -287,7 +287,7 @@ def testCollect_cloak_iterations(self): self.cloak_test( ["Right_Mothwing_Cloak", "Left_Mothwing_Cloak", "Right_Mothwing_Cloak"], [], - {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, + {"Left_Mothwing_Cloak": 1, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, ) # with self.subTest("R - L"): # self.cloak_test( @@ -331,7 +331,7 @@ def testCollect_cloak_iterations(self): self.cloak_test( ["Left_Mothwing_Cloak", "Right_Mothwing_Cloak", "Right_Mothwing_Cloak"], [], - {"Left_Mothwing_Cloak": 2, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, + {"Left_Mothwing_Cloak": 1, "LEFTDASH": 2, "Right_Mothwing_Cloak": 2, "RIGHTDASH": 2}, ) with self.subTest("L - L"): self.cloak_test(