chooseToDiscard和chooseCard的autochoose机制优化

This commit is contained in:
mengxinzxz 2024-04-19 00:34:41 +08:00
parent 8df58c02e8
commit 164628ff73
1 changed files with 5 additions and 0 deletions

View File

@ -4522,7 +4522,9 @@ export class Player extends HTMLDivElement {
next.autochoose = function () { next.autochoose = function () {
if (!this.forced) return false; if (!this.forced) return false;
if (typeof this.selectCard == "function") return false; if (typeof this.selectCard == "function") return false;
if (this.complexCard || this.complexSelect || this.filterOk) return false;
var cards = this.player.getCards(this.position); var cards = this.player.getCards(this.position);
if (cards.some(card => !this.filterCard(card, this))) return false;
var num = cards.length; var num = cards.length;
for (var i = 0; i < cards.length; i++) { for (var i = 0; i < cards.length; i++) {
if (!lib.filter.cardDiscardable(cards[i], this.player, this)) num--; if (!lib.filter.cardDiscardable(cards[i], this.player, this)) num--;
@ -4779,6 +4781,9 @@ export class Player extends HTMLDivElement {
next.autochoose = function () { next.autochoose = function () {
if (!this.forced) return false; if (!this.forced) return false;
if (typeof this.selectCard == "function") return false; if (typeof this.selectCard == "function") return false;
if (this.complexCard || this.complexSelect || this.filterOk) return false;
var cards = this.player.getCards(this.position);
if (cards.some(card => !this.filterCard(card, this))) return false;
return get.select(this.selectCard)[0] >= this.player.countCards(this.position); return get.select(this.selectCard)[0] >= this.player.countCards(this.position);
}; };
next.setContent("chooseCard"); next.setContent("chooseCard");