feedback1 WC: no deployment in the water, tactical points inside the tactician's range

Player reports #3 and #9 after the 0.1.0 release.

#3 On 战场#08(下半) 涨潮控制 (act2autochess_m04) operators could be placed in the
pool and 突袭 members jumped into it. The 深水区 (tile_deepsea) has buildableType
ALL in the level file, but it refuses deployment (PRTS 地形 深水区 "地形机制:拒绝
部署"; the season-1 战场#05 puts a 特制水上平台 - "在水上建立可以部署任意单位的
平台" - on every one of its water tiles).
- grid.js DEPLOY_REFUSED_TILES: the legend's effective build is NONE, so
  canStand (突袭 landing tile, tactical points, summon tiles) never picks the
  water; a hard-blocked 射击台 / mound tile takes no melee unit either.
- build-data: stages.json legend `buildable` is the effective type (the level's
  value kept in `buildableType`), deployTiles exclude the water, a 特制水上平台
  makes its tile deployable (act1 m05, inactive). board.js / gameLogic.js
  deploy maps follow (water platforms included); bots plan on the same map.
- Gate routes are unchanged; the water now counts as non-blockable ground in
  the path tie-break (audit lists updated).

#9 伺夜's 狼群 and 缪尔赛思's 流形 ("只能部署在召唤者攻击范围内", tokens.json
`ownerRange`) could be placed anywhere.
- PlayerState._legal / summonRange: a range-bound summon only on a tile of its
  owner's attack range (loadout grid rotated by the owner's facing); swaps with
  the owner are checked from the owner's new tile; re-orienting (or promoting)
  the owner sends a summon left outside back onto its stack with a toast.
- The client lights and accepts the same tiles (gameLogic.summonRange), the bot
  plans inside them, the invariants check it, the 伺夜 kit re-uses the piece's
  tile only inside her range.

Tests: test/match/feedback1-placement, test/sim/feedback1-water, the opt-in
headless-Chrome test/ui/feedback1-placement.e2e (fastServer hook SP_STAGE);
existing summon / deploy / pathing tests moved off the water tiles.
This commit is contained in:
sganggs committed 2026-10-03 02:01:34 +08:00
1 parent 7f134737ce
commit c92867656d
26 files changed
+789 -73

No files matched your search

+3 -2
View File
@@ -30,9 +30,9 @@ export function freePort() {
* Start the real server (`node server/index.js`, or test/e2e/fastServer.mjs with `fast` speed-ups) on a free port (or
* `port`: e.g. the port of a server just stopped — a server restart the open clients reconnect to).
* @param {{ port?: number, fast?: { timerScale?: number, combatSpeed?: number, startRound?: 'boss'|'hidden'|number, kit?: number, chess?: string[],
* items?: string[], idleBots?: boolean, kits?: string[][], botChess?: string[], autoPlace?: boolean, eliminate?: number[] } }} [opts]
* items?: string[], idleBots?: boolean, kits?: string[][], botChess?: string[], autoPlace?: boolean, eliminate?: number[], stage?: string } }} [opts]
* kits: per-human starter kits (seat order); botChess: the AI seats' kit; autoPlace: the kits go onto the board at the
* first prep; eliminate: humans (seat order) eliminated at the jump — fastServer.mjs hooks
* first prep; eliminate: humans (seat order) eliminated at the jump; stage: the stage of every match — fastServer.mjs hooks
* @returns {Promise<{ base: string, port: number, logs: string[], stop: (o?: { hard?: boolean }) => Promise<void> }>}
*/
export async function startRealServer(opts = {}) {
@@ -55,6 +55,7 @@ export async function startRealServer(opts = {}) {
if (opts.fast.botChess?.length) env.SP_BOT_CHESS = opts.fast.botChess.join(',');
if (opts.fast.autoPlace) env.SP_AUTO_PLACE = '1';
if (opts.fast.eliminate?.length) env.SP_ELIMINATE = opts.fast.eliminate.join(',');
if (opts.fast.stage) env.SP_STAGE = String(opts.fast.stage);
}
const child = spawn(process.execPath, [entry], { cwd: ROOT, env, stdio: ['ignore', 'pipe', 'pipe'] });
const logs = [];
+8
View File
@@ -20,6 +20,8 @@
// the hand: the seat keeps no board and leaks).
// SP_ELIMINATE=<humanIdx,…>: those humans (seat order) are eliminated at the jump, before the round's boss pairing — an
// eliminated spectator from the first round on (test/ui/watch-bonds.e2e.test.js, the Final Assault).
// SP_STAGE=<stageId>: every match is played on this stage instead of the drawn one (test/ui/feedback1-placement.e2e.test.js:
// 战场#08's pool).
// Not a test file (node --test runs it as a no-op module when NODE_TEST_CONTEXT is set).
import { startServer } from '../../server/index.js';
@@ -43,12 +45,18 @@ if (!process.env.NODE_TEST_CONTEXT) {
const botChess = String(process.env.SP_BOT_CHESS || '').split(',').map((x) => x.trim()).filter(Boolean);
const autoPlace = process.env.SP_AUTO_PLACE === '1';
const eliminate = String(process.env.SP_ELIMINATE || '').split(',').map((x) => x.trim()).filter(Boolean).map(Number);
const forcedStage = String(process.env.SP_STAGE || '').trim();
class FastMatch extends Match {
constructor(opts) {
super({ ...opts, timerScale, combatSpeed });
this._jumped = !startAt;
this._placeRound = null;
if (forcedStage && this.gd.stage(forcedStage)) {
this.stageId = forcedStage;
this.stage = this.gd.stage(forcedStage);
for (const ps of this.players.values()) ps.invalidateDeployMap();
}
}
startRound(r) {
+6 -4
View File
@@ -172,9 +172,10 @@ test('battle input: board units in deploy order with items; tokens carry ownerUi
const it = giveItem(m, ps, 'chess_item_1_01_e_a');
assert.deepEqual(m.handle('p_0', { t: 'g.equip', itemUid: it.uid, targetUid: b.uid }), { ok: true });
const tok = ps.hand.find((p) => p && p.kind === 'token');
m.handle('p_0', { t: 'g.move', uid: tok.uid, to: { area: 'board', row: 9, col: 4 } });
// (9,6): inside 伺夜's range ("只能部署在召唤者攻击范围内", player report #9 after 0.1.0)
assert.deepEqual(m.handle('p_0', { t: 'g.move', uid: tok.uid, to: { area: 'board', row: 9, col: 6 } }), { ok: true });
const input = ps.battleInput();
assert.deepEqual(input.units.map((u) => [u.row, u.col]), [[12, 3], [10, 5], [9, 4]], 'top→bottom then left→right');
assert.deepEqual(input.units.map((u) => [u.row, u.col]), [[12, 3], [10, 5], [9, 6]], 'top→bottom then left→right');
assert.deepEqual(input.units[0].items, ['chess_item_1_01_e_a']);
assert.equal(input.units[2].kind, 'token');
assert.equal(input.units[2].ownerUid, a.uid);
@@ -229,12 +230,13 @@ test('withdrawing a deployed summon into a full hand: HAND_FULL like any other c
assert.deepEqual(m.handle('p_0', { t: 'g.move', uid: medic.uid, to: { area: 'board', row: 10, col: 5 } }), { ok: true });
const drone = ps.hand.find((p) => p && p.kind === 'token');
assert.ok(drone && drone.count === 1, 'one 狼群');
assert.deepEqual(m.handle('p_0', { t: 'g.move', uid: drone.uid, to: { area: 'board', row: 9, col: 4 } }), { ok: true });
// (9,6): inside 伺夜's range ("只能部署在召唤者攻击范围内", player report #9 after 0.1.0)
assert.deepEqual(m.handle('p_0', { t: 'g.move', uid: drone.uid, to: { area: 'board', row: 9, col: 6 } }), { ok: true });
// golden items never merge with each other: a plain full hand
for (let i = 0; i < ps.hand.length; i++) if (!ps.hand[i]) giveItem(m, ps, 'chess_item_1_02_e_b', 'hand', i);
assert.ok(ps.hand.every(Boolean) && ps.tempEmpty);
assert.equal(m.handle('p_0', { t: 'g.move', uid: drone.uid, to: { area: 'hand', idx: 0 } }).error, ERR.HAND_FULL, 'a new card for a full hand');
assert.equal(ps.board.get('9,4'), drone, 'the 狼群 stays on the board');
assert.equal(ps.board.get('9,6'), drone, 'the 狼群 stays on the board');
assert.ok(ps.tempEmpty, 'nothing overflowed into temp (Ready stays possible)');
assert.equal(m.handle('p_0', { t: 'g.move', uid: medic.uid, to: { area: 'hand', idx: 0 } }).error, ERR.HAND_FULL, 'the same as withdrawing an operator');
// a free slot: the 狼群 comes back
+262
View File
@@ -0,0 +1,262 @@
// Player reports after the 0.1.0 release, placement legality on the server (PlayerState / board.js), the client's
// mirror (ui/gameLogic.js canPlace / boardTargets = the drag highlights) and the bots:
// #3 "有水池的那张图干员可以错误的被部署到水里" — 战场#08(下半) 涨潮控制 (act2autochess_m04): the 深水区 (tile_deepsea,
// board (10–12, 6)) refuses deployment (PRTS 地形 深水区 "地形机制:拒绝部署"; 特制水上平台 "在水上建立可以部署任意
// 单位的平台" on every 深水区 of the season-1 战场#05) although the level's buildableType says ALL.
// #9 "干员伺夜这样的战术家的战术点能被错误的被放到攻击范围之外" — the tacticians' summons (伺夜's 狼群, 缪尔赛思's 流形)
// read "只能部署在召唤者攻击范围内" (token description; PRTS 狼群 特性): the piece may only stand on a tile of its
// owner's attack range (the rotated grid of its board tile and facing). Re-orienting the owner in place keeps the
// piece while it is still inside, else sends it back to its stack [ASSUMED]; moving the owner sends it back anyway
// (PRTS 卫戍协议/帮助 "移动干员时,其所属召唤物全部退场并重置至手牌区").
// The sim side (突袭 landing tile, tactical point) is test/sim/feedback1-water.test.js.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { buildDeployMap, canPlace as boardCanPlace, legalTiles, positionClass, tileKey, ownerRangeKeys } from '../../server/match/board.js';
import { ERR } from '../../shared/constants.js';
import { DATA, makeMatch, give, checkInvariants, chessOfTier } from './harness.js';
import { botPrep, planLayout } from '../../server/match/bot.js';
import { placementContext, canPlace as clientCanPlace, boardTargets, deployMap as clientDeployMap } from '../../public/js/ui/gameLogic.js';
const STAGE = 'act2autochess_m04';
const WATER = ['10,6', '11,6', '12,6'];
const VIGIL = 'chess_char_3_19_a';
const MLYSS = 'chess_char_6_11_a';
const WOLF = 'token_10028_vigil_wolf';
const MANIFOLD = 'token_10030_mlyss_wtrman';
const MELEE = (c) => c.position === 'MELEE';
const RANGED = (c) => c.position === 'RANGED';
function prep(stageId = STAGE, seed = 11) {
const h = makeMatch({ mode: 'solo', difficulty: 'NORMAL', seed }).start();
h.toPrep(1);
h.setStage(stageId);
const ps = h.ps('p_0');
for (const p of [...ps.board.values(), ...ps.hand.filter(Boolean)]) if (p.kind === 'chess') ps.returnCopies(p);
ps.board.clear();
ps.hand.fill(null);
ps.recompute();
return { h, m: h.m, ps };
}
const move = (m, uid, to, dir) => m.handle('p_0', { t: 'g.move', uid, to, ...(dir ? { dir } : {}) });
const board = (r, c) => ({ area: 'board', row: r, col: c });
const stackOf = (ps, id) => [...ps.hand, ...ps.temp].find((p) => p && p.kind === 'token' && p.id === id) ?? null;
const clientCtx = (m, ps, field = 'normal') => placementContext({
priv: ps.privateView(), stage: m.stage, editable: true, field,
getChess: (id) => DATA.chess[id] ?? null, getToken: (id) => DATA.tokens[id] ?? null, getItem: (id) => DATA.items[id] ?? null,
});
// ---------------------------------------------------------------------------------------------------------------------
// #3 the pool
test('#3 board.js: no deploy class on 战场#08\'s 深水区 — normal field, both boss halves; the client\'s map agrees', () => {
const st = DATA.stages[STAGE];
const n = buildDeployMap(st);
for (const k of WATER) assert.equal(n.get(k), undefined, `normal ${k}`);
assert.equal(n.get('11,5'), 'melee', 'the road beside it stays deployable');
for (const field of ['bossL', 'bossR']) {
const b = buildDeployMap(st, { field });
// boss (3–5, 6) = board (10–12, 6); the right half is mirrored (col 14 → board col 6)
for (const k of WATER) assert.equal(b.get(k), undefined, `${field} ${k}`);
assert.deepEqual([...clientDeployMap(st, { field })].sort(), [...b].sort(), `${field}: client = server`);
}
assert.deepEqual([...clientDeployMap(st)].sort(), [...n].sort(), 'normal: client = server');
});
test('#3 g.move: neither a melee nor a ranged operator nor a summon goes into the water (BAD_TILE); the client refuses and never lights it', () => {
const { m, ps } = prep();
const melee = give(m, ps, chessOfTier(1, MELEE).find((x) => m.pool.has(x)));
const ranged = give(m, ps, chessOfTier(1, RANGED).find((x) => m.pool.has(x)));
for (const k of WATER) {
const [r, c] = k.split(',').map(Number);
assert.equal(move(m, melee.uid, board(r, c)).error, ERR.BAD_TILE, `melee ${k}`);
assert.equal(move(m, ranged.uid, board(r, c)).error, ERR.BAD_TILE, `ranged ${k}`);
}
// 伺夜 (ranged) beside the pool facing it: her 狼群 (MELEE) may not go into the water either
const vigil = give(m, ps, VIGIL);
assert.deepEqual(move(m, vigil.uid, board(11, 4)), { ok: true });
const wolf = stackOf(ps, WOLF);
assert.ok(wolf);
assert.equal(move(m, wolf.uid, board(11, 6)).error, ERR.BAD_TILE, '狼群 into the water');
const ctx = clientCtx(m, ps);
for (const piece of [melee, ranged, wolf]) {
for (const k of WATER) {
const [r, c] = k.split(',').map(Number);
assert.equal(clientCanPlace(ctx, piece.uid, board(r, c)).ok, false, `client ${piece.id} ${k}`);
}
const lit = boardTargets(ctx, piece.uid).legal.map(([r, c]) => tileKey(r, c));
for (const k of WATER) assert.ok(!lit.includes(k), `${piece.id}: ${k} not lit`);
}
checkInvariants(m);
m.dispose();
});
test('#3 act1 m05 (season 1, inactive): a 特制水上平台 makes its 深水区 deployable for any unit; the raw level files agree', () => {
const st = DATA.stages.act1autochess_m05;
const map = buildDeployMap(st);
const platforms = st.devices.filter((d) => d.role === 'waterPlatform' && d.active).map((d) => tileKey(d.pos[0], d.pos[1]));
for (const k of platforms) {
const [r, c] = k.split(',').map(Number);
if (r < 9 || r > 12 || c < 2 || c > 10) continue;
assert.equal(map.get(k), 'melee', `platform ${k}`);
}
assert.deepEqual([...clientDeployMap(st)].sort(), [...map].sort());
});
test('#3 bots never put a piece into the water (layout planner and full bot preps on 战场#08)', () => {
const h = makeMatch({ mode: 'coop', difficulty: 'NORMAL', humans: 1, bots: 3, seed: 5 }).start();
h.setStage(STAGE);
let pieces = 0;
for (let round = 1; round <= 5; round++) {
h.toPrep(round);
for (const ps of h.m.players.values()) {
if (!ps.isBot || !ps.alive) continue;
if (!ps.ready) botPrep(h.m, ps);
for (const k of ps.board.keys()) { pieces++; assert.ok(!WATER.includes(k), `R${round} ${ps.playerId}: a piece on ${k}`); }
const plan = planLayout(h.m, ps, ps.allChess());
for (const k of plan.values()) assert.ok(!WATER.includes(k), `plan on ${k}`);
}
}
assert.ok(pieces > 10, 'the bots fielded pieces');
h.invariants();
h.m.dispose();
});
// ---------------------------------------------------------------------------------------------------------------------
// #9 tactical points
test('#9 data: 狼群 and 流形 are owner-range summons (token text "只能部署在召唤者攻击范围内"), no other hand summon is', () => {
assert.equal(DATA.tokens[WOLF].ownerRange, true);
assert.equal(DATA.tokens[MANIFOLD].ownerRange, true);
for (const t of Object.values(DATA.tokens)) if (t.placeable && t.tokenId !== WOLF && t.tokenId !== MANIFOLD) assert.ok(!t.ownerRange, t.name);
});
test('#9 g.move: 伺夜\'s 狼群 only on a tile of her attack range (rotated grid of her tile + facing); outside → BAD_TILE', () => {
const { m, ps } = prep();
const vigil = give(m, ps, VIGIL);
assert.deepEqual(move(m, vigil.uid, board(10, 4), 'RIGHT'), { ok: true });
const wolf = stackOf(ps, WOLF);
const range = ownerRangeKeys(DATA.chess[VIGIL].rangeGrid, 10, 4, 'RIGHT');
assert.ok(range.has('11,5') && range.has('9,7') && !range.has('10,3') && !range.has('12,4'));
// behind her / two rows down: outside the 3-row, 4-column range
for (const [r, c] of [[10, 3], [12, 4], [12, 5], [9, 8]]) assert.equal(move(m, wolf.uid, board(r, c)).error, ERR.BAD_TILE, `outside ${r},${c}`);
assert.ok(stackOf(ps, WOLF), 'still in the hand');
assert.deepEqual(move(m, wolf.uid, board(11, 5)), { ok: true }, 'inside the range');
const placed = ps.board.get('11,5');
assert.equal(placed.id, WOLF);
// board → board: a move out of the range is refused too, one inside it is fine
assert.equal(move(m, placed.uid, board(12, 4)).error, ERR.BAD_TILE);
assert.deepEqual(move(m, placed.uid, board(9, 6)), { ok: true });
assert.equal(ps.board.get('9,6'), placed);
checkInvariants(m);
m.dispose();
});
test('#9 re-orienting the tactician: a summon still inside the new range stays, one left outside goes back to its stack', () => {
const { m, ps } = prep();
const vigil = give(m, ps, VIGIL);
assert.deepEqual(move(m, vigil.uid, board(10, 4), 'RIGHT'), { ok: true });
assert.deepEqual(move(m, stackOf(ps, WOLF).uid, board(11, 5)), { ok: true });
const wolf = ps.board.get('11,5');
// facing UP the range is rows 10–13 × cols 3–5: (11,5) is still inside
assert.deepEqual(move(m, vigil.uid, board(10, 4), 'UP'), { ok: true });
assert.equal(ps.board.get('10,4').dir, 'UP');
assert.equal(ps.board.get('11,5'), wolf, 'still in range: stays');
// facing LEFT the range is cols 1–4: (11,5) falls outside → back onto its stack in the hand
assert.deepEqual(move(m, vigil.uid, board(10, 4), 'LEFT'), { ok: true });
assert.equal(ps.board.get('11,5'), undefined, 'outside the new range: lifted');
const stack = stackOf(ps, WOLF);
assert.ok(stack && stack.count === 1, 'back in the hand');
assert.equal(ps.battleInput().units.filter((u) => u.kind === 'token').length, 0);
checkInvariants(m);
m.dispose();
});
test('#9 swaps: a summon dragged onto its tactician, or an operator onto the summon, must leave the summon inside the range', () => {
const { m, ps } = prep();
const vigil = give(m, ps, VIGIL);
assert.deepEqual(move(m, vigil.uid, board(10, 4), 'RIGHT'), { ok: true });
assert.deepEqual(move(m, stackOf(ps, WOLF).uid, board(10, 5)), { ok: true });
const wolf = ps.board.get('10,5');
// wolf onto 伺夜: she would stand on (10,5) facing RIGHT and the wolf behind her on (10,4) — outside → refused
assert.equal(move(m, wolf.uid, board(10, 4)).error, ERR.BAD_TILE);
assert.equal(ps.board.get('10,5'), wolf);
assert.equal(ps.board.get('10,4'), vigil);
// the wolf on (11,4), right above her: after the swap it is right below her (offset −1, 0) — inside → allowed
assert.deepEqual(move(m, wolf.uid, board(11, 4)), { ok: true });
assert.deepEqual(move(m, wolf.uid, board(10, 4)), { ok: true }, 'swap with the owner, still in range');
assert.equal(ps.board.get('10,4'), wolf);
assert.equal(ps.board.get('11,4'), vigil);
// another operator dragged onto the wolf would send the wolf to that operator's tile: outside → refused
const other = give(m, ps, chessOfTier(1, MELEE).find((x) => m.pool.has(x)));
assert.deepEqual(move(m, other.uid, board(12, 3)), { ok: true });
assert.equal(move(m, other.uid, board(10, 4)).error, ERR.BAD_TILE, '(12,3) is outside 伺夜\'s range (she stands on (11,4) now)');
assert.deepEqual(move(m, other.uid, board(12, 5)), { ok: true });
assert.deepEqual(move(m, other.uid, board(10, 4)), { ok: true }, '(12,5) is inside: the wolf moves there');
assert.equal(ps.board.get('12,5'), wolf);
checkInvariants(m);
m.dispose();
});
test('#9 the client mirrors it: the drag highlights of 狼群 / 流形 are exactly the free legal tiles of the owner\'s range', () => {
const { m, ps } = prep();
const vigil = give(m, ps, VIGIL);
assert.deepEqual(move(m, vigil.uid, board(10, 4), 'RIGHT'), { ok: true });
const mly = give(m, ps, MLYSS);
assert.deepEqual(move(m, mly.uid, board(12, 8), 'LEFT'), { ok: true });
const map = buildDeployMap(m.stage);
for (const [owner, tid, dir, at] of [[vigil, WOLF, 'RIGHT', [10, 4]], [mly, MANIFOLD, 'LEFT', [12, 8]]]) {
const ctx = clientCtx(m, ps);
const tok = stackOf(ps, tid);
assert.ok(tok, tid);
const range = ownerRangeKeys(DATA.chess[owner.id].rangeGrid, at[0], at[1], dir);
const pos = positionClass(DATA.tokens[tid]);
const want = legalTiles(map, pos).map(([r, c]) => tileKey(r, c)).filter((k) => range.has(k) && !ps.board.has(k)).sort();
const lit = boardTargets(ctx, tok.uid).legal.map(([r, c]) => tileKey(r, c)).sort();
assert.deepEqual(lit, want, `${tid} highlights`);
assert.ok(want.length > 0);
// every lit tile is accepted by the server, every other deployable tile refused
for (const k of map.keys()) {
const [r, c] = k.split(',').map(Number);
if (ps.board.has(k)) continue;
assert.equal(clientCanPlace(ctx, tok.uid, board(r, c)).ok, lit.includes(k), `client ${tid} ${k}`);
assert.equal(boardCanPlace(map, pos, r, c) && range.has(k), lit.includes(k));
}
}
// the client's swap rule: 狼群 onto 伺夜 from (10,5) would end behind her → refused
assert.deepEqual(move(m, stackOf(ps, WOLF).uid, board(10, 5)), { ok: true });
const ctx = clientCtx(m, ps);
assert.equal(clientCanPlace(ctx, ps.board.get('10,5').uid, board(10, 4)).ok, false);
checkInvariants(m);
m.dispose();
});
test('#9 bots place 狼群 / 流形 only inside their owner\'s range', () => {
let placed = 0;
for (const seed of [3, 8, 21]) {
const h = makeMatch({ mode: 'coop', humans: 1, bots: 1, seed }).start();
h.toPrep(2);
h.setStage(STAGE);
const bp = h.ps('ai_0');
for (const p of [...bp.board.values(), ...bp.hand.filter(Boolean)]) if (p.kind === 'chess') bp.returnCopies(p);
bp.board.clear();
bp.hand.fill(null);
bp.recompute();
give(h.m, bp, 'chess_char_1_10_a'); // 古米: a blocker
give(h.m, bp, VIGIL);
give(h.m, bp, MLYSS);
bp.ready = false;
botPrep(h.m, bp);
for (const [k, p] of bp.board) {
if (p.kind !== 'token') continue;
const owner = [...bp.board.entries()].find(([, q]) => q.uid === p.ownerUid);
assert.ok(owner, 'its owner is on the board');
const [or, oc] = owner[0].split(',').map(Number);
const range = ownerRangeKeys(DATA.chess[owner[1].id].rangeGrid, or, oc, owner[1].dir || 'RIGHT');
assert.ok(range.has(k), `seed ${seed}: ${p.id} on ${k} inside ${owner[1].id}'s range`);
placed++;
}
checkInvariants(h.m);
h.m.dispose();
}
assert.ok(placed > 0, 'the bots placed some summons');
});
+5 -1
View File
@@ -219,7 +219,9 @@ describe('#7 audit: every stage × deploy field (server = official level data =
});
test('independent check against the raw official level files (buildableType / heightType + non-hidden devices)', { skip: !HAS_LEVELS && 'no .cache/gamedata level files (run node tools/build-data.mjs once)' }, () => {
const ROLE = { trap_1105_accrate: 'block', trap_032_mound: 'block', trap_1106_achplat: 'platform' };
// trap_040_canoe 特制水上平台 "在水上建立可以部署任意单位的平台"; tile_deepsea refuses deployment whatever its
// buildableType (PRTS 地形 深水区 "地形机制:拒绝部署" — player report #3 after 0.1.0, 战场#08's pool)
const ROLE = { trap_1105_accrate: 'block', trap_032_mound: 'block', trap_1106_achplat: 'platform', trap_040_canoe: 'water' };
for (const [id, st] of Object.entries(DATA.stages)) {
const lv = JSON.parse(readFileSync(levelFile(id), 'utf8'));
const map = lv.mapData.map, tiles = lv.mapData.tiles, H = map.length;
@@ -231,6 +233,8 @@ describe('#7 audit: every stage × deploy field (server = official level data =
if (!t || d === 'block') return null;
// 射击台: ranged only [ASSUMED, DATA §15.11] (the remake's rule for a raised platform)
if (d === 'platform') return 'ranged';
if (d === 'water') return 'melee';
if (t.tileKey === 'tile_deepsea') return null;
if (t.heightType === 'LOWLAND' && (t.buildableType === 'ALL' || t.buildableType === 'MELEE')) return 'melee';
if (t.buildableType === 'RANGED' || (t.heightType === 'HIGHLAND' && t.buildableType === 'ALL')) return 'ranged';
return null;
+11 -11
View File
@@ -115,7 +115,7 @@ test('moving an owner on the board sends its placed summons back to its card (PR
assert.deepEqual(move(m, cat.uid, { area: 'board', row: 10, col: 4 }, 'UP'), { ok: true });
assert.equal([...ps.board.values()].filter((p) => p.kind === 'token').length, 2);
// a real move: both devices leave the board and go back onto one card of 2
assert.deepEqual(move(m, cat.uid, { area: 'board', row: 10, col: 6 }), { ok: true });
assert.deepEqual(move(m, cat.uid, { area: 'board', row: 10, col: 7 }), { ok: true });
assert.equal([...ps.board.values()].filter((p) => p.kind === 'token').length, 0, 'no device left on the board');
const back = tokensOf(ps, DEVICE);
assert.equal(back.length, 1);
@@ -216,26 +216,26 @@ test('a summon dragged onto an operator swaps it away: that operator\'s other pl
const cat = give(m, ps, CATHY);
const hm = give(m, ps, SILENCE);
assert.deepEqual(move(m, cat.uid, { area: 'board', row: 10, col: 4 }), { ok: true });
assert.deepEqual(move(m, hm.uid, { area: 'board', row: 10, col: 6 }), { ok: true });
assert.deepEqual(move(m, hm.uid, { area: 'board', row: 10, col: 7 }), { ok: true });
const devCard = stackOf(ps, DEVICE);
assert.deepEqual(move(m, devCard.uid, { area: 'board', row: 10, col: 3 }), { ok: true });
assert.deepEqual(move(m, devCard.uid, { area: 'board', row: 11, col: 4 }, 'UP'), { ok: true });
assert.deepEqual(move(m, stackOf(ps, DRONE).uid, { area: 'board', row: 10, col: 7 }), { ok: true });
// 凯瑟琳's device (10,3) dropped onto 赫默 (10,6): 赫默 takes 10,3, so her drone goes back to her card; 凯瑟琳 did not move
assert.deepEqual(move(m, stackOf(ps, DRONE).uid, { area: 'board', row: 10, col: 8 }), { ok: true });
// 凯瑟琳's device (10,3) dropped onto 赫默 (10,7): 赫默 takes 10,3, so her drone goes back to her card; 凯瑟琳 did not move
const devA = ps.board.get('10,3');
assert.deepEqual(move(m, devA.uid, { area: 'board', row: 10, col: 6 }), { ok: true });
assert.deepEqual(move(m, devA.uid, { area: 'board', row: 10, col: 7 }), { ok: true });
assert.equal(ps.board.get('10,3')?.uid, hm.uid);
assert.equal(ps.board.get('10,6')?.uid, devA.uid, 'the dragged device is where it was dropped');
assert.equal(ps.board.get('10,7'), undefined, '赫默\'s placed drone left the board');
assert.equal(ps.board.get('10,7')?.uid, devA.uid, 'the dragged device is where it was dropped');
assert.equal(ps.board.get('10,8'), undefined, '赫默\'s placed drone left the board');
assert.equal(stackOf(ps, DRONE)?.count, 1, '… back onto her card');
assert.equal(ps.board.get('11,4')?.id, DEVICE, '凯瑟琳\'s other device stays');
// the other device (11,4) dropped onto its own owner (10,4): 凯瑟琳 takes 11,4; the dropped device stays at 10,4, her
// remaining placed device (10,6) goes back onto her card
// remaining placed device (10,7) goes back onto her card
const devB = ps.board.get('11,4');
assert.deepEqual(move(m, devB.uid, { area: 'board', row: 10, col: 4 }), { ok: true });
assert.equal(ps.board.get('11,4')?.uid, cat.uid);
assert.equal(ps.board.get('10,4')?.uid, devB.uid);
assert.equal(ps.board.get('10,6'), undefined);
assert.equal(ps.board.get('10,7'), undefined);
assert.equal(stackOf(ps, DEVICE)?.count, 1);
assert.equal(tokensOf(ps, DEVICE).reduce((n, p) => n + (p.count || 1), 0), 2, 'still 2 devices in all');
checkInvariants(m);
@@ -263,7 +263,7 @@ test('a summon stack left in temp at the prep deadline comes back next round (PR
assert.deepEqual(move(m, card.uid, { area: 'board', row: 11, col: 4 }, 'UP'), { ok: true });
for (let i = 0; ps.hand.some((x) => x == null); i++) giveItem(m, ps, PLAIN[i]);
// moving 凯瑟琳 with a full hand: her devices go back as one card of 2, which overflows into temp and blocks Ready
assert.deepEqual(move(m, cat.uid, { area: 'board', row: 10, col: 6 }), { ok: true });
assert.deepEqual(move(m, cat.uid, { area: 'board', row: 10, col: 7 }), { ok: true });
const inTemp = ps.temp.find((p) => p && p.kind === 'token' && p.id === DEVICE);
assert.equal(inTemp?.count, 2);
assert.deepEqual(m.handle('p_0', { t: 'g.ready', ready: true }), { error: ERR.TEMP_NOT_EMPTY });
@@ -277,7 +277,7 @@ test('a summon stack left in temp at the prep deadline comes back next round (PR
assert.equal(back[0].count, 2, 'the deploy limit again');
assert.equal(back[0].ownerUid, cat.uid);
assert.deepEqual(move(m, back[0].uid, { area: 'board', row: 10, col: 5 }, 'RIGHT'), { ok: true });
assert.deepEqual(move(m, back[0].uid, { area: 'board', row: 11, col: 6 }, 'UP'), { ok: true });
assert.deepEqual(move(m, back[0].uid, { area: 'board', row: 11, col: 7 }, 'UP'), { ok: true });
assert.ok(ps.tempEmpty, 'placing both cleared temp');
// a later round start grants nothing more: both devices are on the board
h.drive(() => m.phase === PHASE.PREP && m.round === 3);
+87
View File
@@ -0,0 +1,87 @@
// Player report #3 after the 0.1.0 release: "有水池的那张图干员可以错误的被部署到水里,突袭分队干员也会自动落到水里".
// The pool is the 深水区 (tile_deepsea) of 战场#08(下半) 涨潮控制 (act2autochess_m04: board (10–12, 6), the partner's
// (10–12, 14), boss (3–5, 6) / (3–5, 14)). The level file says buildableType ALL, but the tile refuses deployment
// officially: PRTS 地形 深水区 "地形机制:拒绝部署", and the season-1 战场#05 puts a 特制水上平台 ("在水上建立可以部署任意单位
// 的平台") on every one of its 深水区 tiles. The sim side: `grid.canStand` refuses it, so no automatic placement (the
// 突袭 landing tile, a tactician's tactical point, summon tiles) ever picks a water tile. The prep side (placement on
// the board) is test/match/feedback1-placement.test.js.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { makeBattle, chessRec, enemyRec, checkInvariants } from '../helpers/battleHarness.js';
import { getDefaultSource } from '../../server/sim/simdata.js';
import { inRange } from '../../server/sim/content/support/index.js';
const STAGE = 'act2autochess_m04';
const WATER = [[10, 6], [11, 6], [12, 6]];
const isWater = (b, r, c) => b.grid.tile(r, c).key === 'tile_deepsea';
const VIGIL = 'chess_char_3_19_a'; // 伺夜 (战术家): 狼群 on a tactical point
const WOLF = 'token_10028_vigil_wolf';
test('the stage data: 战场#08\'s 深水区 refuses deployment (effective buildable NONE; the level\'s buildableType kept)', () => {
const st = getDefaultSource().getStage(STAGE);
const raw = st.raw ?? st;
const d = raw.tiles.d;
assert.equal(d.tileKey, 'tile_deepsea');
assert.equal(d.buildable, 'NONE', 'PRTS 地形 深水区: 拒绝部署');
assert.equal(d.buildableType, 'ALL', 'the level file\'s own value is kept');
const deploy = new Set([...raw.deployTiles.normal.melee, ...raw.deployTiles.normal.rangedOnly].map(([r, c]) => `${r},${c}`));
for (const [r, c] of WATER) assert.ok(!deploy.has(`${r},${c}`), `deployTiles.normal excludes ${r},${c}`);
for (const side of ['bossLeft', 'bossRight']) {
const t = new Set([...raw.deployTiles[side].melee, ...raw.deployTiles[side].rangedOnly].map(([r, c]) => `${r},${c}`));
for (const [r, c] of [[3, 6], [4, 6], [5, 6], [3, 14], [4, 14], [5, 14]]) assert.ok(!t.has(`${r},${c}`), `${side} excludes ${r},${c}`);
}
});
test('grid.canStand refuses the water for melee and ranged units; the road next to it stays standable', () => {
const h = makeBattle({ stageId: STAGE, units: [] });
for (const [r, c] of WATER) {
assert.ok(isWater(h.b, r, c));
assert.equal(h.b.grid.canStand(r, c), false, `melee ${r},${c}`);
assert.equal(h.b.grid.canStand(r, c, { ranged: true }), false, `ranged ${r},${c}`);
assert.equal(h.b.grid.groundPassable(r, c), true, 'enemies still wade through it');
}
assert.equal(h.b.grid.canStand(11, 5), true);
assert.equal(h.b.grid.canStand(12, 7, { ranged: true }), true);
// the other tile the deploy map denies to melee units: a hard-blocked tile (a 射击台 a map card switched on, ranged
// only in the prep) — no automatic placement puts a melee unit there either
h.b.setObstacle(12, 7, true);
assert.equal(h.b.grid.canStand(12, 7), false, 'melee: not on a 射击台');
assert.equal(h.b.grid.canStand(12, 7, { ranged: true }), true, 'ranged: may stand on it');
});
test('#3 突袭: an idle member jumping to an enemy that wades in the pool lands on dry ground next to it, never in the water', () => {
const defs = {
chess: { r_m: chessRec({ id: 'r_m', bonds: ['raidShip'], profession: 'WARRIOR', skill: null }) },
enemies: { enemy_wader: enemyRec({ key: 'enemy_wader', hp: 1e7, speed: 0 }) },
};
for (const [er, ec] of WATER) {
const h = makeBattle({
stageId: STAGE, defs, bonds: { raidShip: { count: 2, active: true, tier: 1, layers: 0 } },
enemies: [{ key: 'enemy_wader', pos: [er, ec] }], units: [{ chessId: 'r_m', row: 9, col: 3 }],
});
const u = h.unit('r_m');
assert.ok(h.runUntil(() => u.alive && (u.tileR !== 9 || u.tileC !== 3), 14), `jumped (enemy at ${er},${ec})`);
assert.ok(!isWater(h.b, u.tileR, u.tileC), `landed on ${u.tileR},${u.tileC}, not in the water (enemy ${er},${ec})`);
assert.ok(h.b.grid.canStand(u.tileR, u.tileC), 'a tile a melee operator may be deployed on');
assert.ok(inRange(u, h.enemy('enemy_wader')), 'the enemy is in range after the jump');
checkInvariants(h.b);
}
});
test('#3 the tactical point of a tactician never lies in the water (伺夜 facing the pool, no 狼群 piece placed)', () => {
// 伺夜 on the fenced tile (11,7) facing LEFT: her range covers the pool (10–12, 6) — the nearest tiles on the enemy
// path (11,6) — and the road (12,7) / (12,5) / (11,5) behind it
const h = makeBattle({ stageId: STAGE, units: [{ chessId: VIGIL, row: 11, col: 7, dir: 'LEFT' }] });
h.step(1);
const vigil = h.unit(VIGIL);
assert.ok(vigil && vigil.alive);
const tp = h.b.findTacticalPoint(vigil);
assert.ok(tp, 'a tactical point exists');
assert.ok(!isWater(h.b, tp[0], tp[1]), `tactical point ${tp} is not water`);
h.run(1);
const wolf = h.allies().find((u) => u.defId === WOLF && u.alive);
assert.ok(wolf, 'the pack came as her 援军');
assert.ok(!isWater(h.b, wolf.tileR, wolf.tileC), `the pack stands on ${wolf.tileR},${wolf.tileC}, not in the water`);
assert.ok((vigil.baseRangeKeys || []).includes(wolf.tileR * 21 + wolf.tileC), 'inside her attack range');
checkInvariants(h.b);
});
+9 -2
View File
@@ -188,7 +188,12 @@ const UNAVOIDABLE = {
act2autochess_m01: { low: '', up: '12,9 11,9 10,9', uLow: '9,10', uUp: '12,17 11,17 10,17 9,10', b5: '5,9 4,9 3,9|5,11 4,11 3,11', b2: '|' },
act2autochess_m02: { low: '', up: '12,9', uLow: '9,10', uUp: '12,17 9,10', b5: '5,9|5,11', b2: '|' },
act2autochess_m03: { low: '10,9', up: '12,9', uLow: '10,17 9,10 10,9', uUp: '12,17 9,10 10,9', b5: '5,9|5,11', b2: '3,9|3,11' },
act2autochess_m04: { low: '', up: '12,9', uLow: '9,10', uUp: '12,17 9,10', b5: '5,9|5,11', b2: '|' },
// the 深水区 (cols 6 / 14 between the fences) refuses deployment (player report #3 after 0.1.0): non-blockable, and
// every route crosses it — the routes themselves did not change
act2autochess_m04: {
low: '10,6 11,6', up: '12,9 12,6', uLow: '10,14 11,14 9,10 10,6 11,6', uUp: '12,17 12,14 9,10 10,6 11,6',
b5: '5,9 5,6|5,11 5,14', b2: '3,6 4,6|3,14 4,14',
},
};
test('audit: every active stage × gate × field — the non-blockable tiles crossed are exactly the listed unavoidable ones', REAL, () => {
@@ -269,7 +274,9 @@ test('audit: every WALK leg of every wave template (normal / 联防 / boss / hid
}
}
assert.ok(n > 200, `${n} legs audited (${extra} unavoidable non-blockable crossings)`);
assert.equal(accepted, 17, 'accepted boss-arena exceptions (update the count only after reviewing a new one)');
// (17 before 战场#08's 深水区 became non-blockable: on its boss field the +2 detours around the arena floor cross the
// water as well, so three of its legs are no longer exceptions — player report #3 after 0.1.0)
assert.equal(accepted, 14, 'accepted boss-arena exceptions (update the count only after reviewing a new one)');
});
// ---------------------------------------------------------------------------------------------------------------
+3 -1
View File
@@ -46,9 +46,11 @@ function official(sid, { crates: extraCrates = [], blocks: extraBlocks = [], rec
for (const [r, c] of extraBlocks) blocked.add(`${r},${c}`);
const inside = (r, c) => (rect ? r >= rect.r0 && r <= rect.r1 && c >= rect.c0 && c <= rect.c1 : r >= 0 && r < H && c >= 0 && c < W);
const passable = (r, c) => inside(r, c) && ['ALL', 'WALK_ONLY'].includes(tile(r, c).passableMask) && !blocked.has(`${r},${c}`);
// non-blockable walkable terrain: not LOWLAND buildable for melee (floor, gates, goal, teleports)
// non-blockable walkable terrain: not LOWLAND buildable for melee (floor, gates, goal, teleports) — and the 深水区,
// which refuses deployment whatever its buildableType (PRTS 地形 深水区 "拒绝部署"; player report #3 after 0.1.0)
const nb = (r, c) => {
const t = tile(r, c);
if (t.tileKey === 'tile_deepsea') return true;
return !(t.heightType === 'LOWLAND' && (t.buildableType === 'ALL' || t.buildableType === 'MELEE'));
};
const bres = ([r0, c0], [r1, c1], clear) => {
+136
View File
@@ -0,0 +1,136 @@
// Real-server browser check of two player reports after the 0.1.0 release (placement legality, headless Chrome):
// #3 "有水池的那张图干员可以错误的被部署到水里" — on 战场#08(下半) 涨潮控制 (act2autochess_m04, test/e2e/fastServer.mjs hook
// SP_STAGE) the drag highlights of an operator never light the 深水区 (board (10–12, 6)) and a drop there is refused.
// #9 "干员伺夜这样的战术家的战术点能被错误的被放到攻击范围之外" — while 伺夜's 狼群 card is dragged only the free legal
// tiles of her attack range light up; a drop outside is refused, one inside opens the wheel; re-orienting her so the
// pack falls outside her range sends it back to the hand.
// Real mouse drags (press, move, read the 'legal' highlight group of the view, release). Zero console errors.
//
// SP_E2E=1 node --test test/ui/feedback1-placement.e2e.test.js
import { test, describe } from 'node:test';
import assert from 'node:assert/strict';
import { existsSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { Client, ROOT, sleep, hasChrome, startRealServer, problemsOf } from '../e2e/client.mjs';
import { ownerRangeKeys } from '../../server/match/board.js';
const ENABLED = process.env.SP_E2E === '1' && hasChrome() && existsSync(path.join(ROOT, 'public/assets'));
const STAGE = 'act2autochess_m04';
const VIGIL = 'chess_char_3_19_a', GUMMY = 'chess_char_1_10_a', WOLF = 'token_10028_vigil_wolf';
const WATER = ['10,6', '11,6', '12,6'];
const json = (f) => JSON.parse(readFileSync(path.join(ROOT, 'data', f), 'utf8'));
async function soloToPrep(c) {
await c.open();
await c.enter('煌');
await c.click('.mode-card', '独立模拟');
await c.click('.diff-card', '险境');
await c.click('.create-box button', '开始独立模拟');
await c.waitFor((s) => !!s.room, 'solo room');
if (!(await c.st()).phase) await c.click('.room-bar__right button', '开始模拟', { timeout: 20000 });
await c.waitFor((s) => s.phase === 'INFO_CHECK', 'briefing', 30000);
await c.click('.brief__foot .btn--primary', '准备就绪');
await c.waitFor((s) => s.phase === 'BAND_DRAFT', 'band draft', 30000);
await c.click('.dband', null, { nth: 1 });
await c.click('.draft-detail__btns .btn--primary', '确认选择');
await c.waitFor((x) => x.phase === 'PREP' && !x.ready, 'prep', 60000);
await sleep(1800);
}
const handOf = (c, id) => c.page.evaluate((id) => (globalThis.__SP__.store.get().match.private?.hand || []).find((p) => p && p.id === id) || null, id);
const boardOf = (c, id) => c.page.evaluate((id) => (globalThis.__SP__.store.get().match.private?.board || []).filter((p) => p.id === id), id);
const legalLit = (c) => c.page.evaluate(() => {
const hl = globalThis.__SP_VIEW__?.raw?.debug?.tiles?.highlights?.get('legal');
return hl ? hl.tiles.map((t) => (Array.isArray(t) ? `${t[0]},${t[1]}` : `${t.row},${t.col}`)) : [];
});
const wheelOpen = (c) => c.page.evaluate(() => !!document.querySelector('.fwheel__dia'));
/** Press on hand piece `uid`, move over `hover` and read the legal highlights mid-drag, then release on `drop`. */
async function dragRead(c, uid, hover, drop, shot = null) {
const from = await c.piecePoint(uid);
const over = await c.tilePoint(hover[0], hover[1]);
const to = await c.tilePoint(drop[0], drop[1]);
assert.ok(from && over && to, `piece ${uid} and tiles on screen`);
const m = c.page.mouse;
await m.move(from.x, from.y);
await m.down();
for (let i = 1; i <= 12; i++) { await m.move(from.x + ((over.x - from.x) * i) / 12, from.y + ((over.y - from.y) * i) / 12); await sleep(14); }
await sleep(250);
const lit = (await legalLit(c)).sort();
if (shot) await c.shot(shot);
for (let i = 1; i <= 8; i++) { await m.move(over.x + ((to.x - over.x) * i) / 8, over.y + ((to.y - over.y) * i) / 8); await sleep(14); }
await sleep(200);
await m.up();
await sleep(500);
return lit;
}
describe('player reports #3 / #9 after 0.1.0: placement highlights (real server, headless Chrome)', { skip: !ENABLED && 'set SP_E2E=1 (and have Chrome + assets) to run' }, () => {
test('the pool is never lit nor accepted; 狼群 lights and accepts only 伺夜\'s range', { timeout: 240000 }, async () => {
const puppeteer = (await import('puppeteer-core')).default;
const srv = await startRealServer({ fast: { timerScale: 0.5, combatSpeed: 4, startRound: 2, chess: [VIGIL, GUMMY], stage: STAGE } });
const c = new Client(puppeteer, srv.base, 'feedback1', { prefix: 'fb1' });
try {
await soloToPrep(c);
assert.equal(await c.page.evaluate(() => globalThis.__SP__.store.get().match.public.stageId), STAGE, 'SP_STAGE hook');
const melee = new Set(json('stages.json')[STAGE].deployTiles.normal.melee.map(([r, col]) => `${r},${col}`));
for (const k of WATER) assert.ok(!melee.has(k), `data: ${k} not deployable`);
// 伺夜 onto (10,4) facing RIGHT through the wheel
const vigil = await handOf(c, VIGIL);
assert.ok(vigil, '伺夜 in the hand');
const lit0 = await dragRead(c, vigil.uid, [9, 3], [10, 4]);
for (const k of WATER) assert.ok(!lit0.includes(k), `伺夜: ${k} not lit (${lit0.join(' ')})`);
assert.ok(lit0.includes('11,5') && lit0.includes('10,7'), 'the dry tiles around the pool are lit');
await c.page.waitForSelector('.fwheel__dia', { timeout: 4000 });
await c.swipe('RIGHT');
await sleep(600);
assert.deepEqual((await boardOf(c, VIGIL)).map((p) => [p.row, p.col, p.dir]), [[10, 4, 'RIGHT']]);
// #3: 古米 (melee) — no water lit, a drop into the pool is refused (no wheel, still in the hand)
const gummy = await handOf(c, GUMMY);
const lit1 = await dragRead(c, gummy.uid, [9, 3], [11, 6], 'pool-drag');
for (const k of WATER) assert.ok(!lit1.includes(k), `古米: ${k} not lit`);
assert.deepEqual(lit1, [...melee].sort(), 'every melee tile (伺夜\'s too: a swap), no water');
assert.equal(await wheelOpen(c), false, 'no wheel for a drop into the water');
assert.ok(await handOf(c, GUMMY), '古米 is still in the hand');
await c.shot('pool-refused');
// #9: the pack card lights exactly the free melee tiles of her range (rows 9–11 × cols 4–7 minus her tile and the pool)
const wolf = await handOf(c, WOLF);
assert.ok(wolf, 'the 狼群 card is in the hand');
const range = ownerRangeKeys(json('chess.json')[VIGIL].rangeGrid, 10, 4, 'RIGHT');
const want = [...melee].filter((k) => range.has(k) && k !== '10,4').sort();
const lit2 = await dragRead(c, wolf.uid, [11, 5], [12, 3], 'wolf-drag');
assert.deepEqual(lit2, want, `狼群 highlights = her range (${lit2.join(' ')})`);
for (const k of ['12,3', '12,4', '10,3', '9,8']) assert.ok(!lit2.includes(k), `${k} outside her range is not lit`);
assert.equal(await wheelOpen(c), false, 'a drop outside her range opens no wheel');
assert.ok(await handOf(c, WOLF), 'the pack stays in the hand');
// inside: the wheel opens and the pack is placed
await dragRead(c, wolf.uid, [11, 5], [11, 5]);
await c.page.waitForSelector('.fwheel__dia', { timeout: 4000 });
await c.swipe('RIGHT');
await sleep(600);
assert.deepEqual((await boardOf(c, WOLF)).map((p) => [p.row, p.col]), [[11, 5]], 'placed inside her range');
await c.shot('wolf-in-range');
// re-orient 伺夜 to LEFT in place: (11,5) leaves her range → the pack goes back to the hand
const v = (await boardOf(c, VIGIL))[0];
const from = await c.piecePoint(v.uid);
const to = await c.tilePoint(10, 4);
await c.drag(from, to);
await c.page.waitForSelector('.fwheel__dia', { timeout: 4000 });
await c.swipe('LEFT');
await sleep(800);
assert.deepEqual((await boardOf(c, VIGIL)).map((p) => p.dir), ['LEFT']);
assert.equal((await boardOf(c, WOLF)).length, 0, 'the pack left the board');
assert.ok(await handOf(c, WOLF), '… back to the hand');
await c.shot('wolf-lifted');
assert.deepEqual(problemsOf([c]), []);
} finally {
await c.close();
await srv.stop();
}
});
});
+5 -2
View File
@@ -217,6 +217,9 @@ describe('placement mirror (canPlace)', () => {
const board = [];
const tiles = [[9, 3], [9, 4], [9, 5], [9, 7], [9, 8], [9, 9], [10, 5], [10, 7]];
for (const [row, col] of tiles) board.push({ ...piece(MELEE), row, col });
// the 狼群's owner: 伺夜 facing UP on (9,4) — her range (rows 9–12 × cols 3–5) covers the tiles tried below
// ("只能部署在召唤者攻击范围内", player report #9 after 0.1.0)
board[1] = { ...piece('chess_char_3_19_a'), row: 9, col: 4, dir: 'UP' };
const extra = piece(MELEE);
const ctx = ctxFor(privWith({ board, hand: [extra] }));
const full = canPlace(ctx, extra.uid, { area: 'board', row: 11, col: 5 });
@@ -225,7 +228,7 @@ describe('placement mirror (canPlace)', () => {
const onBoard = board[0];
assert.equal(canPlace(ctx, onBoard.uid, { area: 'board', row: 11, col: 5 }).ok, true, 'moving on the board never hits the cap');
// tokens don't use deploy slots
const tok = { uid: ++uid, kind: 'token', id: 'token_10028_vigil_wolf', count: 1, ownerUid: board[0].uid };
const tok = { uid: ++uid, kind: 'token', id: 'token_10028_vigil_wolf', count: 1, ownerUid: board[1].uid };
const ctx2 = ctxFor(privWith({ board, hand: [tok] }));
assert.equal(canPlace(ctx2, tok.uid, { area: 'board', row: 11, col: 5 }).ok, true);
assert.equal(canPlace(ctx2, tok.uid, { area: 'board', row: 10, col: 4 }).ok, false, 'MELEE token not on high ground');
@@ -234,7 +237,7 @@ describe('placement mirror (canPlace)', () => {
const ctx3 = ctxFor(privWith({ board, hand: [orphan] }));
assert.equal(canPlace(ctx3, orphan.uid, { area: 'board', row: 11, col: 5 }).code, 'BAD_TARGET', 'summoner must be deployed');
// a hand chess swapping with a board token takes a deploy slot (cap applies)
const bTok = { uid: ++uid, kind: 'token', id: 'token_10028_vigil_wolf', count: 1, ownerUid: board[0].uid, row: 11, col: 5 };
const bTok = { uid: ++uid, kind: 'token', id: 'token_10028_vigil_wolf', count: 1, ownerUid: board[1].uid, row: 11, col: 5 };
const ctx4 = ctxFor(privWith({ board: [...board, bTok], hand: [extra] }));
assert.equal(canPlace(ctx4, extra.uid, { area: 'board', row: 11, col: 5 }).code, 'BOARD_FULL');
});