修改机器人默认参数

This commit is contained in:
zhl 2021-03-19 16:35:06 +08:00
parent a0792dcbd5
commit 10eba07531

View File

@ -24,6 +24,7 @@ export class Robot {
this.host = host
this.roomId = roomId
this.client = new Client(host)
this.updateRobotCfg(0)
}
async connect() {
@ -70,12 +71,7 @@ export class Robot {
}
break
case 'update_robot_level':
const { cheatRate, noEatRate, noTripleRate } = new GameEnv().getRobotCfg(data.lvl)
log(`update robot lvl to: ${data.lvl}, cheatRate: ${cheatRate}, noEatRate: ${noEatRate}, noTripleRate: ${noTripleRate}`)
this.lvl = data.lvl
this.cheatRate = cheatRate
this.noEatRate = noEatRate
this.noTripleRate = noTripleRate
self.updateRobotCfg(data.lvl)
break
}
})
@ -137,7 +133,14 @@ export class Robot {
this.room.send(messageType, message)
}
private updateRobotCfg(lvl: number) {
const { cheatRate, noEatRate, noTripleRate } = new GameEnv().getRobotCfg(lvl)
log(`update robot lvl to: ${lvl}, cheatRate: ${cheatRate}, noEatRate: ${noEatRate}, noTripleRate: ${noTripleRate}`)
this.lvl = lvl
this.cheatRate = cheatRate
this.noEatRate = noEatRate
this.noTripleRate = noTripleRate
}
// >>>>>>>>>>>>>>>>>> begin
/**
*