Sell value for wine
This commit is contained in:
+15
-1
@@ -13,7 +13,7 @@ import { block_visuals, Visuals } from "$/client/rendering/visuals.ts";
|
||||
import { AssetManager } from "$/client/assets.ts";
|
||||
import { fluid_rules, set_fluid_rules } from "$/client/fluid_rules.ts";
|
||||
import { setup as setup_client } from "$/mods/bworld/scripts/client.ts";
|
||||
import { JUICE_VALUE, type JuiceableParams } from "$/mods/bworld/scripts/shared.ts";
|
||||
import { JUICE_VALUE, type JuiceableParams, WINE_VALUE } from "$/mods/bworld/scripts/shared.ts";
|
||||
import type { FermentableRecipe } from "$/mods/bworld/scripts/fermenting.ts";
|
||||
import { copy_dir, stone_floor, test_game } from "./helpers.ts";
|
||||
|
||||
@@ -246,6 +246,20 @@ Deno.test("every juice ferments into wine from the same fruit, named after it in
|
||||
}
|
||||
});
|
||||
|
||||
Deno.test("wine sells for WINE_VALUE times the juice from the same fruit, and not at all when that juice can't be sold", async () => {
|
||||
const { game } = await setup();
|
||||
const rules = game.mods.fluid_rules;
|
||||
const sellable = EverythingRegistry.entries<ItemRegistry>("items")
|
||||
.filter(([, item]) => item.components?.["bworld:juiceable"] && item.base_sell_value !== undefined);
|
||||
assert(sellable.length > 0);
|
||||
for (const [id] of sellable) {
|
||||
const juice = rules.sell_value({ id: "bworld:juice", data: { item: id } })!;
|
||||
assertEquals(rules.sell_value({ id: "bworld:wine", data: { item: id } }), WINE_VALUE * juice);
|
||||
}
|
||||
// the cloudberry can't be sold, so neither can its juice or wine
|
||||
assertEquals(rules.sell_value({ id: "bworld:wine", data: { item: CLOUDBERRY } }), undefined);
|
||||
});
|
||||
|
||||
Deno.test("a broken bworld:fermentable recipe stops the server from starting", async () => {
|
||||
const juice = { fluid: { id: "bworld:juice" }, amount: 100 };
|
||||
for (
|
||||
|
||||
Reference in New Issue
Block a user