story: public discards, factual rivalry wording, Portal ties, fixture Portals per duel-cards #70

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 21:55:25 -05:00
co-authored by Claude Opus 5.5
parent 26ca8e2f27
commit 0ca7704767
6 changed files with 43 additions and 19 deletions
+2
View File
@@ -150,6 +150,8 @@ export function renderEvent(nar: Narrator, ev: StoryEvent, index: number, viewer
if (count > 1) return nar.sentence('drawHiddenMany', index, { player: P(ev.seat), count: () => numberWord(count) });
return nar.sentence('drawHidden', index, { player: P(ev.seat) });
}
case 'discard':
return nar.sentence('discard', index, { player: P(ev.seat), card: M(ev.card) });
case 'connected':
return nar.sentence('connected', index, { a: M(ev.a), b: M(ev.b), reason: () => ev.reason });
case 'rivalry':
+11 -2
View File
@@ -181,8 +181,13 @@ export function recap(record: MatchRecord): RecapDoc {
if (!mine.length) { background.push(`${record.players[seat].name} played no cards.`); continue; }
const counts = new Map<string, number>();
for (const p of mine) { const k = C[p.id].portal ?? 'Neutral'; counts.set(k, (counts.get(k) ?? 0) + 1); }
const [portal, n] = [...counts.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0]))[0];
background.push(`${portal} was the largest Portal in the force of ${record.players[seat].name} (${numberWord(n)} of ${numberWord(mine.length)} ${mine.length === 1 ? 'card' : 'cards'} played).`);
const sorted = [...counts.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0]));
const max = sorted[0][1];
const tops = sorted.filter(([, n]) => n === max).map(([k]) => k);
const name = record.players[seat].name;
const played = `${numberWord(mine.length)} ${mine.length === 1 ? 'card' : 'cards'} played`;
if (tops.length === 1) background.push(`${tops[0]} was the largest Portal in the force of ${name} (${numberWord(max)} of ${played}).`);
else background.push(`${listJoin(tops)} were equally represented in the force of ${name} (${numberWord(max)} ${max === 1 ? 'card' : 'cards'} each, of ${played}).`);
}
// Course of the battle: the largest Notability swings and destroyed cards of cost ≥ 4.
@@ -266,6 +271,10 @@ export function recap(record: MatchRecord): RecapDoc {
};
}
function listJoin(xs: string[]): string {
return xs.length <= 1 ? xs.join('') : `${xs.slice(0, -1).join(', ')} and ${xs[xs.length - 1]}`;
}
function cards(n: number): string { return `${n} ${n === 1 ? 'card' : 'cards'}`; }
function turnAt(events: StoryEvent[], index: number): number {
+6 -1
View File
@@ -71,13 +71,18 @@ export const LOG_TEMPLATES = {
'{player} added {count} cards to their hand.',
'{player} took {count} cards into hand.',
],
discard: [
'{player} discarded {card}.',
'{card} was discarded by {player}.',
'{player} moved {card} from hand to Deleted.',
],
connected: [
'{a} and {b} were Connected ({reason}).',
'{a} was Connected to {b} through {reason}.',
'Records link {a} and {b} ({reason}).',
],
rivalry: [
'{a} and {b} had previously been associated through {reason}.',
'{a} and {b} are both listed under {reason}.',
'{a} and {b} share {reason}.',
'The two sides were linked through {reason}.',
],
+2
View File
@@ -43,6 +43,8 @@ export type StoryEvent =
| { kind: 'tokenCreated'; seat: Seat; source: string; token: string; count: number }
/** `card` set when the drawn card is known to the viewer's record; hidden draws omit it. */
| { kind: 'draw'; seat: Seat; card?: string; count?: number }
/** Deleted is public (DUEL_DESIGN §2.3): discards are always named. */
| { kind: 'discard'; seat: Seat; card: string }
| { kind: 'connected'; seat: Seat; a: string; b: string; reason: string }
| { kind: 'rivalry'; a: string; b: string; reason: string }
| { kind: 'gameOver'; winner: Seat; reason: GameOverReason; turn: number };
+12 -12
View File
@@ -9,23 +9,23 @@
"Turn 7. alice added a card to their hand. *Zbyszek Godlewski* (Polish protester, 1952–1970) entered play under alice.[5]",
"Turn 8. bob added a card to their hand. *Marc Fesneau* (French politician, born 1971) entered play under bob.[6]",
"Turn 9. alice drew one card. *Zbyszek Godlewski* (6/3) attacked. *Zbyszek Godlewski* was blocked by *Marc Fesneau* (5/4). *Zbyszek Godlewski* was removed from play. *Marc Fesneau* was removed from play. alice drew one card.",
"Turn 10. bob added a card to their hand. bob brought *Pallas's cat* (Species of small wild cat) into play.[7]",
"Turn 11. alice drew a card. *Tom Ewell* (American actor, 1909–1994) was deployed by alice.[8]",
"Turn 12. bob drew a card. *Tom Ewell* adopted *Heart rot* (Fungal disease of trees) and became a 2/2.[9] *Pallas's cat* (5/5) attacked. *Pallas's cat* dealt 5 damage to alice, leaving 15 Notability.",
"Turn 13. alice drew one card. *Tom Ewell* adopted *Monoid* (Algebraic structure with an associative operation and an identity element) and became a 5/5.[10] *Tom Ewell* (5/5) advanced on bob. bob lost 5 Notability (11 remaining).",
"Turn 14. bob drew one card. bob cited *2025 Tehreek-e-Labbaik Pakistan protests* (Gaza war protests in Pakistan).[11] *Tom Ewell* took 3 damage from *2025 Tehreek-e-Labbaik Pakistan protests*. *Tatsunoko Production* (Japanese animation studio) was deployed by bob.[12] *Pallas's cat* (5/5) attacked. alice's Notability fell to 10.",
"Turn 15. alice drew one card. *Tom Ewell* (5/5) advanced on bob. *Tom Ewell* dealt 5 damage to bob, leaving 6 Notability.",
"Turn 16. bob added a card to their hand. bob sent *Pallas's cat* (5/5) into combat. *Pallas's cat* dealt 5 damage to alice, leaving 5 Notability.",
"Turn 17. alice added a card to their hand. *Tom Ewell* (5/5) advanced on bob. *Tom Ewell* dealt 5 damage to bob, leaving 1 Notability.",
"Turn 18. bob drew one card. *Pallas's cat* (5/5) advanced on alice. alice lost 5 Notability (0 remaining). alice was nominated for deletion. The result was **delete**."
"Turn 10. bob added a card to their hand. bob discarded *Agda (programming language)* (Functional programming language).[7] bob deployed *Pallas's cat* (Species of small wild cat).[8]",
"Turn 11. alice drew one card. alice deployed *Tom Ewell* (American actor, 1909–1994).[9]",
"Turn 12. bob added a card to their hand. bob attached *Heart rot* (Fungal disease of trees) to *Tom Ewell* (2/2).[10] *Pallas's cat* (5/5) advanced on alice. *Pallas's cat* dealt 5 damage to alice, leaving 15 Notability.",
"Turn 13. alice added a card to their hand. *Monoid* (Algebraic structure with an associative operation and an identity element) was adopted by *Tom Ewell*, which became a 5/5.[11] alice sent *Tom Ewell* (5/5) into combat. bob lost 5 Notability (11 remaining).",
"Turn 14. bob drew one card. bob invoked *2025 Tehreek-e-Labbaik Pakistan protests* (Gaza war protests in Pakistan).[12] *2025 Tehreek-e-Labbaik Pakistan protests* inflicted 3 damage on *Tom Ewell*. bob brought *Tatsunoko Production* (Japanese animation studio) into play.[13] bob sent *Pallas's cat* (5/5) into combat. alice's Notability fell to 10.",
"Turn 15. alice drew a card. *Tom Ewell* (5/5) advanced on bob. bob lost 5 Notability (6 remaining).",
"Turn 16. bob drew a card. bob sent *Pallas's cat* (5/5) into combat. alice lost 5 Notability (5 remaining).",
"Turn 17. alice drew one card. *Tom Ewell* (5/5) advanced on bob. bob's Notability fell to 1.",
"Turn 18. bob drew one card. bob sent *Pallas's cat* (5/5) into combat. alice lost 5 Notability (0 remaining). alice was reduced to 0 Notability. bob won."
],
"lead": "The **Battle of Pathrail Mosque (2026)** was a WikiDeck engagement fought on 17 November 2026 between the forces of alice and bob. It lasted eighteen turns and ended in a Pyrrhic victory for bob.[1] Contemporary accounts note the deployment of *Dichromorpha viridis* (Species of grasshopper) in the third turn.[2]",
"sections": [
{
"heading": "Background",
"paragraphs": [
"History was the largest Portal in the force of alice (two of five cards played).",
"Earth was the largest Portal in the force of bob (two of seven cards played)."
"Arts, Earth, History, Science and Society were equally represented in the force of alice (one card each, of five cards played).",
"Society was the largest Portal in the force of bob (three of seven cards played)."
]
},
{
@@ -37,7 +37,7 @@
"In the fourteenth turn, *Pallas's cat* dealt 5 damage to alice, leaving 10 Notability.",
"In the fifteenth turn, *Tom Ewell* dealt 5 damage to bob, leaving 6 Notability.",
"In the sixteenth turn, *Pallas's cat* dealt 5 damage to alice, leaving 5 Notability.",
"alice was reduced to 0 Notability. bob won."
"alice was nominated for deletion. The result was **delete**."
]
},
{
+10 -4
View File
@@ -19,7 +19,7 @@ function card(id: string, title: string, type: CardType, cost: number, portal: s
}
const cards: Record<string, StoryCard> = Object.fromEntries([
card('a1', 'Dichromorpha viridis', 'Figure', 2, 'Earth', 0),
card('a2', 'Pathrail Mosque', 'Location', 2, 'History', 0),
card('a2', 'Pathrail Mosque', 'Location', 2, 'Society', 0),
card('a3', 'Zbyszek Godlewski', 'Figure', 5, 'History', 0),
card('a4', 'Monoid', 'Doctrine', 6, 'Science', 0),
card('a5', 'Tom Ewell', 'Figure', 6, 'Arts', 0),
@@ -28,8 +28,9 @@ const cards: Record<string, StoryCard> = Object.fromEntries([
card('b3', 'Marc Fesneau', 'Figure', 5, 'Society', 1),
card('b4', "Pallas's cat", 'Figure', 6, 'Earth', 1),
card('b5', 'Heart rot', 'Doctrine', 5, 'Science', 1),
card('b6', '2025 Tehreek-e-Labbaik Pakistan protests', 'Event', 5, 'History', 1),
card('b6', '2025 Tehreek-e-Labbaik Pakistan protests', 'Event', 5, 'Society', 1),
card('b7', 'Tatsunoko Production', 'Institution', 6, 'Arts', 1),
card('b8', 'Agda (programming language)', 'Doctrine', 6, 'Science', 1),
].map(c => [c.id, c]));
const T = (turn: number): StoryEvent => ({ kind: 'turnStart', turn, seat: turn % 2 === 1 ? 0 : 1 });
@@ -49,7 +50,7 @@ const events: StoryEvent[] = [
T(9), { kind: 'draw', seat: 0 }, { kind: 'attack', seat: 0, card: 'a3', power: 6, toughness: 3 },
{ kind: 'block', seat: 1, blocker: 'b3', attacker: 'a3', power: 5, toughness: 4 },
{ kind: 'destroyed', card: 'a3' }, { kind: 'destroyed', card: 'b3' }, { kind: 'draw', seat: 0 },
T(10), { kind: 'draw', seat: 1 }, { kind: 'deploy', seat: 1, card: 'b4' },
T(10), { kind: 'draw', seat: 1 }, { kind: 'discard', seat: 1, card: 'b8' }, { kind: 'deploy', seat: 1, card: 'b4' },
T(11), { kind: 'draw', seat: 0 }, { kind: 'deploy', seat: 0, card: 'a5' },
T(12), { kind: 'draw', seat: 1 }, { kind: 'adopt', seat: 1, doctrine: 'b5', figure: 'a5', power: 2, toughness: 2 },
{ kind: 'attack', seat: 1, card: 'b4', power: 5, toughness: 5 }, { kind: 'playerDamage', seat: 0, source: 'b4', amount: 5, life: 15 },
@@ -124,7 +125,7 @@ test('log: golden lines for the omniscient view', () => {
const later = lines.filter(l => l.text.includes('*Tom Ewell*'));
assert.ok(later.length >= 3);
assert.equal(later.filter(l => l.text.includes('American actor')).length, 1);
assert.equal(references.length, 12);
assert.equal(references.length, 13); // 12 played + the discarded Agda
// snapshot of the whole log text (golden): regenerate deliberately if templates change
assert.equal(paras.join('\n').length > 1500, true);
assert.deepEqual(renderLog(record, null), { lines, references });
@@ -142,6 +143,11 @@ test('log: logFor hides the opponent\'s draws', () => {
assert.ok(forAlice.some(t => /alice.*Dichromorpha viridis|Dichromorpha viridis.*alice/.test(t) && /drew|drawn|hand/.test(t)));
});
test('log: discards are public (Deleted is a public zone)', () => {
const forAlice = renderLog(record, 0).lines.map(l => l.text);
assert.ok(forAlice.some(t => /Agda \(programming language\)/.test(t) && /discard|Deleted/.test(t)));
});
test('determinism: same seed gives the same text; another seed varies it', () => {
assert.deepEqual(recap(record), recap(structuredClone(record)));
const other = recap({ ...record, seed: 'another-seed' });