Instant targeting, damage on bars, interrupted casts, no arrows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-24 14:21:08 +01:00
parent bc99a1e0c5
commit 049e2c771a
6 changed files with 85 additions and 41 deletions

View file

@ -756,15 +756,11 @@ class AbilityTest(unittest.TestCase):
self.assertEqual(game.ITEMS["health_potion_3"]["drink"], game.HEALTH_HEAL[2])
self.assertNotIn("health_potion_3", game.edible({"bank": {"health_potion_3": 1}, "food": None}))
def test_volley_spends_arrows(self):
def test_volley_needs_no_arrows(self):
world, p = self.fighter("ranger", 45, weapon="maple_bow")
p["bank"] = {"arrows": 100}
game.start_action(world, p, "fight_goblins", T0)
summary = game.process_player(world, p, T0 + 1800, random.Random(2))
shot = summary["used"].get("arrows", 0)
self.assertGreater(shot, 0)
self.assertEqual(shot % 5, 0)
self.assertEqual(p["bank"].get("arrows", 0), 100 - shot)
p["bank"] = {}
fight = game.simulate_fight(world, p, game.ACTION_BY_ID["fight_goblins"], random.Random(2))
self.assertTrue(any(e[1] == p["id"] and e[6] == "volley" for e in fight["events"]))
def test_a_party_rests_as_long_as_its_slowest(self):
world = world_with(("wil", "builder"), ("kay", "builder"))
@ -836,6 +832,13 @@ class ActivePlayTest(unittest.TestCase):
dead = {e[2]: e[0] for e in self.fight["events"] if e[3] == "die"}
self.assertTrue(all(e[2] == "e1" for e in swings if e[0] < dead.get("e1", 1e9)))
def test_a_press_lands_on_the_enemy_it_names(self):
game.set_manual(self.world, self.p, "concuss", True, T0)
self.p["xp"]["combat"] = game.XP_TABLE[30]
self.assertIsNone(game.press(self.world, self.p, "concuss", self.at(3), "e1")) # not the one you're hitting
used = [e for e in self.fight["events"] if e[1] == "ash" and e[6] == "concuss" and e[0] >= self.at(3) - T0]
self.assertEqual(used[0][2], "e1")
def test_no_presses_while_resting_or_out_of_a_fight(self):
game.set_manual(self.world, self.p, "crushing_blow", True, T0)
self.assertEqual(game.press(self.world, self.p, "crushing_blow", T0), "Still resting")
@ -1028,10 +1031,11 @@ class LootTest(unittest.TestCase):
plain = game.simulate_fight(world, p, game.ACTION_BY_ID["fight_scouts"], random.Random(4))
world, p = self.ranger("wyrmscale_quiver")
mods = game.fighter(p, game.NO_BLESSING, {})["mods"]
self.assertEqual(mods["volley"], {"cost": 0, "c": 1.4})
self.assertEqual(mods["volley"], {"c": 1.4})
quivered = game.simulate_fight(world, p, game.ACTION_BY_ID["fight_scouts"], random.Random(4))
self.assertGreater(game.member_of(plain, "ash")["shot"], 0)
self.assertEqual(game.member_of(quivered, "ash")["shot"], 0) # no arrows
aims = lambda f: [e[0] for e in f["events"] if e[1] == "ash" and e[6] == "aimed_shot" and e[3] in ("cast", "hit", "crit")]
cast, landed = aims(quivered)[:2]
self.assertAlmostEqual(landed - cast, 1.5, places=1) # 2s of aiming, a quarter shorter
def test_a_pendant_mends_a_second_ally(self):
world = world_with(("kay", "homesteader"), ("wil", "builder"), ("bo", "miner"))