Maze minigame
This commit is contained in:
@@ -504,3 +504,40 @@ Deno.test("the ring minigame needs every ring checked, and missing one loses it"
|
||||
assertEquals(t.fish().length, 1);
|
||||
}), "ring");
|
||||
});
|
||||
|
||||
Deno.test("the maze minigame lands the fish when its screen says the mouse got through, and loses it on a wall", async () => {
|
||||
const t = await setup();
|
||||
const closes = () => t.take(1).some((m: Msg) => m.type === "close_menu");
|
||||
await with_minigames(async () => {
|
||||
t.send(1, { type: "chat", text: "/fish cod" });
|
||||
let opened = opened_menu(t.take(1));
|
||||
t.send(1, { type: "menu_button", menu: opened.id, button: 0 });
|
||||
t.game.tick();
|
||||
assert(closes());
|
||||
assertEquals(t.fish().length, 0);
|
||||
|
||||
t.send(1, { type: "chat", text: "/fish cod" });
|
||||
opened = opened_menu(t.take(1));
|
||||
t.send(1, { type: "menu_button", menu: opened.id, button: 1 });
|
||||
assertEquals(t.fish().map((i: Msg) => i.id), ["bworld:cod"]);
|
||||
}, "maze");
|
||||
});
|
||||
|
||||
Deno.test("the maze minigame loses the fish after 8 seconds, whatever the difficulty", async () => {
|
||||
const t = await setup();
|
||||
const closes = () => t.take(1).some((m: Msg) => m.type === "close_menu");
|
||||
await with_minigames(async () => {
|
||||
for (const difficulty of [0, 100]) {
|
||||
await with_difficulty(difficulty, async () => {
|
||||
t.send(1, { type: "chat", text: "/fish cod" });
|
||||
assertEquals(opened_menu(t.take(1)).data, { ticks_left: 160, time: 160 });
|
||||
for (let i = 0; i < 159; i++) t.game.tick();
|
||||
assert(!closes());
|
||||
t.game.tick();
|
||||
t.game.tick();
|
||||
assert(closes());
|
||||
assertEquals(t.fish().length, 0);
|
||||
});
|
||||
}
|
||||
}, "maze");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user