Name played action cards in turn replay summaries
This commit is contained in:
parent
21214e23b9
commit
ec8ba883cc
6 changed files with 28 additions and 3 deletions
|
|
@ -317,3 +317,5 @@ Viewer 0.1.98 keeps the region city count inline and only shows that count and t
|
|||
Viewer 0.1.99 / engine 0.4.78 fixes Revolution's independent sacrifices: the first prevents action loss and the second prevents government change. Step two no longer overwrites step one's result, and the government prompt checks the second sacrifice. Saved games already awaiting step two recover the first sacrifice from active (not undone) history. The journal explicitly names the consequence prevented. Validated all four sacrifice combinations and saved-step compatibility, plus the reported game's local copy; no live moves were submitted.
|
||||
|
||||
Viewer 0.1.100 fixes mobile map controls wrapping into a tall block and overlapping activity controls. The map toolbar stays on one compact row, with journal/chat above it. Smaller outer margins and an explicit width cap preserve a gap between player panels and the action bar. Redo no longer adds a toolbar column: Undo's menu arrow, long press, context menu, or keyboard Down opens Redo. Verified layout at 320/360/393/430px in both map views, keyboard access, and long-press without accidental Undo. Engine remains 0.4.78.
|
||||
|
||||
Viewer 0.1.101 names publicly played action cards in Since your last turn summaries, retaining resource and other outcomes. It resolves the card from the frame's public Playing ActionCard log entry and the public catalog; drawn/hidden cards are never used to infer a name. Checked replay tests and existing public game-history examples. Engine remains 0.4.78.
|
||||
|
|
|
|||
4
web-client/package-lock.json
generated
4
web-client/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.100",
|
||||
"version": "0.1.101",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.100",
|
||||
"version": "0.1.101",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.100",
|
||||
"version": "0.1.101",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
frame ?? null,
|
||||
$session.game,
|
||||
$session.view?.advances,
|
||||
$session.view?.cardCatalog,
|
||||
),
|
||||
);
|
||||
const progress = $derived(
|
||||
|
|
|
|||
|
|
@ -453,3 +453,15 @@ test('choice recaps use public decisions and happiness outcomes', () => {
|
|||
'India · Decided to convert mood to culture tokens',
|
||||
);
|
||||
});
|
||||
|
||||
test('recap names a publicly played action card, never a drawn card', () => {
|
||||
const before = { cursor: 0, actor: 0, title: 'End turn', tiles: [], players: [{id:0,civilization:'Greece',units:[],cities:[]}] } as unknown as BoardFrame;
|
||||
const after = {...before,cursor:1,title:'Play action card'};
|
||||
const action = {player:0,action:{Playing:{ActionCard:2}},items:[]} as LoggedAction;
|
||||
const history = {log_index:1,log:[{age:1,rounds:[{round:1,turns:[{actions:[action]}]}]}]} as Game;
|
||||
const catalog = [{id:2,name:'Great Ideas',description:'Gain ideas.',free:true,tactics:null}];
|
||||
assert.equal(frameDetails(before,after,history,[],catalog).caption,'Greece · Played Good Ideas');
|
||||
action.action = {Response:{Bool:true}};
|
||||
action.items = [{player:0,HandCard:{card:{ActionCard:2},to:{Hand:0}}}];
|
||||
assert.ok(!frameDetails(before,after,history,[],catalog).caption.includes('Good Ideas'));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ export function frameDetails(
|
|||
frame: BoardFrame | null,
|
||||
game?: Game | null,
|
||||
advances: View['advances'] = [],
|
||||
cards: NonNullable<View['cardCatalog']> = [],
|
||||
) {
|
||||
if (!frame) return { caption: 'No recorded positions yet.', positions: [] as string[] };
|
||||
const actor = frame.players.find((p) => p.id === frame.actor)?.civilization;
|
||||
|
|
@ -166,6 +167,15 @@ export function frameDetails(
|
|||
.flatMap((age) => age.rounds.flatMap((round) => round.turns.flatMap((turn) => turn.actions ?? [])))
|
||||
.slice(before.cursor, frame.cursor);
|
||||
const items = actions.flatMap((action) => action.items ?? []);
|
||||
if (frame.title === 'Play action card') {
|
||||
const played = actions.flatMap(action => {
|
||||
const playing = typeof action.action === 'object' && action.action?.Playing;
|
||||
return playing && typeof playing === 'object' && 'ActionCard' in playing && typeof playing.ActionCard === 'number'
|
||||
? [playing.ActionCard] : [];
|
||||
});
|
||||
const names = [...new Set(played.map(id => cards.find(card => card.id === id)?.name).filter(Boolean))];
|
||||
if (names.length) description = `Played ${names.join(' · ')}`;
|
||||
}
|
||||
if (frame.title === 'Civilization ability') {
|
||||
// Older frames kept a generic title. The public start entry already names
|
||||
// the advance or leader ability, including free actions with no cost item.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue