修正比大小模式下的一些ug

This commit is contained in:
zhl 2021-03-30 16:07:16 +08:00
parent ed36bc0371
commit 7c18cf8454
4 changed files with 24 additions and 16 deletions

View File

@ -223,13 +223,18 @@ export class Robot {
let repData: any = {
cards: cardIds
}
if (hasEatCard) {
repData.target = targetCard.id
if (this.room.state.mode === 4) {
self.reply('dice_card_c2s', repData)
} else {
if (hasEatCard) {
repData.target = targetCard.id
}
if (result.nums) {
repData.nums = result.nums
}
self.reply('discard_card_c2s', repData)
}
if (result.nums) {
repData.nums = result.nums
}
self.reply('discard_card_c2s', repData)
}
/**

View File

@ -183,13 +183,18 @@ export class RobotClient implements Client {
let repData: any = {
cards: cardIds
}
if (hasEatCard) {
repData.target = targetCard.id
if (this.svrstate.mode === 4) {
self.reply('dice_card_c2s', repData)
} else {
if (hasEatCard) {
repData.target = targetCard.id
}
if (result.nums) {
repData.nums = result.nums
}
self.reply('discard_card_c2s', repData)
}
if (result.nums) {
repData.nums = result.nums
}
self.reply('discard_card_c2s', repData)
}
/**

View File

@ -53,7 +53,7 @@ export class ChangeCardCommand extends Command<CardGameState, { client: Client,
}
if (finishCount >= this.room.maxClients) {
// TODO:: 根据 this.state.firstPlayer确定先手
if (this.state.mode === 4) {
if (this.state.mode !== 4) {
// 正式开始游戏, 第一个玩家出牌
this.state.updateGameState(GameStateConst.STATE_BEGIN_DRAW)
return [new NextTurnCommand()]

View File

@ -14,7 +14,6 @@ export class DiceResultCommand extends Command<CardGameState, { timeUp: boolean
this.state.updateGameState(GameStateConst.STATE_DICE_RESULT)
let max = 0
let winner
let resultMap: any = {}
let cardIds = []
for (let [pid, cardArr] of tmpActionMap) {
const cards = cardArr as Card[]
@ -29,13 +28,12 @@ export class DiceResultCommand extends Command<CardGameState, { timeUp: boolean
cardIds.push(card.id)
}
ap = ap * doubleCount
resultMap.push([pid, cardIds])
if (ap > max) {
max = ap
winner = pid
}
}
this.room.broadcast('dice_result_s2c', {winner, tatal: max, results: resultMap})
this.room.broadcast('dice_result_s2c', {winner, tatal: max })
let player = this.state.players.get(winner)
const time = this.room.battleMan.onPlayerRoundWin(player)
await this.delay(time)