@g3nomaly/g3n-mods 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +8 -2
- package/README.md +13 -6
- package/mods/agent-adventure/.claude-plugin/plugin.json +23 -0
- package/mods/agent-adventure/hooks/content.ts +263 -0
- package/mods/agent-adventure/hooks/engine.ts +1125 -0
- package/mods/agent-adventure/hooks/hooks.json +1 -0
- package/mods/agent-adventure/hooks/register.tsx +465 -0
- package/mods/agent-adventure/hooks/sprite.ts +424 -0
- package/mods/agent-adventure/types/index.d.ts +248 -0
- package/mods/agent-adventure/view/panes.json +8 -0
- package/mods/agent-adventure/view/view.css +230 -0
- package/mods/agent-adventure/view/view.ts +308 -0
- package/mods/agents-panel/.claude-plugin/plugin.json +9 -1
- package/mods/agents-panel/hooks/register.tsx +18 -4
- package/mods/agents-panel/view/panes.json +8 -0
- package/mods/context-bar/.claude-plugin/plugin.json +9 -1
- package/mods/context-bar/hooks/register.tsx +4 -3
- package/mods/context-bar/view/panes.json +8 -0
- package/mods/custom-crab-agents/hooks/register.tsx +15 -1
- package/mods/delete-guard/.claude-plugin/plugin.json +9 -1
- package/mods/delete-guard/hooks/register.tsx +15 -5
- package/mods/delete-guard/view/panes.json +8 -0
- package/mods/focus-mode/.claude-plugin/plugin.json +6 -0
- package/mods/focus-mode/hooks/register.tsx +7 -4
- package/mods/focus-mode/view/panes.json +8 -0
- package/mods/mini-game/.claude-plugin/plugin.json +10 -2
- package/mods/mini-game/hooks/bubbles.ts +27 -0
- package/mods/mini-game/hooks/minesweeper.ts +108 -0
- package/mods/mini-game/hooks/mole.ts +91 -0
- package/mods/mini-game/hooks/register.tsx +206 -148
- package/mods/mini-game/types/index.d.ts +18 -1
- package/mods/mini-game/view/panes.json +8 -0
- package/mods/tool-timeline/.claude-plugin/plugin.json +9 -1
- package/mods/tool-timeline/hooks/register.tsx +18 -4
- package/mods/tool-timeline/view/panes.json +8 -0
- package/mods/you-should-know/.claude-plugin/plugin.json +3 -3
- package/mods/you-should-know/hooks/register.tsx +173 -45
- package/mods/you-should-know/types/index.d.ts +13 -4
- package/package.json +2 -1
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
// packages/g3n-mods/mods/agent-adventure/hooks/sprite.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The pixel sprites, shared by the hooks module, which draws them as an Svg on surfaces without the mod's view, and
|
|
5
|
+
* by the view in `view/view.ts`. Plain data and string building only, so both can import it.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Each letter of a sprite row is a palette color; `.` is empty. */
|
|
9
|
+
export const PALETTE: Readonly<Record<string, string>> = {
|
|
10
|
+
k: '#1b1b24', s: '#f2c9a0', S: '#d9a47a', h: '#6b4226', y: '#e8c46a',
|
|
11
|
+
r: '#c0392b', R: '#8e2a20', b: '#3a6ea5', B: '#24466e', g: '#3fa66b', G: '#2a7048',
|
|
12
|
+
w: '#f0f0f0', W: '#c9d1d9', m: '#a8b2bd', M: '#6b7480', o: '#8b5a2b', O: '#5c3a1a',
|
|
13
|
+
p: '#8e5bd0', P: '#5d3a91', t: '#d8c38f', T: '#a8935a', e: '#f2c14e', E: '#e0773a',
|
|
14
|
+
c: '#6fd3e0', C: '#3a9fb0', n: '#e8e2cf', N: '#b8b09a', l: '#7ad46a', L: '#4a9c45',
|
|
15
|
+
x: '#ff4a3d', z: '#cfe8ff', Z: '#9fb8d8', q: '#3b3f4a', Q: '#262932', v: '#b07ad8', a: '#ffe9a8',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Heroes, 12 by 14, facing right. Enemies face left; bosses are drawn bigger.
|
|
20
|
+
* `recruit` is a hooded figure for a hero still signing up.
|
|
21
|
+
*/
|
|
22
|
+
export const SPRITES: Readonly<Record<string, readonly string[]>> = {
|
|
23
|
+
fighter: [
|
|
24
|
+
'.....rr.....',
|
|
25
|
+
'....MMMM....',
|
|
26
|
+
'...MmmmmM...',
|
|
27
|
+
'...MsksksM..',
|
|
28
|
+
'...MssSssM..',
|
|
29
|
+
'....MMMM..m.',
|
|
30
|
+
'.MM.rrrr..m.',
|
|
31
|
+
'MmmMmrrmm.m.',
|
|
32
|
+
'MmemMrrrrsO.',
|
|
33
|
+
'MmmM.RRRR...',
|
|
34
|
+
'.MM..rrrr...',
|
|
35
|
+
'.....M..M...',
|
|
36
|
+
'.....M..M...',
|
|
37
|
+
'....OO..OO..',
|
|
38
|
+
],
|
|
39
|
+
healer: [
|
|
40
|
+
'....wwww....',
|
|
41
|
+
'...wwyyyw...',
|
|
42
|
+
'...wysksk...',
|
|
43
|
+
'...wysssS...',
|
|
44
|
+
'....wsss.e..',
|
|
45
|
+
'...wwwwww.e.',
|
|
46
|
+
'..swwewwwwe.',
|
|
47
|
+
'...wweeww.o.',
|
|
48
|
+
'...wwweww.o.',
|
|
49
|
+
'...wwwwww.o.',
|
|
50
|
+
'...wwwwww.o.',
|
|
51
|
+
'..wwwwwwww..',
|
|
52
|
+
'...ww..ww...',
|
|
53
|
+
'...tt..tt...',
|
|
54
|
+
],
|
|
55
|
+
monk: [
|
|
56
|
+
'............',
|
|
57
|
+
'....ssss....',
|
|
58
|
+
'...ssssss...',
|
|
59
|
+
'...sssksk...',
|
|
60
|
+
'...ssssss...',
|
|
61
|
+
'....SSSS....',
|
|
62
|
+
'..EEEEEEEE..',
|
|
63
|
+
'.sEEEOOEEEs.',
|
|
64
|
+
'.s.EEEEEE.s.',
|
|
65
|
+
'...OOOOOO...',
|
|
66
|
+
'...EEEEEE...',
|
|
67
|
+
'...EE..EE...',
|
|
68
|
+
'...ss..ss...',
|
|
69
|
+
'..ss....ss..',
|
|
70
|
+
],
|
|
71
|
+
ranger: [
|
|
72
|
+
'...GGGG.....',
|
|
73
|
+
'..GGGGGG.o..',
|
|
74
|
+
'..GGsksk..o.',
|
|
75
|
+
'..GsssssS.o.',
|
|
76
|
+
'...Gsss...o.',
|
|
77
|
+
'..GGGGGGs.o.',
|
|
78
|
+
'.GGgggggGso.',
|
|
79
|
+
'.G.ggOgg..o.',
|
|
80
|
+
'.G.gggggg.o.',
|
|
81
|
+
'...OOOOO.o..',
|
|
82
|
+
'...gggggo...',
|
|
83
|
+
'...gg..gg...',
|
|
84
|
+
'...OO..OO...',
|
|
85
|
+
'..OOO..OOO..',
|
|
86
|
+
],
|
|
87
|
+
mage: [
|
|
88
|
+
'.....P......',
|
|
89
|
+
'....PPP.....',
|
|
90
|
+
'...PPPPP....',
|
|
91
|
+
'..PPPPPPPP..',
|
|
92
|
+
'...sksksc...',
|
|
93
|
+
'...sssssc...',
|
|
94
|
+
'...wwwww.C..',
|
|
95
|
+
'..PppppPPo..',
|
|
96
|
+
'..PpppppPo..',
|
|
97
|
+
'..PppeppPo..',
|
|
98
|
+
'..PppppPPo..',
|
|
99
|
+
'..PpppppPo..',
|
|
100
|
+
'.PPpppppPP..',
|
|
101
|
+
'..PP...PP...',
|
|
102
|
+
],
|
|
103
|
+
guardian: [
|
|
104
|
+
'....eeee....',
|
|
105
|
+
'...MmmmmM...',
|
|
106
|
+
'...MkmkmM...',
|
|
107
|
+
'...MmmmmM...',
|
|
108
|
+
'....MMMM....',
|
|
109
|
+
'bbb.mmmm....',
|
|
110
|
+
'bebbmbbmm...',
|
|
111
|
+
'beebmbbbmso.',
|
|
112
|
+
'bebbmbbbm.o.',
|
|
113
|
+
'bbb.MMMM..o.',
|
|
114
|
+
'.b..mmmm..o.',
|
|
115
|
+
'....M..M....',
|
|
116
|
+
'....M..M....',
|
|
117
|
+
'...MM..MM...',
|
|
118
|
+
],
|
|
119
|
+
rogue: [
|
|
120
|
+
'............',
|
|
121
|
+
'...qqqq.....',
|
|
122
|
+
'..qqqqqq....',
|
|
123
|
+
'..qQQxQx....',
|
|
124
|
+
'..qQQQQQ....',
|
|
125
|
+
'...qqqq.....',
|
|
126
|
+
'..qqqqqq....',
|
|
127
|
+
'.qQqqqqqs.W.',
|
|
128
|
+
'.s.qqrqq.W..',
|
|
129
|
+
'...QQQQQ....',
|
|
130
|
+
'...qqqqq....',
|
|
131
|
+
'...qq..qq...',
|
|
132
|
+
'...QQ..QQ...',
|
|
133
|
+
'..QQ....QQ..',
|
|
134
|
+
],
|
|
135
|
+
recruit: [
|
|
136
|
+
'............',
|
|
137
|
+
'....TTTT....',
|
|
138
|
+
'...TttttT...',
|
|
139
|
+
'..TtkkkktT..',
|
|
140
|
+
'..TtkkkktT..',
|
|
141
|
+
'...TttttT...',
|
|
142
|
+
'..TttttttT..',
|
|
143
|
+
'..TttttttT..',
|
|
144
|
+
'..TttttttT..',
|
|
145
|
+
'..TttttttT..',
|
|
146
|
+
'..TttttttT..',
|
|
147
|
+
'..TttttttT..',
|
|
148
|
+
'...TT..TT...',
|
|
149
|
+
'...OO..OO...',
|
|
150
|
+
],
|
|
151
|
+
slime: [
|
|
152
|
+
'............',
|
|
153
|
+
'............',
|
|
154
|
+
'............',
|
|
155
|
+
'............',
|
|
156
|
+
'.....ll.....',
|
|
157
|
+
'....llll....',
|
|
158
|
+
'...llwlll...',
|
|
159
|
+
'..llwllllL..',
|
|
160
|
+
'..lkllklllL.',
|
|
161
|
+
'.lllllllllL.',
|
|
162
|
+
'.llLllllllL.',
|
|
163
|
+
'lllllllllllL',
|
|
164
|
+
'LLLLLLLLLLLL',
|
|
165
|
+
'............',
|
|
166
|
+
],
|
|
167
|
+
wolf: [
|
|
168
|
+
'............',
|
|
169
|
+
'............',
|
|
170
|
+
'............',
|
|
171
|
+
'.MM.........',
|
|
172
|
+
'MMMM........',
|
|
173
|
+
'MxMMM.......',
|
|
174
|
+
'MMMMMMMMMM..',
|
|
175
|
+
'.WW.MMMMMMM.',
|
|
176
|
+
'....MMMMMMMM',
|
|
177
|
+
'....MMMMMM.M',
|
|
178
|
+
'....M.M.M.M.',
|
|
179
|
+
'....M.M.M.M.',
|
|
180
|
+
'...MM.M.MM.M',
|
|
181
|
+
'............',
|
|
182
|
+
],
|
|
183
|
+
goblin: [
|
|
184
|
+
'............',
|
|
185
|
+
'............',
|
|
186
|
+
'.g......g...',
|
|
187
|
+
'.gg.ggggg...',
|
|
188
|
+
'..ggkgkgg...',
|
|
189
|
+
'...ggggg....',
|
|
190
|
+
'....GGG.....',
|
|
191
|
+
'.o.ttttt....',
|
|
192
|
+
'.o.gtttgg...',
|
|
193
|
+
'.ogTTTTT....',
|
|
194
|
+
'.o..ttt.....',
|
|
195
|
+
'....g..g....',
|
|
196
|
+
'....g..g....',
|
|
197
|
+
'...GG..GG...',
|
|
198
|
+
],
|
|
199
|
+
shaman: [
|
|
200
|
+
'....e..e....',
|
|
201
|
+
'.g.eeeee.g..',
|
|
202
|
+
'.gggggggggg.',
|
|
203
|
+
'...gxggxg...',
|
|
204
|
+
'...ggggg....',
|
|
205
|
+
'....GGG.....',
|
|
206
|
+
'.c.PPPPP....',
|
|
207
|
+
'.o.PvPvPg...',
|
|
208
|
+
'.o.PPPPP....',
|
|
209
|
+
'.o.PvPvP....',
|
|
210
|
+
'.o.PPPPP....',
|
|
211
|
+
'..PPPPPPP...',
|
|
212
|
+
'....g..g....',
|
|
213
|
+
'...GG..GG...',
|
|
214
|
+
],
|
|
215
|
+
bat: [
|
|
216
|
+
'............',
|
|
217
|
+
'............',
|
|
218
|
+
'............',
|
|
219
|
+
'P.........P.',
|
|
220
|
+
'PP..P.P..PP.',
|
|
221
|
+
'PPP.PPP.PPP.',
|
|
222
|
+
'PPPPPxPxPPPP',
|
|
223
|
+
'.PPPPPPPPPP.',
|
|
224
|
+
'..PP.PPP.PP.',
|
|
225
|
+
'.P....w....P',
|
|
226
|
+
'............',
|
|
227
|
+
'............',
|
|
228
|
+
'............',
|
|
229
|
+
'............',
|
|
230
|
+
],
|
|
231
|
+
spider: [
|
|
232
|
+
'............',
|
|
233
|
+
'............',
|
|
234
|
+
'............',
|
|
235
|
+
'............',
|
|
236
|
+
'....hhhh....',
|
|
237
|
+
'..hhhhhhhh..',
|
|
238
|
+
'.hhxhxhhhhh.',
|
|
239
|
+
'h.hhhhhhhh.h',
|
|
240
|
+
'h.hhhhhhhh.h',
|
|
241
|
+
'.h.h.hh.h.h.',
|
|
242
|
+
'.h.h.hh.h.h.',
|
|
243
|
+
'h..h....h..h',
|
|
244
|
+
'...h....h...',
|
|
245
|
+
'............',
|
|
246
|
+
],
|
|
247
|
+
golem: [
|
|
248
|
+
'............',
|
|
249
|
+
'....MMMM....',
|
|
250
|
+
'...MmmmmM...',
|
|
251
|
+
'...McmcmM...',
|
|
252
|
+
'...MmmmmM...',
|
|
253
|
+
'.MMMMMMMMMM.',
|
|
254
|
+
'MmmMmmmmMmmM',
|
|
255
|
+
'MmmMmmcmMmmM',
|
|
256
|
+
'MmmMmmmmMmmM',
|
|
257
|
+
'.MM.MMMM.MM.',
|
|
258
|
+
'....Mm.mM...',
|
|
259
|
+
'...MMm.mMM..',
|
|
260
|
+
'...MMM.MMM..',
|
|
261
|
+
'............',
|
|
262
|
+
],
|
|
263
|
+
skeleton: [
|
|
264
|
+
'............',
|
|
265
|
+
'....nnnn....',
|
|
266
|
+
'...nnnnnn...',
|
|
267
|
+
'...nknnkn...',
|
|
268
|
+
'...nnnnnn...',
|
|
269
|
+
'....nNnN....',
|
|
270
|
+
'.M...nn.....',
|
|
271
|
+
'.M.nnnnnn...',
|
|
272
|
+
'.MnnNnNnnn..',
|
|
273
|
+
'.M..nnnn....',
|
|
274
|
+
'....N..N....',
|
|
275
|
+
'....n..n....',
|
|
276
|
+
'....n..n....',
|
|
277
|
+
'...nn..nn...',
|
|
278
|
+
],
|
|
279
|
+
ghost: [
|
|
280
|
+
'............',
|
|
281
|
+
'....zzzz....',
|
|
282
|
+
'...zzzzzz...',
|
|
283
|
+
'..zzkzzkzz..',
|
|
284
|
+
'..zzkzzkzz..',
|
|
285
|
+
'..zzzzzzzz..',
|
|
286
|
+
'.zzzzkkzzzz.',
|
|
287
|
+
'.zzzzzzzzzz.',
|
|
288
|
+
'.zzzzzzzzzZ.',
|
|
289
|
+
'.zzzzzzzzzZ.',
|
|
290
|
+
'..zzzzzzzZ..',
|
|
291
|
+
'..zZ.zZ.zZ..',
|
|
292
|
+
'..Z..Z..Z...',
|
|
293
|
+
'............',
|
|
294
|
+
],
|
|
295
|
+
cultist: [
|
|
296
|
+
'....RRRR....',
|
|
297
|
+
'...RRRRRR...',
|
|
298
|
+
'..RRkkkkRR..',
|
|
299
|
+
'..RkxkkxkR..',
|
|
300
|
+
'..RkkkkkkR..',
|
|
301
|
+
'...RRRRRR...',
|
|
302
|
+
'.E.RRRRRR...',
|
|
303
|
+
'.ERRrRRrRR..',
|
|
304
|
+
'.o.RRRRRR...',
|
|
305
|
+
'.o.RrRRrR...',
|
|
306
|
+
'.o.RRRRRR...',
|
|
307
|
+
'..RRRRRRRR..',
|
|
308
|
+
'..RR....RR..',
|
|
309
|
+
'............',
|
|
310
|
+
],
|
|
311
|
+
knight: [
|
|
312
|
+
'....nnnn....',
|
|
313
|
+
'...MMMMMM...',
|
|
314
|
+
'...MkxkxM...',
|
|
315
|
+
'...MMMMMM...',
|
|
316
|
+
'....nNnN....',
|
|
317
|
+
'm..MMMMMM...',
|
|
318
|
+
'm.MmMMMMmM..',
|
|
319
|
+
'mmMmmnnmmM..',
|
|
320
|
+
'm.MmMnnMmM..',
|
|
321
|
+
'm..MMMMMM...',
|
|
322
|
+
'...MmmmmM...',
|
|
323
|
+
'....M..M....',
|
|
324
|
+
'....n..n....',
|
|
325
|
+
'...MM..MM...',
|
|
326
|
+
],
|
|
327
|
+
goblinKing: [
|
|
328
|
+
'..e.e.e.e...',
|
|
329
|
+
'..eeeeeee...',
|
|
330
|
+
'.g.ggggg.g..',
|
|
331
|
+
'.gggxggxgg..',
|
|
332
|
+
'..ggggggg...',
|
|
333
|
+
'...gwwwg....',
|
|
334
|
+
'.rrrGGGrrr..',
|
|
335
|
+
'rrreeeeerrr.',
|
|
336
|
+
'r.geeeeegr.o',
|
|
337
|
+
'r.gTTTTTg.oo',
|
|
338
|
+
'r..ttttt..o.',
|
|
339
|
+
'...gg.gg....',
|
|
340
|
+
'...gg.gg....',
|
|
341
|
+
'..GGG.GGG...',
|
|
342
|
+
],
|
|
343
|
+
wyrm: [
|
|
344
|
+
'............',
|
|
345
|
+
'..c.........',
|
|
346
|
+
'.ccC........',
|
|
347
|
+
'cCxCC.......',
|
|
348
|
+
'CCCCCc......',
|
|
349
|
+
'.wCCCCc..c..',
|
|
350
|
+
'...CCCCc.cC.',
|
|
351
|
+
'...cCCCCcCCC',
|
|
352
|
+
'..cCCcCCCCC.',
|
|
353
|
+
'..CCccCCCCC.',
|
|
354
|
+
'.CC.cCCCCCC.',
|
|
355
|
+
'.C..CC.CC.CC',
|
|
356
|
+
'....C..C...C',
|
|
357
|
+
'...CC.CC....',
|
|
358
|
+
],
|
|
359
|
+
lich: [
|
|
360
|
+
'..e.e.e.....',
|
|
361
|
+
'..eeeee.....',
|
|
362
|
+
'..nnnnn..p..',
|
|
363
|
+
'..nxnxn.ppp.',
|
|
364
|
+
'..nnnnn..p..',
|
|
365
|
+
'...nNn...o..',
|
|
366
|
+
'.PPPPPPP.o..',
|
|
367
|
+
'PPpPPPpPPn..',
|
|
368
|
+
'P.PPPPPP.o..',
|
|
369
|
+
'n.PpPPpP.o..',
|
|
370
|
+
'..PPPPPP.o..',
|
|
371
|
+
'.PPpPPpPP...',
|
|
372
|
+
'.PPPPPPPP...',
|
|
373
|
+
'PPP.PP.PPP..',
|
|
374
|
+
],
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** Size of one sprite pixel, in CSS pixels. */
|
|
378
|
+
export const PIXEL = 4
|
|
379
|
+
export const SPRITE_COLUMNS = 12
|
|
380
|
+
export const SPRITE_ROWS = 14
|
|
381
|
+
|
|
382
|
+
/** How big each rank is drawn, in sprite pixels per pixel. */
|
|
383
|
+
export const RANK_SCALE: Readonly<Record<'normal' | 'elite' | 'boss', number>> = { normal: 1, elite: 1.25, boss: 1.75 }
|
|
384
|
+
|
|
385
|
+
/** Elites keep their kind's look with a gold tint over it. */
|
|
386
|
+
const ELITE_TINT = '#f2c14e'
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @brief Draws a sprite as one SVG, one rect per row run of a color.
|
|
390
|
+
*
|
|
391
|
+
* @param look - A class id, an enemy kind or a boss key; an unknown look draws the recruit.
|
|
392
|
+
* @param options - `flip` mirrors it to face left; `pixel` sets the size of a pixel; `tint` washes it in a color
|
|
393
|
+
* (an elite's gold); `isDown` greys it and lays it on its side.
|
|
394
|
+
* @returns The SVG markup as a string.
|
|
395
|
+
*/
|
|
396
|
+
export function spriteSvg(look: string, options: { flip?: boolean; pixel?: number; tint?: string; isDown?: boolean } = {}): string {
|
|
397
|
+
const rows = SPRITES[look] ?? SPRITES.recruit ?? []
|
|
398
|
+
const size = options.pixel ?? PIXEL
|
|
399
|
+
const width = SPRITE_COLUMNS * size
|
|
400
|
+
const height = SPRITE_ROWS * size
|
|
401
|
+
const rects: string[] = []
|
|
402
|
+
rows.forEach((row, y) => {
|
|
403
|
+
let x = 0
|
|
404
|
+
while (x < row.length) {
|
|
405
|
+
const letter = row.charAt(x)
|
|
406
|
+
let run = 1
|
|
407
|
+
while (x + run < row.length && row.charAt(x + run) === letter) run++
|
|
408
|
+
const color = PALETTE[letter]
|
|
409
|
+
if (color !== undefined) {
|
|
410
|
+
const left = options.flip === true ? SPRITE_COLUMNS - x - run : x
|
|
411
|
+
rects.push(`<rect x="${left * size}" y="${y * size}" width="${run * size}" height="${size}" fill="${color}"/>`)
|
|
412
|
+
}
|
|
413
|
+
x += run
|
|
414
|
+
}
|
|
415
|
+
})
|
|
416
|
+
const tint = options.tint === undefined ? '' : `<rect width="${width}" height="${height}" fill="${options.tint}" opacity="0.18" style="mix-blend-mode:overlay"/>`
|
|
417
|
+
const down = options.isDown === true ? ` opacity="0.45" style="filter:grayscale(1)"` : ''
|
|
418
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" shape-rendering="crispEdges"${down}>${rects.join('')}${tint}</svg>`
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/** The tint an elite of any kind gets. */
|
|
422
|
+
export function eliteTint(rank: 'normal' | 'elite' | 'boss'): string | undefined {
|
|
423
|
+
return rank === 'elite' ? ELITE_TINT : undefined
|
|
424
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// packages/g3n-mods/mods/agent-adventure/types/index.d.ts
|
|
2
|
+
|
|
3
|
+
/** A hero's class: picks its look, its stats, its basic action and the pool its skills come from. */
|
|
4
|
+
export type ClassId = 'fighter' | 'healer' | 'monk' | 'ranger' | 'mage' | 'guardian' | 'rogue'
|
|
5
|
+
|
|
6
|
+
/** A dungeon's theme: its enemies, its boss and its colors. */
|
|
7
|
+
export type RegionId = 'woods' | 'caves' | 'crypt'
|
|
8
|
+
|
|
9
|
+
/** What a skill does when used; `passive` skills are never used, they raise a stat. */
|
|
10
|
+
export type SkillKind =
|
|
11
|
+
| 'strike' | 'multi' | 'cleave' | 'stun' | 'burn' | 'drain'
|
|
12
|
+
| 'heal' | 'healSelf' | 'healAll' | 'revive' | 'mend'
|
|
13
|
+
| 'shield' | 'taunt' | 'rally' | 'passive'
|
|
14
|
+
|
|
15
|
+
/** A stat a passive skill or a relic raises. */
|
|
16
|
+
export type StatId = 'hp' | 'atk' | 'def' | 'spd' | 'crit' | 'evade'
|
|
17
|
+
|
|
18
|
+
/** One skill, a basic action, or an enemy's special. */
|
|
19
|
+
export type SkillDef = {
|
|
20
|
+
id: string
|
|
21
|
+
name: string
|
|
22
|
+
kind: SkillKind
|
|
23
|
+
/** Damage multiplier, healed share of max HP, or the effect's strength, by kind */
|
|
24
|
+
power: number
|
|
25
|
+
/** Own turns to wait after use; 0 for a basic action */
|
|
26
|
+
cd: number
|
|
27
|
+
/** Turns an effect lasts (shield, taunt, rally, burn) */
|
|
28
|
+
turns?: number
|
|
29
|
+
/** Hits of a `multi` skill */
|
|
30
|
+
hits?: number
|
|
31
|
+
/** The stat a `passive` skill raises, by `power` as a share (0.2 is +20%) or flat for crit and evade */
|
|
32
|
+
stat?: StatId
|
|
33
|
+
blurb: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A hero, kept across sessions in the mod's store under `hero:<id>`. Times are milliseconds since the epoch. */
|
|
37
|
+
export type Hero = {
|
|
38
|
+
id: string
|
|
39
|
+
name: string
|
|
40
|
+
cls: ClassId
|
|
41
|
+
level: number
|
|
42
|
+
/** XP toward the next level */
|
|
43
|
+
xp: number
|
|
44
|
+
/** Highest level reached; reaching a new multiple of 10 above it offers a skill choice */
|
|
45
|
+
bestLevel: number
|
|
46
|
+
/** Learned skill ids, oldest first, at most 3 */
|
|
47
|
+
skills: string[]
|
|
48
|
+
/** The agent kind this hero turns up for: `main` for the main thread, else a subagent type such as `Explore` */
|
|
49
|
+
calling: string
|
|
50
|
+
motto?: string
|
|
51
|
+
/** How this hero feels about others, by hero id, from -2 to 2. Set by its agent through the mod's tool */
|
|
52
|
+
feelings: Record<string, number>
|
|
53
|
+
/** Who picked the name: the game's name list, the model, or the hero's own agent */
|
|
54
|
+
namedBy: 'game' | 'model' | 'agent'
|
|
55
|
+
/** Still waiting for the model to christen it; it does not fight yet */
|
|
56
|
+
isRecruit: boolean
|
|
57
|
+
/** Two skill ids offered at a milestone, waiting on a pick */
|
|
58
|
+
choice?: [string, string]
|
|
59
|
+
/** Boss names this hero has beaten; permanent trophies */
|
|
60
|
+
trophies: string[]
|
|
61
|
+
record: { runs: number; wins: number; wipes: number; kills: number }
|
|
62
|
+
createdAt: number
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** An effect on a fighter, counted down at the start of its own turns. */
|
|
66
|
+
export type Effect = {
|
|
67
|
+
kind: 'shield' | 'taunt' | 'burn' | 'stun' | 'rally' | 'enrage'
|
|
68
|
+
turns: number
|
|
69
|
+
power: number
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A hero or an enemy in a fight. */
|
|
73
|
+
export type Fighter = {
|
|
74
|
+
/** The hero's id, or `e<n>` for an enemy */
|
|
75
|
+
id: string
|
|
76
|
+
side: 'hero' | 'enemy'
|
|
77
|
+
name: string
|
|
78
|
+
/** Sprite: a class id or an enemy kind */
|
|
79
|
+
look: string
|
|
80
|
+
level: number
|
|
81
|
+
hp: number
|
|
82
|
+
maxHp: number
|
|
83
|
+
atk: number
|
|
84
|
+
def: number
|
|
85
|
+
spd: number
|
|
86
|
+
crit: number
|
|
87
|
+
evade: number
|
|
88
|
+
/** Readiness; the fighter acts once it holds the most and at least `READY` */
|
|
89
|
+
gauge: number
|
|
90
|
+
basic: SkillDef
|
|
91
|
+
skills: SkillDef[]
|
|
92
|
+
cooldowns: Record<string, number>
|
|
93
|
+
effects: Effect[]
|
|
94
|
+
/** HP restored at the start of each own turn, a share of max HP (a relic's) */
|
|
95
|
+
regen: number
|
|
96
|
+
rank: 'normal' | 'elite' | 'boss'
|
|
97
|
+
/** A boss's phase: 1, then 2 once below half HP */
|
|
98
|
+
phase: number
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** One stop of a run's path. A `fork` sets the kind of the stop after it. */
|
|
102
|
+
export type StopKind = 'fight' | 'elite' | 'fork' | 'camp' | 'boss'
|
|
103
|
+
|
|
104
|
+
/** One adventure through a generated dungeon. Heroes keep their levels; this and its loot do not outlive it. */
|
|
105
|
+
export type Run = {
|
|
106
|
+
number: number
|
|
107
|
+
region: RegionId
|
|
108
|
+
path: StopKind[]
|
|
109
|
+
/** Index of the stop the party is at */
|
|
110
|
+
at: number
|
|
111
|
+
/** Encounters fought so far this run; raises the tier of the next */
|
|
112
|
+
fought: number
|
|
113
|
+
relics: string[]
|
|
114
|
+
potions: number
|
|
115
|
+
/** HP each hero carries between fights, by hero id; a hero not listed starts full */
|
|
116
|
+
hp: Record<string, number>
|
|
117
|
+
/** A phoenix feather was used this run */
|
|
118
|
+
isFeatherUsed: boolean
|
|
119
|
+
/** Doubled XP on the next fight: the party took the dangerous route */
|
|
120
|
+
isDaring: boolean
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** What the party is doing. `wait` counts ticks left in the scene. */
|
|
124
|
+
export type Scene =
|
|
125
|
+
| { kind: 'tavern' }
|
|
126
|
+
| { kind: 'travel'; wait: number }
|
|
127
|
+
| { kind: 'fight' }
|
|
128
|
+
| { kind: 'victory'; wait: number }
|
|
129
|
+
| { kind: 'fork'; wait: number; id: number; route?: 'safe' | 'danger'; why?: string; by?: string }
|
|
130
|
+
| { kind: 'camp'; wait: number }
|
|
131
|
+
| { kind: 'wipe'; wait: number }
|
|
132
|
+
| { kind: 'cleared'; wait: number }
|
|
133
|
+
|
|
134
|
+
/** A running agent and the hero it plays. */
|
|
135
|
+
export type Binding = {
|
|
136
|
+
/** `main`, or the subagent's id */
|
|
137
|
+
agent: string
|
|
138
|
+
heroId: string
|
|
139
|
+
/** Tick the agent's turn ended; it stays in the party a short while after */
|
|
140
|
+
leftAt?: number
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** A line of the adventure's log. */
|
|
144
|
+
export type LogLine = { id: number; text: string; tone: 'info' | 'good' | 'bad' | 'loot' | 'level' }
|
|
145
|
+
|
|
146
|
+
/** A visual event the view animates once, by id. */
|
|
147
|
+
export type Fx = {
|
|
148
|
+
id: number
|
|
149
|
+
kind: 'act' | 'hit' | 'miss' | 'heal' | 'down' | 'buff' | 'level' | 'learn' | 'phase' | 'say'
|
|
150
|
+
/** The fighter or hero it happens to */
|
|
151
|
+
at: string
|
|
152
|
+
/** The fighter who acted, for `act` */
|
|
153
|
+
from?: string
|
|
154
|
+
amount?: number
|
|
155
|
+
isCrit?: boolean
|
|
156
|
+
text?: string
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** The whole game, held in session state and drawn by the pane. */
|
|
160
|
+
export type World = {
|
|
161
|
+
heroes: Hero[]
|
|
162
|
+
bindings: Binding[]
|
|
163
|
+
run: Run | null
|
|
164
|
+
scene: Scene
|
|
165
|
+
/** The fight in progress */
|
|
166
|
+
fighters: Fighter[]
|
|
167
|
+
/** Actions taken in the fight in progress */
|
|
168
|
+
turns: number
|
|
169
|
+
log: LogLine[]
|
|
170
|
+
fx: Fx[]
|
|
171
|
+
/** Next id for a log line, an fx or a fork */
|
|
172
|
+
seq: number
|
|
173
|
+
tick: number
|
|
174
|
+
/** Random state; every roll comes from it, so a world steps the same way twice */
|
|
175
|
+
rng: number
|
|
176
|
+
runs: number
|
|
177
|
+
/** Multiplier on enemy HP and attack: rises while the party wins easily, falls after close fights and wipes */
|
|
178
|
+
threat: number
|
|
179
|
+
/** Show calmer animations */
|
|
180
|
+
isCalm: boolean
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** One hero or fighter as the view draws it. */
|
|
184
|
+
export type UnitView = {
|
|
185
|
+
id: string
|
|
186
|
+
name: string
|
|
187
|
+
look: string
|
|
188
|
+
side: 'hero' | 'enemy'
|
|
189
|
+
level: number
|
|
190
|
+
hp: number
|
|
191
|
+
maxHp: number
|
|
192
|
+
rank: 'normal' | 'elite' | 'boss'
|
|
193
|
+
isDown: boolean
|
|
194
|
+
/** Short tags: `stunned`, `shielded`, `burning`, `taunting`, `rallied`, `enraged` */
|
|
195
|
+
tags: string[]
|
|
196
|
+
/** Class or enemy name, e.g. `Healer` */
|
|
197
|
+
title: string
|
|
198
|
+
/** The hero plays an agent right now */
|
|
199
|
+
isActive?: boolean
|
|
200
|
+
xpShare?: number
|
|
201
|
+
skills?: string[]
|
|
202
|
+
motto?: string
|
|
203
|
+
trophies?: number
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** A hero of the guild as the roster lists it. */
|
|
207
|
+
export type RosterEntry = {
|
|
208
|
+
id: string
|
|
209
|
+
name: string
|
|
210
|
+
look: string
|
|
211
|
+
title: string
|
|
212
|
+
level: number
|
|
213
|
+
xpShare: number
|
|
214
|
+
skills: string[]
|
|
215
|
+
motto?: string
|
|
216
|
+
trophies: number
|
|
217
|
+
isActive: boolean
|
|
218
|
+
/** How many runs, wins and wipes, e.g. `12 runs · 9 cleared · 1 wipe` */
|
|
219
|
+
record: string
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** What the view gets. */
|
|
223
|
+
export type ViewData = {
|
|
224
|
+
scene: Scene['kind']
|
|
225
|
+
region: { id: RegionId; name: string } | null
|
|
226
|
+
runNumber: number
|
|
227
|
+
stops: Array<{ kind: StopKind; state: 'done' | 'here' | 'ahead' }>
|
|
228
|
+
heroes: UnitView[]
|
|
229
|
+
enemies: UnitView[]
|
|
230
|
+
log: LogLine[]
|
|
231
|
+
fx: Fx[]
|
|
232
|
+
relics: Array<{ name: string; icon: string; blurb: string }>
|
|
233
|
+
potions: number
|
|
234
|
+
/** Scene caption, e.g. `The party argues about the route…` */
|
|
235
|
+
caption: string
|
|
236
|
+
isCalm: boolean
|
|
237
|
+
trophies: number
|
|
238
|
+
/** Every christened hero, highest level first */
|
|
239
|
+
roster: RosterEntry[]
|
|
240
|
+
/** The threat as a percentage of normal, e.g. 130 */
|
|
241
|
+
threat: number
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare module 'claude-code' {
|
|
245
|
+
interface PluginState {
|
|
246
|
+
'agent-adventure': { world: World | null }
|
|
247
|
+
}
|
|
248
|
+
}
|