texas-poker-core 1.4.13 → 1.4.16
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 +24 -4
- package/dist/Controller/constants.js +1 -1
- package/dist/Deck/core.js +4 -0
- package/dist/Player/index.js +40 -20
- package/package.json +1 -1
- package/types/Player/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -433,14 +433,34 @@ bufix
|
|
|
433
433
|
增加类型到处
|
|
434
434
|
|
|
435
435
|
## 1.4.8
|
|
436
|
-
|
|
436
|
+
|
|
437
|
+
texas 实例新增 beforeStageAdvance,beforeNextPlayerTurn
|
|
438
|
+
|
|
437
439
|
## 1.4.9
|
|
438
|
-
|
|
440
|
+
|
|
441
|
+
修复 min,max 逻辑错误
|
|
442
|
+
|
|
439
443
|
## 1.4.10
|
|
444
|
+
|
|
440
445
|
增加新一轮重拍角色方法
|
|
446
|
+
|
|
441
447
|
## 1.4.11
|
|
448
|
+
|
|
442
449
|
修改游戏结算时的逻辑遗漏
|
|
450
|
+
|
|
443
451
|
## 1.4.12
|
|
444
|
-
|
|
452
|
+
|
|
453
|
+
修复 wager 局后未清空的问题
|
|
454
|
+
|
|
445
455
|
## 1.4.13
|
|
446
|
-
|
|
456
|
+
|
|
457
|
+
gameEnd 事件增加 pokesRevealed 字段用于入库
|
|
458
|
+
|
|
459
|
+
## 1.4.14
|
|
460
|
+
|
|
461
|
+
fix: 修复结算金额分配异常
|
|
462
|
+
|
|
463
|
+
## 1.4.15
|
|
464
|
+
允许玩家全押时下注所有筹码
|
|
465
|
+
## 1.4.16
|
|
466
|
+
允许玩家全押时下注所有筹码
|
|
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.stageMap = void 0;
|
|
7
7
|
var _ = require(".");
|
|
8
|
-
var stageMap = exports.stageMap = new Map([[_.StageEnum.PRE_FLOP, '翻牌前'], [_.StageEnum.FLOP, '翻牌圈'], [_.StageEnum.TURN, '转牌圈'], [_.StageEnum.RIVER, '
|
|
8
|
+
var stageMap = exports.stageMap = new Map([[_.StageEnum.PRE_FLOP, '翻牌前'], [_.StageEnum.FLOP, '翻牌圈'], [_.StageEnum.TURN, '转牌圈'], [_.StageEnum.RIVER, '河牌圈']]);
|
package/dist/Deck/core.js
CHANGED
|
@@ -412,7 +412,11 @@ var getWinners = exports.getWinners = function getWinners(players) {
|
|
|
412
412
|
}).map(function (player) {
|
|
413
413
|
return player.rankStrength;
|
|
414
414
|
})));
|
|
415
|
+
// 还好通过数据分析这里
|
|
416
|
+
// 这里需要过滤弃牌的玩家, 在场玩家去比大小
|
|
415
417
|
return players.filter(function (p) {
|
|
418
|
+
return p.getStatus() !== 'out';
|
|
419
|
+
}).filter(function (p) {
|
|
416
420
|
return p.rankStrength === maxRankStrength;
|
|
417
421
|
});
|
|
418
422
|
};
|
package/dist/Player/index.js
CHANGED
|
@@ -476,6 +476,12 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
476
476
|
lowestBetAmount: _classPrivateFieldGet(_lowestBetAmount, this)
|
|
477
477
|
})));
|
|
478
478
|
case 8:
|
|
479
|
+
if (!(money === this.balance)) {
|
|
480
|
+
_context3.next = 10;
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
return _context3.abrupt("return", this.allIn());
|
|
484
|
+
case 10:
|
|
479
485
|
_classPrivateFieldSet(_action, this, {
|
|
480
486
|
type: _constant.ActionTypeEnum.BET,
|
|
481
487
|
payload: {
|
|
@@ -494,18 +500,18 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
494
500
|
}
|
|
495
501
|
});
|
|
496
502
|
_classPrivateFieldGet(_dealer, this).addAction(this);
|
|
497
|
-
_context3.next =
|
|
503
|
+
_context3.next = 16;
|
|
498
504
|
return (_classPrivateFieldGet4 = _classPrivateFieldGet(_callbackOfAction, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.call(this, this, preFlopDefaultAction);
|
|
499
|
-
case
|
|
505
|
+
case 16:
|
|
500
506
|
if (preFlopDefaultAction) {
|
|
501
|
-
_context3.next =
|
|
507
|
+
_context3.next = 19;
|
|
502
508
|
break;
|
|
503
509
|
}
|
|
504
|
-
_context3.next =
|
|
510
|
+
_context3.next = 19;
|
|
505
511
|
return this.transferControl();
|
|
506
|
-
case
|
|
512
|
+
case 19:
|
|
507
513
|
return _context3.abrupt("return", money);
|
|
508
|
-
case
|
|
514
|
+
case 20:
|
|
509
515
|
case "end":
|
|
510
516
|
return _context3.stop();
|
|
511
517
|
}
|
|
@@ -566,6 +572,12 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
566
572
|
attemptedTotal: money + _classPrivateFieldGet(_currentStageTotalAmount, this)
|
|
567
573
|
})));
|
|
568
574
|
case 10:
|
|
575
|
+
if (!(money === this.balance)) {
|
|
576
|
+
_context4.next = 12;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
return _context4.abrupt("return", this.allIn());
|
|
580
|
+
case 12:
|
|
569
581
|
_classPrivateFieldGet(_pool, this).add(this, money);
|
|
570
582
|
_classPrivateFieldSet(_action, this, {
|
|
571
583
|
type: _constant.ActionTypeEnum.RAISE,
|
|
@@ -574,9 +586,9 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
574
586
|
}
|
|
575
587
|
});
|
|
576
588
|
_classPrivateFieldGet(_dealer, this).addAction(this);
|
|
577
|
-
_context4.next =
|
|
589
|
+
_context4.next = 17;
|
|
578
590
|
return (_classPrivateFieldGet5 = _classPrivateFieldGet(_callbackOfAction, this)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.call(this, this);
|
|
579
|
-
case
|
|
591
|
+
case 17:
|
|
580
592
|
_TexasEngineContext.TexasEngineContext.emitTrace({
|
|
581
593
|
channel: 'player',
|
|
582
594
|
name: 'raise',
|
|
@@ -586,9 +598,9 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
586
598
|
money: money
|
|
587
599
|
}
|
|
588
600
|
});
|
|
589
|
-
_context4.next =
|
|
601
|
+
_context4.next = 20;
|
|
590
602
|
return this.transferControl();
|
|
591
|
-
case
|
|
603
|
+
case 20:
|
|
592
604
|
case "end":
|
|
593
605
|
return _context4.stop();
|
|
594
606
|
}
|
|
@@ -681,7 +693,7 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
681
693
|
value: function () {
|
|
682
694
|
var _allIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
683
695
|
var _classPrivateFieldGet7;
|
|
684
|
-
var
|
|
696
|
+
var moneyShouldPay;
|
|
685
697
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
686
698
|
while (1) switch (_context6.prev = _context6.next) {
|
|
687
699
|
case 0:
|
|
@@ -693,17 +705,25 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
693
705
|
return _context6.abrupt("return", this.fail(new _TexasError.default(_TexasError.TexasCoreErrorCode.PLAYER_CANNOT_ALL_IN)));
|
|
694
706
|
case 3:
|
|
695
707
|
// 其他玩家持有筹码的最大值, 全押金额不可超过该值
|
|
696
|
-
maxAllInAmount = this.getMaxAllInAmount()
|
|
697
|
-
moneyShouldPay = Math.min(
|
|
708
|
+
// const maxAllInAmount = this.getMaxAllInAmount()
|
|
709
|
+
// const moneyShouldPay = Math.min(
|
|
710
|
+
// Math.max(
|
|
711
|
+
// maxAllInAmount - this.#currentStageTotalAmount,
|
|
712
|
+
// this.#lowestBetAmount
|
|
713
|
+
// ),
|
|
714
|
+
// this.balance
|
|
715
|
+
// )
|
|
716
|
+
// fix: 允许玩家全押所有筹码, 多的进入边池就行
|
|
717
|
+
moneyShouldPay = this.balance;
|
|
698
718
|
if (!(moneyShouldPay <= 0)) {
|
|
699
|
-
_context6.next =
|
|
719
|
+
_context6.next = 6;
|
|
700
720
|
break;
|
|
701
721
|
}
|
|
702
722
|
return _context6.abrupt("return", this.fail(new _TexasError.default(_TexasError.TexasCoreErrorCode.PLAYER_ALL_IN_INVALID, {
|
|
703
723
|
moneyShouldPay: moneyShouldPay,
|
|
704
724
|
balance: this.balance
|
|
705
725
|
})));
|
|
706
|
-
case
|
|
726
|
+
case 6:
|
|
707
727
|
_classPrivateFieldGet(_pool, this).add(this, moneyShouldPay);
|
|
708
728
|
_classPrivateFieldSet(_action, this, {
|
|
709
729
|
type: _constant.ActionTypeEnum.ALL_IN,
|
|
@@ -713,9 +733,9 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
713
733
|
});
|
|
714
734
|
_classPrivateFieldSet(_status, this, 'allIn');
|
|
715
735
|
_classPrivateFieldGet(_dealer, this).addAction(this);
|
|
716
|
-
_context6.next =
|
|
736
|
+
_context6.next = 12;
|
|
717
737
|
return (_classPrivateFieldGet7 = _classPrivateFieldGet(_callbackOfAction, this)) === null || _classPrivateFieldGet7 === void 0 ? void 0 : _classPrivateFieldGet7.call(this, this);
|
|
718
|
-
case
|
|
738
|
+
case 12:
|
|
719
739
|
_TexasEngineContext.TexasEngineContext.emitTrace({
|
|
720
740
|
channel: 'player',
|
|
721
741
|
name: 'all_in',
|
|
@@ -726,11 +746,11 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
726
746
|
balance: this.balance
|
|
727
747
|
}
|
|
728
748
|
});
|
|
729
|
-
_context6.next =
|
|
749
|
+
_context6.next = 15;
|
|
730
750
|
return this.transferControl();
|
|
731
|
-
case
|
|
751
|
+
case 15:
|
|
732
752
|
return _context6.abrupt("return", moneyShouldPay);
|
|
733
|
-
case
|
|
753
|
+
case 16:
|
|
734
754
|
case "end":
|
|
735
755
|
return _context6.stop();
|
|
736
756
|
}
|
package/package.json
CHANGED
package/types/Player/index.d.ts
CHANGED
|
@@ -89,7 +89,7 @@ export declare class Player implements GameComponent {
|
|
|
89
89
|
check(): Promise<undefined>;
|
|
90
90
|
fold(): Promise<undefined>;
|
|
91
91
|
bet(money: number, preFlopDefaultAction?: boolean): Promise<number>;
|
|
92
|
-
raise(money: number): Promise<undefined>;
|
|
92
|
+
raise(money: number): Promise<number | undefined>;
|
|
93
93
|
call(): Promise<undefined>;
|
|
94
94
|
allIn(): Promise<number>;
|
|
95
95
|
/**
|