BlueGit

timfa questward

Files

questward / shared / definitions / alchemy.js

alchemy.js

alchemy.js 2.3 KiB Download Raw
1/** Cauldron action / step kinds (authoritative recipe language). */
2export const AlchemyStepKind = Object.freeze({
3 heat: "heat",
4 cool: "cool",
5 stir: "stir",
6 insert: "insert"
7});
8
9export const POTION_MAX_STACK = 16;
10export const POTION_FILL_LEVELS = Object.freeze([1, 2, 3, 4, 5]);
11export const CAULDRON_SLOT_COUNT = 4;
12
13/**
14 * Known successful potions. Ingredient `key` matches item def keys (resolved to itemId at runtime).
15 * A potion may never use more than 4 unique ingredients (ratio units).
16 */
17export const ALCHEMY_POTION_DEFINITIONS = Object.freeze({
18 greenDraught: Object.freeze({
19 potionKey: "greenDraught",
20 displayName: "Green draught",
21 minAlchemyLevel: 1,
22 color: Object.freeze({ r: 0.25, g: 0.72, b: 0.35 }),
23 fillLevel: 4,
24 ingredients: Object.freeze([
25 Object.freeze({ key: "green-herb", quantity: 2 }),
26 Object.freeze({ key: "apple", quantity: 1 })
27 ]),
28 steps: Object.freeze([
29 Object.freeze({ kind: AlchemyStepKind.heat }),
30 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "green-herb" }),
31 Object.freeze({ kind: AlchemyStepKind.stir }),
32 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "apple" }),
33 Object.freeze({ kind: AlchemyStepKind.cool })
34 ]),
35 effect: Object.freeze({ type: "heal", amount: 5 })
36 })
37});
38
39/**
40 * Failure (unstable) potions chosen by hashing the step transcript.
41 * Effects are stubs for later systems.
42 */
43export const UNSTABLE_POTION_EFFECTS = Object.freeze([
44 Object.freeze({ effectKey: "slow", displayName: "Unstable draught (sluggish)", color: { r: 0.45, g: 0.35, b: 0.55 }, fillLevel: 3, effect: { type: "slow", durationMs: 60_000 } }),
45 Object.freeze({ effectKey: "harm", displayName: "Unstable draught (bitter)", color: { r: 0.7, g: 0.2, b: 0.15 }, fillLevel: 2, effect: { type: "damage", amount: 4 } }),
46 Object.freeze({ effectKey: "blind", displayName: "Unstable draught (murky)", color: { r: 0.15, g: 0.15, b: 0.2 }, fillLevel: 3, effect: { type: "blind", durationMs: 30_000 } }),
47 Object.freeze({ effectKey: "queasy", displayName: "Unstable draught (queasy)", color: { r: 0.55, g: 0.65, b: 0.2 }, fillLevel: 2, effect: { type: "queasy", durationMs: 45_000 } })
48]);
49
50export function alchemyPotionDefinition (potionKey)
51{
52 return ALCHEMY_POTION_DEFINITIONS[potionKey] ?? null;
53}
54
55export function listAlchemyPotions ()
56{
57 return Object.values(ALCHEMY_POTION_DEFINITIONS);
58}