Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Sim: gdd-0.3 staffed fields settle their Food into the national stock (Fixes #2471) (#2706)

Beribcec2fdf0188
diff --git a/changelog.d/2471-field-food-settlement.md b/changelog.d/2471-field-food-settlement.md
new file mode 100644
index 000000000..efd99fe8f
--- /dev/null
+++ b/changelog.d/2471-field-food-settlement.md
@@ -0,0 +1,6 @@
+### Changed
+
+- GDD 0.3: a staffed field can now settle its month's Food into the national stock: 2, 3 or 5 times
+ `field_food_per_turn` by its farmer's tier, once per field and in field order, with a Why line for each. A field the
+ enemy holds adds nothing but keeps its farmer and assignment, and once retaken it produces again from the next month
+ with no new order (Fixes #2471). No game uses it yet, so play is unchanged.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 6daa0e4f2..b4fbdb552 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -116,7 +116,7 @@ The #1696 status comment of 27 October 2026 says, "It does not yet provide the l
R-CITY-009: The job default (Q-JOBS-1, owner, 15 October 2026). On each housing step, after the refugees become civilians (R-CITY-004), each city whose default is on sets its employed to `min(job slots, civilians + craftsmen)`, in ascending city id, at no Attention cost. Every city's default is on at the start; an accepted `AssignWorkers` order fixes that city's number and turns its default off for the rest of the game. Each change is a `city` cause on the Why screen ("Town: N groups in work"). A city's record writes `jobs=manual` into the state hash only when its default is off.
-R-CITY-010: A city the enemy holds pauses (decision D6, owner, 1 November 2026, "Approve all six (Recommended)", [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547); #1711). Under gdd-0.3 only, a city is held in a turn when an enemy military unit (a unit with a `side` other than the player's; a halutz has no side and holds nothing, R-UNIT-001) stands on its settlement hex when steps 5 and 6 run, after step 3: no later step moves an enemy unit, so that is where it stands at the turn's end. An enemy formation that arrives on the hex at step 9 (R-UNIT-009) holds the city from the next turn. That turn a held city pays no R-CITY-002 job income and its R-PROJ-003 projects gain no progress: their records, turns left and carried fraction stay as they were. Its staffed arms workshops pause the same way: no charge and no progress, the cycle kept (R-ARMS-006). The housing step still absorbs refugees and fills default jobs; its people and every id stay, nobody is evacuated, and an objective already awarded stays awarded. A turn in which no enemy unit is on the hex pays and builds as before. Cities have no Food production of their own on main (R-FIELD-002 fields belong to no city), so there is nothing else to pause until #1694 links fields to cities. gdd-0.1 and legacy are unchanged, and gdd-0.1 keeps its R-END-003 defeat. The turn-report line for a held city is still to come.
+R-CITY-010: A city the enemy holds pauses (decision D6, owner, 1 November 2026, "Approve all six (Recommended)", [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547); #1711). Under gdd-0.3 only, a city is held in a turn when an enemy military unit (a unit with a `side` other than the player's; a halutz has no side and holds nothing, R-UNIT-001) stands on its settlement hex when steps 5 and 6 run, after step 3: no later step moves an enemy unit, so that is where it stands at the turn's end. An enemy formation that arrives on the hex at step 9 (R-UNIT-009) holds the city from the next turn. That turn a held city pays no R-CITY-002 job income and its R-PROJ-003 projects gain no progress: their records, turns left and carried fraction stay as they were. Its staffed arms workshops pause the same way: no charge and no progress, the cycle kept (R-ARMS-006). The housing step still absorbs refugees and fills default jobs; its people and every id stay, nobody is evacuated, and an objective already awarded stays awarded. A turn in which no enemy unit is on the hex pays and builds as before. Cities have no Food production of their own on main (R-FIELD-002 fields belong to no city), so there is nothing else to pause until #1694 links fields to cities. The gdd-0.3 field fixture pauses a field the same way (R-FIELD-002, #2471): a field not Israeli-held at settlement adds no Food, and its farmer and assignment stay until it is retaken. gdd-0.1 and legacy are unchanged, and gdd-0.1 keeps its R-END-003 defeat. The turn-report line for a held city is still to come.
R-CITY-005: The cities' employed share (employed over civilians and craftsmen, summed over all cities; 1 with none) is an effect-web source of `morale`, Social cohesion (`work_lifts_cohesion`, source id `employed_share`), read after the turn's housing. The legacy loop has no cities, so there it reads 0 and adds nothing. Housing reaches Social cohesion through the existing `housing` link (`homes_lift_morale`) until Phase 3 makes it the cities' aggregate (Q-NAT-2, decided 15 October 2026). Phase 1's separate cohesion value and its two weights are gone (D-C1, Reading 2).
@@ -240,7 +240,7 @@ R-FIELD-001: `PioneerWork(unit, plow_fields, site)` plows a field at a site whos
R-FIELD-002: Each turn in step 6, after the cities' production and in ordinal site id order, every plowed field adds `field_food_per_turn` Food units to the national stock (R-FOOD-001), with no workers (Q-FIELD-2, decided 17 October 2026). A field being plowed adds nothing. The Food arrives before the nation eats in step 7, so in a turn with imports (R-FOOD-002) the import tops the stock up by that much less. `field_food_per_turn` is 1, a labelled design value (Q-FIELD-3: "1 Food a turn"), and required in the GDD loop.
-Then changed (3 Nov 2026): under exact `gdd-0.3`, in synthetic fixtures only (R-POP-004), each authored starting field (`regions.yaml` `field_hexes`, Q36) is one Work slot for one farmer (`field.slots` 1; owner, 3 November 2026, "One farmer per field (Recommended)"), staffed only by a farmer located in its region (Q27) while the field is Israeli-held (Q37). Only a farmer may hold a field (owner, 4 November 2026: asked "May only a unit with the Farmer profession staff a field?", the owner answered "yes", [recorded on #1694](https://github.com/eyalgolan/statecraft-israel/issues/1694#issuecomment-6623124984)). A field staffed in the month's snapshot (27M-2) and still Israeli-held yields `farmer.output` (2 / 3 / 5) times `field_food_per_turn` by the snapshot tier, and no Money; an unworked field yields nothing. No Food moves and no game-loop caller is added; losing and retaking a field (27M-1) waits on the job default (#1692).
+Then changed (3 Nov 2026): under exact `gdd-0.3`, in synthetic fixtures only (R-POP-004), each authored starting field (`regions.yaml` `field_hexes`, Q36) is one Work slot for one farmer (`field.slots` 1; owner, 3 November 2026, "One farmer per field (Recommended)"), staffed only by a farmer located in its region (Q27) while the field is Israeli-held (Q37). Only a farmer may hold a field (owner, 4 November 2026: asked "May only a unit with the Farmer profession staff a field?", the owner answered "yes", [recorded on #1694](https://github.com/eyalgolan/statecraft-israel/issues/1694#issuecomment-6623124984)). A field staffed in the month's snapshot (27M-2) and still Israeli-held yields `farmer.output` (2 / 3 / 5) times `field_food_per_turn` by the snapshot tier, and no Money; an unworked field yields nothing. Then changed (#2471): the fixture's settlement adds that yield to the national Food stock (R-FOOD-001), each field's once and in ordinal field-id order, with one Why line per field that yields. Control is checked again at settlement as well as at the snapshot's freeze, and a field lost by either adds nothing while its farmer keeps the same id, tier and assignment (D6: "its people stay"); once retaken, the next month's snapshot yields again with no new assignment (D6: "On retaking, everything resumes and nothing is deleted."). The caller states which fields are Israeli-held (maintainer reading: the sim has no hex control for fields yet). No game-loop caller is added, and the legacy and gdd-0.1 plowed-field harvest above is unchanged.
R-SWAMP-001: `PioneerWork(unit, dry_swamp, site)` drains a swamp at a site whose kinds include `swamp`, by R-SITE-001 to R-SITE-003's rules, with `dry_swamp_turns` and `dry_swamp_cost` (12 turns and IL 4m, labelled design values, required in the GDD loop; Q-SWAMP-1, decided 17 October 2026). Built, the swamp site is drained, and the field site in its hex becomes ready: before that a `plow_fields` order there is refused with the state unchanged and the Attention refunded, as at an unbuilt yishuv (R-FIELD-001). Drained, the swamp does nothing else. A field site is not also a swamp site, since draining would plow it; the loader refuses a row that gives it both kinds. The MVP's one swamp site is the Hula (Q-SWAMP-1; Q-SWAMP-3, "Allow as planned", owner, 17 October 2026, #789).
diff --git a/sim/Statecraft.Sim.Tests/Gdd03FieldFixtureTests.cs b/sim/Statecraft.Sim.Tests/Gdd03FieldFixtureTests.cs
index 2b4f62e70..efd3b9d00 100644
--- a/sim/Statecraft.Sim.Tests/Gdd03FieldFixtureTests.cs
+++ b/sim/Statecraft.Sim.Tests/Gdd03FieldFixtureTests.cs
@@ -32,8 +32,9 @@ public class Gdd03FieldFixtureTests
}
// The month's snapshot (#1716, 27M-2), taken now; every field is available at the freeze unless listed as not held.
- static Gdd03SyntheticMonthContext Month(Content c, GameState s, params string[] notHeldAtFreeze) =>
- Gdd03SyntheticMonthContext.CreateSynthetic(SaveGame.Gdd03Ruleset, 0, s.PopulationLedger.Units,
+ static Gdd03SyntheticMonthContext Month(Content c, GameState s, params string[] notHeldAtFreeze) => MonthAt(c, s, 0, notHeldAtFreeze);
+ static Gdd03SyntheticMonthContext MonthAt(Content c, GameState s, int ordinal, params string[] notHeldAtFreeze) =>
+ Gdd03SyntheticMonthContext.CreateSynthetic(SaveGame.Gdd03Ruleset, ordinal, s.PopulationLedger.Units,
Gdd03FieldFixture.Fields(c).Select(f => new Gdd03SyntheticFacilitySnapshot(f.Id, !notHeldAtFreeze.Contains(f.Id), 1)),
Array.Empty<int>(), Array.Empty<Gdd03SyntheticHousingSnapshot>(), Array.Empty<Gdd03SyntheticPendingEntry>());
static HashSet<string> AllHeld(Content c) => Gdd03FieldFixture.Fields(c).Select(f => f.Id).ToHashSet(StringComparer.Ordinal);
@@ -154,7 +155,7 @@ public class Gdd03FieldFixtureTests
}
// Q37 and #1694 ("Enemy control ... disables the slot"): a field staffed at the freeze but no longer Israeli-held
- // yields nothing while the others still yield. The assignment is not changed: loss and retake (27M-1) are not here.
+ // yields nothing while the others still yield. The assignment is not changed; retaking is in the settlement test below.
[Fact] public void AFieldNoLongerIsraeliHeldYieldsNothing()
{
var c = Real(); var s = State(c, new[] { Person(InValleys), Person(InValleys) });
@@ -317,6 +318,62 @@ public class Gdd03FieldFixtureTests
Refused(s, () => Gdd03FieldFixture.ResolveWorkXp(c, s, month, AllHeld(c)), "more than one farmer");
}
+ // R-FIELD-002 and R-CITY-010 under gdd-0.3 (#2471): a staffed field still Israeli-held at settlement adds its 2 / 3 / 5
+ // to the national Food stock once, in field-id order, one cause each; an unstaffed field adds nothing. A field lost
+ // (at the freeze or only by settlement) adds nothing and keeps its farmer, tier and assignment (D6: "its people stay");
+ // retaken, it yields again from the next snapshot with no new assignment (D6: "everything resumes and nothing is deleted").
+ [Fact] public void StaffedHeldFieldsSettleIntoTheFoodStockAndALostFieldResumesOnRetaking()
+ {
+ var c = Real();
+ var s = State(c, new[] { Person(InValleys, tier: CivilianTier.Novice), Person(InValleys, tier: CivilianTier.Trained),
+ Person(InValleys, tier: CivilianTier.Veteran) });
+ var f = new Gdd03FieldFixture(c, s, Array.Empty<Gdd03FixtureSlot>());
+ f.Staff(2, V3, israeliHeld: true); f.Staff(0, V1, israeliHeld: true); f.Staff(1, V2, israeliHeld: true);
+ var people = s.PopulationLedger.Units;
+ s.Food = 7;
+
+ var why = new List<Cause>();
+ var settled = f.Settle(Rules(c), MonthAt(c, s, 0), AllHeld(c), why);
+ Assert.Equal(10, settled.Food);
+ Assert.Equal(17, settled.Fields.Values.Count(food => food == 0)); // the unstaffed fields: no Food and no cause
+ Assert.Equal(17, s.Food);
+ Assert.Equal(new[] { (V1, 2.0), (V2, 3.0), (V3, 5.0) }, why.Select(x => (x.Args[0], x.Delta)));
+ Assert.All(why, x => Assert.Equal(("economy", "food", CauseKeys.FieldFood), (x.System, x.Target, x.Key)));
+
+ // Lost after the freeze: control is checked again at settlement.
+ var held = AllHeld(c); held.Remove(V1);
+ why.Clear();
+ f.Settle(Rules(c), MonthAt(c, s, 1), held, why);
+ Assert.Equal(17 + 8, s.Food);
+ Assert.Equal(new[] { V2, V3 }, why.Select(x => x.Args[0]));
+ // Lost at the freeze: the snapshot does not count the farmer as working.
+ f.Settle(Rules(c), MonthAt(c, s, 2, V1), AllHeld(c), new List<Cause>()); // freeze-only loss: settlement-time control is held
+ Assert.Equal(17 + 8 + 8, s.Food);
+ Assert.Equal(people, s.PopulationLedger.Units); // same ids, tiers and assignments
+
+ // Retaken: the next snapshot yields again, with no Staff call.
+ f.Settle(Rules(c), MonthAt(c, s, 3), AllHeld(c), new List<Cause>());
+ Assert.Equal(17 + 8 + 8 + 10, s.Food);
+ Assert.Equal(people, s.PopulationLedger.Units);
+ }
+
+ // R-CITY-010: a month is credited once per fixture; a second Settle for the same month is refused and changes nothing.
+ [Fact] public void ASettledMonthIsRefusedAndTheFoodStockStaysPut()
+ {
+ var c = Real();
+ var s = State(c, new[] { Person(InValleys, tier: CivilianTier.Novice) });
+ var f = new Gdd03FieldFixture(c, s, Array.Empty<Gdd03FixtureSlot>());
+ f.Staff(0, V1, israeliHeld: true);
+ s.Food = 7;
+ f.Settle(Rules(c), MonthAt(c, s, 4), AllHeld(c), new List<Cause>());
+ Assert.Equal(9, s.Food);
+ var why = new List<Cause>();
+ Refused(s, () => f.Settle(Rules(c), MonthAt(c, s, 4), AllHeld(c), why), "already settled");
+ Assert.Empty(why);
+ f.Settle(Rules(c), MonthAt(c, s, 5), AllHeld(c), new List<Cause>()); // the next month still settles
+ Assert.Equal(11, s.Food);
+ }
+
// R-FIELD-002 under gdd-0.1 is unchanged: fields need no workers there, and this fixture refuses that ruleset.
[Fact] public void Gdd01FieldsAreUnchanged()
{
diff --git a/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs b/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs
index bada68743..54a75cc4f 100644
--- a/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs
+++ b/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs
@@ -115,7 +115,7 @@ public class RemainingCauseKeysTests
sites++;
}
}
- Assert.Equal(122, sites); // 122 with #2527's FoodImported and the conversion's fx_reserves line; 120 with #2457's event Debt line (R-EFX-009); 119 with #1700 slice B's ProjectBuilderFreed; 118 with #1700's builders (R-CITY-011: two ProjectBuilder lines, ProjectWaiting, the build order's job-default line); 114 with #1703's gdd-0.3 housing surcharge and housing cohesion lines; 112 with the arms workshops' five (R-ARMS-005 with its job-default line, R-ARMS-006; #1701); 107 with R-MONEY-004's DollarsConverted (#813); 106 since #2212: EconomySystem.OtherMoney's line (105 since #2199: PayOrBorrow's Paid line)
+ Assert.Equal(123, sites); // 123 with #2471's gdd-0.3 field Food line (R-FIELD-002); 122 with #2527's FoodImported and the conversion's fx_reserves line; 120 with #2457's event Debt line (R-EFX-009); 119 with #1700 slice B's ProjectBuilderFreed; 118 with #1700's builders (R-CITY-011: two ProjectBuilder lines, ProjectWaiting, the build order's job-default line); 114 with #1703's gdd-0.3 housing surcharge and housing cohesion lines; 112 with the arms workshops' five (R-ARMS-005 with its job-default line, R-ARMS-006; #1701); 107 with R-MONEY-004's DollarsConverted (#813); 106 since #2212: EconomySystem.OtherMoney's line (105 since #2199: PayOrBorrow's Paid line)
}
[Fact]
diff --git a/sim/Statecraft.Sim/Cause.cs b/sim/Statecraft.Sim/Cause.cs
index 452d1f1b3..95fdef670 100644
--- a/sim/Statecraft.Sim/Cause.cs
+++ b/sim/Statecraft.Sim/Cause.cs
@@ -154,6 +154,9 @@ namespace Statecraft.Sim
public const string DollarsConvertedFx = "dollars_converted_fx";
/// <summary>Args: f.Id.</summary>
public const string FoodHarvest = "food_harvest";
+ /// <summary>A gdd-0.3 field's farmer added Delta Food (R-FIELD-002, #2471). Args: the field id ("field/q,r"). Only
+ /// the synthetic field fixture makes it, so the Unity Why screen has no wording for it yet.</summary>
+ public const string FieldFood = "field_food";
/// <summary>Args: CauseKeys.Number(need).</summary>
public const string FoodShortage = "food_shortage";
/// <summary>Args: CauseKeys.Number(s.Food).</summary>
@@ -275,7 +278,7 @@ namespace Statecraft.Sim
EventNew, EventChosen, EventDelegated, EventDelegatedPartial, EventAmount, EventStock, EventGrant, EventCity,
EventUnlock, EventPolicy, EventSetRung, EventRejoin, MilitaryUpkeep, HousingSurcharge, HousingCohesion,
ObjectiveCompleted, PrisonersReturned, SoldiersReturned,
- WorkersAssigned, WagesPaid, ImmigrantsHoused, HousingShortage, ImmigrantsWaiting, RecruitsVeteran, CorridorStarted, CorridorCancelled, CorridorCompleted, PioneersVeteran, MapBorrowed, MapBuilt, LandWorkStarted, SiteStarted, SiteCancelled, SiteCompleted, ProjectStarted, ProjectCancelled, ProjectCompleted, ProjectBuilder, ProjectBuilderFreed, ProjectWaiting, ArmsBought, WorkshopWorkers, WorkshopArms, WorkshopPaused, DollarsConverted, DollarsConvertedFx, FoodHarvest, FoodShortage, FoodWithoutImports, FoodImported, PrisonerFood, PrisonerFoodShortage, CraftsmenReturned, CraftsmenReassigned, PioneerReturned, PioneersReassigned, TrainingStarted, TrainingArms, TrainingCancelled, TrainingArmsReturned, ReplacementsStopped, ReplacementsJoined, MilitaryTrained, PioneersTrained, CraftsmenTrained, Appointed, Reshuffle, AppointmentsEnded, ApprovalStability, CoalitionCollapsed, LegislatureConvened, GovernmentTookOffice, CoalitionChanged, EraEnded, AdvisoryPolicyRejected, PolicyRejected, PolicySet, AdvisoryBudgetRejected, BudgetRejected, PlaceCaptured, EnemyRegained, PlaceAnnexed, PlaceWithdrawn, PlaceDeported, DeportEffect, DeportCost, OccupationStarted, PendingBecameRaid, OccupationLostUnit, OccupationCountdown, DepopulationSupport,
+ WorkersAssigned, WagesPaid, ImmigrantsHoused, HousingShortage, ImmigrantsWaiting, RecruitsVeteran, CorridorStarted, CorridorCancelled, CorridorCompleted, PioneersVeteran, MapBorrowed, MapBuilt, LandWorkStarted, SiteStarted, SiteCancelled, SiteCompleted, ProjectStarted, ProjectCancelled, ProjectCompleted, ProjectBuilder, ProjectBuilderFreed, ProjectWaiting, ArmsBought, WorkshopWorkers, WorkshopArms, WorkshopPaused, DollarsConverted, DollarsConvertedFx, FoodHarvest, FieldFood, FoodShortage, FoodWithoutImports, FoodImported, PrisonerFood, PrisonerFoodShortage, CraftsmenReturned, CraftsmenReassigned, PioneerReturned, PioneersReassigned, TrainingStarted, TrainingArms, TrainingCancelled, TrainingArmsReturned, ReplacementsStopped, ReplacementsJoined, MilitaryTrained, PioneersTrained, CraftsmenTrained, Appointed, Reshuffle, AppointmentsEnded, ApprovalStability, CoalitionCollapsed, LegislatureConvened, GovernmentTookOffice, CoalitionChanged, EraEnded, AdvisoryPolicyRejected, PolicyRejected, PolicySet, AdvisoryBudgetRejected, BudgetRejected, PlaceCaptured, EnemyRegained, PlaceAnnexed, PlaceWithdrawn, PlaceDeported, DeportEffect, DeportCost, OccupationStarted, PendingBecameRaid, OccupationLostUnit, OccupationCountdown, DepopulationSupport,
};
/// <summary>A number as an Arg: invariant and round-trip, so the UI rounds exactly the value Message rounded.</summary>
diff --git a/sim/Statecraft.Sim/Gdd03FieldFixture.cs b/sim/Statecraft.Sim/Gdd03FieldFixture.cs
index 1efd936f6..8c140eb88 100644
--- a/sim/Statecraft.Sim/Gdd03FieldFixture.cs
+++ b/sim/Statecraft.Sim/Gdd03FieldFixture.cs
@@ -32,18 +32,20 @@ namespace Statecraft.Sim
}
}
- /// <summary>R-FIELD-002 under exact gdd-0.3, synthetic fixtures only (R-POP-004): no command, loader, turn or
- /// Food-stock hookup. Owner, 3 November 2026, #1694: "One farmer per field (Recommended)"; the option read: "Each
+ /// <summary>R-FIELD-002 under exact gdd-0.3, synthetic fixtures only (R-POP-004): no command, loader or turn hookup;
+ /// <see cref="Settle"/> adds a month's yield to the Food stock (#2471). Owner, 3 November 2026, #1694: "One farmer per field (Recommended)"; the option read: "Each
/// field takes one farmer; an unworked field produces nothing." Each authored field (Q36) is one Farm slot of
/// `field.slots` (1) in the shared <see cref="Gdd03AssignmentFixture"/>, which stays the single writer and whose
- /// ledger refuses a farmer living outside the field's region (Q27). Loss and retake (27M-1), preparation (#1713),
- /// and Food demand are not here; farmer work XP is <see cref="ResolveWorkXp"/> (#2468).</summary>
+ /// ledger refuses a farmer living outside the field's region (Q27). A lost field keeps its farmer and yields again
+ /// once retaken (<see cref="Settle"/>); preparation (#1713) and Food demand are not here; farmer work XP is
+ /// <see cref="ResolveWorkXp"/> (#2468).</summary>
internal sealed class Gdd03FieldFixture
{
readonly GameState state;
readonly Gdd03AssignmentFixture work;
readonly Gdd03FieldRates rates;
readonly SortedDictionary<string, Gdd03Field> fields;
+ readonly HashSet<int> settledMonths = new HashSet<int>(); // R-CITY-010: one settlement per month, per fixture
internal static IReadOnlyList<Gdd03Field> Fields(Content content)
{
@@ -172,5 +174,25 @@ namespace Statecraft.Sim
candidate.PopulationLedger.Reconcile();
return candidate;
}
+
+ /// <summary>R-FIELD-002 and R-CITY-010 under gdd-0.3 (#2471): adds the month's <see cref="Yield"/> to the national
+ /// Food stock, each field's once, in ordinal field-id order, with one cause per field that yields. Control is the
+ /// caller's <paramref name="israeliHeldNow"/> at settlement, besides the snapshot's freeze: a field lost by either
+ /// adds nothing, and its farmer, tier and assignment stay as they are (D6: "its people stay"), so the next snapshot
+ /// after retaking yields again with no new assignment. A month already settled by this fixture is refused unchanged
+ /// (<see cref="ArgumentException"/>), so the stock cannot be credited twice for one month. The sum is checked before the stock changes.</summary>
+ internal Gdd03FieldYield Settle(MvpRules rules, Gdd03SyntheticMonthContext month, IReadOnlyCollection<string> israeliHeldNow, List<Cause> why)
+ {
+ if (why == null) throw new ArgumentNullException(nameof(why));
+ var y = Yield(rules, month, israeliHeldNow);
+ if (settledMonths.Contains(month.MonthOrdinal)) throw new ArgumentException("This month is already settled.");
+ var food = checked(state.Food + y.Food);
+ foreach (var field in y.Fields.Where(x => x.Value > 0).OrderBy(x => x.Key, StringComparer.Ordinal)) // field-id order, stated here so it does not rest on the yield's dictionary type
+ why.Add(new Cause("economy", "food", field.Value,
+ FormattableString.Invariant($"{field.Key}: its farmer yielded {field.Value} units of Food"), key: CauseKeys.FieldFood, args: new[] { field.Key }));
+ state.Food = food;
+ settledMonths.Add(month.MonthOrdinal);
+ return y;
+ }
}
}
diff --git a/unity/Assets/Tests/EditMode/CauseTextTests.cs b/unity/Assets/Tests/EditMode/CauseTextTests.cs
index e0a928345..14d266a72 100644
--- a/unity/Assets/Tests/EditMode/CauseTextTests.cs
+++ b/unity/Assets/Tests/EditMode/CauseTextTests.cs
@@ -550,7 +550,8 @@ public class CauseTextTests
CauseKeys.EventDelegatedPartial, CauseKeys.EventGrant, CauseKeys.EventNew, CauseKeys.EventPolicy,
CauseKeys.EventRejoin, CauseKeys.EventSetRung, CauseKeys.EventStock, CauseKeys.EventUnlock,
CauseKeys.MilitaryUpkeep, CauseKeys.HousingSurcharge, CauseKeys.HousingCohesion,
- CauseKeys.ObjectiveCompleted, CauseKeys.PrisonersReturned, CauseKeys.SoldiersReturned }), rows.Select(x => x.Key), "all remaining keys");
+ CauseKeys.ObjectiveCompleted, CauseKeys.PrisonersReturned, CauseKeys.SoldiersReturned,
+ CauseKeys.FieldFood }), rows.Select(x => x.Key), "all remaining keys"); // FieldFood (#2471): only the gdd-0.3 field fixture makes it, no turn yet, so no wording yet
var appointed = rows.Single(x => x.Key == CauseKeys.Appointed);
StringAssert.Contains("התפקיד שנשמר", CauseText.Line(appointed, c, NoRows, he, names), "historical title, not current title");
}