Files
ark-stronghold-protocol/test/ui/playtest6-bounty.test.js
T
sganggs 5e6fe19a70 feedback1 WB: bounty drafts offer the cards of their half (late bounty enemies no longer in the R3 draft)
Player report #2: boss bounties, second-half specials and their upgraded copies
showed up in the first 悬赏决策 draft. A draft up to R7 (the official wave
generator's first half) now offers the 接下来两场作战 cards, a draft from R8 the
下场作战 and multi-round cards, with no tier window (the official late draft
screenshot shows boss bounties worth 1 to 6 together). choices.json cards.bounty
draftHalf, schedule bountyHalf; the mode's inactive enemy list no longer thins
the bounty draft (PRTS 11/18 note).
2026-10-03 01:38:33 +08:00

58 lines
3.6 KiB
JavaScript

// User playtest #6 item 4 (workstream WC), the client side: a 悬赏决策 card shows how many battles its enemies come for
// the way the official card does — "下场作战" / "两场作战" in blue, a multi-round card's "每场" in red (activity_table
// effectDesc rich text) — instead of plain text. A real draft (server/match/choices.js generateDraft → cardView), through
// m.public's normalisation (ui/gameLogic.js normalizeSp), resolved by the overlay (ui/choiceOverlay.js resolveSpCard).
// The server side is in test/match/playtest6-matchflow.test.js.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { DATA } from '../match/harness.js';
import { GameData } from '../../server/match/gamedata.js';
import { generateDraft, cardView } from '../../server/match/choices.js';
import { createRng } from '../../server/sim/rng.js';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
// the browser data store reads the real data files from disk
globalThis.fetch = async (url) => {
const name = String(url).split('/').pop();
try {
const body = readFileSync(path.join(ROOT, 'data', name), 'utf8');
return { ok: true, status: 200, json: async () => JSON.parse(body) };
} catch {
return { ok: false, status: 404, json: async () => ({}) };
}
};
const { data } = await import('../../public/js/data.js');
const { resolveSpCard } = await import('../../public/js/ui/choiceOverlay.js');
const { normalizeSp } = await import('../../public/js/ui/gameLogic.js');
const { parseRichText } = await import('../../public/js/ui/richText.js');
test('#4 the draft overlay shows each bounty card\'s battles in the official colours (blue 下场 / 两场; a multi-round card reads 两场 too)', async () => {
await data.loadAll('choices', 'effects', 'items', 'assets', 'enemies');
const gd = new GameData(DATA, 'mode_multi_hard');
// the official multi-round cards: two battles, in the two-battle cards' blue (the user's call after playtest #6)
const MULTI = new Set(DATA.choices.cards.bounty.filter((c) => c.multiRound).map((c) => c.effectId));
const seen = new Set();
// R3 offers the two-battle cards, R9 the next-battle and multi-round ones (player feedback #2, choices.js bountyDraftHalf)
for (let seed = 1; seed <= 80 && seen.size < 3; seed++) {
const round = seed % 2 ? 3 : 9;
const d = generateDraft(gd, createRng(seed * 977 + 3), round, { stageId: 'act2autochess_m02' });
assert.equal(d.family, 'bounty', `co-op 绝境 R${round} is a bounty draft`);
const sp = normalizeSp({ family: d.family, cards: d.cards.map(cardView), order: ['p_0'], turn: 'p_0', picks: {}, taken: {} }, [{ playerId: 'p_0' }]);
for (const card of sp.cards) {
const view = resolveSpCard(card, sp.family);
const segs = parseRichText(view.desc).filter((s) => s.text);
const styled = (cls) => segs.filter((s) => s.cls.includes(cls)).map((s) => s.text).join('|');
assert.ok(!styled('ba.vdown').includes('每场'), `${card.id} ${view.name}: no red 每场 (${view.desc})`);
if (card.rounds === 2) assert.ok(styled('ba.vup').includes('两场作战'), `${card.id} ${view.name}: blue 两场作战 (${view.desc})`);
else assert.match(styled('ba.vup'), /下场(作战|战斗)/, `${card.id} ${view.name}: blue 下场 (${view.desc})`);
seen.add(MULTI.has(card.id) ? 'multi' : card.rounds);
}
}
assert.deepEqual([...seen].map(String).sort(), ['1', '2', 'multi'], 'drafts with 1-, 2-battle and multi-round cards were checked');
});