From c175acb1651f7ef4b30af2ac157f7e563c6b69b7 Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 5 Mar 2021 18:32:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B5=8B=E8=AF=95=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E6=9C=BA=E5=99=A8=E4=BA=BA=E4=BD=9C=E5=BC=8A?= =?UTF-8?q?=E7=9A=84=E6=9C=BA=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/commands/BeginGameCommand.ts | 20 +++++++++++--------- src/utils/assistant.util.ts | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/rooms/commands/BeginGameCommand.ts b/src/rooms/commands/BeginGameCommand.ts index 8c3c704..7a26e4a 100644 --- a/src/rooms/commands/BeginGameCommand.ts +++ b/src/rooms/commands/BeginGameCommand.ts @@ -45,20 +45,22 @@ export class BeginGameCommand extends Command { } } - let rate = 0 - if (oplayer.winRate > highRate) { - rate = oplayer.winRate * 100 | 0 - } else if (oplayer.winRate > lowRate) { - rate = oplayer.winRate / 2 * 100 | 0 - } - debugRoom(`opposite play win rate: ${oplayer.winRate}, robot change rate: ${rate}`) + let assistClient = this.room.getAssistClient(player.id) if (global.isProd) { + let rate = 0 + if (oplayer.winRate > highRate) { + rate = oplayer.winRate * 100 | 0 + } else if (oplayer.winRate > lowRate) { + rate = oplayer.winRate / 2 * 100 | 0 + } + debugRoom(`opposite play win rate: ${ oplayer.winRate }, robot change rate: ${ rate }`) client.send('update_change_rate', { val: rate }) + assistClient.send('update_change_rate', { val: rate }) } else { client.send('update_change_rate', { val: 100 }) + assistClient.send('update_change_rate', { val: 100 }) } - let assistClient = this.room.getAssistClient(player.id) - assistClient.send('update_change_rate', { val: rate }) + } } diff --git a/src/utils/assistant.util.ts b/src/utils/assistant.util.ts index 6e0a3c8..d7b74b1 100644 --- a/src/utils/assistant.util.ts +++ b/src/utils/assistant.util.ts @@ -122,7 +122,7 @@ let assistantUtil = { robotLog(`begin cheat ^_^`) let random = getRandom(0, 100) if (random <= rate) { - let max = Math.min(maxCount+1, cardArr.length + 1) + let max = Math.min(maxCount+2, cardArr.length + 1) let randomCount = getRandom(maxCount, max) let resultCards: Card[] = cardArr.randomGet(randomCount) let sameVal = false