feedback5 CB5: an eliminated player (and a spectator seat) follows a player through every phase reset — the one it last watched, else the first player still in — instead of being sent back to its own empty board each round (community report of 2026-10-06, item 56; the idea of PR #189)
Official: research 09 §3.1 — after elimination the client keeps observing (self_dead_dialog KEEP_WATCH,
DeadAutoObDn { obIndex, state, preparation }, FindFirstAvailObTarget). Until 0.2.0 every phase reset cleared
an eliminated player's watch: in 回合开始 / 机变 / 休整期 it saw its own empty board, in battle the first field.
Server (server/match/match/watch.js): Match.watchPref (viewer → the player of its last manual g.watch: a prep
scout, a single-player field, or the new optional g.watch playerId on a shared 联防 / boss pair field — PR
#189's review point); _watchTargetOf = that player while still in, else the first player still in (seat
order, AI seats included); startRound scouts its board (_followScout, kept through 机变 and 休整期), both
combat modes and the boss fields start on its field, a resync / a spectator joining in prep gets the board,
a followed player who quits hands over at once. Client: the screen adopts the pushed board like a 前往查看 tap
(battle/observe.js followedScout; the stale-field fix of PR #189), keeps it through the prep phases (no camera
flight home and back), a spectator no longer asks for the first player itself; g.watch sends the tapped row.
Overlap with PR #189 (not merged): the same preference chain; differences — the fallback includes AI seats
(a lone human with AI teammates had nobody to follow), shared fields record the tapped playerId.
Golden unchanged. Tests: test/match/feedback5-watch-follow.test.js (new, 9), spectator.test.js updated (the
spectator follows the player it scouted). Docs: design/network.md, PLAYING.md.
This commit is contained in:
1 parent
464a823bc5
commit
e8d2b45ad4
14 files changed
+330
-47
No files matched your search
@@ -6,7 +6,8 @@
|
||||
// replica of their battle; 返回战场 goes back;
|
||||
// * 联防 / 最终攻势: the ‹ › pill switches the camera LEFT half / 全景 / RIGHT half of the own field; the other pair's
|
||||
// boss field is never shown to a fighting player;
|
||||
// * eliminated: anything.
|
||||
// * eliminated: anything — each phase reset starts on the player it follows (the server's prep scout / b.start,
|
||||
// followedScout).
|
||||
|
||||
import { PHASE } from '../../../shared/constants.js';
|
||||
import { data } from '../data.js';
|
||||
@@ -82,6 +83,23 @@ export function resumedWatch(b, { pub = null, myId = '', alive = true, watching
|
||||
return { seen: b.battleId, fieldId: b.fieldId };
|
||||
}
|
||||
|
||||
/**
|
||||
* The prep board the server pushed to a viewer that follows a player (an eliminated player or a spectator seat:
|
||||
* Match._followScout — the player it last watched, else the first player still in; community report of 2026-10-06,
|
||||
* item 56, the idea of PR #189), to adopt as the watched board like a 前往查看 tap: `field` is such a scout (m.field
|
||||
* `prep`, an `n:<pid>` id other than the own) and the screen watches nothing (`watching` null — a 返回战场 this phase is
|
||||
* not overridden: the caller adopts a board once per phase). Null for a living player: its phase resets keep its own
|
||||
* board.
|
||||
* @param {{ field?: any, watching?: string|null, alive?: boolean, spectator?: boolean, myId?: string }} o
|
||||
* @returns {string|null} the fieldId to watch
|
||||
*/
|
||||
export function followedScout({ field = null, watching = null, alive = true, spectator = false, myId = '' } = {}) {
|
||||
if (watching || (alive && !spectator) || !isObj(field) || !field.prep) return null;
|
||||
const fid = field.fieldId;
|
||||
if (typeof fid !== 'string' || !fid.startsWith('n:') || fid === `n:${myId}`) return null;
|
||||
return fid;
|
||||
}
|
||||
|
||||
/** Teammates' progress for the waiting pill: [{ playerId, name, killed, total, done, isBot }]. */
|
||||
export function teammateProgress(pub, myId) {
|
||||
const out = [];
|
||||
|
||||
Reference in new issue
Block a user