调整测试模式下机器人作弊的机率

This commit is contained in:
zhl 2021-03-05 18:32:23 +08:00
parent 579a3dd318
commit c175acb165
2 changed files with 12 additions and 10 deletions

View File

@ -45,20 +45,22 @@ export class BeginGameCommand extends Command<CardGameState, {}> {
}
}
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 })
}
}

View File

@ -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