修改机器人作弊机率

This commit is contained in:
zhl 2021-03-09 12:47:49 +08:00
parent ad3e12011a
commit 43f0a21063
3 changed files with 43 additions and 14 deletions

View File

@ -66,8 +66,18 @@ export class GameEnv {
public petInheritRate: number
// 低级机器人的胜率值
public robotLvlLow: number
public robotRateLow: number
// 中等机器人的胜率值
public robotLvlMid: number
public robotRateMid: number
// 高级机器人的胜率值
public robotLvlHigh: number
public robotRateHigh: number
// 变态机器人的胜率值
public robotLvlExtra: number
public robotRateExtra: number
public init(data: Map<number, BaseCfg>) {
this.initCardNum = data.get(BaseConst.INIT_CARD_NUM).value
@ -106,6 +116,23 @@ export class GameEnv {
this.canEatAdv = !!data.get(BaseConst.CAN_EAT_ADV).value
this.petInheritRate = data.get(BaseConst.PET_INHERIT_RATE).value / 100
this.robotLvlLow = data.get(BaseConst.ROBOT_LVL_LOW).value
this.robotLvlMid = data.get(BaseConst.ROBOT_LVL_MID).value
this.robotLvlHigh = data.get(BaseConst.ROBOT_LVL_HIGHT).value
this.robotLvlExtra = data.get(BaseConst.ROBOT_LVL_EXTRA).value
this.robotRateLow = data.get(BaseConst.ROBOT_RATE_LOW).value
this.robotRateMid = data.get(BaseConst.ROBOT_RATE_MID).value
this.robotRateHigh = data.get(BaseConst.ROBOT_RATE_HIGHT).value
this.robotRateExtra = data.get(BaseConst.ROBOT_RATE_EXTRA).value
}
public getCheatRate(val: number) {
if (val < this.robotLvlLow) {
return this.robotRateLow
} else if (val < this.robotLvlMid) {
return this.robotRateMid
} else if (val < this.robotLvlHigh) {
return this.robotRateHigh
} else {
return this.robotRateExtra
}
}
}

View File

@ -64,8 +64,21 @@ export class BaseConst {
public static readonly PET_INHERIT_RATE = 99041
// 低级机器人的胜率值
public static readonly ROBOT_LVL_LOW = 99042
// 中等机器人胜率值
public static readonly ROBOT_LVL_MID = 99043
// 高级机器人的胜率值
public static readonly ROBOT_LVL_HIGHT = 99044
// 变态机器人胜率值
public static readonly ROBOT_LVL_EXTRA = 99045
// 低级机器人的胜率值
public static readonly ROBOT_RATE_LOW = 99046
// 中等机器人胜率值
public static readonly ROBOT_RATE_MID = 99047
// 高级机器人的胜率值
public static readonly ROBOT_RATE_HIGHT = 99048
// 变态机器人胜率值
public static readonly ROBOT_RATE_EXTRA = 99049
public static readonly COMPOUND = 'compound'
public static readonly EFFECTCARD = 'effectcard'

View File

@ -21,8 +21,6 @@ export class BeginGameCommand extends Command<CardGameState, {}> {
cardAll.randomSort()
// 如果是匹配模式, 挑战机器人作弊比率
if (this.state.mode == 1) {
let highRate = new GameEnv().robotLvlHigh / 100
let lowRate = new GameEnv().robotLvlLow / 100
for (let [, player] of this.state.players) {
if (!player.robot) {
continue
@ -46,21 +44,12 @@ export class BeginGameCommand extends Command<CardGameState, {}> {
}
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 }`)
let rate = new GameEnv().getCheatRate(oplayer.winRate * 100)
if (rate) {
debugRoom(`opposite play win rate: ${ oplayer.winRate }, robot cheat 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 })
}
}
}