@dotmon/core 0.1.0
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/LICENSE +21 -0
- package/dist/chunk-QBHMZDDB.js +358 -0
- package/dist/index.cjs +369 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +1 -0
- package/dist/locales/en.cjs +29 -0
- package/dist/locales/en.d.cts +7 -0
- package/dist/locales/en.d.ts +7 -0
- package/dist/locales/en.js +27 -0
- package/dist/locales/index.cjs +13 -0
- package/dist/locales/index.d.cts +11 -0
- package/dist/locales/index.d.ts +11 -0
- package/dist/locales/index.js +11 -0
- package/dist/locales/ja.cjs +29 -0
- package/dist/locales/ja.d.cts +7 -0
- package/dist/locales/ja.d.ts +7 -0
- package/dist/locales/ja.js +27 -0
- package/dist/render/index.cjs +628 -0
- package/dist/render/index.d.cts +42 -0
- package/dist/render/index.d.ts +42 -0
- package/dist/render/index.js +348 -0
- package/dist/stats-BMnyxbee.d.ts +17 -0
- package/dist/stats-Cs0yRJTk.d.cts +17 -0
- package/dist/types-CsVv0MnX.d.cts +12 -0
- package/dist/types-DYNij_HS.d.ts +12 -0
- package/dist/types-kWKrAd-B.d.cts +27 -0
- package/dist/types-kWKrAd-B.d.ts +27 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dotmon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
// src/presets.ts
|
|
2
|
+
var presets = {
|
|
3
|
+
mochi: { connected: true, symmetric: true, outline: true, face: true, legs: "auto" },
|
|
4
|
+
retro: { connected: false, symmetric: true, outline: true, face: false, legs: "none" },
|
|
5
|
+
chaos: { connected: false, symmetric: false, outline: true, face: true, legs: "none" }
|
|
6
|
+
};
|
|
7
|
+
function resolveOptions(options = {}) {
|
|
8
|
+
const base = presets[options.preset ?? "mochi"];
|
|
9
|
+
return {
|
|
10
|
+
connected: options.connected ?? base.connected,
|
|
11
|
+
symmetric: options.symmetric ?? base.symmetric,
|
|
12
|
+
outline: options.outline ?? base.outline,
|
|
13
|
+
face: options.face ?? base.face,
|
|
14
|
+
legs: options.legs ?? base.legs
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function presetKeyFromOpts(o) {
|
|
18
|
+
if (o.connected && o.symmetric) return "mochi";
|
|
19
|
+
if (!o.connected && o.symmetric) return "retro";
|
|
20
|
+
if (!o.connected && !o.symmetric && o.outline && o.face) return "chaos";
|
|
21
|
+
return "custom";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/hash.ts
|
|
25
|
+
function fnv1a(str) {
|
|
26
|
+
let hash = 2166136261;
|
|
27
|
+
for (let i = 0; i < str.length; i++) {
|
|
28
|
+
hash ^= str.charCodeAt(i);
|
|
29
|
+
hash = Math.imul(hash, 16777619);
|
|
30
|
+
}
|
|
31
|
+
return hash >>> 0;
|
|
32
|
+
}
|
|
33
|
+
function mulberry32(seed) {
|
|
34
|
+
let a = seed;
|
|
35
|
+
return () => {
|
|
36
|
+
a |= 0;
|
|
37
|
+
a = a + 1831565813 | 0;
|
|
38
|
+
let t = Math.imul(a ^ a >>> 15, 1 | a);
|
|
39
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
40
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/stats.ts
|
|
45
|
+
var NATURE_IDS = [
|
|
46
|
+
"cheerful",
|
|
47
|
+
// ようき
|
|
48
|
+
"easygoing",
|
|
49
|
+
// のんびり
|
|
50
|
+
"timid",
|
|
51
|
+
// おくびょう
|
|
52
|
+
"stubborn",
|
|
53
|
+
// がんこ
|
|
54
|
+
"headstrong",
|
|
55
|
+
// いじっぱり
|
|
56
|
+
"gentle",
|
|
57
|
+
// おっとり
|
|
58
|
+
"playful",
|
|
59
|
+
// やんちゃ
|
|
60
|
+
"calm",
|
|
61
|
+
// れいせい
|
|
62
|
+
"shy",
|
|
63
|
+
// てれや
|
|
64
|
+
"hungry",
|
|
65
|
+
// はらぺこ
|
|
66
|
+
"sleepyhead",
|
|
67
|
+
// ねぼすけ
|
|
68
|
+
"whimsical"
|
|
69
|
+
// きまぐれ
|
|
70
|
+
];
|
|
71
|
+
function getStats(seed, options = {}) {
|
|
72
|
+
const o = resolveOptions(options);
|
|
73
|
+
const r = mulberry32(fnv1a(seed + "::status"));
|
|
74
|
+
const key = presetKeyFromOpts(o);
|
|
75
|
+
const tier = key === "chaos" ? 2 : key === "retro" ? 1 : 0;
|
|
76
|
+
const lo = [1, 38, 66][tier];
|
|
77
|
+
const hi = [19, 76, 99][tier];
|
|
78
|
+
const roll = () => Math.round(lo + r() * (hi - lo));
|
|
79
|
+
const lv = Math.max(1, roll());
|
|
80
|
+
const nature = NATURE_IDS[Math.floor(r() * NATURE_IDS.length)];
|
|
81
|
+
const hp = roll() * 8 + Math.floor(r() * 8);
|
|
82
|
+
const mp = roll() * 4 + Math.floor(r() * 4);
|
|
83
|
+
const atk = roll();
|
|
84
|
+
const def = roll();
|
|
85
|
+
const spd = roll();
|
|
86
|
+
const luck = Math.round(1 + r() * 98);
|
|
87
|
+
return { lv, nature, hp, mp, atk, def, spd, luck };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/generate.ts
|
|
91
|
+
var SIZE = 16;
|
|
92
|
+
var HALF = 8;
|
|
93
|
+
function generateSvg(seed, options = {}) {
|
|
94
|
+
const o = resolveOptions(options);
|
|
95
|
+
const view = options.view ?? "front";
|
|
96
|
+
const frame = options.frame ?? 0;
|
|
97
|
+
const rand = mulberry32(fnv1a(seed));
|
|
98
|
+
const pick = (arr) => arr[Math.floor(rand() * arr.length)];
|
|
99
|
+
const g = Array.from({ length: SIZE }, () => new Array(SIZE).fill(0));
|
|
100
|
+
const hue = Math.floor(rand() * 12) * 30;
|
|
101
|
+
const sat = 55 + rand() * 25;
|
|
102
|
+
const lig = 55 + rand() * 12;
|
|
103
|
+
const top = 2 + Math.floor(rand() * 2);
|
|
104
|
+
const bottom = 12 + Math.floor(rand() * 2);
|
|
105
|
+
const height = bottom - top + 1;
|
|
106
|
+
if (o.connected) {
|
|
107
|
+
const widths = [];
|
|
108
|
+
let w = 2 + Math.floor(rand() * 2);
|
|
109
|
+
for (let i = 0; i < height; i++) {
|
|
110
|
+
const progress = i / height;
|
|
111
|
+
let step;
|
|
112
|
+
const r = rand();
|
|
113
|
+
if (progress < 0.6) step = r < 0.55 ? 1 : r < 0.85 ? 0 : -1;
|
|
114
|
+
else step = r < 0.35 ? 1 : r < 0.6 ? 0 : -1;
|
|
115
|
+
w = Math.max(1, Math.min(7, w + step));
|
|
116
|
+
widths.push(w);
|
|
117
|
+
}
|
|
118
|
+
for (let i = 1; i < height - 1; i++) {
|
|
119
|
+
if (rand() < 0.18 && widths[i] > 2) widths[i] -= 1;
|
|
120
|
+
}
|
|
121
|
+
for (let i = 0; i < height; i++) {
|
|
122
|
+
for (let x = HALF - widths[i]; x < HALF; x++) g[top + i][x] = 1;
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
for (let y = top; y <= bottom; y++) {
|
|
126
|
+
for (let x = 1; x < HALF; x++) {
|
|
127
|
+
if (rand() < 0.45) g[y][x] = 1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (let y = 0; y < SIZE; y++) {
|
|
132
|
+
for (let x = 0; x < HALF; x++) {
|
|
133
|
+
if (o.symmetric) {
|
|
134
|
+
g[y][SIZE - 1 - x] = g[y][x];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (!o.symmetric) {
|
|
139
|
+
for (let y = top; y <= bottom; y++) {
|
|
140
|
+
for (let x = HALF; x < SIZE - 1; x++) {
|
|
141
|
+
g[y][x] = rand() < 0.45 ? 1 : 0;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (o.connected && o.symmetric && rand() < 0.55) {
|
|
146
|
+
const hornStyle = pick(["stub", "long", "ear"]);
|
|
147
|
+
let topRow = top;
|
|
148
|
+
while (topRow <= bottom && !g[topRow].some((v) => v)) topRow++;
|
|
149
|
+
const xs = [];
|
|
150
|
+
for (let x = 0; x < HALF; x++) if (g[topRow][x]) xs.push(x);
|
|
151
|
+
if (xs.length) {
|
|
152
|
+
const hx = xs[0] + (xs.length > 2 ? 1 : 0);
|
|
153
|
+
const len = hornStyle === "long" ? 2 : 1;
|
|
154
|
+
for (let d = 1; d <= len; d++) {
|
|
155
|
+
if (topRow - d >= 0) {
|
|
156
|
+
const col = hornStyle === "ear" ? 1 : 5;
|
|
157
|
+
g[topRow - d][hx] = col;
|
|
158
|
+
g[topRow - d][SIZE - 1 - hx] = col;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (o.face) {
|
|
164
|
+
let topRow = 0;
|
|
165
|
+
while (topRow < SIZE && !g[topRow].some((v) => v === 1)) topRow++;
|
|
166
|
+
let botRow = SIZE - 1;
|
|
167
|
+
while (botRow > 0 && !g[botRow].some((v) => v === 1)) botRow--;
|
|
168
|
+
const eyeRow = Math.min(botRow - 2, topRow + Math.max(1, Math.round((botRow - topRow) * 0.32)));
|
|
169
|
+
const cols = [];
|
|
170
|
+
for (let x = 0; x < SIZE; x++) if (g[eyeRow][x] === 1) cols.push(x);
|
|
171
|
+
if (cols.length >= 1) {
|
|
172
|
+
const side = view === "left" || view === "right";
|
|
173
|
+
const cx = (SIZE - 1) / 2;
|
|
174
|
+
const eyeStyle = pick(["dot", "wide", "sleepy"]);
|
|
175
|
+
const stamp = (x) => {
|
|
176
|
+
if (view === "back") return;
|
|
177
|
+
if (eyeStyle === "dot") {
|
|
178
|
+
g[eyeRow][x] = 4;
|
|
179
|
+
} else if (eyeStyle === "wide") {
|
|
180
|
+
g[eyeRow][x] = 3;
|
|
181
|
+
if (g[eyeRow + 1]) g[eyeRow + 1][x] = 4;
|
|
182
|
+
} else {
|
|
183
|
+
g[eyeRow][x] = 2;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const twoEyes = cols.length >= 4;
|
|
187
|
+
if (side) {
|
|
188
|
+
stamp(cols[Math.min(1, cols.length - 1)]);
|
|
189
|
+
} else if (twoEyes) {
|
|
190
|
+
const gap = Math.max(1, Math.min(3, Math.floor(cols.length / 3)));
|
|
191
|
+
stamp(Math.floor(cx - gap));
|
|
192
|
+
stamp(Math.ceil(cx + gap));
|
|
193
|
+
} else {
|
|
194
|
+
stamp(Math.round(cx));
|
|
195
|
+
}
|
|
196
|
+
const mRow = eyeRow + 2 + (eyeStyle === "wide" ? 1 : 0);
|
|
197
|
+
const mW = twoEyes ? pick([1, 1, 3]) : 1;
|
|
198
|
+
if (view !== "back" && mRow <= botRow) {
|
|
199
|
+
if (side) {
|
|
200
|
+
let m0 = 0;
|
|
201
|
+
while (m0 < SIZE && g[mRow][m0] !== 1) m0++;
|
|
202
|
+
for (let x = m0; x < m0 + mW && x < SIZE; x++) {
|
|
203
|
+
if (g[mRow][x] === 1) g[mRow][x] = 4;
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
for (let x = Math.round(cx - (mW - 1) / 2); x <= Math.round(cx + (mW - 1) / 2); x++) {
|
|
207
|
+
if (g[mRow][x] === 1) g[mRow][x] = 4;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const legCols = [];
|
|
214
|
+
let drawnLegStyle = null;
|
|
215
|
+
if (o.connected && o.symmetric) {
|
|
216
|
+
const rolled = pick(["none", "two", "two", "two", "many"]);
|
|
217
|
+
const legStyle = o.legs === "auto" ? rolled : o.legs;
|
|
218
|
+
if (legStyle !== "none") {
|
|
219
|
+
let botRow = SIZE - 1;
|
|
220
|
+
while (botRow > 0 && !g[botRow].some((v) => v === 1)) botRow--;
|
|
221
|
+
const maxLen = SIZE - 2 - botRow;
|
|
222
|
+
const xs = [];
|
|
223
|
+
for (let x = 0; x < HALF; x++) if (g[botRow][x] === 1) xs.push(x);
|
|
224
|
+
if (xs.length && maxLen >= 1) {
|
|
225
|
+
const draw = (x, len) => {
|
|
226
|
+
for (let d = 1; d <= len; d++) {
|
|
227
|
+
g[botRow + d][x] = 1;
|
|
228
|
+
g[botRow + d][SIZE - 1 - x] = 1;
|
|
229
|
+
}
|
|
230
|
+
legCols.push({ x, len, botRow });
|
|
231
|
+
};
|
|
232
|
+
if (legStyle === "two") {
|
|
233
|
+
const lx = xs.length > 2 ? xs[1] : xs[0];
|
|
234
|
+
const len = Math.min(maxLen, 1 + Math.floor(rand() * 2));
|
|
235
|
+
if (view === "left" || view === "right") {
|
|
236
|
+
for (let d = 1; d <= len; d++) g[botRow + d][7] = 1;
|
|
237
|
+
legCols.push({ x: 7, len, botRow });
|
|
238
|
+
} else {
|
|
239
|
+
draw(lx, len);
|
|
240
|
+
}
|
|
241
|
+
drawnLegStyle = "two";
|
|
242
|
+
} else {
|
|
243
|
+
for (let i = 0; i < xs.length; i += 2) {
|
|
244
|
+
const len = Math.min(maxLen, rand() < 0.5 ? 2 : 1);
|
|
245
|
+
draw(xs[i], len);
|
|
246
|
+
}
|
|
247
|
+
drawnLegStyle = "many";
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const drawn = drawnLegStyle ?? "none";
|
|
253
|
+
if (frame > 0) {
|
|
254
|
+
if (drawnLegStyle === "two" && legCols.length) {
|
|
255
|
+
const c = legCols[0];
|
|
256
|
+
if (frame === 1) g[c.botRow + c.len][c.x] = 0;
|
|
257
|
+
else g[c.botRow + c.len][SIZE - 1 - c.x] = 0;
|
|
258
|
+
} else if (drawnLegStyle === "many" && legCols.length > 1) {
|
|
259
|
+
for (let i = frame === 1 ? 1 : 0; i < legCols.length; i += 2) {
|
|
260
|
+
const c = legCols[i];
|
|
261
|
+
g[c.botRow + c.len][c.x] = 0;
|
|
262
|
+
g[c.botRow + c.len][SIZE - 1 - c.x] = 0;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (frame === 2) {
|
|
266
|
+
let tR = 0;
|
|
267
|
+
while (tR < SIZE && !g[tR].some((v) => v)) tR++;
|
|
268
|
+
let bR = SIZE - 1;
|
|
269
|
+
while (bR > 0 && !g[bR].some((v) => v)) bR--;
|
|
270
|
+
if (bR - tR > 3) {
|
|
271
|
+
const mid = Math.floor((tR + bR) / 2);
|
|
272
|
+
for (let y = mid; y > tR; y--) g[y] = g[y - 1].slice();
|
|
273
|
+
g[tR] = new Array(SIZE).fill(0);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (o.outline) {
|
|
278
|
+
const isBody = (y, x) => y >= 0 && y < SIZE && x >= 0 && x < SIZE && g[y][x] !== 0 && g[y][x] !== 9;
|
|
279
|
+
const marks = [];
|
|
280
|
+
for (let y = 0; y < SIZE; y++) {
|
|
281
|
+
for (let x = 0; x < SIZE; x++) {
|
|
282
|
+
if (g[y][x] === 0 && (isBody(y - 1, x) || isBody(y + 1, x) || isBody(y, x - 1) || isBody(y, x + 1))) {
|
|
283
|
+
marks.push([y, x]);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
for (const [y, x] of marks) g[y][x] = 9;
|
|
288
|
+
}
|
|
289
|
+
if (view === "right") for (const row of g) row.reverse();
|
|
290
|
+
const colors = {
|
|
291
|
+
1: `hsl(${hue} ${sat}% ${lig}%)`,
|
|
292
|
+
2: `hsl(${hue} ${sat}% ${Math.max(18, lig - 24)}%)`,
|
|
293
|
+
3: "#fdfdf5",
|
|
294
|
+
4: "#1a1a24",
|
|
295
|
+
5: `hsl(${(hue + 165) % 360} ${sat}% ${lig}%)`,
|
|
296
|
+
9: "#1a1a24"
|
|
297
|
+
};
|
|
298
|
+
let rects = "";
|
|
299
|
+
for (let y = 0; y < SIZE; y++) {
|
|
300
|
+
let x = 0;
|
|
301
|
+
while (x < SIZE) {
|
|
302
|
+
const v = g[y][x];
|
|
303
|
+
if (v === 0) {
|
|
304
|
+
x++;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
let x2 = x;
|
|
308
|
+
while (x2 + 1 < SIZE && g[y][x2 + 1] === v) x2++;
|
|
309
|
+
rects += `<rect x="${x}" y="${y}" width="${x2 - x + 1}" height="1" fill="${colors[v]}"/>`;
|
|
310
|
+
x = x2 + 1;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" shape-rendering="crispEdges">${rects}</svg>`;
|
|
314
|
+
return { svg, drawnLegStyle: drawn, size: SIZE };
|
|
315
|
+
}
|
|
316
|
+
function createMonster(seed, options = {}) {
|
|
317
|
+
const resolved = resolveOptions(options);
|
|
318
|
+
const cache = /* @__PURE__ */ new Map();
|
|
319
|
+
const get = (view = "front", frame = 0) => {
|
|
320
|
+
const key = view + ":" + frame;
|
|
321
|
+
let r = cache.get(key);
|
|
322
|
+
if (!r) {
|
|
323
|
+
r = generateSvg(seed, { ...resolved, view, frame });
|
|
324
|
+
cache.set(key, r);
|
|
325
|
+
}
|
|
326
|
+
return r;
|
|
327
|
+
};
|
|
328
|
+
let stats = null;
|
|
329
|
+
return {
|
|
330
|
+
seed,
|
|
331
|
+
opts: resolved,
|
|
332
|
+
svg: (view, frame) => get(view, frame).svg,
|
|
333
|
+
result: get,
|
|
334
|
+
get drawnLegStyle() {
|
|
335
|
+
return get().drawnLegStyle;
|
|
336
|
+
},
|
|
337
|
+
get stats() {
|
|
338
|
+
if (!stats) stats = getStats(seed, resolved);
|
|
339
|
+
return stats;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// src/names.ts
|
|
345
|
+
var SYL_A_JA = ["\u30E2", "\u30DD", "\u30D4", "\u30D7", "\u30C1\u30E3", "\u30DF", "\u30DC", "\u30AC", "\u30EB", "\u30CB\u30E3", "\u30BA", "\u30C9\u30F3", "\u30DA", "\u30AD\u30E5", "\u30DB"];
|
|
346
|
+
var SYL_B_JA = ["\u30B3", "\u30ED\u30F3", "\u30BF", "\u30D4", "\u30E0\u30EB", "\u30DC\u30F3", "\u30C1", "\u30CB", "\u30B4\u30F3", "\u30B9\u30B1", "\u30EA\u30F3", "\u30DA\u30F3", "\u30DD\u30DD", "\u30BE\u30FC"];
|
|
347
|
+
var SYL_A_EN = ["Mo", "Po", "Pi", "Pu", "Cha", "Mi", "Bo", "Ga", "Ru", "Nya", "Zu", "Don", "Pe", "Kyu", "Ho"];
|
|
348
|
+
var SYL_B_EN = ["ko", "ron", "ta", "pi", "muru", "bon", "chi", "ni", "gon", "suke", "rin", "pen", "popo", "zo"];
|
|
349
|
+
function randomName(locale = "en") {
|
|
350
|
+
const i = Math.floor(Math.random() * SYL_A_JA.length);
|
|
351
|
+
const j = Math.floor(Math.random() * SYL_B_JA.length);
|
|
352
|
+
return locale === "ja" ? SYL_A_JA[i] + SYL_B_JA[j] : SYL_A_EN[i] + SYL_B_EN[j];
|
|
353
|
+
}
|
|
354
|
+
function safeFileName(seed) {
|
|
355
|
+
return "monster-" + seed.replace(/[\\/:*?"<>|\s]/g, "_");
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export { NATURE_IDS, SIZE, createMonster, generateSvg, getStats, presetKeyFromOpts, presets, randomName, resolveOptions, safeFileName };
|