Wait for the host to press "next hand" on every table

Previously only the review CPU table paused after each hand; cash-only,
friends and CPU tables moved on automatically after a short delay. Now
every table keeps the result on screen until the host presses 次のハンドへ,
and the next hand is dealt right away. If the host has left, the new host
presses it; with no human seated the table still advances on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
野口煌陽andClaude Opus 5.5 committed 2026-10-30 22:56:37 +09:00
1 parent 22ee28ba03
commit f64c502086
8 files changed
+103 -31

No files matched your search

+23 -14
View File
@@ -42,8 +42,8 @@ class Table {
this.pendingSeating = null; // ホストが決めた席順(時計回りのトークン)。ハンド中は次のハンドの始めに並べ替える
this.withBots = this.mode === 'cpu' || this.mode === 'review';
if (this.withBots) this.seatBots(opts.cpuCount);
// レビュー付きCPU戦: session = 保存する対局、last = 直前のハンドのレビュー、waiting = 次のハンドへ進むのを待っている
this.review = this.mode === 'review' ? { session: null, last: null, waiting: false } : null;
// レビュー付きCPU戦: session = 保存する対局、last = 直前のハンドのレビュー
this.review = this.mode === 'review' ? { session: null, last: null } : null;
this.hand = null;
this.started = false;
this.paused = false;
@@ -119,6 +119,24 @@ class Table {
.filter((i) => i >= 0);
}
// ハンドが終わったら、ホストが「次のハンドへ」を押すまで次のハンドを始めない
// (ホストが着席していなければ待たずに進める)
get awaitingNext() {
const h = this.hand;
if (!h || !h.finished || h.nextApproved) return false;
const host = this.seatOf(this.hostToken);
return host >= 0 && !this.seats[host].left;
}
nextHand(token, now = Date.now()) {
if (!this.isHost(token)) return 'ホストのみ操作できます';
if (this.paused) return '一時停止中です';
if (!this.awaitingNext) return 'ハンドが終わっていません';
this.hand.nextApproved = true;
this.nextHandAt = now; // 待たずに次の tick で始める
return null;
}
// CPU だけでハンドを続けても意味がないので、人間が1人は参加している必要がある
canDeal() {
const eligible = this.eligibleSeats();
@@ -201,7 +219,6 @@ class Table {
order.push(i);
}
this.handNumber++;
if (this.review) this.review.waiting = false;
const { sb, bb } = this.blinds;
this.nextHandAt = null;
this.runoutAt = null;
@@ -388,7 +405,7 @@ class Table {
this.reviewHand();
changed = true;
}
if (this.hand && this.hand.finished && this.review && this.review.waiting) return changed;
if (this.awaitingNext) return changed;
if (this.hand && this.hand.finished) {
if (this.nextHandAt == null) {
@@ -436,7 +453,7 @@ class Table {
// ---- レビュー付きCPU戦 ----
// 終わったハンドのレビューを作って保存し、作成者が見終わるまで次のハンドを待つ
// 終わったハンドのレビューを作って保存する(作成者が見終わって「次のハンドへ」を押すまで次のハンドは始まらない)
reviewHand() {
const h = this.hand;
h.reviewed = true;
@@ -458,14 +475,6 @@ class Table {
}
reviews.addHand(this.review.session, record);
this.review.last = record;
this.review.waiting = !this.seats[hero].left;
}
reviewNext(token) {
if (!this.review) return 'レビュー付きのテーブルではありません';
if (!this.isHost(token)) return '操作できません';
this.review.waiting = false;
return null;
}
// 作成者に送るレビュー(直前のハンドの要約)
@@ -476,7 +485,6 @@ class Table {
const scores = hands.map((x) => x.handScore).filter((x) => x != null);
return {
sessionId: r.session ? r.session.id : null,
waiting: r.waiting,
hands: hands.length,
average: scores.length ? Math.round(scores.reduce((a, b) => a + b, 0) / scores.length) : null,
last: last && {
@@ -565,6 +573,7 @@ class Table {
phase: this.phase,
started: this.started,
paused: this.paused,
awaitingNext: this.awaitingNext,
handNumber: this.handNumber,
hand: hv,
toAct: this.handActive ? h.toAct : null,