feedback5 WK: a placeable 自选 summon works end to end — the client finds data/backups.json tokens where it looks up a summon (game lookups, detail card, renderer), the match harness's legacy checks read the player's data view; a test slots 凯尔希 (kit list widened for the test): her Mon3tr stack comes to the hand when she is deployed, places, and the battle fields it as her variant

Golden unchanged.
This commit is contained in:
sganggs committed 2026-10-06 00:19:29 +08:00
1 parent 01d5fa3e94
commit 476b926da3
5 files changed
+52 -7

No files matched your search

+36
View File
@@ -321,3 +321,39 @@ test('a match keeps the picks its seat had at its start (the next match takes a
assert.deepEqual(h2.ps('p_1').diy, { [T6A]: { charId: SIEGE, skillIndex: 1, uniEquipId: null } });
h2.m.dispose();
});
test('a placeable 自选 summon comes to the hand like any operator\'s, places, and fights as its owner\'s variant', REAL, () => {
const h = diyMatch().start();
const m = h.m;
h.toPrep(1);
const p0 = h.ps('p_0');
// 凯尔希 has no kit yet: the kit list is widened for this test (her Mon3tr is a placeable talent summon)
assert.equal(p0.setDiy({ [T6B]: { charId: 'char_003_kalts', skillIndex: 0, uniEquipId: null } }, { kitted: [...KITTED_CHARS, 'char_003_kalts'] }), true);
p0.initDiyStock(new Set());
clear(p0);
const k = gain(p0, T6B);
const tile = legalTileFor(m, p0, T6B);
assert.deepEqual(m.handle('p_0', { t: 'g.move', uid: k.uid, to: { area: 'board', row: tile[0], col: tile[1] } }), { ok: true });
const stack = p0.hand.find((p) => p && p.kind === 'token');
assert.ok(stack, 'the Mon3tr stack is in the hand');
assert.equal(stack.id, 'token_10002_kalts_mon3tr');
assert.equal(stack.ownerUid, k.uid);
assert.equal(p0.gd.token(stack.id).name, 'Mon3tr', 'the player\'s data view finds the 自选 summon');
const t2 = legalTileFor(m, p0, T6B, new Set([`${tile[0]},${tile[1]}`]));
assert.deepEqual(m.handle('p_0', { t: 'g.move', uid: stack.uid, to: { area: 'board', row: t2[0], col: t2[1] } }), { ok: true });
const input = p0.battleInput();
const tok = input.units.find((u) => u.kind === 'token');
assert.deepEqual([tok.tokenId, tok.ownerUid], ['token_10002_kalts_mon3tr', k.uid]);
const spec = wire(buildBattleSpec({
battleId: 't.2', fieldId: 'n:p_0', kind: 'normal', seed: 5, modeId: m.modeId, round: 1, stageId: m.stageId,
rect: { ...GEO.NORMAL_RECT }, timeLimit: 20, players: [input], spawns: [], routes: m.wave.routes,
flags: { layerGainsEnabled: true, ...m.gd.dp }, enemyOverrides: {}, content: 'full',
}));
const bt = createBattleFromSpec(spec, m.ds, { quiet: true, recordEvents: false });
bt.step();
const mon = bt.allyUnits.find((u) => u.kind === 'token');
assert.ok(mon && mon.def.name === 'Mon3tr', 'the summon is fielded');
assert.equal(mon.ownerUnit?.def?.charId, 'char_003_kalts');
h.invariants();
m.dispose();
});
+2 -1
View File
@@ -178,7 +178,8 @@ function legacyInvariants(m) {
for (const [k, p] of ps.board) {
const [r, c] = k.split(',').map(Number);
assert.ok(r >= FIELD.r0 && r <= FIELD.r1 && c >= FIELD.c0 && c <= FIELD.c1, `piece outside the board ${k}`);
const rec = p.kind === 'token' ? m.gd.token(p.id) : m.gd.chess(p.id);
const pgd = ps.gd || m.gd; // the player's data view (0.2.0 自选: its summons are data/backups.json tokens)
const rec = p.kind === 'token' ? pgd.token(p.id) : pgd.chess(p.id);
assert.ok(rec, `unknown board piece ${p.id}`);
const cls = p.kind === 'chess' ? placeClass(ps, rec) : positionClass(rec);
assert.ok(canPlace(dmap, cls, r, c), `illegal tile ${p.id} @ ${k}`);