Skip to content

Commit

Permalink
fixes to tests and col/rem
Browse files Browse the repository at this point in the history
  • Loading branch information
qwint committed Oct 2, 2024
1 parent ed21cc1 commit 4009fa1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
22 changes: 12 additions & 10 deletions worlds/hk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions worlds/hk/test/test_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 4009fa1

Please sign in to comment.