pixi-rainman-game-engine 0.1.13 → 0.1.15

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.
@@ -184,10 +184,16 @@ export class ApiConfig {
184
184
  * @param {InitDataInterface} data
185
185
  */
186
186
  initSymbolMap(data) {
187
+ if (Object.keys(RainMan.symbolIds).length !== data.symbols.length) {
188
+ logError(`🛑 SYMBOL_IDS does not match symbols_names!`);
189
+ logError(RainMan.symbolIds, data.symbols_names);
190
+ throw new Error("Check and fix SYMBOL_IDS");
191
+ }
187
192
  for (const [key, name] of data.symbols_names.entries()) {
188
193
  const backendId = data.symbols[key];
189
194
  if (!Object.values(RainMan.symbolIds).includes(name)) {
190
195
  logError(`🛑 "${name}" was not found in SymbolIds enum!`);
196
+ throw new Error("Check and fix SYMBOL_IDS");
191
197
  }
192
198
  this.symbolMap.set(backendId, name);
193
199
  }
@@ -33,6 +33,7 @@ export declare abstract class AbstractController<T> {
33
33
  protected resolveBigWin?: () => void;
34
34
  protected resolveMysteryWin?: () => void;
35
35
  protected mysteryFxSymbol: SymbolId | null;
36
+ protected mysteryFxSymbolMustFormWinningLine: boolean;
36
37
  protected mysteryWinSymbol: Nullable<SymbolId>;
37
38
  private componentRegistry;
38
39
  protected _lastWinAmount: number;
@@ -32,6 +32,7 @@ export class AbstractController {
32
32
  resolveBigWin;
33
33
  resolveMysteryWin;
34
34
  mysteryFxSymbol = null;
35
+ mysteryFxSymbolMustFormWinningLine = false;
35
36
  mysteryWinSymbol = null;
36
37
  componentRegistry;
37
38
  _lastWinAmount = 0;
@@ -41,11 +42,9 @@ export class AbstractController {
41
42
  this.connection = connection;
42
43
  const initData = this.connection.initData();
43
44
  this.config = new ApiConfig(initData);
44
- this.buttonsEventManager = buttonsEventManager;
45
45
  this.quickStopController = new QuickStopController(buttonsEventManager);
46
46
  this.uiController = new UiController(this.config);
47
47
  this.componentRegistry = RainMan.componentRegistry;
48
- this.init();
49
48
  this.setupSpaceOrEnterListener();
50
49
  }
51
50
  init() {
@@ -236,6 +235,7 @@ export class AbstractController {
236
235
  getReelIndexesToShowMysteryFx(spinLogic) {
237
236
  const { onStopBlindsConfiguration } = spinLogic;
238
237
  const reelsIndexesWithScatter = [];
238
+ const streak = [];
239
239
  let howManyScattersAppeared = 0;
240
240
  for (let columnIndex = 0; columnIndex < RainMan.config.numberOfColumns; columnIndex++) {
241
241
  if (howManyScattersAppeared >= 2) {
@@ -245,9 +245,20 @@ export class AbstractController {
245
245
  const symbol = onStopBlindsConfiguration[columnIndex][rowIndex];
246
246
  if (symbol === this.mysteryFxSymbol) {
247
247
  howManyScattersAppeared++;
248
+ streak.push(rowIndex);
249
+ break;
248
250
  }
249
251
  }
250
252
  }
253
+ if (this.mysteryFxSymbolMustFormWinningLine) {
254
+ if (this.config.streakMap.has(streak.join("")))
255
+ return reelsIndexesWithScatter;
256
+ const couldFormWinningLine = Array.from({ length: RainMan.config.numberOfRows }, (_, row) => [
257
+ ...streak,
258
+ row,
259
+ ]).some((streak) => this.config.streakMap.has(streak.join("")));
260
+ return couldFormWinningLine ? reelsIndexesWithScatter : [];
261
+ }
251
262
  return reelsIndexesWithScatter;
252
263
  }
253
264
  handleSpinLogic() {
@@ -1,7 +1,7 @@
1
1
  import { SpinData, SymbolReels } from "../../connectivity";
2
2
  export declare const logInfo: (...params: unknown[]) => false | void;
3
- export declare const logError: (message: string) => false | void;
4
- export declare const logWarn: (message: string) => false | void;
3
+ export declare const logError: (...message: unknown[]) => false | void;
4
+ export declare const logWarn: (...message: unknown[]) => false | void;
5
5
  export declare const logGroup: (...params: unknown[]) => false | void;
6
6
  export declare const logGroupEnd: () => false | void;
7
7
  export declare const debugSpinData: (data: SpinData) => void;
@@ -3,8 +3,8 @@ import { AbstractColumnsContainer } from "../../components";
3
3
  import { RainMan } from "../../Rainman";
4
4
  const DEBUG_ENABLED = process.env.NODE_ENV === "development";
5
5
  export const logInfo = (...params) => DEBUG_ENABLED && console.info("[RainMan][INFO]:", ...params);
6
- export const logError = (message) => DEBUG_ENABLED && console.error("[RainMan][ERROR]:", message);
7
- export const logWarn = (message) => DEBUG_ENABLED && console.warn("[RainMan][WARN]:", message);
6
+ export const logError = (...message) => DEBUG_ENABLED && console.error("[RainMan][ERROR]:", ...message);
7
+ export const logWarn = (...message) => DEBUG_ENABLED && console.warn("[RainMan][WARN]:", ...message);
8
8
  export const logGroup = (...params) => DEBUG_ENABLED && console.group("[RainMan][Group]\n", ...params);
9
9
  export const logGroupEnd = () => DEBUG_ENABLED && console.groupEnd();
10
10
  export const debugSpinData = (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "This repository contains all of the mechanics that used in rainman games.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",