UNPKG

slotify.js

Version:

A video slot game session framework for JavaScript

42 lines (41 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GameSession = void 0; var GameSession = /** @class */ (function () { function GameSession(config) { this._config = config; this._bet = this.isBetAvailable(this._config.bet) ? this._config.bet : this._config.availableBets[0]; this._credits = this._config.creditsAmount; } GameSession.prototype.isBetAvailable = function (bet) { return this._config.availableBets.indexOf(bet) >= 0; }; GameSession.prototype.getAvailableBets = function () { return this._config.availableBets; }; GameSession.prototype.getBet = function () { return this._bet; }; GameSession.prototype.getCreditsAmount = function () { return this._credits; }; GameSession.prototype.setCreditsAmount = function (value) { this._credits = value; }; GameSession.prototype.setBet = function (bet) { this._bet = bet; }; GameSession.prototype.play = function () { if (this.canPlayNextGame()) { this._credits -= this._bet; } }; GameSession.prototype.canPlayNextGame = function () { return this._credits >= this._bet; }; GameSession.prototype.getWinningAmount = function () { return 0; }; return GameSession; }()); exports.GameSession = GameSession;