koishipro-core.js 1.0.10 → 1.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/dist/index.cjs CHANGED
@@ -25,6 +25,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __decorateClass = (decorators, target, key, kind) => {
29
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
30
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
31
+ if (decorator = decorators[i])
32
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
33
+ if (kind && result) __defProp(target, key, result);
34
+ return result;
35
+ };
28
36
 
29
37
  // index.ts
30
38
  var index_exports = {};
@@ -432,9 +440,6 @@ var LEN_EMPTY = 4;
432
440
  var LEN_HEADER = 8;
433
441
 
434
442
  // src/utility/binary.ts
435
- function readU8(buf, offset) {
436
- return buf[offset] ?? 0;
437
- }
438
443
  function readU16(buf, offset) {
439
444
  return new DataView(buf.buffer, buf.byteOffset, buf.byteLength).getUint16(
440
445
  offset,
@@ -447,160 +452,22 @@ function readI32(buf, offset) {
447
452
  true
448
453
  );
449
454
  }
450
- function readU32(buf, offset) {
451
- return new DataView(buf.buffer, buf.byteOffset, buf.byteLength).getUint32(
452
- offset,
453
- true
454
- );
455
- }
456
455
 
457
456
  // src/utility/utf8.ts
458
457
  var encoder = new TextEncoder();
459
458
  var decoder = new TextDecoder("utf-8");
460
- function encodeUtf8(value) {
461
- return encoder.encode(value);
462
- }
463
459
  function decodeUtf8(value) {
464
460
  return decoder.decode(value);
465
461
  }
466
462
 
467
463
  // src/adapters/ocgcore-parsers.ts
468
- function parseCardInfo(payload) {
469
- let offset = 0;
470
- const flags = readI32(payload, offset) >>> 0;
471
- offset += 4;
472
- const info = { flags, empty: flags === 0 };
473
- if (flags === 0) {
474
- return info;
475
- }
476
- if (flags & OcgcoreCommonConstants.QUERY_CODE) {
477
- info.code = readI32(payload, offset);
478
- offset += 4;
479
- }
480
- if (flags & OcgcoreCommonConstants.QUERY_POSITION) {
481
- const pdata = readI32(payload, offset);
482
- offset += 4;
483
- info.position = (pdata >>> 24 & 255) >>> 0;
484
- }
485
- if (flags & OcgcoreCommonConstants.QUERY_ALIAS) {
486
- info.alias = readI32(payload, offset);
487
- offset += 4;
488
- }
489
- if (flags & OcgcoreCommonConstants.QUERY_TYPE) {
490
- info.type = readI32(payload, offset);
491
- offset += 4;
492
- }
493
- if (flags & OcgcoreCommonConstants.QUERY_LEVEL) {
494
- info.level = readI32(payload, offset);
495
- offset += 4;
496
- }
497
- if (flags & OcgcoreCommonConstants.QUERY_RANK) {
498
- info.rank = readI32(payload, offset);
499
- offset += 4;
500
- }
501
- if (flags & OcgcoreCommonConstants.QUERY_ATTRIBUTE) {
502
- info.attribute = readI32(payload, offset);
503
- offset += 4;
504
- }
505
- if (flags & OcgcoreCommonConstants.QUERY_RACE) {
506
- info.race = readI32(payload, offset);
507
- offset += 4;
508
- }
509
- if (flags & OcgcoreCommonConstants.QUERY_ATTACK) {
510
- info.attack = readI32(payload, offset);
511
- offset += 4;
512
- }
513
- if (flags & OcgcoreCommonConstants.QUERY_DEFENSE) {
514
- info.defense = readI32(payload, offset);
515
- offset += 4;
516
- }
517
- if (flags & OcgcoreCommonConstants.QUERY_BASE_ATTACK) {
518
- info.baseAttack = readI32(payload, offset);
519
- offset += 4;
520
- }
521
- if (flags & OcgcoreCommonConstants.QUERY_BASE_DEFENSE) {
522
- info.baseDefense = readI32(payload, offset);
523
- offset += 4;
524
- }
525
- if (flags & OcgcoreCommonConstants.QUERY_REASON) {
526
- info.reason = readI32(payload, offset);
527
- offset += 4;
528
- }
529
- if (flags & OcgcoreCommonConstants.QUERY_REASON_CARD) {
530
- offset += 4;
531
- }
532
- if (flags & OcgcoreCommonConstants.QUERY_EQUIP_CARD) {
533
- const controller = readU8(payload, offset) >>> 0;
534
- const location = readU8(payload, offset + 1) >>> 0;
535
- const sequence = readU8(payload, offset + 2) >>> 0;
536
- info.equipCard = { controller, location, sequence };
537
- offset += 4;
538
- }
539
- if (flags & OcgcoreCommonConstants.QUERY_TARGET_CARD) {
540
- const count = readI32(payload, offset);
541
- offset += 4;
542
- const targets = [];
543
- for (let i = 0; i < count; i++) {
544
- const controller = readU8(payload, offset) >>> 0;
545
- const location = readU8(payload, offset + 1) >>> 0;
546
- const sequence = readU8(payload, offset + 2) >>> 0;
547
- targets.push({ controller, location, sequence });
548
- offset += 4;
549
- }
550
- info.targetCards = targets;
551
- }
552
- if (flags & OcgcoreCommonConstants.QUERY_OVERLAY_CARD) {
553
- const count = readI32(payload, offset);
554
- offset += 4;
555
- const overlay = [];
556
- for (let i = 0; i < count; i++) {
557
- overlay.push(readI32(payload, offset));
558
- offset += 4;
559
- }
560
- info.overlayCards = overlay;
561
- }
562
- if (flags & OcgcoreCommonConstants.QUERY_COUNTERS) {
563
- const count = readI32(payload, offset);
564
- offset += 4;
565
- const counters = [];
566
- for (let i = 0; i < count; i++) {
567
- const type = readU16(payload, offset) >>> 0;
568
- const ccount = readU16(payload, offset + 2) >>> 0;
569
- counters.push({ type, count: ccount });
570
- offset += 4;
571
- }
572
- info.counters = counters;
573
- }
574
- if (flags & OcgcoreCommonConstants.QUERY_OWNER) {
575
- info.owner = readI32(payload, offset);
576
- offset += 4;
577
- }
578
- if (flags & OcgcoreCommonConstants.QUERY_STATUS) {
579
- info.status = readI32(payload, offset);
580
- offset += 4;
581
- }
582
- if (flags & OcgcoreCommonConstants.QUERY_LSCALE) {
583
- info.lscale = readI32(payload, offset);
584
- offset += 4;
585
- }
586
- if (flags & OcgcoreCommonConstants.QUERY_RSCALE) {
587
- info.rscale = readI32(payload, offset);
588
- offset += 4;
589
- }
590
- if (flags & OcgcoreCommonConstants.QUERY_LINK) {
591
- info.link = readI32(payload, offset);
592
- offset += 4;
593
- info.linkMarker = readI32(payload, offset);
594
- offset += 4;
595
- }
596
- return info;
597
- }
464
+ var import_ygopro_msg_encode = require("ygopro-msg-encode");
598
465
  function parseCardQuery(raw, length) {
599
466
  if (length <= LEN_HEADER) {
600
467
  return null;
601
468
  }
602
469
  const payload = raw.subarray(4, length);
603
- return parseCardInfo(payload);
470
+ return new import_ygopro_msg_encode.CardQuery().fromPayload(payload);
604
471
  }
605
472
  function parseFieldCardQuery(raw, length) {
606
473
  const cards = [];
@@ -612,85 +479,20 @@ function parseFieldCardQuery(raw, length) {
612
479
  }
613
480
  const end = Math.min(length, offset + chunkLen);
614
481
  if (chunkLen <= LEN_HEADER) {
615
- cards.push({ flags: 0, empty: true });
482
+ const emptyCard = new import_ygopro_msg_encode.CardQuery();
483
+ emptyCard.flags = 0;
484
+ emptyCard.empty = true;
485
+ cards.push(emptyCard);
616
486
  } else {
617
487
  const payload = raw.subarray(offset + 4, end);
618
- cards.push(parseCardInfo(payload));
488
+ cards.push(new import_ygopro_msg_encode.CardQuery().fromPayload(payload));
619
489
  }
620
490
  offset += chunkLen;
621
491
  }
622
492
  return cards;
623
493
  }
624
494
  function parseFieldInfo(raw) {
625
- let offset = 0;
626
- const message = readU8(raw, offset++) >>> 0;
627
- const duelRule = readU8(raw, offset++) >>> 0;
628
- const players = [];
629
- for (let i = 0; i < 2; i++) {
630
- const lp = readI32(raw, offset) >>> 0;
631
- offset += 4;
632
- const mzone = [];
633
- for (let seq = 0; seq < 7; seq++) {
634
- const occupied = readU8(raw, offset++) >>> 0 !== 0;
635
- if (occupied) {
636
- const position = readU8(raw, offset++) >>> 0;
637
- const xyzCount = readU8(raw, offset++) >>> 0;
638
- mzone.push({ occupied, position, xyzCount });
639
- } else {
640
- mzone.push({ occupied });
641
- }
642
- }
643
- const szone = [];
644
- for (let seq = 0; seq < 8; seq++) {
645
- const occupied = readU8(raw, offset++) >>> 0 !== 0;
646
- if (occupied) {
647
- const position = readU8(raw, offset++) >>> 0;
648
- szone.push({ occupied, position });
649
- } else {
650
- szone.push({ occupied });
651
- }
652
- }
653
- const deckCount = readU8(raw, offset++) >>> 0;
654
- const handCount = readU8(raw, offset++) >>> 0;
655
- const graveCount = readU8(raw, offset++) >>> 0;
656
- const removedCount = readU8(raw, offset++) >>> 0;
657
- const extraCount = readU8(raw, offset++) >>> 0;
658
- const extraPCount = readU8(raw, offset++) >>> 0;
659
- players[i] = {
660
- lp,
661
- mzone,
662
- szone,
663
- deckCount,
664
- handCount,
665
- graveCount,
666
- removedCount,
667
- extraCount,
668
- extraPCount
669
- };
670
- }
671
- const chainCount = readU8(raw, offset++) >>> 0;
672
- const chains = [];
673
- for (let i = 0; i < chainCount; i++) {
674
- const code = readU32(raw, offset) >>> 0;
675
- offset += 4;
676
- const infoLocation = readU32(raw, offset) >>> 0;
677
- offset += 4;
678
- const chainCard = {
679
- controller: (infoLocation & 255) >>> 0,
680
- location: (infoLocation >>> 8 & 255) >>> 0,
681
- sequence: (infoLocation >>> 16 & 255) >>> 0,
682
- subSequence: (infoLocation >>> 24 & 255) >>> 0
683
- };
684
- const trigger = {
685
- controller: readU8(raw, offset++) >>> 0,
686
- location: readU8(raw, offset++) >>> 0,
687
- sequence: readU8(raw, offset++) >>> 0
688
- };
689
- const description = readU32(raw, offset) >>> 0;
690
- offset += 4;
691
- chains.push({ code, chainCard, trigger, description });
692
- }
693
- return { message, duelRule, players, chains };
495
+ return new import_ygopro_msg_encode.YGOProMsgReloadField().fromPayload(raw);
694
496
  }
695
497
  function parseRegistryKeys(raw) {
696
498
  const keys = [];
@@ -747,6 +549,7 @@ function normalizeStartDuelOptions(options) {
747
549
  }
748
550
 
749
551
  // src/ocgcore-duel.ts
552
+ var import_ygopro_msg_encode2 = require("ygopro-msg-encode");
750
553
  var OcgcoreDuel = class {
751
554
  constructor(ocgcoreWrapper, duelPtr) {
752
555
  this.ocgcoreWrapper = ocgcoreWrapper;
@@ -772,9 +575,9 @@ var OcgcoreDuel = class {
772
575
  setPlayerInfo(info) {
773
576
  this.ocgcoreWrapper.ocgcoreModule._set_player_info(
774
577
  this.duelPtr,
775
- info.playerId,
578
+ info.player,
776
579
  info.lp,
777
- info.startCount,
580
+ info.startHand,
778
581
  info.drawCount
779
582
  );
780
583
  }
@@ -795,15 +598,27 @@ var OcgcoreDuel = class {
795
598
  const result = this.ocgcoreWrapper.ocgcoreModule._process(this.duelPtr);
796
599
  const length = (result & 268435455) >>> 0;
797
600
  const status = (result >>> 28 & 15) >>> 0;
798
- const message = this.getMessage(length);
799
- return { length: message.length, raw: message.raw, status };
601
+ const messageData = this.getMessage(length);
602
+ let parsedMessage;
603
+ if (messageData.raw.length > 0) {
604
+ try {
605
+ parsedMessage = import_ygopro_msg_encode2.YGOProMessages.getInstanceFromPayload(messageData.raw);
606
+ } catch (e) {
607
+ }
608
+ }
609
+ return {
610
+ length: messageData.length,
611
+ raw: messageData.raw,
612
+ status,
613
+ message: parsedMessage
614
+ };
800
615
  }
801
616
  newCard(card) {
802
617
  this.ocgcoreWrapper.ocgcoreModule._new_card(
803
618
  this.duelPtr,
804
619
  card.code,
805
620
  card.owner,
806
- card.playerId,
621
+ card.player,
807
622
  card.location,
808
623
  card.sequence,
809
624
  card.position
@@ -821,7 +636,7 @@ var OcgcoreDuel = class {
821
636
  const ptr = this.ocgcoreWrapper.malloc(QUERY_BUFFER_SIZE);
822
637
  const length = this.ocgcoreWrapper.ocgcoreModule._query_card(
823
638
  this.duelPtr,
824
- query.playerId,
639
+ query.player,
825
640
  query.location,
826
641
  query.sequence,
827
642
  query.queryFlag,
@@ -836,7 +651,7 @@ var OcgcoreDuel = class {
836
651
  queryFieldCount(query) {
837
652
  return this.ocgcoreWrapper.ocgcoreModule._query_field_count(
838
653
  this.duelPtr,
839
- query.playerId,
654
+ query.player,
840
655
  query.location
841
656
  );
842
657
  }
@@ -844,7 +659,7 @@ var OcgcoreDuel = class {
844
659
  const ptr = this.ocgcoreWrapper.malloc(QUERY_BUFFER_SIZE);
845
660
  const length = this.ocgcoreWrapper.ocgcoreModule._query_field_card(
846
661
  this.duelPtr,
847
- query.playerId,
662
+ query.player,
848
663
  query.location,
849
664
  query.queryFlag,
850
665
  ptr,
@@ -888,13 +703,11 @@ var OcgcoreDuel = class {
888
703
  );
889
704
  }
890
705
  getRegistryValue(key) {
891
- const keyBytes = encodeUtf8(key);
892
706
  const outPtr = this.ocgcoreWrapper.malloc(REGISTRY_BUFFER_SIZE);
893
707
  const length = this.ocgcoreWrapper.useTmpData(
894
708
  (keyPtr) => this.ocgcoreWrapper.ocgcoreModule._get_registry_value(
895
709
  this.duelPtr,
896
710
  keyPtr,
897
- keyBytes.length,
898
711
  outPtr
899
712
  ),
900
713
  key
@@ -906,15 +719,11 @@ var OcgcoreDuel = class {
906
719
  return { length, raw, value, text };
907
720
  }
908
721
  setRegistryValue(key, value) {
909
- const keyBytes = encodeUtf8(key);
910
- const valueBytes = encodeUtf8(value);
911
722
  this.ocgcoreWrapper.useTmpData(
912
723
  (keyPtr, valuePtr) => this.ocgcoreWrapper.ocgcoreModule._set_registry_value(
913
724
  this.duelPtr,
914
725
  keyPtr,
915
- keyBytes.length,
916
- valuePtr,
917
- valueBytes.length
726
+ valuePtr
918
727
  ),
919
728
  key,
920
729
  value
@@ -942,24 +751,84 @@ var OcgcoreDuel = class {
942
751
  );
943
752
  const raw = this.ocgcoreWrapper.copyHeap(outPtr, Math.max(0, length));
944
753
  this.ocgcoreWrapper.free(outPtr);
945
- const entries = length >= 0 ? parseRegistryDump(raw) : [];
946
- return { length, raw, entries };
754
+ const dict = {};
755
+ if (length > 0) {
756
+ const entries = parseRegistryDump(raw);
757
+ for (const entry of entries) {
758
+ if (entry.valueText !== void 0) {
759
+ dict[entry.key] = entry.valueText;
760
+ }
761
+ }
762
+ }
763
+ return { length, raw, dict };
947
764
  }
948
765
  loadRegistry(input) {
949
- this.ocgcoreWrapper.useTmpData(
950
- (ptr) => this.ocgcoreWrapper.ocgcoreModule._load_registry(
951
- this.duelPtr,
952
- ptr,
953
- input.length
954
- ),
955
- input
956
- );
766
+ if (input instanceof Uint8Array) {
767
+ this.ocgcoreWrapper.useTmpData(
768
+ (ptr) => this.ocgcoreWrapper.ocgcoreModule._load_registry(
769
+ this.duelPtr,
770
+ ptr,
771
+ input.length
772
+ ),
773
+ input
774
+ );
775
+ } else {
776
+ for (const [key, value] of Object.entries(input)) {
777
+ this.setRegistryValue(key, value);
778
+ }
779
+ }
957
780
  }
958
781
  };
959
782
 
960
783
  // src/structs/card-data.ts
961
- var import_typed_struct = __toESM(require("typed-struct"));
962
- var CardDataStruct = new import_typed_struct.default().UInt32LE("code").UInt32LE("alias").UInt16Array("setcode", 16).UInt32LE("type").UInt32LE("level").UInt32LE("attribute").UInt32LE("race").Int32LE("attack").Int32LE("defense").UInt32LE("lscale").UInt32LE("rscale").UInt32LE("linkMarker").compile();
784
+ var import_ygopro_msg_encode3 = require("ygopro-msg-encode");
785
+ var _CardDataStruct = class _CardDataStruct {
786
+ static fromBytes(data) {
787
+ const obj = new _CardDataStruct();
788
+ (0, import_ygopro_msg_encode3.fillBinaryFields)(obj, data, _CardDataStruct);
789
+ return obj;
790
+ }
791
+ toBytes() {
792
+ return (0, import_ygopro_msg_encode3.toBinaryFields)(this, _CardDataStruct);
793
+ }
794
+ };
795
+ __decorateClass([
796
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 0)
797
+ ], _CardDataStruct.prototype, "code", 2);
798
+ __decorateClass([
799
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 4)
800
+ ], _CardDataStruct.prototype, "alias", 2);
801
+ __decorateClass([
802
+ (0, import_ygopro_msg_encode3.BinaryField)("u16", 8, 16)
803
+ ], _CardDataStruct.prototype, "setcode", 2);
804
+ __decorateClass([
805
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 40)
806
+ ], _CardDataStruct.prototype, "type", 2);
807
+ __decorateClass([
808
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 44)
809
+ ], _CardDataStruct.prototype, "level", 2);
810
+ __decorateClass([
811
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 48)
812
+ ], _CardDataStruct.prototype, "attribute", 2);
813
+ __decorateClass([
814
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 52)
815
+ ], _CardDataStruct.prototype, "race", 2);
816
+ __decorateClass([
817
+ (0, import_ygopro_msg_encode3.BinaryField)("i32", 56)
818
+ ], _CardDataStruct.prototype, "attack", 2);
819
+ __decorateClass([
820
+ (0, import_ygopro_msg_encode3.BinaryField)("i32", 60)
821
+ ], _CardDataStruct.prototype, "defense", 2);
822
+ __decorateClass([
823
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 64)
824
+ ], _CardDataStruct.prototype, "lscale", 2);
825
+ __decorateClass([
826
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 68)
827
+ ], _CardDataStruct.prototype, "rscale", 2);
828
+ __decorateClass([
829
+ (0, import_ygopro_msg_encode3.BinaryField)("u32", 72)
830
+ ], _CardDataStruct.prototype, "linkMarker", 2);
831
+ var CardDataStruct = _CardDataStruct;
963
832
 
964
833
  // src/types/ocgcore-enums.ts
965
834
  var OcgcoreMessageType = /* @__PURE__ */ ((OcgcoreMessageType2) => {
@@ -1057,15 +926,14 @@ var OcgcoreWrapper = class {
1057
926
  if (!data) {
1058
927
  return 0;
1059
928
  }
1060
- const CardDataCtor = CardDataStruct;
1061
929
  let buf;
1062
- if (data instanceof CardDataCtor) {
1063
- buf = CardDataStruct.raw(data);
930
+ if (data instanceof CardDataStruct) {
931
+ buf = data.toBytes();
1064
932
  } else {
1065
- const cardData = new CardDataCtor();
933
+ const cardData = new CardDataStruct();
1066
934
  cardData.code = data.code;
1067
935
  cardData.alias = data.alias;
1068
- const targetSetcode = cardData.setcode;
936
+ const targetSetcode = new Uint16Array(16);
1069
937
  targetSetcode.fill(0);
1070
938
  if (data.setcode instanceof Uint16Array && data.setcode.length === 16) {
1071
939
  targetSetcode.set(data.setcode);
@@ -1074,6 +942,7 @@ var OcgcoreWrapper = class {
1074
942
  targetSetcode[i] = data.setcode[i];
1075
943
  }
1076
944
  }
945
+ cardData.setcode = targetSetcode;
1077
946
  cardData.type = data.type;
1078
947
  cardData.level = data.level;
1079
948
  cardData.attribute = data.attribute;
@@ -1083,7 +952,7 @@ var OcgcoreWrapper = class {
1083
952
  cardData.lscale = data.lscale;
1084
953
  cardData.rscale = data.rscale;
1085
954
  cardData.linkMarker = data.linkMarker;
1086
- buf = CardDataStruct.raw(cardData);
955
+ buf = cardData.toBytes();
1087
956
  }
1088
957
  this.heapU8.set(buf, cardDataPtr);
1089
958
  return 0;
@@ -2399,13 +2268,13 @@ function createReplayDuel(wrapper, yrp) {
2399
2268
  }
2400
2269
  return wrapper.createDuel(header?.seed ?? 0);
2401
2270
  }
2402
- function loadDeck(duel, deck, owner, playerId) {
2271
+ function loadDeck(duel, deck, owner, player) {
2403
2272
  if (!deck) return;
2404
2273
  for (const code of deck.main ?? []) {
2405
2274
  duel.newCard({
2406
2275
  code,
2407
2276
  owner,
2408
- playerId,
2277
+ player,
2409
2278
  location: LOCATION_DECK,
2410
2279
  sequence: 0,
2411
2280
  position: POS_FACEDOWN_DEFENSE
@@ -2415,7 +2284,7 @@ function loadDeck(duel, deck, owner, playerId) {
2415
2284
  duel.newCard({
2416
2285
  code,
2417
2286
  owner,
2418
- playerId,
2287
+ player,
2419
2288
  location: LOCATION_EXTRA,
2420
2289
  sequence: 0,
2421
2290
  position: POS_FACEDOWN_DEFENSE
@@ -2469,15 +2338,15 @@ function* playYrpStep(ocgcoreWrapper, yrpInput) {
2469
2338
  setRegistryValue(duel, "player_type_0", "0");
2470
2339
  setRegistryValue(duel, "player_type_1", "1");
2471
2340
  duel.setPlayerInfo({
2472
- playerId: 0,
2341
+ player: 0,
2473
2342
  lp: yrp.startLp,
2474
- startCount: yrp.startHand,
2343
+ startHand: yrp.startHand,
2475
2344
  drawCount: yrp.drawCount
2476
2345
  });
2477
2346
  duel.setPlayerInfo({
2478
- playerId: 1,
2347
+ player: 1,
2479
2348
  lp: yrp.startLp,
2480
- startCount: yrp.startHand,
2349
+ startHand: yrp.startHand,
2481
2350
  drawCount: yrp.drawCount
2482
2351
  });
2483
2352
  duel.preloadScript("./script/patches/entry.lua");
@@ -2548,13 +2417,13 @@ function testCard(ocgcoreWrapper, ...ids) {
2548
2417
  });
2549
2418
  duel.preloadScript("./script/special.lua");
2550
2419
  duel.preloadScript("./script/init.lua");
2551
- duel.setPlayerInfo({ playerId: 0, lp: 8e3, startCount: 5, drawCount: 1 });
2552
- duel.setPlayerInfo({ playerId: 1, lp: 8e3, startCount: 5, drawCount: 1 });
2420
+ duel.setPlayerInfo({ player: 0, lp: 8e3, startHand: 5, drawCount: 1 });
2421
+ duel.setPlayerInfo({ player: 1, lp: 8e3, startHand: 5, drawCount: 1 });
2553
2422
  for (const code of ids) {
2554
2423
  duel.newCard({
2555
2424
  code,
2556
2425
  owner: 0,
2557
- playerId: 0,
2426
+ player: 0,
2558
2427
  location: LOCATION_DECK2,
2559
2428
  sequence: 0,
2560
2429
  position: POS_FACEUP_ATTACK