Hitting !!

This commit is contained in:
2026-09-30 15:41:30 -03:00
parent 3af5f6e54b
commit 5e2b415f5c
9 changed files with 82 additions and 7 deletions
+25
View File
@@ -184,6 +184,31 @@ Deno.test("attacking again before the attack speed allows hits weaker, like mine
assertEquals(alice.attack_strength(), 1);
});
Deno.test("players hear their attack speed for the indicator, and any swing, even at the air, starts the cooldown over", async () => {
const { game, spawn, ticks, send, take } = await floor_game();
const [alice] = game.players();
ticks(1);
take(1);
alice.attributes.get(ATTRIBUTES.attack_speed)!.add_modifier({
id: "claws",
amount: 0.3,
operation: "add_multiplied_base",
});
ticks(1);
assertEquals(take(1).filter((m) => m.type === "attack_speed").map((m) => m.value), [4 * 1.3]);
// too far to hit, but the swing still counts, like the client's indicator shows
const far = spawn(0.5, 100, 20.5);
ticks(10);
send(1, { type: "attack_entity", id: far.id });
assertEquals(alice.attack_strength_ticker, 0);
// and so does a swing at the air
ticks(10);
send(1, { type: "swing" });
assertEquals(alice.attack_strength_ticker, 0);
});
Deno.test("players hit each other, knocking them back and flashing red for everyone else", async () => {
const { game, ticks, send, join, take } = await floor_game();
join(2, "bob");