BlueGit

timfa questward

Files

questward / shared / definitions / alchemy.js

alchemy.js

alchemy.js 5.1 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;
12export const DYE_CAULDRON_SLOT_COUNT = 6;
13
14/** Deterministic cauldron look lines (hashed from the step transcript). */
15export 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
26export 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 * Step `insert` is once per ingredient addition; quantity lives in `ingredients`.
32 */
33export const ALCHEMY_POTION_DEFINITIONS = Object.freeze({
34 lesserHealthTonic: Object.freeze({
35 potionKey: "lesserHealthTonic",
36 displayName: "Lesser health tonic",
37 minAlchemyLevel: 1,
38 color: Object.freeze({ r: 0.35, g: 0.78, b: 0.42 }),
39 fillLevel: 4,
40 ingredients: Object.freeze([
41 Object.freeze({ key: "thyme", quantity: 1 }),
42 Object.freeze({ key: "mint", quantity: 1 })
43 ]),
44 steps: Object.freeze([
45 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "thyme" }),
46 Object.freeze({ kind: AlchemyStepKind.heat }),
47 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "mint" }),
48 Object.freeze({ kind: AlchemyStepKind.stir })
49 ]),
50 effect: Object.freeze({
51 type: "health-regen",
52 amountPerSecond: 1,
53 durationMs: 10_000
54 })
55 }),
56 lesserHasteDraught: Object.freeze({
57 potionKey: "lesserHasteDraught",
58 displayName: "Lesser haste draught",
59 minAlchemyLevel: 1,
60 color: Object.freeze({ r: 0.45, g: 0.85, b: 0.75 }),
61 fillLevel: 4,
62 ingredients: Object.freeze([
63 Object.freeze({ key: "mint", quantity: 2 }),
64 Object.freeze({ key: "lavender", quantity: 1 })
65 ]),
66 steps: Object.freeze([
67 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "mint" }),
68 Object.freeze({ kind: AlchemyStepKind.heat }),
69 Object.freeze({ kind: AlchemyStepKind.stir }),
70 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "lavender" }),
71 Object.freeze({ kind: AlchemyStepKind.cool })
72 ]),
73 effect: Object.freeze({
74 type: "stamina-regen",
75 amountPerSecond: 1,
76 durationMs: 10_000
77 })
78 }),
79 strengthPotion: Object.freeze({
80 potionKey: "strengthPotion",
81 displayName: "Strength potion",
82 minAlchemyLevel: 1,
83 color: Object.freeze({ r: 0.82, g: 0.32, b: 0.18 }),
84 fillLevel: 4,
85 ingredients: Object.freeze([
86 Object.freeze({ key: "thyme", quantity: 3 }),
87 Object.freeze({ key: "nettle", quantity: 2 })
88 ]),
89 steps: Object.freeze([
90 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "thyme" }),
91 Object.freeze({ kind: AlchemyStepKind.stir }),
92 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "nettle" }),
93 Object.freeze({ kind: AlchemyStepKind.heat })
94 ]),
95 effect: Object.freeze({
96 type: "strength-bonus",
97 amount: 5,
98 durationMs: 60_000
99 })
100 }),
101 clarityPotion: Object.freeze({
102 potionKey: "clarityPotion",
103 displayName: "Clarity potion",
104 minAlchemyLevel: 1,
105 color: Object.freeze({ r: 0.55, g: 0.45, b: 0.92 }),
106 fillLevel: 4,
107 ingredients: Object.freeze([
108 Object.freeze({ key: "rosemary", quantity: 1 }),
109 Object.freeze({ key: "chamomile", quantity: 2 })
110 ]),
111 steps: Object.freeze([
112 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "rosemary" }),
113 Object.freeze({ kind: AlchemyStepKind.cool }),
114 Object.freeze({ kind: AlchemyStepKind.insert, itemKey: "chamomile" }),
115 Object.freeze({ kind: AlchemyStepKind.stir })
116 ]),
117 effect: Object.freeze({
118 type: "mind-bonus",
119 amount: 5,
120 durationMs: 60_000
121 })
122 })
123});
124
125/**
126 * Failure (unstable) potions chosen by hashing the step transcript.
127 */
128export const UNSTABLE_POTION_EFFECTS = Object.freeze([
129 Object.freeze({
130 effectKey: "stamina-drain",
131 displayName: "Unstable draught (leeching)",
132 color: { r: 0.55, g: 0.2, b: 0.35 },
133 fillLevel: 3,
134 effect: Object.freeze({
135 type: "stamina-drain",
136 amountPerSecond: 1,
137 durationMs: 15_000
138 })
139 }),
140 Object.freeze({
141 effectKey: "glow",
142 displayName: "Unstable draught (glowing)",
143 color: { r: 0.95, g: 0.9, b: 0.45 },
144 fillLevel: 3,
145 effect: Object.freeze({
146 type: "glow",
147 lightRadiusTiles: 2,
148 durationMs: 10_000
149 })
150 }),
151 Object.freeze({
152 effectKey: "shrink",
153 displayName: "Unstable draught (diminishing)",
154 color: { r: 0.7, g: 0.55, b: 0.85 },
155 fillLevel: 2,
156 effect: Object.freeze({
157 type: "shrink",
158 scale: 0.5,
159 durationMs: 30_000
160 })
161 }),
162 Object.freeze({
163 effectKey: "blind",
164 displayName: "Unstable draught (murky)",
165 color: { r: 0.12, g: 0.12, b: 0.16 },
166 fillLevel: 3,
167 effect: Object.freeze({
168 type: "blind",
169 durationMs: 20_000
170 })
171 })
172]);
173
174export function alchemyPotionDefinition (potionKey)
175{
176 return ALCHEMY_POTION_DEFINITIONS[potionKey] ?? null;
177}
178
179export function listAlchemyPotions ()
180{
181 return Object.values(ALCHEMY_POTION_DEFINITIONS);
182}