Bosses: own loot each, open at area level +5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-22 14:08:41 +01:00
parent 988968f3b3
commit 2579be2475
3 changed files with 41 additions and 14 deletions

View file

@ -2154,11 +2154,27 @@ class PartyTest(unittest.TestCase):
self.assertEqual(game.join_fight(world, kay, "kay", T0), "No one to join")
wil["xp"]["combat"] = game.XP_TABLE[60]
game.start_action(world, wil, "fight_ruins", T0)
self.assertEqual(game.join_fight(world, kay, "wil", T0), "Needs level 26")
self.assertEqual(game.join_fight(world, kay, "wil", T0), "Needs level 20")
game.start_action(world, wil, "fight_scouts", T0)
self.assertIsNone(game.join_fight(world, kay, "wil", T0))
self.assertEqual(game.join_fight(world, wil, "kay", T0), "Already fighting together")
def test_bosses_give_everyone_their_own_loot(self):
world, wil, kay = self.pair(level=30)
for p in (wil, kay):
p["equip"].update(weapon="steel_sword", helmet="steel_helmet", body="steel_body", legs="steel_legs")
p["bank"] = {"cooked_salmon": 5000}
game.start_action(world, wil, "fight_ruins", T0)
self.assertIsNone(game.join_fight(world, kay, "wil", T0))
self.online(world, T0 + 3600, random.Random(6))
wins = wil["away"]["wins"]
self.assertGreater(wins, 10)
low, high = game.ACTION_BY_ID["fight_ruins"]["gold"]
for p in (wil, kay):
self.assertTrue(wins * low <= p["away"]["gold"] <= wins * high) # a whole purse each
bones = p["away"]["items"].get("big_bones", 0) + p["away"]["overflow"].get("big_bones", 0)
self.assertEqual(bones, wins) # the sure drop, for each of them
def test_loot_is_shared_out(self):
shares = game.share_loot((7, {"bones": 1, "arrows": 5}), ["a", "b"], random.Random(1))
self.assertEqual(sorted(gold for gold, _ in shares.values()), [3, 4])