@slot-engine/core 0.2.4 → 0.2.6
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.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -400,11 +400,11 @@ var GameSymbol = class _GameSymbol {
|
|
|
400
400
|
* Creates a clone of this GameSymbol.
|
|
401
401
|
*/
|
|
402
402
|
clone() {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
const cloned = Object.create(_GameSymbol.prototype);
|
|
404
|
+
cloned.id = this.id;
|
|
405
|
+
cloned.pays = this.pays;
|
|
406
|
+
cloned.properties = this.properties.size > 0 ? new Map(this.properties) : /* @__PURE__ */ new Map();
|
|
407
|
+
return cloned;
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
410
|
|
|
@@ -457,6 +457,9 @@ var Board = class {
|
|
|
457
457
|
setSymbol(reelIndex, rowIndex, symbol) {
|
|
458
458
|
this.reels[reelIndex] = this.reels[reelIndex] || [];
|
|
459
459
|
this.reels[reelIndex][rowIndex] = symbol;
|
|
460
|
+
this.updateSymbol(reelIndex, rowIndex, {
|
|
461
|
+
position: [reelIndex, rowIndex]
|
|
462
|
+
});
|
|
460
463
|
}
|
|
461
464
|
removeSymbol(reelIndex, rowIndex) {
|
|
462
465
|
if (this.reels[reelIndex]) {
|
|
@@ -665,16 +668,19 @@ var Board = class {
|
|
|
665
668
|
const reelLength = opts.reels[ridx].length;
|
|
666
669
|
for (let p = padSymbols - 1; p >= 0; p--) {
|
|
667
670
|
const topPos = ((reelPos - (p + 1)) % reelLength + reelLength) % reelLength;
|
|
668
|
-
this.paddingTop[ridx].push(opts.reels[ridx][topPos]);
|
|
671
|
+
this.paddingTop[ridx].push(opts.reels[ridx][topPos].clone());
|
|
669
672
|
const bottomPos = (reelPos + symbolsPerReel[ridx] + p) % reelLength;
|
|
670
|
-
this.paddingBottom[ridx].unshift(opts.reels[ridx][bottomPos]);
|
|
673
|
+
this.paddingBottom[ridx].unshift(opts.reels[ridx][bottomPos].clone());
|
|
671
674
|
}
|
|
672
675
|
for (let row = 0; row < symbolsPerReel[ridx]; row++) {
|
|
673
676
|
const symbol = opts.reels[ridx][(reelPos + row) % reelLength];
|
|
674
677
|
if (!symbol) {
|
|
675
678
|
throw new Error(`Failed to get symbol at pos ${reelPos + row} on reel ${ridx}`);
|
|
676
679
|
}
|
|
677
|
-
this.reels[ridx][row] = symbol;
|
|
680
|
+
this.reels[ridx][row] = symbol.clone();
|
|
681
|
+
this.updateSymbol(ridx, row, {
|
|
682
|
+
position: [ridx, row]
|
|
683
|
+
});
|
|
678
684
|
}
|
|
679
685
|
}
|
|
680
686
|
return {
|
|
@@ -742,6 +748,7 @@ var Board = class {
|
|
|
742
748
|
newSymbol = forcedSym;
|
|
743
749
|
}
|
|
744
750
|
assert3(newSymbol, "Failed to get new symbol for tumbling.");
|
|
751
|
+
newSymbol = newSymbol.clone();
|
|
745
752
|
this.reels[ridx].unshift(newSymbol);
|
|
746
753
|
newFirstSymbolPositions[ridx] = symbolPos;
|
|
747
754
|
if (!newBoardSymbols[ridx]) {
|
|
@@ -755,7 +762,7 @@ var Board = class {
|
|
|
755
762
|
if (firstSymbolPos === void 0) continue;
|
|
756
763
|
for (let p = 1; p <= padSymbols; p++) {
|
|
757
764
|
const topPos = (firstSymbolPos - p + reels[ridx].length) % reels[ridx].length;
|
|
758
|
-
const padSymbol = reels[ridx][topPos];
|
|
765
|
+
const padSymbol = reels[ridx][topPos]?.clone();
|
|
759
766
|
assert3(padSymbol, "Failed to get new padding symbol for tumbling.");
|
|
760
767
|
this.paddingTop[ridx].unshift(padSymbol);
|
|
761
768
|
if (!newPaddingTopSymbols[ridx]) {
|
|
@@ -769,6 +776,14 @@ var Board = class {
|
|
|
769
776
|
return newFirstSymbolPositions[ridx] ?? stop;
|
|
770
777
|
});
|
|
771
778
|
}
|
|
779
|
+
for (let ridx = 0; ridx < reelsAmount; ridx++) {
|
|
780
|
+
const reel = this.reels[ridx];
|
|
781
|
+
for (let rowIdx = 0; rowIdx < reel.length; rowIdx++) {
|
|
782
|
+
this.updateSymbol(ridx, rowIdx, {
|
|
783
|
+
position: [ridx, rowIdx]
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
}
|
|
772
787
|
return {
|
|
773
788
|
newBoardSymbols,
|
|
774
789
|
newPaddingTopSymbols
|
|
@@ -4891,6 +4906,7 @@ export {
|
|
|
4891
4906
|
SPIN_TYPE,
|
|
4892
4907
|
StandaloneBoard,
|
|
4893
4908
|
StaticReelSet,
|
|
4909
|
+
WinType,
|
|
4894
4910
|
createSlotGame,
|
|
4895
4911
|
defineGameModes,
|
|
4896
4912
|
defineSymbols,
|