From 87a6c774b691728ea3ae7b01ea72be9fe71f3132 Mon Sep 17 00:00:00 2001 From: Felix R Date: Mon, 2 Oct 2023 20:20:32 -0300 Subject: [PATCH 01/11] bumpstik: treasure/booster location rules --- worlds/bumpstik/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/worlds/bumpstik/__init__.py b/worlds/bumpstik/__init__.py index 9eeb3325e38f..cc04384c3bcb 100644 --- a/worlds/bumpstik/__init__.py +++ b/worlds/bumpstik/__init__.py @@ -118,6 +118,13 @@ def create_items(self): def set_rules(self): forbid_item(self.multiworld.get_location("Bonus Booster 5", self.player), "Booster Bumper", self.player) + for x in range(1, 33): + self.multiworld.get_location(f"Treasure Bumper {x}").access_rule = \ + lambda state, x = x: state.has("Treasure Bumper", self.player, x) + for x in range(1, 6): + self.multiworld.get_location(f"Bonus Booster {x}").access_rule = \ + lambda state, x = x: state.has("Booster Bumper", self.player, x) + def generate_basic(self): self.multiworld.get_location("Level 5 - Cleared all Hazards", self.player).place_locked_item( From c82adf7d752657dcb6ffa24cac869762b8634353 Mon Sep 17 00:00:00 2001 From: Felix R Date: Mon, 2 Oct 2023 20:25:18 -0300 Subject: [PATCH 02/11] bumpstik: oop missed a bit --- worlds/bumpstik/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worlds/bumpstik/__init__.py b/worlds/bumpstik/__init__.py index cc04384c3bcb..234879e356c9 100644 --- a/worlds/bumpstik/__init__.py +++ b/worlds/bumpstik/__init__.py @@ -119,10 +119,10 @@ def set_rules(self): forbid_item(self.multiworld.get_location("Bonus Booster 5", self.player), "Booster Bumper", self.player) for x in range(1, 33): - self.multiworld.get_location(f"Treasure Bumper {x}").access_rule = \ + self.multiworld.get_location(f"Treasure Bumper {x}", self.player).access_rule = \ lambda state, x = x: state.has("Treasure Bumper", self.player, x) for x in range(1, 6): - self.multiworld.get_location(f"Bonus Booster {x}").access_rule = \ + self.multiworld.get_location(f"Bonus Booster {x}", self.player).access_rule = \ lambda state, x = x: state.has("Booster Bumper", self.player, x) From aef1f6f797d3d2ac14c149cbc8f814074d3f8334 Mon Sep 17 00:00:00 2001 From: Felix R Date: Mon, 2 Oct 2023 20:45:08 -0300 Subject: [PATCH 03/11] bumpstik: apply access rule to Hazards check --- worlds/bumpstik/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/worlds/bumpstik/__init__.py b/worlds/bumpstik/__init__.py index 234879e356c9..a0bd2647cc9b 100644 --- a/worlds/bumpstik/__init__.py +++ b/worlds/bumpstik/__init__.py @@ -108,7 +108,7 @@ def create_items(self): item_pool += self._create_item_in_quantities( name, frequencies[i]) - item_delta = len(location_table) - len(item_pool) - 1 + item_delta = len(location_table) - len(item_pool) if item_delta > 0: item_pool += self._create_item_in_quantities( "Score Bonus", item_delta) @@ -116,20 +116,17 @@ def create_items(self): self.multiworld.itempool += item_pool def set_rules(self): - forbid_item(self.multiworld.get_location("Bonus Booster 5", self.player), - "Booster Bumper", self.player) for x in range(1, 33): self.multiworld.get_location(f"Treasure Bumper {x}", self.player).access_rule = \ lambda state, x = x: state.has("Treasure Bumper", self.player, x) for x in range(1, 6): self.multiworld.get_location(f"Bonus Booster {x}", self.player).access_rule = \ lambda state, x = x: state.has("Booster Bumper", self.player, x) + self.multiworld.get_location("Level 5 - Cleared all Hazards", self.player).access_rule = \ + lambda state: state.has("Hazard Bumper", self.player, 25) def generate_basic(self): - self.multiworld.get_location("Level 5 - Cleared all Hazards", self.player).place_locked_item( - self.create_item(self.get_filler_item_name())) - self.multiworld.completion_condition[self.player] = \ lambda state: state.has("Booster Bumper", self.player, 5) and \ state.has("Treasure Bumper", self.player, 32) From 4f8e681e91a73ed4f40ebdd53bcbe3465edee43d Mon Sep 17 00:00:00 2001 From: Felix R Date: Mon, 2 Oct 2023 21:56:05 -0300 Subject: [PATCH 04/11] bumpstik: move completion cond. to set_rules --- worlds/bumpstik/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/worlds/bumpstik/__init__.py b/worlds/bumpstik/__init__.py index a0bd2647cc9b..da222cf67cb1 100644 --- a/worlds/bumpstik/__init__.py +++ b/worlds/bumpstik/__init__.py @@ -124,9 +124,8 @@ def set_rules(self): lambda state, x = x: state.has("Booster Bumper", self.player, x) self.multiworld.get_location("Level 5 - Cleared all Hazards", self.player).access_rule = \ lambda state: state.has("Hazard Bumper", self.player, 25) - - - def generate_basic(self): + self.multiworld.completion_condition[self.player] = \ lambda state: state.has("Booster Bumper", self.player, 5) and \ state.has("Treasure Bumper", self.player, 32) + From 776d5ff74daabce15a75835ebd40a14c425b5317 Mon Sep 17 00:00:00 2001 From: Felix R Date: Wed, 4 Oct 2023 19:07:43 -0300 Subject: [PATCH 05/11] =?UTF-8?q?bumpstik:=20tests=3F=20I=20have=20literal?= =?UTF-8?q?ly=20never=20written=20these=20before=20so=20=F0=9F=A4=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worlds/bumpstik/test/TestLogic.py | 23 +++++++++++++++++++++++ worlds/bumpstik/test/__init__.py | 5 +++++ 2 files changed, 28 insertions(+) create mode 100644 worlds/bumpstik/test/TestLogic.py create mode 100644 worlds/bumpstik/test/__init__.py diff --git a/worlds/bumpstik/test/TestLogic.py b/worlds/bumpstik/test/TestLogic.py new file mode 100644 index 000000000000..e016e0bfef7f --- /dev/null +++ b/worlds/bumpstik/test/TestLogic.py @@ -0,0 +1,23 @@ +from . import BumpStikTestBase + + +class TestRuleLogic(BumpStikTestBase): + def testTreasures(self): + locations = ["Treasure Bumper 4"] + items = [["Treasure Bumper" for _ in range(4)]] + self.assertAccessDependency(locations, items) + + def testTreasuresLv2(self): + locations = ["Treasure Bumper 12"] + items = [["Treasure Bumper" for _ in range(12)] + + ["Bonus Booster" for _ in range(2)]] + self.assertAccessDependency(locations, items) + + def testLevels(self): + landmarks = [f"Level {x} - Combo 5" for _ in range(2, 5)] + \ + ["Level 5 - Cleared all Hazards"] + for x, landmark in enumerate(landmarks): + locations = [landmark] + items = [["Treasure Bumper" for _ in range(x * 8)] + + ["Bonus Booster" for _ in range(x + 1)]] + self.assertAccessDependency(locations, items) diff --git a/worlds/bumpstik/test/__init__.py b/worlds/bumpstik/test/__init__.py new file mode 100644 index 000000000000..1199d7b8e506 --- /dev/null +++ b/worlds/bumpstik/test/__init__.py @@ -0,0 +1,5 @@ +from test.TestBase import WorldTestBase + + +class BumpStikTestBase(WorldTestBase): + game = "Bumper Stickers" From e4b428200dd642d36aace849c538a88148e04426 Mon Sep 17 00:00:00 2001 From: Felix R Date: Wed, 4 Oct 2023 19:10:51 -0300 Subject: [PATCH 06/11] bumpstik: oops --- worlds/bumpstik/test/TestLogic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worlds/bumpstik/test/TestLogic.py b/worlds/bumpstik/test/TestLogic.py index e016e0bfef7f..b977af78bf65 100644 --- a/worlds/bumpstik/test/TestLogic.py +++ b/worlds/bumpstik/test/TestLogic.py @@ -14,7 +14,7 @@ def testTreasuresLv2(self): self.assertAccessDependency(locations, items) def testLevels(self): - landmarks = [f"Level {x} - Combo 5" for _ in range(2, 5)] + \ + landmarks = [f"Level {x} - Combo 5" for x in range(2, 5)] + \ ["Level 5 - Cleared all Hazards"] for x, landmark in enumerate(landmarks): locations = [landmark] From 019b314c3502973427647d251cdfb766b49efa01 Mon Sep 17 00:00:00 2001 From: Felix R Date: Tue, 10 Oct 2023 09:39:37 -0300 Subject: [PATCH 07/11] bumpstik: how about this? --- worlds/bumpstik/test/TestLogic.py | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/worlds/bumpstik/test/TestLogic.py b/worlds/bumpstik/test/TestLogic.py index b977af78bf65..e31180a81b1d 100644 --- a/worlds/bumpstik/test/TestLogic.py +++ b/worlds/bumpstik/test/TestLogic.py @@ -2,22 +2,23 @@ class TestRuleLogic(BumpStikTestBase): - def testTreasures(self): - locations = ["Treasure Bumper 4"] - items = [["Treasure Bumper" for _ in range(4)]] - self.assertAccessDependency(locations, items) + def testLogic(self): + for x in range(1, 33): + if x == 32: + self.assertFalse(self.can_reach_location("Level 5 - Cleared all Hazards")) - def testTreasuresLv2(self): - locations = ["Treasure Bumper 12"] - items = [["Treasure Bumper" for _ in range(12)] + - ["Bonus Booster" for _ in range(2)]] - self.assertAccessDependency(locations, items) + self.collect(self.get_item_by_name("Treasure Bumper")) + if x % 8 == 0: + self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 1}")) + for y in range(self.count("Bonus Booster"), round(x / 8) + 1): + self.collect(self.get_item_by_name("Bonus Booster")) + self.assertTrue(self.can_reach_location(f"Booster Bumper {y + 1}")) + if y < 4: + self.assertFalse(self.can_reach_location(f"Booster Bumper {y + 2}")) + + if x == 32: + self.assertTrue(self.can_reach_location("Level 5 - Cleared all Hazards")) + self.assertTrue(self.can_reach_location(f"Treasure Bumper {x + 1}")) + if x < 31: + self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 2}")) - def testLevels(self): - landmarks = [f"Level {x} - Combo 5" for x in range(2, 5)] + \ - ["Level 5 - Cleared all Hazards"] - for x, landmark in enumerate(landmarks): - locations = [landmark] - items = [["Treasure Bumper" for _ in range(x * 8)] + - ["Bonus Booster" for _ in range(x + 1)]] - self.assertAccessDependency(locations, items) From 38b175674ec08be4b1fac34e822d508b07108242 Mon Sep 17 00:00:00 2001 From: Felix R Date: Tue, 10 Oct 2023 15:35:30 -0300 Subject: [PATCH 08/11] bumpstik: fix some logic --- worlds/bumpstik/Regions.py | 8 ++++---- worlds/bumpstik/__init__.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/worlds/bumpstik/Regions.py b/worlds/bumpstik/Regions.py index 247d6d61a34b..3a62080e1dea 100644 --- a/worlds/bumpstik/Regions.py +++ b/worlds/bumpstik/Regions.py @@ -23,13 +23,13 @@ def create_regions(world: MultiWorld, player: int): entrance_map = { "Level 1": lambda state: - state.has("Booster Bumper", player, 2) and state.has("Treasure Bumper", player, 9), + state.has("Booster Bumper", player, 2) and state.has("Treasure Bumper", player, 8), "Level 2": lambda state: - state.has("Booster Bumper", player, 3) and state.has("Treasure Bumper", player, 17), + state.has("Booster Bumper", player, 3) and state.has("Treasure Bumper", player, 16), "Level 3": lambda state: - state.has("Booster Bumper", player, 4) and state.has("Treasure Bumper", player, 25), + state.has("Booster Bumper", player, 4) and state.has("Treasure Bumper", player, 24), "Level 4": lambda state: - state.has("Booster Bumper", player, 5) and state.has("Treasure Bumper", player, 33) + state.has("Booster Bumper", player, 5) and state.has("Treasure Bumper", player, 32) } for x, region_name in enumerate(region_map): diff --git a/worlds/bumpstik/__init__.py b/worlds/bumpstik/__init__.py index da222cf67cb1..c4e65d07b6a9 100644 --- a/worlds/bumpstik/__init__.py +++ b/worlds/bumpstik/__init__.py @@ -116,11 +116,11 @@ def create_items(self): self.multiworld.itempool += item_pool def set_rules(self): - for x in range(1, 33): - self.multiworld.get_location(f"Treasure Bumper {x}", self.player).access_rule = \ + for x in range(1, 32): + self.multiworld.get_location(f"Treasure Bumper {x + 1}", self.player).access_rule = \ lambda state, x = x: state.has("Treasure Bumper", self.player, x) - for x in range(1, 6): - self.multiworld.get_location(f"Bonus Booster {x}", self.player).access_rule = \ + for x in range(1, 5): + self.multiworld.get_location(f"Bonus Booster {x + 1}", self.player).access_rule = \ lambda state, x = x: state.has("Booster Bumper", self.player, x) self.multiworld.get_location("Level 5 - Cleared all Hazards", self.player).access_rule = \ lambda state: state.has("Hazard Bumper", self.player, 25) From 35793db9453cd3afea2016411a3ae927f58590eb Mon Sep 17 00:00:00 2001 From: Felix R Date: Tue, 10 Oct 2023 15:35:39 -0300 Subject: [PATCH 09/11] bumpstik: this almost works but not quite --- worlds/bumpstik/test/TestLogic.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/worlds/bumpstik/test/TestLogic.py b/worlds/bumpstik/test/TestLogic.py index e31180a81b1d..1a523455b56d 100644 --- a/worlds/bumpstik/test/TestLogic.py +++ b/worlds/bumpstik/test/TestLogic.py @@ -9,16 +9,23 @@ def testLogic(self): self.collect(self.get_item_by_name("Treasure Bumper")) if x % 8 == 0: - self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 1}")) - for y in range(self.count("Bonus Booster"), round(x / 8) + 1): - self.collect(self.get_item_by_name("Bonus Booster")) - self.assertTrue(self.can_reach_location(f"Booster Bumper {y + 1}")) + if x < 32: + self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 1}")) + for y in range(self.count("Booster Bumper"), round(x / 8) + 1): + self.assertTrue(self.can_reach_location(f"Bonus Booster {y + 1}"), + f"BB {y + 1} check not reachable with {self.count('Booster Bumper')} BBs") if y < 4: - self.assertFalse(self.can_reach_location(f"Booster Bumper {y + 2}")) + self.assertFalse(self.can_reach_location(f"Bonus Booster {y + 2}"), + f"BB {y + 2} check reachable with {self.count('Treasure Bumper')} TBs") + self.collect(self.get_item_by_name("Booster Bumper")) - if x == 32: - self.assertTrue(self.can_reach_location("Level 5 - Cleared all Hazards")) - self.assertTrue(self.can_reach_location(f"Treasure Bumper {x + 1}")) if x < 31: self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 2}")) - + if x < 32: + self.assertTrue(self.can_reach_location(f"Treasure Bumper {x + 1}"), + f"TB {x + 1} check not reachable with {self.count('Treasure Bumper')} TBs") + elif x == 32: + self.assertTrue(self.can_reach_location("Level 5 - 50,000+ Total Points")) + self.assertFalse(self.can_reach_location("Level 5 - Cleared all Hazards")) + self.collect(self.get_items_by_name("Hazard Bumper")) + self.assertTrue(self.can_reach_location("Level 5 - Cleared all Hazards")) From 0865dcec396a37c61b8d3888a7e704f609dba171 Mon Sep 17 00:00:00 2001 From: Felix R Date: Thu, 12 Oct 2023 12:14:53 -0300 Subject: [PATCH 10/11] bumpstik: accurate region boundaries for BBs since we're using rules now --- worlds/bumpstik/Regions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worlds/bumpstik/Regions.py b/worlds/bumpstik/Regions.py index 3a62080e1dea..6cddde882a08 100644 --- a/worlds/bumpstik/Regions.py +++ b/worlds/bumpstik/Regions.py @@ -23,11 +23,11 @@ def create_regions(world: MultiWorld, player: int): entrance_map = { "Level 1": lambda state: - state.has("Booster Bumper", player, 2) and state.has("Treasure Bumper", player, 8), + state.has("Booster Bumper", player, 1) and state.has("Treasure Bumper", player, 8), "Level 2": lambda state: - state.has("Booster Bumper", player, 3) and state.has("Treasure Bumper", player, 16), + state.has("Booster Bumper", player, 2) and state.has("Treasure Bumper", player, 16), "Level 3": lambda state: - state.has("Booster Bumper", player, 4) and state.has("Treasure Bumper", player, 24), + state.has("Booster Bumper", player, 3) and state.has("Treasure Bumper", player, 24), "Level 4": lambda state: state.has("Booster Bumper", player, 5) and state.has("Treasure Bumper", player, 32) } From 994c16c2eddcd50938ca331c2bc00c432b32c5be Mon Sep 17 00:00:00 2001 From: Felix R Date: Thu, 12 Oct 2023 12:15:01 -0300 Subject: [PATCH 11/11] bumpstik: holy heck it works now --- worlds/bumpstik/test/TestLogic.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/worlds/bumpstik/test/TestLogic.py b/worlds/bumpstik/test/TestLogic.py index 1a523455b56d..e374b7b1e999 100644 --- a/worlds/bumpstik/test/TestLogic.py +++ b/worlds/bumpstik/test/TestLogic.py @@ -9,9 +9,14 @@ def testLogic(self): self.collect(self.get_item_by_name("Treasure Bumper")) if x % 8 == 0: - if x < 32: + bb_count = round(x / 8) + + if bb_count < 4: self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 1}")) - for y in range(self.count("Booster Bumper"), round(x / 8) + 1): + elif bb_count == 4: + bb_count += 1 + + for y in range(self.count("Booster Bumper"), bb_count): self.assertTrue(self.can_reach_location(f"Bonus Booster {y + 1}"), f"BB {y + 1} check not reachable with {self.count('Booster Bumper')} BBs") if y < 4: @@ -21,6 +26,9 @@ def testLogic(self): if x < 31: self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 2}")) + elif x == 31: + self.assertFalse(self.can_reach_location("Level 5 - 50,000+ Total Points")) + if x < 32: self.assertTrue(self.can_reach_location(f"Treasure Bumper {x + 1}"), f"TB {x + 1} check not reachable with {self.count('Treasure Bumper')} TBs")