texas-poker-core 1.2.7 → 1.2.8
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/README.md +4 -1
- package/dist/Controller/index.js +84 -56
- package/dist/Dealer/index.js +1 -1
- package/dist/Deck/core.js +38 -5
- package/dist/Deck/index.js +13 -1
- package/dist/Player/index.js +47 -5
- package/dist/Pool/index.js +2 -0
- package/dist/index.js +14 -0
- package/dist/utils/index.js +2 -6
- package/package.json +1 -1
- package/types/Controller/index.d.ts +3 -1
- package/types/Deck/core.d.ts +11 -0
- package/types/Deck/index.d.ts +5 -0
- package/types/Player/index.d.ts +4 -0
- package/types/index.d.ts +1 -0
- package/types/utils/index.d.ts +1 -1
package/README.md
CHANGED
package/dist/Controller/index.js
CHANGED
|
@@ -7,6 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _TexasError = _interopRequireDefault(require("../TexasError"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
10
16
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
11
17
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
12
18
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
@@ -130,13 +136,18 @@ var Controller = /*#__PURE__*/function () {
|
|
|
130
136
|
return !player.actionable();
|
|
131
137
|
}) && _classPrivateFieldGet(_stage, this) === 'river';
|
|
132
138
|
if (shouldEndGame) {
|
|
133
|
-
var
|
|
139
|
+
var _classPrivateFieldGet4;
|
|
134
140
|
this.end();
|
|
135
141
|
_classPrivateFieldSet(_endAt, this, this.stage);
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
var _classPrivateFieldGet3 = _classPrivateFieldGet(_dealer, this).deck.getMaxPresentationAndPokes(),
|
|
143
|
+
presentation = _classPrivateFieldGet3.presentation,
|
|
144
|
+
pokes = _classPrivateFieldGet3.pokes;
|
|
145
|
+
(_classPrivateFieldGet4 = _classPrivateFieldGet(_callbackOfEnd, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.call(this, {
|
|
146
|
+
showHandPokes: true,
|
|
138
147
|
currentStage: _classPrivateFieldGet(_stage, this),
|
|
139
|
-
|
|
148
|
+
restCommonPokes: this.getCommonPokes(_classPrivateFieldGet(_stage, this), 'river'),
|
|
149
|
+
maxPokes: pokes,
|
|
150
|
+
maxPresentation: presentation[0]
|
|
140
151
|
});
|
|
141
152
|
console.log('游戏结束(shouldEndGame):', _classPrivateFieldGet(_endAt, this));
|
|
142
153
|
return true;
|
|
@@ -156,21 +167,21 @@ var Controller = /*#__PURE__*/function () {
|
|
|
156
167
|
return !player.actionable();
|
|
157
168
|
});
|
|
158
169
|
if (canPushToNextStage) {
|
|
159
|
-
var
|
|
160
|
-
console.log('推进到下个阶段, 触发人', (
|
|
170
|
+
var _classPrivateFieldGet5, _classPrivateFieldGet6;
|
|
171
|
+
console.log('推进到下个阶段, 触发人', (_classPrivateFieldGet5 = _classPrivateFieldGet(_activePlayer, this)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.getUserInfo().name);
|
|
161
172
|
var index = stages.findIndex(function (stage) {
|
|
162
173
|
return stage === _classPrivateFieldGet(_stage, _this);
|
|
163
174
|
});
|
|
164
|
-
var
|
|
175
|
+
var currentStage = _classPrivateFieldGet(_stage, this);
|
|
165
176
|
var nextStage = stages[index + 1];
|
|
166
177
|
_classPrivateFieldSet(_stage, this, nextStage);
|
|
167
178
|
_classPrivateFieldGet(_dealer, this).resetCurrentStageTotalAmount();
|
|
168
179
|
_classPrivateFieldGet(_dealer, this).resetActionsOfPlayers();
|
|
169
180
|
_classPrivateFieldGet(_dealer, this).resetActionsHistory();
|
|
170
|
-
(
|
|
181
|
+
(_classPrivateFieldGet6 = _classPrivateFieldGet(_callbackOnNextStage, this)) === null || _classPrivateFieldGet6 === void 0 || _classPrivateFieldGet6.call(this, {
|
|
171
182
|
stage: nextStage,
|
|
172
|
-
lastStage:
|
|
173
|
-
commonPokes: this.getCommonPokes(
|
|
183
|
+
lastStage: currentStage,
|
|
184
|
+
commonPokes: this.getCommonPokes(currentStage, nextStage)
|
|
174
185
|
});
|
|
175
186
|
console.log('游戏进入下一个阶段 => ', _classPrivateFieldGet(_stage, this));
|
|
176
187
|
this.resetActivePlayer();
|
|
@@ -215,71 +226,77 @@ var Controller = /*#__PURE__*/function () {
|
|
|
215
226
|
}
|
|
216
227
|
|
|
217
228
|
// 大盲小盲的默认下注行为
|
|
229
|
+
// 在双人竞技中, 庄家需要下小盲注, 同时率先开始行动
|
|
218
230
|
}, {
|
|
219
231
|
key: "takeActionInPreFlop",
|
|
220
232
|
value: function () {
|
|
221
|
-
var _takeActionInPreFlop = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
222
|
-
var
|
|
223
|
-
var
|
|
224
|
-
return _regeneratorRuntime().wrap(function
|
|
225
|
-
while (1) switch (
|
|
233
|
+
var _takeActionInPreFlop = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
234
|
+
var _this2 = this;
|
|
235
|
+
var takeDefaultActionPlayers, _takeDefaultActionPla, bigBlind, activePlayer, _classPrivateFieldGet7;
|
|
236
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
237
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
226
238
|
case 0:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
239
|
+
takeDefaultActionPlayers = _assertClassBrand(_Controller_brand, this, _getSmallBindAndBigBind).call(this);
|
|
240
|
+
takeDefaultActionPlayers.forEach(/*#__PURE__*/function () {
|
|
241
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(player, index) {
|
|
242
|
+
var amount;
|
|
243
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
244
|
+
while (1) switch (_context.prev = _context.next) {
|
|
245
|
+
case 0:
|
|
246
|
+
if (player) {
|
|
247
|
+
amount = index === 0 ? _classPrivateFieldGet(_dealer, _this2).lowestBetAmount / 2 : _classPrivateFieldGet(_dealer, _this2).lowestBetAmount;
|
|
248
|
+
player.bet(amount, true);
|
|
249
|
+
_classPrivateFieldGet(_defaultBets, _this2).push({
|
|
250
|
+
userId: player.getUserInfo().id,
|
|
251
|
+
balance: player.balance,
|
|
252
|
+
amount: amount
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
case 1:
|
|
256
|
+
case "end":
|
|
257
|
+
return _context.stop();
|
|
258
|
+
}
|
|
259
|
+
}, _callee);
|
|
260
|
+
}));
|
|
261
|
+
return function (_x, _x2) {
|
|
262
|
+
return _ref.apply(this, arguments);
|
|
263
|
+
};
|
|
264
|
+
}());
|
|
265
|
+
_takeDefaultActionPla = _slicedToArray(takeDefaultActionPlayers, 2), bigBlind = _takeDefaultActionPla[1];
|
|
266
|
+
activePlayer = bigBlind === null || bigBlind === void 0 ? void 0 : bigBlind.getNextPlayer();
|
|
251
267
|
if (!activePlayer) {
|
|
252
|
-
|
|
268
|
+
_context2.next = 10;
|
|
253
269
|
break;
|
|
254
270
|
}
|
|
255
|
-
|
|
271
|
+
_context2.next = 7;
|
|
256
272
|
return (_classPrivateFieldGet7 = _classPrivateFieldGet(_callbackOfGameStart, this)) === null || _classPrivateFieldGet7 === void 0 ? void 0 : _classPrivateFieldGet7.call(this);
|
|
257
273
|
case 7:
|
|
258
274
|
this.transferControlTo(activePlayer);
|
|
259
|
-
|
|
275
|
+
_context2.next = 11;
|
|
260
276
|
break;
|
|
261
277
|
case 10:
|
|
262
278
|
this.reportError(new _TexasError.default(2000, '游戏进程异常'));
|
|
263
279
|
case 11:
|
|
264
280
|
case "end":
|
|
265
|
-
return
|
|
281
|
+
return _context2.stop();
|
|
266
282
|
}
|
|
267
|
-
},
|
|
283
|
+
}, _callee2, this);
|
|
268
284
|
}));
|
|
269
285
|
function takeActionInPreFlop() {
|
|
270
286
|
return _takeActionInPreFlop.apply(this, arguments);
|
|
271
287
|
}
|
|
272
288
|
return takeActionInPreFlop;
|
|
273
|
-
}()
|
|
289
|
+
}() // 获取小盲,大盲玩家
|
|
290
|
+
}, {
|
|
291
|
+
key: "start",
|
|
292
|
+
value: (
|
|
274
293
|
/**
|
|
275
294
|
* @description 开始计时器, 将控制权移交给第一个可以行动的玩家
|
|
276
295
|
*/
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
282
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
296
|
+
function () {
|
|
297
|
+
var _start = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
298
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
299
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
283
300
|
case 0:
|
|
284
301
|
_classPrivateFieldSet(_status, this, 'on');
|
|
285
302
|
_classPrivateFieldSet(_stage, this, 'pre_flop');
|
|
@@ -287,15 +304,15 @@ var Controller = /*#__PURE__*/function () {
|
|
|
287
304
|
|
|
288
305
|
// 测试环境保持玩家balance起始不变
|
|
289
306
|
if (process.env.PROJECT_ENV === 'dev') _classPrivateFieldGet(_dealer, this).reset();
|
|
290
|
-
|
|
307
|
+
_context3.next = 6;
|
|
291
308
|
return this.takeActionInPreFlop();
|
|
292
309
|
case 6:
|
|
293
310
|
this.startTimer();
|
|
294
311
|
case 7:
|
|
295
312
|
case "end":
|
|
296
|
-
return
|
|
313
|
+
return _context3.stop();
|
|
297
314
|
}
|
|
298
|
-
},
|
|
315
|
+
}, _callee3, this);
|
|
299
316
|
}));
|
|
300
317
|
function start() {
|
|
301
318
|
return _start.apply(this, arguments);
|
|
@@ -310,12 +327,12 @@ var Controller = /*#__PURE__*/function () {
|
|
|
310
327
|
}, {
|
|
311
328
|
key: "startTimer",
|
|
312
329
|
value: function startTimer() {
|
|
313
|
-
var
|
|
330
|
+
var _this3 = this;
|
|
314
331
|
// 避免重复开启计时器
|
|
315
332
|
if (_classPrivateFieldGet(_timer, this)) return;
|
|
316
333
|
_classPrivateFieldSet(_timer, this, setInterval(function () {
|
|
317
334
|
var _this$count, _this$count2;
|
|
318
|
-
_classPrivateFieldSet(_count,
|
|
335
|
+
_classPrivateFieldSet(_count, _this3, (_this$count = _classPrivateFieldGet(_count, _this3), _this$count2 = _this$count++, _this$count)), _this$count2;
|
|
319
336
|
}, 1000));
|
|
320
337
|
}
|
|
321
338
|
|
|
@@ -392,4 +409,15 @@ function _getPokeEndIndex(stage) {
|
|
|
392
409
|
if (stage === 'turn') return 4;
|
|
393
410
|
if (stage === 'river') return 5;
|
|
394
411
|
}
|
|
412
|
+
function _getSmallBindAndBigBind() {
|
|
413
|
+
var _classPrivateFieldGet10;
|
|
414
|
+
var smallBind =
|
|
415
|
+
// 在双人游戏中, 庄家同时支付小盲注
|
|
416
|
+
_classPrivateFieldGet(_dealer, this).count === 2 ? _classPrivateFieldGet(_dealer, this).button : (_classPrivateFieldGet10 = _classPrivateFieldGet(_dealer, this).button) === null || _classPrivateFieldGet10 === void 0 ? void 0 : _classPrivateFieldGet10.getNextPlayer();
|
|
417
|
+
var result = [smallBind, smallBind === null || smallBind === void 0 ? void 0 : smallBind.getNextPlayer()];
|
|
418
|
+
if (result.some(function (player) {
|
|
419
|
+
return !player;
|
|
420
|
+
})) this.reportError(new _TexasError.default(2000, '游戏进程异常: 小盲或大盲玩家不存在'));
|
|
421
|
+
return result;
|
|
422
|
+
}
|
|
395
423
|
var _default = exports.default = Controller;
|
package/dist/Dealer/index.js
CHANGED
|
@@ -110,7 +110,7 @@ var Dealer = /*#__PURE__*/function () {
|
|
|
110
110
|
handPokes = _classPrivateFieldGet2.handPokes;
|
|
111
111
|
this.loop(function (player, i) {
|
|
112
112
|
player.setHandPokes(handPokes[i]);
|
|
113
|
-
}, _classPrivateFieldGet(_button, this));
|
|
113
|
+
}, _classPrivateFieldGet(_button, this).getNextPlayer());
|
|
114
114
|
}
|
|
115
115
|
}, {
|
|
116
116
|
key: "addAction",
|
package/dist/Deck/core.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.formatterPoke = exports.comparePresentation = exports.compareFn = void 0
|
|
|
7
7
|
exports.getBestHand = getBestHand;
|
|
8
8
|
exports.getBestPokesPresentation = getBestPokesPresentation;
|
|
9
9
|
exports.getHandPresentation = getHandPresentation;
|
|
10
|
+
exports.getMaxPresentationAndPokes = getMaxPresentationAndPokes;
|
|
11
|
+
exports.getSortedAllHandPokesCombinations = getSortedAllHandPokesCombinations;
|
|
10
12
|
exports.isStraight = exports.getWinners = void 0;
|
|
11
13
|
var _ramda = require("ramda");
|
|
12
14
|
var _constant = require("./constant");
|
|
@@ -244,6 +246,18 @@ function getBestHand(pokes, commonPokes) {
|
|
|
244
246
|
return maxOne;
|
|
245
247
|
}
|
|
246
248
|
|
|
249
|
+
/**
|
|
250
|
+
* @description 获取多个手牌组合中的所有牌型组合, 按照降序排列
|
|
251
|
+
* @param handPokes
|
|
252
|
+
* @param commonPokes
|
|
253
|
+
* @returns
|
|
254
|
+
*/
|
|
255
|
+
function getSortedAllHandPokesCombinations(handPokes, commonPokes) {
|
|
256
|
+
var allCombinations = handPokes.map(function (pokes) {
|
|
257
|
+
return getCombinations([].concat(_toConsumableArray(pokes), _toConsumableArray(commonPokes)));
|
|
258
|
+
}).flat(1).sort(compareFn);
|
|
259
|
+
return allCombinations;
|
|
260
|
+
}
|
|
247
261
|
/**
|
|
248
262
|
* @description 获取多个手牌组合中的最大牌力值
|
|
249
263
|
* @param handPokes
|
|
@@ -251,14 +265,33 @@ function getBestHand(pokes, commonPokes) {
|
|
|
251
265
|
* @returns
|
|
252
266
|
*/
|
|
253
267
|
function getBestPokesPresentation(handPokes, commonPokes) {
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
_handPokes$map$flat$s2 = _slicedToArray(_handPokes$map$flat$s, 1),
|
|
258
|
-
maxOne = _handPokes$map$flat$s2[0];
|
|
268
|
+
var _getSortedAllHandPoke = getSortedAllHandPokesCombinations(handPokes, commonPokes),
|
|
269
|
+
_getSortedAllHandPoke2 = _slicedToArray(_getSortedAllHandPoke, 1),
|
|
270
|
+
maxOne = _getSortedAllHandPoke2[0];
|
|
259
271
|
return getHandPresentation(maxOne);
|
|
260
272
|
}
|
|
261
273
|
|
|
274
|
+
// 获取最大牌型与牌力值
|
|
275
|
+
function getMaxPresentationAndPokes(handPokes, commonPokes) {
|
|
276
|
+
var allCombinations = getSortedAllHandPokesCombinations(handPokes, commonPokes);
|
|
277
|
+
var maxPresentation = getHandPresentation(allCombinations[0]);
|
|
278
|
+
|
|
279
|
+
// 以下方法可以使用reduce实现, 在目前不影响性能的情况下, 先这样实现
|
|
280
|
+
var maxPokes = allCombinations.map(function (combination) {
|
|
281
|
+
return {
|
|
282
|
+
presentation: getHandPresentation(combination),
|
|
283
|
+
pokes: combination
|
|
284
|
+
};
|
|
285
|
+
}).filter(function (item) {
|
|
286
|
+
return item.presentation === maxPresentation;
|
|
287
|
+
}).map(function (item) {
|
|
288
|
+
return item.pokes;
|
|
289
|
+
});
|
|
290
|
+
return {
|
|
291
|
+
presentation: maxPresentation,
|
|
292
|
+
pokes: maxPokes
|
|
293
|
+
};
|
|
294
|
+
}
|
|
262
295
|
/**
|
|
263
296
|
* @description 格式化展示牌信息
|
|
264
297
|
* @param input
|
package/dist/Deck/index.js
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _core = require("./core");
|
|
9
8
|
var _constant = require("./constant");
|
|
9
|
+
var _core = require("./core");
|
|
10
10
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
11
11
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
12
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -127,6 +127,18 @@ var Deck = /*#__PURE__*/function () {
|
|
|
127
127
|
var presentation = (0, _core.getBestPokesPresentation)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this));
|
|
128
128
|
return presentation[0];
|
|
129
129
|
}
|
|
130
|
+
}, {
|
|
131
|
+
key: "getMaxPokeCombinations",
|
|
132
|
+
value: function getMaxPokeCombinations() {
|
|
133
|
+
return (0, _core.getMaxPresentationAndPokes)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this)).pokes;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// 该方法是getMaxPokeCombinations&getMaxPresentation的组合
|
|
137
|
+
}, {
|
|
138
|
+
key: "getMaxPresentationAndPokes",
|
|
139
|
+
value: function getMaxPresentationAndPokes() {
|
|
140
|
+
return (0, _core.getMaxPresentationAndPokes)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this));
|
|
141
|
+
}
|
|
130
142
|
}]);
|
|
131
143
|
}();
|
|
132
144
|
function _createDeck() {
|
package/dist/Player/index.js
CHANGED
|
@@ -46,6 +46,8 @@ var _countDownTime = /*#__PURE__*/new WeakMap();
|
|
|
46
46
|
var _action = /*#__PURE__*/new WeakMap();
|
|
47
47
|
var _lowestBetAmount = /*#__PURE__*/new WeakMap();
|
|
48
48
|
var _currentStageTotalAmount = /*#__PURE__*/new WeakMap();
|
|
49
|
+
var _totalBetAmount = /*#__PURE__*/new WeakMap();
|
|
50
|
+
var _wager = /*#__PURE__*/new WeakMap();
|
|
49
51
|
var _lastPlayer = /*#__PURE__*/new WeakMap();
|
|
50
52
|
var _nextPlayer = /*#__PURE__*/new WeakMap();
|
|
51
53
|
var _timer = /*#__PURE__*/new WeakMap();
|
|
@@ -76,8 +78,7 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
76
78
|
} : _ref$reportError;
|
|
77
79
|
_classCallCheck(this, Player);
|
|
78
80
|
/**
|
|
79
|
-
*
|
|
80
|
-
* 防止预期外的行为
|
|
81
|
+
* 翻牌前大盲的「选项」: 已下大盲且无人加注, 轮到大盲选择过牌/加注/弃牌(无需再跟注)
|
|
81
82
|
*/
|
|
82
83
|
_classPrivateMethodInitSpec(this, _Player_brand);
|
|
83
84
|
/**
|
|
@@ -114,6 +115,14 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
114
115
|
* 当前阶段的下注总额, 全押筹码不够时可以小于此金额
|
|
115
116
|
*/
|
|
116
117
|
_classPrivateFieldInitSpec(this, _currentStageTotalAmount, 0);
|
|
118
|
+
/**
|
|
119
|
+
* 对局总下注额度
|
|
120
|
+
*/
|
|
121
|
+
_classPrivateFieldInitSpec(this, _totalBetAmount, 0);
|
|
122
|
+
/**
|
|
123
|
+
* 输赢情况
|
|
124
|
+
*/
|
|
125
|
+
_classPrivateFieldInitSpec(this, _wager, 0);
|
|
117
126
|
/**
|
|
118
127
|
* 指针指向上一个玩家, 庄家位的`lastPlayer`为`null`
|
|
119
128
|
*/
|
|
@@ -163,6 +172,22 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
163
172
|
set: function set(value) {
|
|
164
173
|
_classPrivateFieldSet(_currentStageTotalAmount, this, value);
|
|
165
174
|
}
|
|
175
|
+
}, {
|
|
176
|
+
key: "totalBetAmount",
|
|
177
|
+
get: function get() {
|
|
178
|
+
return _classPrivateFieldGet(_totalBetAmount, this);
|
|
179
|
+
},
|
|
180
|
+
set: function set(value) {
|
|
181
|
+
_classPrivateFieldSet(_totalBetAmount, this, value);
|
|
182
|
+
}
|
|
183
|
+
}, {
|
|
184
|
+
key: "wager",
|
|
185
|
+
get: function get() {
|
|
186
|
+
return _classPrivateFieldGet(_wager, this);
|
|
187
|
+
},
|
|
188
|
+
set: function set(value) {
|
|
189
|
+
_classPrivateFieldSet(_wager, this, value);
|
|
190
|
+
}
|
|
166
191
|
}, {
|
|
167
192
|
key: "id",
|
|
168
193
|
get: function get() {
|
|
@@ -245,6 +270,7 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
245
270
|
value: function reset() {
|
|
246
271
|
this.resetAction();
|
|
247
272
|
this.resetCurrentStageTotalAmount();
|
|
273
|
+
_classPrivateFieldSet(_totalBetAmount, this, 0);
|
|
248
274
|
_classPrivateFieldSet(_handPokes, this, []);
|
|
249
275
|
_classPrivateFieldSet(_presentation, this, undefined);
|
|
250
276
|
_classPrivateFieldSet(_status, this, 'waiting');
|
|
@@ -372,6 +398,7 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
372
398
|
while (1) switch (_context4.prev = _context4.next) {
|
|
373
399
|
case 0:
|
|
374
400
|
this.checkIfCanAct();
|
|
401
|
+
// 当前轮的最多下注额
|
|
375
402
|
maxBetAmount = Math.max.apply(Math, _toConsumableArray(_classPrivateFieldGet(_dealer, this).filter(function (p) {
|
|
376
403
|
return p !== _this;
|
|
377
404
|
}).map(function (p) {
|
|
@@ -442,6 +469,9 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
442
469
|
if (moneyShouldPay > this.balance) {
|
|
443
470
|
this.reportError(new _TexasError.default(2003, '跟注金额不可大于筹码总数'));
|
|
444
471
|
}
|
|
472
|
+
if (moneyShouldPay === this.balance) {
|
|
473
|
+
this.reportError(new _TexasError.default(2003, '跟注金额等于筹码总数, 应该全押, 不该调用call方法'));
|
|
474
|
+
}
|
|
445
475
|
_classPrivateFieldSet(_action, this, {
|
|
446
476
|
type: 'call',
|
|
447
477
|
payload: {
|
|
@@ -450,12 +480,12 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
450
480
|
});
|
|
451
481
|
_classPrivateFieldGet(_pool, this).add(this, moneyShouldPay);
|
|
452
482
|
_classPrivateFieldGet(_dealer, this).addAction(this);
|
|
453
|
-
_context5.next =
|
|
483
|
+
_context5.next = 12;
|
|
454
484
|
return (_classPrivateFieldGet6 = _classPrivateFieldGet(_callbackOfAction, this)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.call(this, this);
|
|
455
|
-
case
|
|
485
|
+
case 12:
|
|
456
486
|
console.log(_classPrivateFieldGet(_userInfo, this).name, '跟注:', moneyShouldPay);
|
|
457
487
|
this.transferControl();
|
|
458
|
-
case
|
|
488
|
+
case 14:
|
|
459
489
|
case "end":
|
|
460
490
|
return _context5.stop();
|
|
461
491
|
}
|
|
@@ -566,6 +596,9 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
566
596
|
if (_classPrivateFieldGet(_status, this) === 'allIn' || _classPrivateFieldGet(_status, this) === 'out') return false;
|
|
567
597
|
if (!_classPrivateFieldGet(_action, this)) return true;
|
|
568
598
|
|
|
599
|
+
// 翻牌前大盲具有最后行动权: 仅下过盲注视为未行动, 须给一次选择机会
|
|
600
|
+
if (_assertClassBrand(_Player_brand, this, _isBigBlindOptionInPreFlop).call(this) && _classPrivateFieldGet(_action, this).type === 'bet') return true;
|
|
601
|
+
|
|
569
602
|
// 当前的下注金额已经等于最大下注额
|
|
570
603
|
return _classPrivateFieldGet(_currentStageTotalAmount, this) !== this.getMaxBetAmountAtCurrentStage();
|
|
571
604
|
}
|
|
@@ -654,6 +687,7 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
654
687
|
key: "earn",
|
|
655
688
|
value: function earn(money) {
|
|
656
689
|
this.balance += money;
|
|
690
|
+
_classPrivateFieldSet(_wager, this, money - this.totalBetAmount);
|
|
657
691
|
console.log(_classPrivateFieldGet(_userInfo, this).name, '分得奖池金额:', money);
|
|
658
692
|
}
|
|
659
693
|
|
|
@@ -801,6 +835,13 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
801
835
|
}]);
|
|
802
836
|
}();
|
|
803
837
|
_Player = Player;
|
|
838
|
+
function _isBigBlindOptionInPreFlop() {
|
|
839
|
+
return _classPrivateFieldGet(_controller, this).stage === 'pre_flop' && _classPrivateFieldGet(_role, this) === 'big-blind' && _classPrivateFieldGet(_currentStageTotalAmount, this) >= this.getMaxBetAmountAtCurrentStage();
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* @description 获取玩家允许的行动列表
|
|
843
|
+
* 防止预期外的行为
|
|
844
|
+
*/
|
|
804
845
|
function _getAllowedActions() {
|
|
805
846
|
var _this4 = this;
|
|
806
847
|
var _helper = function helper(lastPlayer) {
|
|
@@ -842,6 +883,7 @@ function _getAllowedActions() {
|
|
|
842
883
|
return ['call', 'raise', 'fold', 'allIn'];
|
|
843
884
|
};
|
|
844
885
|
var result = _helper(_classPrivateFieldGet(_dealer, this).actionHistory[_classPrivateFieldGet(_dealer, this).actionHistory.length - 1]);
|
|
886
|
+
if (_assertClassBrand(_Player_brand, this, _isBigBlindOptionInPreFlop).call(this) && result.includes('call')) return ['check', 'raise', 'fold', 'allIn'];
|
|
845
887
|
return result;
|
|
846
888
|
}
|
|
847
889
|
var _default = exports.default = Player;
|
package/dist/Pool/index.js
CHANGED
|
@@ -80,7 +80,9 @@ var Pool = /*#__PURE__*/function () {
|
|
|
80
80
|
if (amount <= 0) this.reportError(new _TexasError.default(2001, '下注金额不可小于零'));
|
|
81
81
|
if (player.balance < amount) this.reportError(new _TexasError.default(2003, '玩家余额不足'));
|
|
82
82
|
player.balance -= amount;
|
|
83
|
+
player.wager -= amount;
|
|
83
84
|
player.currentStageTotalAmount += amount;
|
|
85
|
+
player.totalBetAmount += amount;
|
|
84
86
|
_classPrivateFieldSet(_totalAmount, this, _classPrivateFieldGet(_totalAmount, this) + amount);
|
|
85
87
|
_classPrivateFieldGet(_players, this).add(player);
|
|
86
88
|
_classPrivateFieldGet(_betRecords, this).set(player, (_classPrivateFieldGet(_betRecords, this).get(player) || 0) + amount);
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@ var _exportNames = {
|
|
|
9
9
|
TexasError: true,
|
|
10
10
|
Deck: true,
|
|
11
11
|
formatterPoke: true,
|
|
12
|
+
getBestPokesPresentation: true,
|
|
13
|
+
comparePresentation: true,
|
|
12
14
|
Dealer: true,
|
|
13
15
|
stageMap: true,
|
|
14
16
|
roleMap: true,
|
|
@@ -129,12 +131,24 @@ Object.defineProperty(exports, "actionMap", {
|
|
|
129
131
|
return _constant.actionMap;
|
|
130
132
|
}
|
|
131
133
|
});
|
|
134
|
+
Object.defineProperty(exports, "comparePresentation", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function get() {
|
|
137
|
+
return _core.comparePresentation;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
132
140
|
Object.defineProperty(exports, "formatterPoke", {
|
|
133
141
|
enumerable: true,
|
|
134
142
|
get: function get() {
|
|
135
143
|
return _core.formatterPoke;
|
|
136
144
|
}
|
|
137
145
|
});
|
|
146
|
+
Object.defineProperty(exports, "getBestPokesPresentation", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function get() {
|
|
149
|
+
return _core.getBestPokesPresentation;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
138
152
|
Object.defineProperty(exports, "roleMap", {
|
|
139
153
|
enumerable: true,
|
|
140
154
|
get: function get() {
|
package/dist/utils/index.js
CHANGED
|
@@ -21,13 +21,9 @@ var filterMap = exports.filterMap = function filterMap(callback, map) {
|
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
23
|
var everyMap = exports.everyMap = function everyMap(callback, map) {
|
|
24
|
-
var result =
|
|
24
|
+
var result = true;
|
|
25
25
|
map.forEach(function (value, key) {
|
|
26
|
-
|
|
27
|
-
result = callback(value, key);
|
|
28
|
-
} else {
|
|
29
|
-
result && (result = callback(value, key));
|
|
30
|
-
}
|
|
26
|
+
result && (result = callback(value, key));
|
|
31
27
|
});
|
|
32
28
|
return result;
|
|
33
29
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import Dealer from '../Dealer';
|
|
2
2
|
import { Player } from '../Player';
|
|
3
|
-
import { Poke } from '../Deck/constant';
|
|
3
|
+
import { Poke, handPokeType } from '../Deck/constant';
|
|
4
4
|
import { GameComponent, TexasErrorCallback } from '../Texas';
|
|
5
5
|
export type Stage = 'pre_flop' | 'flop' | 'turn' | 'river';
|
|
6
6
|
export type CallbackOfGameEnd = (params: {
|
|
7
7
|
restCommonPokes: Poke[];
|
|
8
8
|
currentStage: Stage;
|
|
9
9
|
showHandPokes: boolean;
|
|
10
|
+
maxPokes?: Poke[][];
|
|
11
|
+
maxPresentation?: handPokeType;
|
|
10
12
|
}) => void;
|
|
11
13
|
export type CallbackOnNextStage = (params: {
|
|
12
14
|
commonPokes: Poke[];
|
package/types/Deck/core.d.ts
CHANGED
|
@@ -30,6 +30,13 @@ export declare function getHandPresentation(input: Poke[]): string;
|
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
32
|
export declare function getBestHand(pokes: Poke[], commonPokes: Poke[]): Poke[];
|
|
33
|
+
/**
|
|
34
|
+
* @description 获取多个手牌组合中的所有牌型组合, 按照降序排列
|
|
35
|
+
* @param handPokes
|
|
36
|
+
* @param commonPokes
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
export declare function getSortedAllHandPokesCombinations(handPokes: Poke[][], commonPokes: Poke[]): ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
|
|
33
40
|
/**
|
|
34
41
|
* @description 获取多个手牌组合中的最大牌力值
|
|
35
42
|
* @param handPokes
|
|
@@ -37,6 +44,10 @@ export declare function getBestHand(pokes: Poke[], commonPokes: Poke[]): Poke[];
|
|
|
37
44
|
* @returns
|
|
38
45
|
*/
|
|
39
46
|
export declare function getBestPokesPresentation(handPokes: Poke[][], commonPokes: Poke[]): string;
|
|
47
|
+
export declare function getMaxPresentationAndPokes(handPokes: Poke[][], commonPokes: Poke[]): {
|
|
48
|
+
presentation: string;
|
|
49
|
+
pokes: ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
|
|
50
|
+
};
|
|
40
51
|
/**
|
|
41
52
|
* @description 格式化展示牌信息
|
|
42
53
|
* @param input
|
package/types/Deck/index.d.ts
CHANGED
|
@@ -22,5 +22,10 @@ declare class Deck {
|
|
|
22
22
|
};
|
|
23
23
|
getCards(): ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[];
|
|
24
24
|
getMaxPresentation(): handPokeType;
|
|
25
|
+
getMaxPokeCombinations(): ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
|
|
26
|
+
getMaxPresentationAndPokes(): {
|
|
27
|
+
presentation: string;
|
|
28
|
+
pokes: ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
|
|
29
|
+
};
|
|
25
30
|
}
|
|
26
31
|
export default Deck;
|
package/types/Player/index.d.ts
CHANGED
|
@@ -54,6 +54,10 @@ export declare class Player implements GameComponent {
|
|
|
54
54
|
set balance(value: number);
|
|
55
55
|
get currentStageTotalAmount(): number;
|
|
56
56
|
set currentStageTotalAmount(value: number);
|
|
57
|
+
get totalBetAmount(): number;
|
|
58
|
+
set totalBetAmount(value: number);
|
|
59
|
+
get wager(): number;
|
|
60
|
+
set wager(value: number);
|
|
57
61
|
get id(): number;
|
|
58
62
|
get lowestBetAmount(): number;
|
|
59
63
|
get thinkingTime(): number;
|
package/types/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ import { texasErrorMap, TexasErrorCode } from './TexasError/constant';
|
|
|
10
10
|
import { RoomStatus, default as Room, PlayerSeatStatus } from './Room';
|
|
11
11
|
import { User, Role, Action, ActionType, OnlineStatus, default as Player } from './Player';
|
|
12
12
|
export * from './Deck/constant';
|
|
13
|
+
export { getBestPokesPresentation, comparePresentation } from './Deck/core';
|
|
13
14
|
export { Player, User, ActionType, Role, Action, roleMap, actionMap, Stage, ControllerStatus, stageMap, Dealer, Deck, Room, RoomStatus, PlayerSeatStatus, formatterPoke, TexasError, TexasErrorCode, texasErrorMap, Texas, OnlineStatus };
|
package/types/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const getRandomInt: (min: number, max: number) => number;
|
|
2
2
|
export declare const sum: (a: number, b: number) => number;
|
|
3
3
|
export declare const filterMap: <T, K>(callback: (value: K, key: T) => boolean, map: Map<T, K>) => Map<T, K>;
|
|
4
|
-
export declare const everyMap: <T, K>(callback: (value: K, key: T) => boolean, map: Map<T, K>) =>
|
|
4
|
+
export declare const everyMap: <T, K>(callback: (value: K, key: T) => boolean, map: Map<T, K>) => boolean;
|