Skip to content

Commit

Permalink
fix(chess): fix first-step repent
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Mar 21, 2021
1 parent e814fc9 commit e7785ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-chess/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ export function apply(ctx: Context) {
}

if (options.skip) {
if (!state.next) return '尚未有人行棋。'
if (!state.next) return '对局尚未开始。'
if (state.next !== userId) return '当前不是你的回合。'
state.next = state.p1 === userId ? state.p2 : state.p1
channel.chess = state.serial()
return `${session.username} 选择跳过其回合,下一手轮到 ${segment.at(state.next)}。`
}

if (options.repent) {
if (!state.next) return '尚未有人行棋。'
if (!state.next) return '对局尚未开始。'
const last = state.p1 === state.next ? state.p2 : state.p1
if (last !== userId) return '上一手棋不是你所下。'
state.history.pop()
Expand Down

0 comments on commit e7785ca

Please sign in to comment.