Start work on fishing minigames,,
This commit is contained in:
+10
-9
@@ -43,7 +43,11 @@ async function setup() {
|
||||
for (let i = 0; i < 20; i++) t.game.tick();
|
||||
};
|
||||
const reel = () => t.send(1, { type: "use_item" });
|
||||
const fish = () => inventory().filter((i: Msg) => i?.id === "bworld:cod" || i?.id === "bworld:salmon");
|
||||
// what they caught: items with bworld:fish
|
||||
const fish = () =>
|
||||
inventory().filter((i: Msg) =>
|
||||
i && EverythingRegistry.get<ItemRegistry>("items", i.id)?.components?.["bworld:fish"] !== undefined
|
||||
);
|
||||
// ticks until something bites, which pulls the hook under the water. false if nothing did in 35 seconds
|
||||
const wait_for_bite = () => {
|
||||
for (let i = 0; i < 700; i++) {
|
||||
@@ -166,13 +170,10 @@ Deno.test("a fish with biomes is only caught in them, by id or #tag", async () =
|
||||
Array.from({ length: 200 }, () => t.game.mods.loot.roll("bworld:gameplay/fishing", { position })).flat()
|
||||
.map((item) => item.id),
|
||||
);
|
||||
// salmon's biomes are #bworld:is_ocean and #bworld:is_forest, cod has none
|
||||
assertEquals(
|
||||
caught(find((b) => tags.has("biomes", "bworld:is_ocean", b))),
|
||||
new Set(["bworld:cod", "bworld:salmon"]),
|
||||
);
|
||||
assertEquals(
|
||||
caught(find((b) => !tags.has("biomes", "bworld:is_ocean", b) && !tags.has("biomes", "bworld:is_forest", b))),
|
||||
new Set(["bworld:cod"]),
|
||||
// salmon's biomes are #bworld:is_ocean and #bworld:is_river
|
||||
assert(caught(find((b) => tags.has("biomes", "bworld:is_ocean", b))).has("bworld:salmon"));
|
||||
assert(
|
||||
!caught(find((b) => !tags.has("biomes", "bworld:is_ocean", b) && !tags.has("biomes", "bworld:is_river", b)))
|
||||
.has("bworld:salmon"),
|
||||
);
|
||||
});
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ Deno.test("the base game's tags, from scripts", async () => {
|
||||
assert(tags.has("biomes", "#bworld:is_ocean", "bworld:deep_frozen_ocean"));
|
||||
assert(tags.has("biomes", "bworld:is_mountain", "bworld:jagged_peaks"));
|
||||
assert(tags.has("biomes", "bworld:is_forest", "bworld:dark_forest"));
|
||||
assert(!tags.has("biomes", "bworld:is_forest", "bworld:plains"));
|
||||
assert(!tags.has("biomes", "bworld:is_forest", "bworld:river"));
|
||||
assertEquals(tags.get("items", "c:ingots"), [
|
||||
"bworld:copper_ingot",
|
||||
"bworld:tin_ingot",
|
||||
|
||||
Reference in New Issue
Block a user