Hitting !!
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user