diff --git a/public/js/screens/game.js b/public/js/screens/game.js index 5aafe29b..374cf484 100644 --- a/public/js/screens/game.js +++ b/public/js/screens/game.js @@ -1257,7 +1257,7 @@ function MatchScreen() { ${drawer ? html`<${EnemyDrawer} tab=${drawer} onTab=${setDrawer} pub=${pub} priv=${priv} onClose=${() => setDrawer(null)} bandId=${scoutBandId} bandOwner=${scoutBandOwner} - onEnemy=${(k, n) => setDetail({ kind: 'enemy', id: k, count: n })} onChess=${(id) => setDetail({ kind: 'chess', id })} />` : null} + onEnemy=${(k, n) => setDetail({ kind: 'enemy', id: k, count: n })} onChess=${(id) => setDetail({ kind: 'chess', id, foreign: true })} />` : null} ${bondPop ? html`<${BondPopup} bondId=${bondPop.bondId} entry=${bondPop.entry} priv=${bondPop.priv} banned=${pub?.bannedChess || []} owner=${bondPop.name} off=${offBonds.has(bondPop.bondId)} diff --git a/public/js/ui/detailPanel.js b/public/js/ui/detailPanel.js index 8ca31780..eaf509f9 100644 --- a/public/js/ui/detailPanel.js +++ b/public/js/ui/detailPanel.js @@ -631,7 +631,10 @@ export function resolveDetail(target, pieces, { priv = null, backups = data.get( // a bond popup's 变形同构体 row hands the wearer's item ids on (bondStrip onMember): the card shows the pair and the chip const c = data.lookup('chess', target.id); const items = Array.isArray(target.items) ? target.items.filter((x) => typeof x === 'string') : []; - return c ? { type: 'chess', chess: c, hint: target.hint || null, standIn: target.foreign ? null : ownStandIn(c), ...(items.length ? { unitItems: items } : {}) } : null; + // (a bond popup's member card of a teammate's strip — `owner` another player — and the mode's banned list (`foreign`) + // show the chess as it is: the viewer's 补位 list is not theirs) + const foreign = !!target.foreign || (target.owner != null && !!priv && target.owner !== priv.playerId); + return c ? { type: 'chess', chess: c, hint: target.hint || null, standIn: foreign ? null : ownStandIn(c), ...(items.length ? { unitItems: items } : {}) } : null; } if (target.kind === 'item') { const it = data.lookup('items', target.id); return it ? { type: 'item', item: it } : null; } if (target.kind === 'enemy') { const en = data.lookup('enemies', target.id); return en ? { type: 'enemy', enemy: en, count: target.count } : null; } diff --git a/public/js/ui/fallbackField.js b/public/js/ui/fallbackField.js index d0d9008f..c9f70a23 100644 --- a/public/js/ui/fallbackField.js +++ b/public/js/ui/fallbackField.js @@ -21,7 +21,7 @@ import { render } from '../../vendor/preact.module.js'; import { html, TierChip } from './components.js'; import { GEO } from '../../../shared/constants.js'; import { chessAvatarUrl, itemIconUrl, tokenAvatarUrl, enemyIconUrl } from './assetUrls.js'; -import { tileKey, hasFlag, UF, penPlacement, PEN, fieldTile } from './gameLogic.js'; +import { tileKey, hasFlag, UF, penPlacement, PEN, fieldTile, fieldsStandIn, standInOf } from './gameLogic.js'; const DRAG_PX = 6; const DMG_TTL = 900; @@ -119,11 +119,14 @@ export function createFallbackView(host, opts = {}) { const tempPos = (L, idx) => ({ x: (GEO.TEMP_C0 + idx) * L.tile, y: (L.rows + 1.72) * L.tile }); // ---- pieces (prep) --------------------------------------------------------------------------------------- - function pieceArt(p) { + function pieceArt(p, area = null) { const mm = m(); if (p.kind === 'item') return itemIconUrl(mm, lookup('items', p.id)); if (p.kind === 'token') return tokenAvatarUrl(mm, p.id); - return chessAvatarUrl(mm, lookup('chess', p.id)); + const chess = lookup('chess', p.id); + // 0.2.0 补位: on the board a chess the player does not own is its stand-in (render/app.js pieceInfo) + const si = area === 'board' && fieldsStandIn(st.priv, chess) ? standInOf(chess, dataStore?.get?.('backups') ?? null) : null; + return chessAvatarUrl(mm, si || chess); } function pieceName(p) { if (p.kind === 'item') return lookup('items', p.id)?.name || '道具'; @@ -132,7 +135,7 @@ export function createFallbackView(host, opts = {}) { } function Piece({ p, x, y, L, area }) { - const src = pieceArt(p); + const src = pieceArt(p, area); const dragging = st.drag?.uid === p.uid && st.drag.moved; const golden = !!p.golden; const tier = p.tier || lookup('chess', p.id)?.tier || lookup('items', p.id)?.tier;