Prayer: bury on the spot, retuned costs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-27 08:39:34 +00:00
parent 40e5274c4e
commit a7ff97815f
5 changed files with 106 additions and 32 deletions

View file

@ -1448,7 +1448,29 @@ class PrayerTest(unittest.TestCase):
self.assertEqual(p["pp"], 10)
self.assertEqual(p["xp"]["prayer"], game.XP_TABLE[1] + 20)
world["city"]["buildings"]["temple"]["level"] = 2
self.assertEqual(game.bone_points(world, game.ACTION_BY_ID["bury_bones"]), 4)
self.assertEqual(game.bone_points(world, game.ACTION_BY_ID["bury_bones"]), 3)
def test_fight_bones_bury_on_the_spot(self):
world, p = self.priest(level=10)
world["city"]["buildings"]["temple"]["level"] = 2
p["potions"]["prayer"] = {"item": "prayer_potion_2", "charges": 50}
summary = game.empty_summary()
kept = game.bury_on_the_spot(world, p, {"bones": 2, "big_bones": 1, "hide": 1}, T0, summary)
self.assertEqual(kept, {"big_bones": 1, "hide": 1}) # big bones need prayer 15
self.assertEqual(p["pp"], 2 * 3 * 1.5)
self.assertEqual(p["potions"]["prayer"]["charges"], 48)
self.assertEqual(summary["xp"]["prayer"], 2 * game.ACTION_BY_ID["bury_bones"]["xp"] * game.SPOT_BURY_XP)
p["bury"] = False
self.assertEqual(game.bury_on_the_spot(world, p, {"bones": 2}, T0, summary), {"bones": 2})
def test_won_fights_bury_their_bones(self):
world, p = self.priest(level=10)
p["bank"] = {"bread": 200}
game.start_action(world, p, "fight_wolves", T0)
summary = game.process_player(world, p, T0 + 3600, random.Random(1))
self.assertGreater(summary["wins"], 0)
self.assertNotIn("bones", p["bank"])
self.assertGreaterEqual(summary["pp_gained"], 2 * summary["wins"])
def test_choosing_prayers(self):
world, p = self.priest(level=10)
@ -1461,17 +1483,17 @@ class PrayerTest(unittest.TestCase):
scouts = game.ACTION_BY_ID["fight_scouts"]
plain = game.fight_odds(p, scouts)["damage"]
game.set_prayers(p, ["thick_skin", "burst_of_strength"])
p["pp"] = 4
p["pp"], p["bury"] = 8, False
blessed = game.blessing(p)
self.assertEqual(blessed["cost"], 2)
self.assertEqual(blessed["cost"], 4)
self.assertLess(game.fight_odds(p, scouts)["damage"], plain * 0.9)
p["bank"] = {"bread": 200}
game.start_action(world, p, "fight_scouts", T0)
summary = game.process_player(world, p, T0 + 600, random.Random(1))
self.assertEqual(p["pp"], 0)
self.assertEqual(summary["pp_spent"], 4)
self.assertEqual(summary["pp_spent"], 8)
self.assertTrue(summary["prayer_out"])
self.assertEqual(p["xp"]["prayer"], game.XP_TABLE[10] + 4 * game.PRAYER_XP_PER_POINT)
self.assertEqual(p["xp"]["prayer"], game.XP_TABLE[10] + 8 * game.PRAYER_XP_PER_POINT)
def test_second_wind_saves_one_knockout(self):
world, p = self.priest(level=40, combat=10)