From e7eca38ef47417130950b1de0fe7e6d99298bb8a Mon Sep 17 00:00:00 2001 From: mengxinzxz <2223529500@qq.com> Date: Thu, 18 Apr 2024 20:01:49 +0800 Subject: [PATCH] =?UTF-8?q?chooseCard=E6=B7=BB=E5=8A=A0autochoose?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/library/element/content.js | 10 ++++++++++ noname/library/element/player.js | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/noname/library/element/content.js b/noname/library/element/content.js index 7ed9cb15c..0cd1bda8a 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -5296,6 +5296,16 @@ export const Content = { bool: true, links: [], }; + } else if (event.autochoose()) { + event.result = { + bool: true, + autochoose: true, + cards: player.getCards(event.position), + confirm: "ok", + buttons: [], + targets: [], + links: [], + }; } else { if (event.isMine()) { game.check(); diff --git a/noname/library/element/player.js b/noname/library/element/player.js index a032847db..a8a1a244c 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -4776,6 +4776,11 @@ export class Player extends HTMLDivElement { if (next.filterCard == undefined) next.filterCard = lib.filter.all; if (next.selectCard == undefined) next.selectCard = [1, 1]; if (next.ai == undefined) next.ai = get.unuseful3; + next.autochoose = function () { + if (!this.forced) return false; + if (typeof this.selectCard == "function") return false; + return get.select(this.selectCard)[0] >= this.player.countCards(this.position); + }; next.setContent("chooseCard"); next._args = Array.from(arguments); return next;