From 187cc91216e547e8038d85da0ebe80d91cea4012 Mon Sep 17 00:00:00 2001 From: sganggs Date: Sun, 4 Oct 2026 03:02:48 +0800 Subject: [PATCH] =?UTF-8?q?feedback2=20WL:=20=E7=89=B9=E6=80=A7=20shows=20?= =?UTF-8?q?the=20chosen=20module's=20line=20also=20on=20a=20record=20clone?= =?UTF-8?q?d=20for=20another=20skill=20or=20module=20(the=20in-match=20car?= =?UTF-8?q?d=20too);=20found=20by=20the=20Grok=20review=20of=20#64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/ui/detailPanel.js | 4 +++- test/ui/loadout-stats.test.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/public/js/ui/detailPanel.js b/public/js/ui/detailPanel.js index 3f2d457a..85615250 100644 --- a/public/js/ui/detailPanel.js +++ b/public/js/ui/detailPanel.js @@ -274,7 +274,9 @@ export function BondChips({ bondIds, bonds = [], onBond = null, off = null, gran export function traitText(c, golden, lo) { const t = (lo?.record || c).trait || {}; const base = t.descRaw || t.desc || ''; - if (!golden || lo?.record !== c) return base; + if (!golden) return base; + // the record's own module line, also for a record cloned for another skill or module (a 不装备 record carries none) — + // until 0.1.2 a clone fell back to the class trait (Grok review of GitHub #64; the in-match card had it too) return t.moduleDescRaw || base; } diff --git a/test/ui/loadout-stats.test.js b/test/ui/loadout-stats.test.js index 8d1fec1c..82226a40 100644 --- a/test/ui/loadout-stats.test.js +++ b/test/ui/loadout-stats.test.js @@ -284,3 +284,17 @@ test('css: the section reuses the card\'s .dstats / .drange / .rgrid, sized for } assert.match(read('public/index.html'), //); }); + +test('特性 follows the chosen module also when the skill or the module differs from the default (cloned record)', async () => { + const fs = await import('node:fs'); + const { chessLoadout } = await import('../../public/js/ui/gameLogic.js'); + const { traitText } = await import('../../public/js/ui/detailPanel.js'); + const chess = JSON.parse(fs.readFileSync(new URL('../../data/chess.json', import.meta.url), 'utf8')); + const get = (id) => chess[id]; + const shown = (id, lo) => traitText(get(id), true, chessLoadout(get(id), lo, get)); + // 隐现 (MAR-X): its other skill keeps the module's line, not the class trait 优先攻击空中单位 + assert.match(shown('chess_char_1_01_b', { chess_char_1_01_a: { skill: 0, module: null } }), /攻击空中单位时攻击力提升至/); + // 信仰搅拌机: SPT-Y shows its own line; 不装备 shows the class trait + assert.match(shown('chess_char_4_01_b', { chess_char_4_01_a: { skill: get('chess_char_4_01_b').skill.index, module: 'uniequip_003_rmixer' } }), /攻击距离\+1/); + assert.match(shown('chess_char_4_01_b', { chess_char_4_01_a: { skill: get('chess_char_4_01_b').skill.index, module: 'none' } }), /能够阻挡三个敌人/); +});