From a27e45a024846919a99471efa80e60f5b44d68d7 Mon Sep 17 00:00:00 2001 From: st2411020104 Date: Thu, 8 Jan 2026 18:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAI=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E6=AD=A5=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=9E=E5=90=88=E6=B5=81=E7=A8=8B=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/game.js b/game.js index 4c79f21..9f83fd7 100644 --- a/game.js +++ b/game.js @@ -1128,6 +1128,11 @@ class Game { this.addLog(`${player.character.name} 对 ${target.character.name} 使用了【火攻】`); this.showCardUseAnimation(); + if (target.hand.length === 0) { + this.addLog('目标没有手牌,火攻无效'); + return false; + } + const randomCardIndex = Math.floor(Math.random() * target.hand.length); const randomCard = target.hand[randomCardIndex]; this.addLog(`${target.character.name} 展示了一张 ${randomCard.name}`); @@ -1492,7 +1497,6 @@ class Game { } aiPlayCards(player) { - const targets = this.players.filter(p => p.isAlive && p.index !== player.index); const canUseMultipleAttacks = this.hasWeaponWithEffect('zhugeliannu') || player.character.name === '张飞'; const cardPriority = [ @@ -1513,6 +1517,11 @@ class Game { ]; const playNextCard = () => { + if (this.gameOver || this.getCurrentPlayer().index !== player.index) { + return; + } + + const targets = this.players.filter(p => p.isAlive && p.index !== player.index); let cardsUsed = false; if (player.character.name === '刘备' && player.hand.length >= 2) { @@ -1577,7 +1586,7 @@ class Game { targetIndex = this[priority.target](player, targets); } - if (targetIndex !== -1 || !priority.target) { + if (targetIndex !== -1 || !priority.target || priority.isEquip) { const result = this.playCard(cardIndex, targetIndex); if (result) { cardsUsed = true;