Name completed objectives in action recap captions
This commit is contained in:
parent
336217c180
commit
24654cc3e1
5 changed files with 35 additions and 4 deletions
|
|
@ -373,3 +373,5 @@ Viewer 0.1.126 / engine 0.4.90 fixes Loyalty tactics rendering using the Celtic
|
|||
Viewer 0.1.127 / engine 0.4.91 counts Mercenaries targets by distinct Barbarian army hex, not individual units, so selection limits and payment are per army. The prompt explains the grouping. Revolt waiting text explicitly asks for a city for the free infantry.
|
||||
|
||||
Viewer 0.1.128 / engine 0.4.92 prefers human-city trade routes over Barbarian routes for Celts with Currency, after maximizing route count. This preserves food/gold options in actual rewards and prevents false unavoidable-food-waste forecasts.
|
||||
|
||||
Viewer 0.1.129 names publicly completed objectives in replay and live action captions, including existing recorded frames, without duplicating their completion effect.
|
||||
|
|
|
|||
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.128",
|
||||
"version": "0.1.129",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.128",
|
||||
"version": "0.1.129",
|
||||
"dependencies": {
|
||||
"@boardgamers/protocol": "0.9.0",
|
||||
"lucide-svelte": "^0.577.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@boardgamers/clash-web-client",
|
||||
"version": "0.1.128",
|
||||
"version": "0.1.129",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -465,3 +465,20 @@ test('recap names a publicly played action card, never a drawn card', () => {
|
|||
action.items = [{player:0,HandCard:{card:{ActionCard:2},to:{Hand:0}}}];
|
||||
assert.ok(!frameDetails(before,after,history,[],catalog).caption.includes('Good Ideas'));
|
||||
});
|
||||
|
||||
|
||||
test('objective completion recaps name the completed side, without repeating its effect', () => {
|
||||
const { before, after, game } = choiceRecap([
|
||||
{ player: 0, HandCard: { card: { ObjectiveCard: 1 }, to: { CompleteObjective: 'Bold' } } },
|
||||
], [{ player: 0, kind: 'completed', label: 'Bold' }]);
|
||||
before.players[0].civilization = 'Maya';
|
||||
for (const title of ['Select Objective Cards to Complete', 'Complete Objectives', 'Resolve choice']) {
|
||||
after.title = title;
|
||||
assert.equal(frameDetails(before, after, game).caption, 'Maya · Completed Daring');
|
||||
}
|
||||
// A second public completion in the same frame is retained.
|
||||
game.log![0].rounds[0].turns[0].actions![0].items!.push(
|
||||
{ player: 0, HandCard: { to: { CompleteObjective: 'Conqueror' } } },
|
||||
);
|
||||
assert.equal(frameDetails(before, after, game).caption, 'Maya · Completed Daring, Conqueror');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export function frameDetails(
|
|||
let description = ['Explore Resolution', 'Finish ship exploration'].includes(frame.title)
|
||||
? 'Explore'
|
||||
: frame.title;
|
||||
const generic = ['Resolve choice', 'Pay for action', 'Action'].includes(
|
||||
const generic = ['Resolve choice', 'Pay for action', 'Action', 'Select Objective Cards to Complete', 'Complete Objectives'].includes(
|
||||
frame.title,
|
||||
);
|
||||
const outcomes: string[] = [];
|
||||
|
|
@ -208,6 +208,13 @@ export function frameDetails(
|
|||
const readable = wonderName;
|
||||
for (const player of frame.players) {
|
||||
const own = items.filter((item) => item.player === player.id);
|
||||
const completed = [...new Set(own.flatMap((item) => {
|
||||
const to = item.HandCard?.to;
|
||||
return to && typeof to === 'object' && 'CompleteObjective' in to && typeof to.CompleteObjective === 'string'
|
||||
? [to.CompleteObjective] : [];
|
||||
}))];
|
||||
if (completed.length)
|
||||
details.push(`${player.id === frame.actor ? '' : player.civilization + ': '}Completed ${completed.join(', ')}`);
|
||||
const gained = [
|
||||
...new Set(
|
||||
own.filter((item) => item.Advance?.balance === 'Gain').map((item) => item.Advance!.advance),
|
||||
|
|
@ -252,6 +259,11 @@ export function frameDetails(
|
|||
}
|
||||
// Public effect labels identify card types without exposing private cards.
|
||||
for (const effect of frame.effects ?? []) {
|
||||
if (effect.kind === 'completed' && items.some(item => {
|
||||
const to = item.HandCard?.to;
|
||||
return item.player === effect.player && to && typeof to === 'object' &&
|
||||
'CompleteObjective' in to && to.CompleteObjective === effect.label;
|
||||
})) continue;
|
||||
const player = frame.players.find((p) => p.id === effect.player);
|
||||
const label = `${effect.player === frame.actor ? '' : (player?.civilization ?? 'Player') + ': '}${effect.label}`;
|
||||
if (!details.includes(label)) details.push(label);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue