A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: reconvergence events and variant text (R-ALT-010, refs #952; stacked on #978) (#981)
Eyal Golanbc596d280f3c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 333c6df2a..5af009def 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,7 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB### Added- Events: a consequence card's option can rejoin the record (`rejoin`, R-ALT-009; refs #951, #939). No content uses it yet.+- Events: reconvergence events can bend their text to the player's course (`variants`, R-ALT-010; refs #952, #939).- Events: consequence cards (`kind: consequence`) for the roads not taken. They are soft, follow only a roadcontemporaries proposed or debated (the Ferguson test), lie at most 2 cards deep, carry the sensitive tags of the roadthey follow and take the first soft slots of a turn (R-ALT-005 to R-ALT-008, R-ALT-012; refs #950, #939). No contentdiff --git a/content/schema/event.schema.json b/content/schema/event.schema.jsonindex 3609be2b3..d3c677800 100644--- a/content/schema/event.schema.json+++ b/content/schema/event.schema.json@@ -41,11 +41,35 @@"option": { "$ref": "#/definitions/id" },"diverged": { "type": "boolean" }}+ },+ "variant": {+ "type": "object",+ "additionalProperties": false,+ "required": ["when", "text", "sources"],+ "description": "Alternative title and text for a reconvergence event on a road not taken (R-ALT-010). Options and effects do not vary.",+ "properties": {+ "when": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/requirement" } },+ "title": { "type": "string", "description": "Optional; when absent, use the event's title." },+ "text": { "type": "string", "minLength": 1 },+ "sources": {+ "type": "array",+ "minItems": 1,+ "items": {+ "type": "object",+ "additionalProperties": false,+ "required": ["url", "checked"],+ "properties": {+ "url": { "type": "string", "pattern": "^https://" },+ "checked": { "$ref": "#/definitions/date" }+ }+ }+ }+ }}},"properties": {"id": { "$ref": "#/definitions/id", "description": "Unique across all events." },- "kind": { "enum": ["historical", "consequence", "reconvergence"], "description": "Default historical. consequence: a soft card that exists only on a road not taken (R-ALT-005 to R-ALT-008). reconvergence: a real outside event that happened regardless (its variants arrive with #952)." },+ "kind": { "enum": ["historical", "consequence", "reconvergence"], "description": "Default historical. consequence: a soft card that exists only on a road not taken (R-ALT-005 to R-ALT-008). reconvergence: a real outside event that may carry variants (R-ALT-010)." },"title": { "type": "string", "minLength": 1, "description": "May contain office placeholders such as {prime_minister}." },"text": { "type": "string", "minLength": 1, "description": "May contain office placeholders. No invented quotes." },"tags": { "type": "array", "items": { "type": "string" }, "description": "holocaust, terror, massacre and war-casualties are sensitive." },@@ -68,6 +92,7 @@}},"requires": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/requirement" }, "description": "Every entry must hold (R-ALT-001)." },+ "variants": { "type": "array", "items": { "$ref": "#/definitions/variant" } },"options": {"type": "array","minItems": 1,diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex 078f9de69..cc5237bed 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -37,8 +37,9 @@ schema too, or that test fails. Keep the comment when you copy a file.| `from` | yes | First day of the window, `YYYY-MM-DD`. || `to` | no | Day the window ends (exclusive). Must be after `from`. Leave it out for an open window. || `conditions` | no | Indicator bounds that must hold when it fires. See below. |-| `kind` | no (default `historical`) | `consequence` for a card that exists only on a road not taken. See below. |+| `kind` | no (default `historical`) | `consequence` for a card that exists only on a road not taken; `reconvergence` for an outside event with course-specific text. See below. || `requires` | no | Fires only after every listed requirement holds. See below. |+| `variants` | no | `kind: reconvergence` only. Course-specific title and text, each with `when`, `text`, optional `title` and `sources` (R-ALT-010). See "kind". || `objective` | no | Makes the event the completion card of an objective in `objectives.yaml`, which must name this event as its `card`. It fires only once the objective is completed (GDD loop only), and has exactly one option. See `docs/gdd/objective-card.md`. || `options` | yes | One or more options. See below. || `sources` | no by the loader, yes by the rules | A list of `{ url, checked }`. See below. |@@ -155,6 +156,29 @@ cards whose absolute windows are still open can fire. It does not erase the opti`diverged: true` requirement on the same event remains true. The loader refuses `rejoin` on any other kind of event, anunknown or self target, or a target whose alternative road the card does not follow.+A **reconvergence event**, `kind: reconvergence`, is a real outside event that happened regardless of the player's+course. It has a historical option and may bend only its title and text to a road not taken (R-ALT-010):++```yaml+kind: reconvergence+title: The outside event+text: It happened regardless.+from: 1948-07-01+to: 1948-08-01+variants:+ - when: [{ event: parent_event, diverged: true }]+ title: The outside event, on your course+ text: It happened regardless; the earlier decision went the other way.+ sources: [{ url: https://example.org/source, checked: 2026-10-18 }]+```++Variants are tested in file order; the first whose every `when` entry holds supplies the text and, when present, the+title. Options and effects never vary. Each variant needs a source and at least one requirement on a road not taken.+Every road it names must have a window that closes on or before the reconvergence event opens, so wording cannot change+while the card is shown. A variant that names an event's historical option also needs every consequence card that can+`rejoin` that event (R-ALT-009) to close by then, since a rejoin makes that option hold. Variant title and text use the same checked office placeholders as the event itself. Only a+reconvergence event may carry `variants`.+### requires```yaml@@ -351,6 +375,12 @@ Errors are printed as `file: field: message`. These are the messages you are mos| `must be historical, consequence or reconvergence` | `kind` is another word. || `only a consequence card rejoins the record` | An option of another kind of event has `rejoin`. || `rejoins only an event whose road this card follows` | `rejoin` names an event the card does not follow on a road not taken, or one with no historical option. |+| `only a reconvergence event carries variants` | An event with another `kind` has `variants`. |+| `a reconvergence event happened` | A reconvergence event has no historical option. |+| `a variant follows a road not taken` | A variant has no `when` requirement on a non-historical road. |+| `can still be open when this card opens` | A variant names a road whose window has not closed by this event's `from`. |+| `while this card is open` | A variant names an event's historical option, and a consequence card that rejoins that event can still be open when this card opens. |+| `a variant has text` | A variant's `text` is empty. || `is already required` | Two `requires` entries name the same event (they could never both hold, or one is redundant). |A full message looks like this (an effect target misspelled `securty`):diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex b201c1ce5..9429efe54 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -196,4 +196,6 @@ R-ALT-008: Consequence cards take a turn's soft slots before the other soft evenR-ALT-009: An option of a consequence card may `rejoin` an event whose road the card follows (and which has a historical option). Once it is chosen, a requirement on that event's historical option holds, so the record's later cards fire again if their windows are still open. The event's own chosen option is not rewritten, and `diverged: true` on it still holds.+R-ALT-010: An event of `kind: reconvergence` has a historical option and may carry `variants`. The first variant whose every `when` entry holds supplies the card's title (if it gives one) and text; options and effects never vary. Each variant follows a road not taken, carries sources, has its placeholders checked over the event's window, and names only roads whose windows close on or before the event's `from` (for a road's historical option, also every consequence card that can `rejoin` it, R-ALT-009). Only a reconvergence event carries variants.+R-ALT-012: The historical run (the reference player's orders from 15 May 1948 to 15 January 1952) raises no consequence card and diverges nowhere.diff --git a/sim/Statecraft.Sim.Tests/AlternateTimelineTests.cs b/sim/Statecraft.Sim.Tests/AlternateTimelineTests.csindex fa6d36c16..d31dec200 100644--- a/sim/Statecraft.Sim.Tests/AlternateTimelineTests.cs+++ b/sim/Statecraft.Sim.Tests/AlternateTimelineTests.cs@@ -451,6 +451,156 @@ options:Assert.All(end.ChosenOptions, kv => Assert.False(Timeline.Diverged(Real, end, kv.Key), $"the historical run diverged at {kv.Key}"));}+ // ---- Task 7 (#952): reconvergence events and variant text ----------------------------------------------------++ internal const string Outside = @"+id: outside+kind: reconvergence+title: The outside event+text: 'It happened regardless.'+from: 1948-07-01+to: 1948-08-01+options:+ - id: record+ text: As it happened+ historical: true+variants:+ - when: [{ event: parent, diverged: true }]+ title: The outside event, on your course+ text: 'It happened regardless; on your course, the earlier decision went the other way.'+ sources: [{ url: ""https://example.org/outside"", checked: 2026-10-17 }]+";++ [Theory]+ // R-ALT-010+ [InlineData("road", "The outside event, on your course", "It happened regardless; on your course")]+ [InlineData("record", "The outside event", "It happened regardless.")]+ public void TheFirstMatchingVariantSuppliesTheText(string picked, string title, string text)+ {+ var c = Load(("parent.yaml", Parent), ("outside.yaml", Outside));+ var s = NewState(c);+ s.ChosenOptions["parent"] = picked;+ var e = c.Events.Single(x => x.Id == "outside");+ Assert.Equal(title, EventSystem.Title(c, s, e));+ Assert.StartsWith(text, EventSystem.Render(c, s, e));+ Assert.Equal("As it happened", e.Options.Single().Text); // options never vary+ }++ // R-ALT-010+ [Theory]+ [InlineData("kind: reconvergence\n", "", "variants", "only a reconvergence event carries variants")]+ [InlineData(" - when: [{ event: parent, diverged: true }]", " - when: [{ event: parent, option: record }]", "variants[0].when", "a variant follows a road not taken")]+ [InlineData(" - when: [{ event: parent, diverged: true }]", " - when: []", "variants[0].when", "a variant follows a road not taken")]+ [InlineData(" sources: [{ url: \"https://example.org/outside\", checked: 2026-10-17 }]\n", "", "variants[0].sources", "needs at least one source")]+ [InlineData("on your course, the earlier", "on your course, {nobody} and the earlier", "variants[0].text", "unknown office placeholder '{nobody}'")]+ [InlineData(" title: The outside event, on your course\n", " title: '{nobody} on your course'\n", "variants[0].title", "unknown office placeholder '{nobody}'")]+ [InlineData(" text: 'It happened regardless; on your course, the earlier decision went the other way.'\n", " text: ' '\n", "variants[0].text", "a variant has text")]+ [InlineData(" historical: true\nvariants:", "variants:", "options", "a reconvergence event happened: it has a historical option")]+ [InlineData("{ event: parent, diverged: true }", "{ event: nowhere, diverged: true }", "variants[0].when[0].event", "unknown event 'nowhere'")]+ public void ABadVariantIsALoadError(string from, string to, string field, string message)+ {+ var ex = Assert.Throws<ContentException>(() => Load(("parent.yaml", Parent), ("outside.yaml", Outside.Replace(from, to))));+ Assert.Equal("events[outside]." + field, ex.Field);+ Assert.Contains(message, ex.Message);+ }++ [Fact]+ // R-ALT-010, review focus 5+ public void AVariantNeedsItsRoadClosedBeforeTheCardOpens()+ {+ var early = Outside.Replace("from: 1948-07-01", "from: 1948-06-05"); // parent's window runs to 11 June+ var ex = Assert.Throws<ContentException>(() => Load(("parent.yaml", Parent), ("outside.yaml", early)));+ Assert.Equal("events[outside].variants[0].when[0]", ex.Field);+ Assert.Contains("'parent' can still be open when this card opens", ex.Message);+ }++ [Fact]+ // R-ALT-010: a road with an open window is never settled.+ public void AVariantNeedsItsRoadToHaveAWindowThatCloses()+ {+ var ex = Assert.Throws<ContentException>(() => Load(("parent.yaml", Parent.Replace("to: 1948-06-11\n", "")), ("outside.yaml", Outside)));+ Assert.Equal("events[outside].variants[0].when[0]", ex.Field);+ Assert.Contains("'parent' can still be open when this card opens", ex.Message);+ }++ [Fact]+ // R-ALT-010: variants are tried in file order; the first whose every entry holds wins.+ public void TheFirstOfTwoMatchingVariantsWins()+ {+ var two = Outside + @" - when: [{ event: parent, option: road }]+ title: The second variant+ text: 'Also on your course.'+ sources: [{ url: ""https://example.org/outside"", checked: 2026-10-17 }]+";+ var c = Load(("parent.yaml", Parent), ("outside.yaml", two));+ var s = NewState(c);+ s.ChosenOptions["parent"] = "road";+ var e = c.Events.Single(x => x.Id == "outside");+ Assert.Same(e.Variants[0], Timeline.Variant(c, s, e));+ Assert.Equal("The outside event, on your course", EventSystem.Title(c, s, e));+ var untitled = two.Replace(" title: The outside event, on your course\n", "");+ var c2 = Load(("parent.yaml", Parent), ("outside.yaml", untitled));+ var s2 = NewState(c2); s2.ChosenOptions["parent"] = "road";+ Assert.Equal("The outside event", EventSystem.Title(c2, s2, c2.Events.Single(x => x.Id == "outside"))); // no title: the event's own+ }++ [Fact]+ // R-ALT-010: every `when` entry must hold, not just one.+ public void AVariantNeedsEveryEntryToHold()+ {+ var other = Parent.Replace("id: parent", "id: other").Replace("title: Parent", "title: Other");+ var both = Outside.Replace("[{ event: parent, diverged: true }]", "[{ event: parent, diverged: true }, { event: other, option: road }]");+ var c = Load(("parent.yaml", Parent), ("other.yaml", other), ("outside.yaml", both));+ var s = NewState(c);+ s.ChosenOptions["parent"] = "road"; s.ChosenOptions["other"] = "record";+ var e = c.Events.Single(x => x.Id == "outside");+ Assert.Null(Timeline.Variant(c, s, e));+ Assert.Equal("It happened regardless.", EventSystem.Render(c, s, e));+ s.ChosenOptions["other"] = "road";+ Assert.Same(e.Variants[0], Timeline.Variant(c, s, e));+ }++ [Fact]+ // R-ALT-010 with R-ALT-009, review focus 5: a rejoin makes a road's historical option hold, so a variant that names+ // that option waits for every card that can rejoin the road, or its text could flip while the card is open.+ public void AVariantOnTheRecordWaitsForEveryCardThatCanRejoinIt()+ {+ var other = Parent.Replace("id: parent", "id: other").Replace("title: Parent", "title: Other");+ var withRejoin = Consequence.Replace(" text: Hold the course\n", " text: Hold the course\n rejoin: parent\n"); // open 15 June to 15 August+ var onRecord = Outside.Replace("[{ event: parent, diverged: true }]", "[{ event: parent, option: record }, { event: other, diverged: true }]");+ var ex = Assert.Throws<ContentException>(() => Load(("parent.yaml", Parent), ("other.yaml", other), ("after_road.yaml", withRejoin), ("outside.yaml", onRecord)));+ Assert.Equal("events[outside].variants[0].when[0]", ex.Field);+ Assert.Contains("'after_road' can rejoin 'parent' while this card is open", ex.Message);+ var later = onRecord.Replace("from: 1948-07-01\nto: 1948-08-01", "from: 1948-08-15\nto: 1948-09-01");+ Assert.Single(Load(("parent.yaml", Parent), ("other.yaml", other), ("after_road.yaml", withRejoin), ("outside.yaml", later)).Events.Single(x => x.Id == "outside").Variants);+ // A variant on the road itself never flips on a rejoin (the chosen option is not rewritten, diverged stays true).+ foreach (var onRoad in new[] { Outside, Outside.Replace("{ event: parent, diverged: true }", "{ event: parent, option: road }") })+ Assert.Single(Load(("parent.yaml", Parent), ("after_road.yaml", withRejoin), ("outside.yaml", onRoad)).Events.Single(x => x.Id == "outside").Variants);+ }++ [Fact]+ // R-ALT-012+ public void TheHistoricalRunShowsNoVariant()+ {+ var end = GoldenRun.PlayToEnd(Real);+ foreach (var e in Real.Events.Where(x => x.Variants.Count > 0))+ Assert.Null(Timeline.Variant(Real, end, e));+ }++ /// <summary>Review focus 5 on real content: at the state where the card first appears on its road, the variant applies.</summary>+ [Fact]+ public void EveryVariantShowsWhenItsRoadIsTaken()+ {+ foreach (var e in Real.Events.Where(x => x.Variants.Count > 0))+ for (int i = 0; i < e.Variants.Count; i++)+ {+ var road = AltRun.RoadTo(Real, new GameEvent { Id = e.Id, Requires = e.Variants[i].When });+ var fired = AltRun.Play(Real, road).FirstOrDefault(s => s.FiredEvents.Contains(e.Id));+ Assert.NotNull(fired);+ Assert.Same(e.Variants[i], Timeline.Variant(Real, fired!, e));+ }+ }+/// <summary>Review focus 2: every consequence card in content/ fires in a run that takes its road (and, for a second/// card, the first card's option too), with the reference player's orders everywhere else. Until a content slice adds/// one, there is none; AltRunWalksTheRoadBack pins the helper on fixtures.</summary>diff --git a/sim/Statecraft.Sim.Tests/SchemaTests.cs b/sim/Statecraft.Sim.Tests/SchemaTests.csindex b14e97208..8334e4062 100644--- a/sim/Statecraft.Sim.Tests/SchemaTests.cs+++ b/sim/Statecraft.Sim.Tests/SchemaTests.cs@@ -192,6 +192,7 @@ public class SchemaTestsyield return new object[] { "event.schema.json", "", typeof(GameEvent) };yield return new object[] { "event.schema.json", "/properties/conditions/items", typeof(EventCondition) };yield return new object[] { "event.schema.json", "/definitions/requirement", typeof(EventRequirement) };+ yield return new object[] { "event.schema.json", "/definitions/variant", typeof(EventVariant) };yield return new object[] { "event.schema.json", "/properties/options/items", typeof(EventOption) };yield return new object[] { "event.schema.json", "/definitions/alternative", typeof(OptionAlternative) };yield return new object[] { "event.schema.json", "/properties/options/items/properties/effects/items", typeof(OptionEffect) };diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 308c86fae..b45bcf3ef 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -700,6 +700,17 @@ namespace Statecraft.Simpublic bool Diverged { get; set; }}+ /// <summary>R-ALT-010: alternative wording of a reconvergence event for a course that left the record. Options and+ /// effects never vary.</summary>+ public sealed class EventVariant+ {+ public List<EventRequirement> When { get; set; } = new List<EventRequirement>();+ /// <summary>Empty: the event's own title.</summary>+ public string Title { get; set; } = "";+ public string Text { get; set; } = "";+ public List<Source> Sources { get; set; } = new List<Source>();+ }+public sealed class OptionEffect { public string Target { get; set; } = ""; public double Delta { get; set; } }public sealed class EventOption@@ -764,7 +775,7 @@ namespace Statecraft.Simpublic sealed class GameEvent{public string Id { get; set; } = "";- /// <summary>historical (the default), consequence (R-ALT-005) or reconvergence (its variants arrive with #952).</summary>+ /// <summary>historical (the default), consequence (R-ALT-005) or reconvergence (R-ALT-010).</summary>public string Kind { get; set; } = EventKinds.Historical;public string Title { get; set; } = "";public string Text { get; set; } = "";@@ -776,6 +787,7 @@ namespace Statecraft.Simpublic List<EventCondition> Conditions { get; set; } = new List<EventCondition>();/// <summary>Eligible only once every one of these holds (R-ALT-001). Empty: no requirement.</summary>public List<EventRequirement> Requires { get; set; } = new List<EventRequirement>();+ public List<EventVariant> Variants { get; set; } = new List<EventVariant>();public List<EventOption> Options { get; set; } = new List<EventOption>();public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "draft";diff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.csindex 9ec23119a..f8ca29f07 100644--- a/sim/Statecraft.Sim/EventRules.cs+++ b/sim/Statecraft.Sim/EventRules.cs@@ -95,7 +95,7 @@ namespace Statecraft.Sim}}CheckRequirementCycles(c);- CheckKinds(c);+ CheckKinds(c, offices);CheckObjectives(c);}@@ -190,9 +190,9 @@ namespace Statecraft.Simreturn parent.Options.Any(o => o.Historical) && parent.Options.Any(o => o.Id == r.Option && !o.Historical);}- /// <summary>R-ALT-005 to R-ALT-007. Called after every requirement is known to exist and to form no cycle, so the depth+ /// <summary>R-ALT-005 to R-ALT-007 and R-ALT-010. Called after every requirement is known to exist and to form no cycle, so the depth/// walk ends.</summary>- static void CheckKinds(Content c)+ static void CheckKinds(Content c, HashSet<string> offices){var byId = c.Events.ToDictionary(e => e.Id);var depth = new Dictionary<string, int>();@@ -217,6 +217,35 @@ namespace Statecraft.Simif (!target.Options.Any(x => x.Historical) || !e.Requires.Any(r => r.Event == target.Id && IsAlternativeRoad(c, r)))throw new ContentException(e.File, at, "rejoins only an event whose road this card follows, and which has a historical option");}+ if (e.Variants.Count > 0 && e.Kind != EventKinds.Reconvergence)+ throw new ContentException(e.File, F("variants"), "only a reconvergence event carries variants");+ if (e.Kind == EventKinds.Reconvergence && !e.Options.Any(o => o.Historical))+ throw new ContentException(e.File, F("options"), "a reconvergence event happened: it has a historical option");+ for (int i = 0; i < e.Variants.Count; i++)+ {+ var v = e.Variants[i];+ var at = $"variants[{i}]";+ for (int j = 0; j < v.When.Count; j++)+ {+ CheckRequirement(c, e, $"{at}.when[{j}]", v.When[j]);+ var road = c.Events.First(x => x.Id == v.When[j].Event);+ // Review focus 5: the road is settled before the card opens, so the text never flips while it is shown.+ if (!road.To.HasValue || road.To.Value > e.From)+ throw new ContentException(e.File, F($"{at}.when[{j}]"), FormattableString.Invariant($"'{road.Id}' can still be open when this card opens: its window must close on or before {e.From:yyyy-MM-dd}"));+ // R-ALT-009 makes a requirement on the road's historical option hold once a consequence card rejoins it,+ // so every card that can rejoin the road is settled before this card opens too.+ if (!v.When[j].Diverged && road.Options.Any(o => o.Historical && o.Id == v.When[j].Option))+ foreach (var back in c.Events.Where(x => x.Options.Any(o => o.Rejoin == road.Id)))+ if (!back.To.HasValue || back.To.Value > e.From)+ throw new ContentException(e.File, F($"{at}.when[{j}]"), FormattableString.Invariant($"'{back.Id}' can rejoin '{road.Id}' while this card is open: its window must close on or before {e.From:yyyy-MM-dd}"));+ }+ if (!v.When.Any(r => IsAlternativeRoad(c, r)))+ throw new ContentException(e.File, F($"{at}.when"), "a variant follows a road not taken: at least one entry names an option that did not happen, or diverged: true");+ if (v.Text.Trim() == "") throw new ContentException(e.File, F($"{at}.text"), "a variant has text");+ if (v.Sources.Count == 0) throw new ContentException(e.File, F($"{at}.sources"), "needs at least one source");+ if (v.Title != "") CheckPlaceholders(c, e, F($"{at}.title"), v.Title, offices);+ CheckPlaceholders(c, e, F($"{at}.text"), v.Text, offices);+ }if (e.Kind != EventKinds.Consequence){// Only a consequence card may follow one: the record never raises a consequence card, and a historical@@ -224,7 +253,6 @@ namespace Statecraft.Simfor (int i = 0; i < e.Requires.Count; i++)if (byId[e.Requires[i].Event].Kind == EventKinds.Consequence)throw new ContentException(e.File, F($"requires[{i}]"), $"only a consequence card may follow a consequence card ('{e.Requires[i].Event}')");- // kind: reconvergence carries no rule of its own until its variants arrive (#952).continue;}if (e.Objective != "") throw new ContentException(e.File, F("objective"), "a consequence card is not an objective's card");diff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.csindex d5f83023d..1e87e402e 100644--- a/sim/Statecraft.Sim/EventSystem.cs+++ b/sim/Statecraft.Sim/EventSystem.cs@@ -42,7 +42,7 @@ namespace Statecraft.Sim{s.FiredEvents.Add(e.Id);s.PendingEvents.Add(e.Id);- why.Add(new Cause("events", e.Id, 0, $"New: {Cabinet.Fill(c, s, e.Title, FillDate(e, s.Date))}"));+ why.Add(new Cause("events", e.Id, 0, $"New: {Title(c, s, e)}"));}}@@ -65,7 +65,7 @@ namespace Statecraft.Sims.PendingEvents.Remove(eventId);s.ChosenOptions[eventId] = o.Id;var fillDate = FillDate(Get(c, eventId), s.Date);- var title = Cabinet.Fill(c, s, Get(c, eventId).Title, fillDate);+ var title = Title(c, s, Get(c, eventId));why.Add(new Cause("events", eventId, 0, $"{how}: {Cabinet.Fill(c, s, o.Text, fillDate)}"));foreach (var fx in o.Effects.Where(fx => Reaches(s, fx.Target))){@@ -185,7 +185,15 @@ namespace Statecraft.Simpublic static string Render(Content c, GameEvent e, DateTime date) => Offices.Fill(c, e.Text, FillDate(e, date));- /// <summary>Event text as the player sees it now: names follow the player's appointments.</summary>- public static string Render(Content c, GameState s, GameEvent e) => Cabinet.Fill(c, s, e.Text, FillDate(e, s.Date));+ /// <summary>The card's title as the player sees it now: a matching variant's, else the event's (R-ALT-010).</summary>+ public static string Title(Content c, GameState s, GameEvent e)+ {+ var v = Timeline.Variant(c, s, e);+ return Cabinet.Fill(c, s, v != null && v.Title != "" ? v.Title : e.Title, FillDate(e, s.Date));+ }++ /// <summary>Event text as the player sees it now: a matching variant's, with names following the player's appointments.</summary>+ public static string Render(Content c, GameState s, GameEvent e) =>+ Cabinet.Fill(c, s, Timeline.Variant(c, s, e)?.Text ?? e.Text, FillDate(e, s.Date));}}diff --git a/sim/Statecraft.Sim/Timeline.cs b/sim/Statecraft.Sim/Timeline.csindex e06a5b6e3..8a08fb98e 100644--- a/sim/Statecraft.Sim/Timeline.cs+++ b/sim/Statecraft.Sim/Timeline.cs@@ -36,5 +36,9 @@ namespace Statecraft.Sim/// <summary>R-ALT-001: every requirement of the event holds (true when it has none).</summary>public static bool AllMet(Content c, GameState s, GameEvent e) => e.Requires.All(r => Met(c, s, r));++ /// <summary>R-ALT-010: the first variant, in file order, whose every `when` entry holds; null for the event's own text.</summary>+ public static EventVariant? Variant(Content c, GameState s, GameEvent e) =>+ e.Variants.FirstOrDefault(v => v.When.All(r => Met(c, s, r)));}}diff --git a/unity/Assets/Scripts/UI/EventCardPresenter.cs b/unity/Assets/Scripts/UI/EventCardPresenter.csindex 1ff7c21ac..a5a2426c9 100644--- a/unity/Assets/Scripts/UI/EventCardPresenter.cs+++ b/unity/Assets/Scripts/UI/EventCardPresenter.cs@@ -216,7 +216,7 @@ namespace Statecraft.Game.UIimage.style.backgroundPositionY = new BackgroundPosition(BackgroundPositionKeyword.Top,new Length(PortraitFraming.PositionYPercent(portrait.width, portrait.height, PortraitWidth, PortraitHeight, entry!.Value.focusY), LengthUnit.Percent));card.Q<Label>("event-draft").style.display = e.Status == "draft" ? DisplayStyle.Flex : DisplayStyle.None;- card.Q<Label>("event-title").text = Cabinet.Fill(c, s, e.Title, date);+ card.Q<Label>("event-title").text = EventSystem.Title(c, s, e);card.Q<Label>("event-office").text = holder == null ? "" : text.Format("event.office", c.Offices.First(o => o.Id == e.Office).Title, holder.Name);card.Q<Label>("event-text").text = EventSystem.Render(c, s, e);var objective = card.Q<Label>("event-objective"); // an objective card's line (#380); none on any other card