From 39f200f2776b989933e374ae39824e13c1cb9b79 Mon Sep 17 00:00:00 2001 From: Parsons Date: Tue, 20 Aug 2024 23:32:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=B7=E8=A2=AB=E8=A6=81=E6=B1=82?= =?UTF-8?q?=E5=87=BA=E6=AE=BA=E6=99=82=EF=BC=8C=E5=8F=AA=E8=83=BD=E5=87=BA?= =?UTF-8?q?=E6=AE=BA=EF=BC=8C=E4=B8=94=E4=B8=8D=E8=83=BD=E5=87=BA=E7=9A=84?= =?UTF-8?q?=E7=89=8C=E8=AE=8A=E6=9A=97=E9=A1=AF=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/classes/MainPlayer.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/classes/MainPlayer.ts b/src/classes/MainPlayer.ts index 7e3cfa9..11ade70 100644 --- a/src/classes/MainPlayer.ts +++ b/src/classes/MainPlayer.ts @@ -27,6 +27,7 @@ export default class MainPlayer extends Player { game: Game | null = null discardCardsAction: ([]) => void = ([]) => {} mainInstanceMap: { [key: string]: Phaser.GameObjects.Container } = {} + event: string = '' constructor({ id, generral, @@ -52,7 +53,7 @@ export default class MainPlayer extends Player { hp: number hand: { size: number - cards: string[] + cardIds: string[] } equipments: ThreeKingdomsCardIds[] delayScrolls: string[] @@ -191,6 +192,12 @@ export default class MainPlayer extends Player { this.reactionType = '' if (this.skipInstance) this.skipInstance.setAlpha(0) if (this.hintInstance) this.hintInstance.setAlpha(0) + if (this.event === 'AskKillEvent') { + this.handCards.forEach((card) => { + card.instance.setAlpha(1) + }) + this.event = '' + } }) // 提示文字 const hintText = scene.add.text(0, 0, '請選擇要棄的牌', { @@ -245,6 +252,15 @@ export default class MainPlayer extends Player { if (this.game.getActivePlayer() !== this.id) { return } + if (this.event === 'AskKillEvent') { + if (card.name !== '殺') { + return + } else { + this.handCards.forEach((card) => { + card.instance.setAlpha(1) + }) + } + } if (this.discardMode) { if (card.selected) { card.selected = false @@ -440,10 +456,17 @@ export default class MainPlayer extends Player { }, }) } else if (reactionType === 'askKill') { + this.event = 'AskKillEvent' const hintText: Phaser.GameObjects.Text = this.hintInstance.getAt(0) hintText?.setText('請出一張殺') this.hintInstance?.setAlpha(1) this.skipInstance?.setAlpha(1) + // 只能出殺 其他不能出 + this.handCards.forEach((card) => { + if (card.name !== '殺') { + card.instance.setAlpha(0.3) + } + }) } } updatePlayerData(data: any): void {