Achievements page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-25 20:01:33 +00:00
parent f6951b0f12
commit a05530b802
5 changed files with 152 additions and 4 deletions

View file

@ -1077,6 +1077,30 @@ class LootTest(unittest.TestCase):
game.migrate(world, T0)
self.assertEqual(p["patterns"], [])
def test_achievements_read_what_you_have(self):
world, p = self.smith()
card = lambda name: next(c for s in game.achievements(p) for c in s["cards"] if c["name"] == name)
done = lambda name: [e["name"] for e in card(name)["entries"] if e["done"]]
self.assertEqual(len(card("Watchtower Depths")["entries"]), 7)
self.assertEqual(done("Watchtower Depths"), [])
p["patterns"].append("pattern_ogre_forged_warhammer")
self.assertEqual(done("Watchtower Depths"), ["Ogre-forged warhammer"])
# A unique stays found after it's gone.
game.bank_add(world, p, "ogres_knuckle", 1, T0, game.empty_summary())
game.bank_take(p, "ogres_knuckle", 1)
self.assertEqual(done("Uniques"), ["Ogre's knuckle"])
self.assertEqual(done("Masters"), [])
p["xp"]["mining"] = game.XP_TABLE[50]
self.assertEqual(done("Masters"), ["Master miner"])
def test_old_worlds_find_the_uniques_they_hold(self):
world, p = self.smith()
del p["found"]
p["equip"]["ring"] = "ogres_knuckle"
world["version"] = 30
game.migrate(world, T0)
self.assertEqual(p["found"], ["ogres_knuckle"])
class NewSkillsTest(unittest.TestCase):
def test_tools_speed_up_gathering(self):