feedback3 WC: readying with funds left asks first (the prep end wipes them); never for 坎诺特, at 0 funds or under AI 托管

This commit is contained in:
sganggs committed 2026-10-04 17:12:24 +08:00
1 parent 6bf03d07d5
commit db57c39c7a
4 files changed
+104 -3

No files matched your search

+18 -2
View File
@@ -62,7 +62,7 @@
import { useCallback, useEffect, useMemo, useRef, useState } from '../../vendor/hooks.module.js';
import { PHASE, GEO } from '../../../shared/constants.js';
import { fxForm } from '../../../shared/protocol.js';
import { html, Spinner, PhaseBanner, Icon, Button, MicroLabel, confirmDialog, useTicker } from '../ui/components.js';
import { html, Spinner, PhaseBanner, Icon, Button, MicroLabel, confirmDialog, closeAllDialogs, useTicker } from '../ui/components.js';
import { useGameData, GIcon } from '../ui/gameComponents.js';
import { useFieldView } from '../ui/fieldHost.js';
import { TopBar, liveLp, ownLeaks, uniteRemaining, tempInfo, tempReadyReason } from '../ui/hud.js';
@@ -92,7 +92,7 @@ import {
snapHud, activeBubbles, shortcutFor, shortcutBlocked, closesOnFieldPress, phaseTotalSeconds, homeFieldId, ownFieldId, normalizeSp, sortedPlayers,
countdownState, shopBlockReason, stageOverrides, effectiveStage, watchTarget, dropFailureReason,
previewEnemyKey, prepCamera, prepCameraFor, foldCamera, deployFieldOf, panelSide, panelSlots, bondPopupPlace, chessLoadout, unitLoadout,
mergeTarget, modeOffBonds,
mergeTarget, modeOffBonds, readyFundsPrompt,
} from '../ui/gameLogic.js';
import { toast } from '../ui/toasts.js';
import { BriefingScreen } from './briefing.js';
@@ -628,11 +628,27 @@ function MatchScreen() {
// ---- actions ----------------------------------------------------------------------------------------------
const buy = useCallback((i) => actions.buy(i), []);
// 准备 with funds left asks first: the prep's end wipes them (community report #4; not 坎诺特, not at 0 funds, not
// under AI 托管 — gameLogic.readyFundsPrompt). The button and Space both come here.
const askingReady = useRef(false);
const toggleReady = useCallback(async (r) => {
const L = live.current;
const me = Array.isArray(L.pub?.players) ? L.pub.players.find((p) => p && p.playerId === L.myId) : null;
const ask = r ? readyFundsPrompt(L.priv, { keptBands: data.get('config')?.economy?.leftoverFundsKeptByBands, autoplay: !!me?.autoplay }) : null;
if (ask) {
if (askingReady.current) return;
askingReady.current = true;
const ok = await confirmDialog(ask);
askingReady.current = false;
const now = live.current;
if (!ok || now.pub?.phase !== PHASE.PREP || now.priv?.ready) return;
}
setReadyBusy(true);
await actions.ready(r);
setReadyBusy(false);
}, []);
// the prep ended (timer) while the question was open: drop it — the funds are gone either way
useEffect(() => { if (phase !== PHASE.PREP && askingReady.current) closeAllDialogs(); }, [phase]);
/** 出售 (operators, underframe +N) / 销毁 (items and Arts, confirmed: they cannot be sold). */
const sellPiece = useCallback(async (piece) => {
+23
View File
@@ -787,6 +787,29 @@ export function shopBlockReason(kind, { priv, editable, slot, getChess, getItem
return null;
}
/**
* The 准备 confirmation (community report #4 after 0.1.2): readying with funds left asks first — the prep's end wipes
* them (PRTS 卫戍协议/帮助 「本回合的剩余资金将清零」; the server still does: PlayerState.endPrep). act2autochess constData
* `noMoneyTipsBand` — data/config.json economy.leftoverFundsKeptByBands, ["band_cannot"] — names the strategies whose
* funds carry over and that get no such tip (坎诺特 利滚利). No prompt for an un-ready, with 0 funds, when already ready
* or out, or under AI 托管 (the server plays the seat). The dialog's wording is the remake's own [ASSUMED]: neither the
* tables nor PRTS hold the official one.
* @param {any} priv m.private
* @param {{ ready?: boolean, keptBands?: string[]|null, autoplay?: boolean }} [opts] `ready`: the state asked for
* @returns {{ title: string, text: string, okText: string, cancelText: string, micro: string } | null}
*/
export function readyFundsPrompt(priv, { ready = true, keptBands = null, autoplay = false } = {}) {
if (!ready || autoplay || !isObj(priv) || priv.alive === false || priv.ready) return null;
const funds = Math.trunc(Number(priv.funds) || 0);
if (!(funds > 0)) return null;
const kept = Array.isArray(keptBands) ? keptBands : ['band_cannot'];
if (typeof priv.bandId === 'string' && kept.includes(priv.bandId)) return null;
return {
title: '剩余资金', micro: 'FUNDS LEFT', okText: '准备就绪', cancelText: '继续整备',
text: `还有 ${funds} 资金未使用。休整期结束时,本回合的剩余资金将清零。确定准备就绪吗?`,
};
}
// ---- placement (canPlace mirror) ------------------------------------------------------------------------
/**