koishipro-core.js 1.0.9 → 1.0.10
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/dist/index.cjs +20 -12
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +19 -12
- package/dist/index.mjs.map +2 -2
- package/dist/src/play-yrp.d.ts +7 -1
- package/dist/src/utility/load-node-module.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1226,9 +1226,7 @@ import JSZip from "jszip";
|
|
|
1226
1226
|
|
|
1227
1227
|
// src/utility/load-node-module.ts
|
|
1228
1228
|
function loadNodeModule(id, altId) {
|
|
1229
|
-
const req =
|
|
1230
|
-
'return typeof require !== "undefined" ? require : undefined'
|
|
1231
|
-
)();
|
|
1229
|
+
const req = typeof module.require !== "undefined" ? module.require : void 0;
|
|
1232
1230
|
if (!req) {
|
|
1233
1231
|
return null;
|
|
1234
1232
|
}
|
|
@@ -2358,9 +2356,8 @@ function loadTagDeck(duel, deck, owner) {
|
|
|
2358
2356
|
function setRegistryValue(duel, key, value) {
|
|
2359
2357
|
duel.setRegistryValue(key, value);
|
|
2360
2358
|
}
|
|
2361
|
-
|
|
2359
|
+
function* playYrpStep(ocgcoreWrapper, yrpInput) {
|
|
2362
2360
|
const yrp = normalizeYrp(yrpInput);
|
|
2363
|
-
const messages = [];
|
|
2364
2361
|
const responses = yrp.responses.slice();
|
|
2365
2362
|
const duel = createReplayDuel(ocgcoreWrapper, yrp);
|
|
2366
2363
|
let ended = false;
|
|
@@ -2413,16 +2410,19 @@ var playYrp = (ocgcoreWrapper, yrpInput) => {
|
|
|
2413
2410
|
}
|
|
2414
2411
|
duel.startDuel(yrp.opt >>> 0);
|
|
2415
2412
|
while (true) {
|
|
2416
|
-
const
|
|
2417
|
-
|
|
2418
|
-
|
|
2413
|
+
const result = duel.process();
|
|
2414
|
+
yield {
|
|
2415
|
+
duel,
|
|
2416
|
+
result
|
|
2417
|
+
};
|
|
2418
|
+
if (result.raw.length > 0 && result.raw[0] === OcgcoreCommonConstants.MSG_RETRY) {
|
|
2419
2419
|
throw new Error("Got MSG_RETRY");
|
|
2420
2420
|
}
|
|
2421
|
-
if (status === 0) {
|
|
2421
|
+
if (result.status === 0) {
|
|
2422
2422
|
continue;
|
|
2423
2423
|
}
|
|
2424
|
-
if (status === 1) {
|
|
2425
|
-
if (raw.length === 0) {
|
|
2424
|
+
if (result.status === 1) {
|
|
2425
|
+
if (result.raw.length === 0) {
|
|
2426
2426
|
continue;
|
|
2427
2427
|
}
|
|
2428
2428
|
const response = responses.shift();
|
|
@@ -2437,7 +2437,13 @@ var playYrp = (ocgcoreWrapper, yrpInput) => {
|
|
|
2437
2437
|
} finally {
|
|
2438
2438
|
endDuel();
|
|
2439
2439
|
}
|
|
2440
|
-
|
|
2440
|
+
}
|
|
2441
|
+
var playYrp = (ocgcoreWrapper, yrpInput) => {
|
|
2442
|
+
const results = [];
|
|
2443
|
+
for (const result of playYrpStep(ocgcoreWrapper, yrpInput)) {
|
|
2444
|
+
results.push(result.result.raw);
|
|
2445
|
+
}
|
|
2446
|
+
return results;
|
|
2441
2447
|
};
|
|
2442
2448
|
|
|
2443
2449
|
// src/test-card.ts
|
|
@@ -2514,6 +2520,7 @@ export {
|
|
|
2514
2520
|
parseRegistryDump,
|
|
2515
2521
|
parseRegistryKeys,
|
|
2516
2522
|
playYrp,
|
|
2523
|
+
playYrpStep,
|
|
2517
2524
|
testCard
|
|
2518
2525
|
};
|
|
2519
2526
|
//# sourceMappingURL=index.mjs.map
|