@slot-engine/core 0.0.3 → 0.0.4

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.mjs CHANGED
@@ -62,7 +62,7 @@ var GameConfig = class _GameConfig {
62
62
  `Reel set with id "${id}" not found in game mode "${gameMode}". Available reel sets: ${this.config.gameModes[gameMode].reelSets.map((rs) => rs.id).join(", ")}`
63
63
  );
64
64
  }
65
- return reelSet;
65
+ return reelSet.reels;
66
66
  }
67
67
  /**
68
68
  * Retrieves the number of free spins awarded for a given spin type and scatter count.
@@ -79,7 +79,7 @@ var GameConfig = class _GameConfig {
79
79
  /**
80
80
  * Retrieves a result set by its criteria within a specific game mode.
81
81
  */
82
- getGameModeCriteria(mode, criteria) {
82
+ getResultSetByCriteria(mode, criteria) {
83
83
  const gameMode = this.config.gameModes[mode];
84
84
  if (!gameMode) {
85
85
  throw new Error(`Game mode "${mode}" not found in game config.`);
@@ -1049,13 +1049,6 @@ var GameState = class extends GameConfig {
1049
1049
  this.clearPendingRecords();
1050
1050
  this.state.userData = this.config.userState || {};
1051
1051
  }
1052
- /**
1053
- * Checks if a max win is reached by comparing `wallet.currentWin` to `config.maxWin`.
1054
- *
1055
- * Should be called after `wallet.confirmSpinWin()`.
1056
- */
1057
- isMaxWinTriggered() {
1058
- }
1059
1052
  /**
1060
1053
  * Empties the list of pending records in the recorder.
1061
1054
  */
@@ -1501,7 +1494,7 @@ var Board = class extends GameState {
1501
1494
  return stopPositionsForReels;
1502
1495
  }
1503
1496
  /**
1504
- * Selects a random reelset based on the configured weights for the current game mode.\
1497
+ * Selects a random reel set based on the configured weights of the current result set.\
1505
1498
  * Returns the reels as arrays of GameSymbols.
1506
1499
  */
1507
1500
  getRandomReelset() {
@@ -1516,7 +1509,7 @@ var Board = class extends GameState {
1516
1509
  reelSetId = weightedRandom(weights[this.state.currentSpinType], this.state.rng);
1517
1510
  }
1518
1511
  const reelSet = this.getReelsetById(this.state.currentGameMode, reelSetId);
1519
- return reelSet.reels;
1512
+ return reelSet;
1520
1513
  }
1521
1514
  /**
1522
1515
  * Draws a board using specified reel stops.
@@ -2246,22 +2239,25 @@ var SimulationContext = class extends Board {
2246
2239
  this.state.currentGameMode = mode;
2247
2240
  this.state.currentSimulationId = simId;
2248
2241
  this.state.isCriteriaMet = false;
2242
+ const resultSet = this.getResultSetByCriteria(this.state.currentGameMode, criteria);
2249
2243
  while (!this.state.isCriteriaMet) {
2250
2244
  this.actualSims++;
2251
2245
  this.resetSimulation();
2252
- const resultSet = this.getGameModeCriteria(this.state.currentGameMode, criteria);
2253
2246
  this.state.currentResultSet = resultSet;
2254
2247
  this.state.book.criteria = resultSet.criteria;
2255
2248
  this.handleGameFlow();
2256
2249
  if (resultSet.meetsCriteria(this)) {
2257
2250
  this.state.isCriteriaMet = true;
2258
- this.config.hooks.onSimulationAccepted?.(this);
2259
- this.record({
2260
- criteria: resultSet.criteria
2261
- });
2262
2251
  }
2263
2252
  }
2264
2253
  this.wallet.confirmWins(this);
2254
+ if (this.state.book.getPayout() >= this.config.maxWinX) {
2255
+ this.state.triggeredMaxWin = true;
2256
+ }
2257
+ this.record({
2258
+ criteria: resultSet.criteria
2259
+ });
2260
+ this.config.hooks.onSimulationAccepted?.(this);
2265
2261
  this.confirmRecords();
2266
2262
  parentPort?.postMessage({
2267
2263
  type: "complete",