| 1 | /** Cauldron action / step kinds (authoritative recipe language). */ |
| 2 | export const AlchemyStepKind = Object.freeze({ |
| 3 | heat: "heat", |
| 4 | cool: "cool", |
| 5 | stir: "stir", |
| 6 | insert: "insert" |
| 7 | }); |
| 8 | |
| 9 | export const POTION_MAX_STACK = 16; |
| 10 | export const POTION_FILL_LEVELS = Object.freeze([1, 2, 3, 4, 5]); |
| 11 | export const CAULDRON_SLOT_COUNT = 4; |
| 12 | export const DYE_CAULDRON_SLOT_COUNT = 6; |
| 13 | |
| 14 | /** Deterministic cauldron look lines (hashed from the step transcript). */ |
| 15 | export const CAULDRON_FLAVOR_LINES = Object.freeze([ |
| 16 | "The liquid is bubbling", |
| 17 | "The liquid is sizzling", |
| 18 | "The liquid is still", |
| 19 | "The liquid is murky", |
| 20 | "The liquid is swirling", |
| 21 | "The liquid is glowing", |
| 22 | "The liquid is fuming", |
| 23 | "The liquid is boiling" |
| 24 | ]); |
| 25 | |
| 26 | export const CAULDRON_EMPTY_FLAVOR = "The cauldron is empty"; |
| 27 | |
| 28 | /** |
| 29 | * Known successful potions. Ingredient `key` matches item def keys (resolved to itemId at runtime). |
| 30 | * A potion may never use more than 4 unique ingredients (ratio units). |
| 31 | */ |
| 32 | export const ALCHEMY_POTION_DEFINITIONS = Object.freeze({ |
| 33 | greenDraught: Object.freeze({ |
| 34 | potionKey: "greenDraught", |
| 35 | displayName: "Green draught", |
| 36 | minAlchemyLevel: 1, |
| 37 | color: Object.freeze({ r: 0.25, g: 0.72, b: 0.35 }), |
| 38 | fillLevel: 4, |
| 39 | ingredients: Object.freeze([ |
| 40 | Object.freeze({ key: "green-herb", quantity: 2 }), |
| 41 | Object.freeze({ key: "apple", quantity: 1 }) |
| 42 | ]), |
| 43 | steps: Object.freeze([ |
| 44 | Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "green-herb" }), |
| 45 | Object.freeze({ kind: AlchemyStepKind.heat }), |
| 46 | Object.freeze({ kind: AlchemyStepKind.stir }), |
| 47 | Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "apple" }), |
| 48 | Object.freeze({ kind: AlchemyStepKind.cool }) |
| 49 | ]), |
| 50 | effect: Object.freeze({ type: "heal", amount: 5 }) |
| 51 | }) |
| 52 | }); |
| 53 | |
| 54 | /** |
| 55 | * Failure (unstable) potions chosen by hashing the step transcript. |
| 56 | * Effects are stubs for later systems. |
| 57 | */ |
| 58 | export const UNSTABLE_POTION_EFFECTS = Object.freeze([ |
| 59 | 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 } }), |
| 60 | 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 } }), |
| 61 | 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 } }), |
| 62 | 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 } }) |
| 63 | ]); |
| 64 | |
| 65 | export function alchemyPotionDefinition (potionKey) |
| 66 | { |
| 67 | return ALCHEMY_POTION_DEFINITIONS[potionKey] ?? null; |
| 68 | } |
| 69 | |
| 70 | export function listAlchemyPotions () |
| 71 | { |
| 72 | return Object.values(ALCHEMY_POTION_DEFINITIONS); |
| 73 | } |