Commit c67bfeb5 authored by Tt's avatar Tt

完成

parent 26b6f182
This diff is collapsed.
......@@ -8,7 +8,7 @@ export class AI {
Red: 0,
Blue: 0,
letter: "",
current: "Blue",
current: "Red",
};
constructor(networkHelper: NetworkHelper, playerData: any) {
......@@ -49,12 +49,21 @@ export class AI {
//调试加速 2 Math.random() * 3 + 4
await asyncDelay(Math.random() * 3 + 4);
const idx = this.getNextRightIdx();
this.networkHelper.sendFrame({
type: "right",
idx: idx,
uuid: this.playerData.uuid,
color: this.playerData.color,
});
if (Math.random() < 0.8) {
this.networkHelper.sendFrame({
type: "right",
idx: idx,
uuid: this.playerData.uuid,
color: this.playerData.color,
});
} else {
this.networkHelper.sendFrame({
type: "wrong",
uuid: this.playerData.uuid,
color: this.playerData.color,
});
}
}
}
}
......
......@@ -58,7 +58,7 @@ export class GameServer {
name: this.nameList.splice(0, 1)[0],
uuid: player.uuid,
color:
player.uuid == this.networkHelper.room.roomInfo.owner ? "Blue" : "Red",
player.uuid == this.networkHelper.room.roomInfo.owner ? "Red" : "Blue",
isAI: player.isAI,
headUrl: this.headUrls.splice(0, 1)[0],
});
......@@ -82,7 +82,7 @@ export class GameServer {
Red: 0,
Blue: 0,
letter: "",
current: "Blue",
current: "Red",
};
startGame() {
this.networkHelper.sendFrame({
......@@ -108,13 +108,13 @@ export class GameServer {
const playerInfo = {
uuid: "ai_" + i,
isAI: true,
color: "Red",
color: "Blue",
};
this._aiPlayerList.push(new AI(this.networkHelper, playerInfo));
this.addPlayer(playerInfo);
}
//TODO:调试加速
}, 1000)//RandomInt(10000, 15000)
}, 10000)//RandomInt(10000, 15000)
);
}
}
......@@ -128,9 +128,9 @@ export class GameServer {
console.log('letterList: ', letterList);
if (letterList.length > 0) {
if (this.gameStatus.letter == "") {
// let max = Math.max(letterList.length - 2, 0);
// let max = Math.max(9, 0);
// let letter = letterList[max];//[RandomInt(letterList.length) % 3];//转盘只有1-3
// if (this.gameStatus.current != 'Blue') {
// if (this.gameStatus.current == 'Blue') {
// letter = letterList[0]
// }
let letter = letterList[RandomInt(letterList.length) % 3];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment