mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-25 11:53:23 -07:00
Correct logic in Bumper Sticker unit tests
Off By One errors were rampant in the Bumper Stickers unit test logic. This should correct those errors.
This commit is contained in:
@@ -3,8 +3,8 @@ from . import BumpStikTestBase
|
||||
|
||||
class TestRuleLogic(BumpStikTestBase):
|
||||
def testLogic(self):
|
||||
for x in range(1, 33):
|
||||
if x == 32:
|
||||
for x in range(1, 34):
|
||||
if x == 33:
|
||||
self.assertFalse(self.can_reach_location("Level 5 - Cleared all Hazards"))
|
||||
|
||||
self.collect(self.get_item_by_name("Treasure Bumper"))
|
||||
@@ -13,26 +13,31 @@ class TestRuleLogic(BumpStikTestBase):
|
||||
|
||||
if bb_count < 4:
|
||||
self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 1}"))
|
||||
# Can't reach Treasure Bumper 9 check until level 2 is unlocked, etc.
|
||||
# But we don't have enough Treasure Bumpers to reach this check anyway??
|
||||
elif bb_count == 4:
|
||||
bb_count += 1
|
||||
# Level 4 has two new Bonus Booster checks; need to check both
|
||||
|
||||
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:
|
||||
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 < 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"))
|
||||
for y in range(self.count("Booster Bumper"), bb_count + 1):
|
||||
if y > 0:
|
||||
self.assertTrue(self.can_reach_location(f"Bonus Booster {y}"),
|
||||
f"Bonus Booster {y} check not reachable with {self.count('Booster Bumper')} Booster Bumpers")
|
||||
if y < 5:
|
||||
self.assertFalse(self.can_reach_location(f"Bonus Booster {y + 1}"),
|
||||
f"Bonus Booster {y + 1} check reachable with {self.count('Treasure Bumper')} Treasure Bumpers and {self.count('Booster Bumper')} Booster Bumpers")
|
||||
if y < bb_count:
|
||||
self.collect(self.get_item_by_name("Booster Bumper"))
|
||||
|
||||
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")
|
||||
self.assertFalse(self.can_reach_location(f"Treasure Bumper {x + 1}"))
|
||||
elif x == 32:
|
||||
self.assertFalse(self.can_reach_location("Level 5 - 50,000+ Total Points"))
|
||||
|
||||
if x < 33:
|
||||
self.assertTrue(self.can_reach_location(f"Treasure Bumper {x}"),
|
||||
f"Treasure Bumper {x} check not reachable with {self.count('Treasure Bumper')} Treasure Bumpers")
|
||||
elif x == 33:
|
||||
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"))
|
||||
|
||||
Reference in New Issue
Block a user