UNPKG

pokie

Version:

A server-side video slot game logic framework for JavaScript and TypeScript.

93 lines 3.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VideoSlotSession = void 0; const pokie_1 = require("pokie"); class VideoSlotSession { constructor(config = new pokie_1.VideoSlotConfig(), combinationsGenerator = new pokie_1.SymbolsCombinationsGenerator(config), winCalculator = new pokie_1.VideoSlotWinCalculator(config), baseSession = new pokie_1.GameSession(config)) { this.winAmount = 0; this.symbolsCombination = new pokie_1.SymbolsCombination(); this.config = config; this.combinationsGenerator = combinationsGenerator; this.winCalculator = winCalculator; this.baseSession = baseSession; this.symbolsCombination = this.combinationsGenerator.generateSymbolsCombination(); } getPaytable() { return this.config.getPaytable(); } getSymbolsCombination() { return this.symbolsCombination; } getWinningLines() { return this.winCalculator.getWinningLines(); } getWinningScatters() { return this.winCalculator.getWinningScatters(); } getSymbolsSequences() { return this.config.getSymbolsSequences(); } getReelsSymbolsNumber() { return this.config.getReelsSymbolsNumber(); } getReelsNumber() { return this.config.getReelsNumber(); } getAvailableSymbols() { return [...this.config.getAvailableSymbols()]; } getCreditsAmount() { return this.baseSession.getCreditsAmount(); } setCreditsAmount(creditsAmount) { this.baseSession.setCreditsAmount(creditsAmount); } getWinAmount() { return this.winAmount; } getLinesWinning() { return this.winCalculator.getLinesWinning(); } getScattersWinning() { return this.winCalculator.getScattersWinning(); } getAvailableBets() { return [...this.config.getAvailableBets()]; } getBet() { return this.baseSession.getBet(); } setBet(bet) { this.baseSession.setBet(bet); } canPlayNextGame() { return this.baseSession.canPlayNextGame(); } play() { this.baseSession.play(); this.symbolsCombination = this.combinationsGenerator.generateSymbolsCombination(); this.winCalculator.calculateWin(this.getBet(), this.symbolsCombination); this.winAmount = this.winCalculator.getWinAmount(); this.setCreditsAmount(this.getCreditsAmount() + this.winAmount); } isSymbolWild(symbolId) { return this.config.isSymbolWild(symbolId); } isSymbolScatter(symbolId) { return this.config.isSymbolScatter(symbolId); } getWildSymbols() { return this.config.getWildSymbols(); } getScatterSymbols() { return this.config.getScatterSymbols(); } getLinesDefinitions() { return this.config.getLinesDefinitions(); } getLinesPatterns() { return this.config.getLinesPatterns(); } } exports.VideoSlotSession = VideoSlotSession; //# sourceMappingURL=VideoSlotSession.js.map