BlueGit

timfa questward

Files

questward / shared / definitions / alchemy.js

alchemy.js

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