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: Deport, DisplacedByPlayer and the depopulated state, out of play (GDD Phase 6 PR 8, refs #800) (#1327)

Bericc1832418b35
diff --git a/changelog.d/sim-gdd-deport-800.md b/changelog.d/sim-gdd-deport-800.md
new file mode 100644
index 000000000..d83771fe9
--- /dev/null
+++ b/changelog.d/sim-gdd-deport-800.md
@@ -0,0 +1,11 @@
+- Deport, GDD Phase 6 PR 8 (#800; R-CTRL-018 to R-CTRL-022), under owner ruling 1, "honest cost, no reward". It stays
+ out of play: with `mvp.deport_in_play: false` in the real content, `ResolveCapture(settlement, deport)` is still refused
+ as not built yet until the owner has reviewed its cards and dialog (PRs 9 and 10). Under the switch, the units leave as
+ in Raid, Social cohesion and International Support fall at once, the place counts in `DisplacedByPlayer` (places, not
+ people), International Support drags each turn and has a lower ceiling for the rest of the game, and the place is
+ depopulated: no city project or corridor segment on its hex, no timer, no gain. No razing in the MVP.
+ Deport also costs the Treasury IL 6.25m at once, so `DeportNeverDominates` checks Deport is never better than Raid or
+ Occupy on anything, Money included, in every state. The IL 6.25m and the four indicator sizes (Social cohesion 0.15 and
+ International Support 0.15 at once, a drag of 0.005 a turn and a ceiling drop of 0.25, both per place) were accepted by
+ the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6350226175); they stay labelled design values the balance pass (#813) may revisit.
+ A depopulated place stays closed to the player's units. No golden moves.
diff --git a/content/rules.yaml b/content/rules.yaml
index 4d812d9f4..f23b5d33a 100644
--- a/content/rules.yaml
+++ b/content/rules.yaml
@@ -228,6 +228,26 @@ mvp:
# population unit that stays. Neither is a historical figure.
occupation_turns: 6 # DESIGN VALUE: owner-set balance, not a historical figure (D-F4, Q-OCC-3: X, the turns every occupation lasts)
occupation_upkeep_per_turn: 0.005 # DESIGN VALUE: owner-set balance, not a historical figure (D-F4, Q-OCC-1: IL millions a turn per occupied place)
+ # Deport (R-CTRL-018; owner ruling 1, "honest cost, no reward"; Q-DEP-5 (c), owner, 18 October 2026, #783 "Accept all 16
+ # drafts": fixed costs to Social cohesion and International Support, a fixed International Support drag a turn and a lower
+ # International Support ceiling for the rest of the game; "sizes are labelled design values the balance pass sets;
+ # DeportNeverDominates must hold with a margin"). Proposed on #800 and accepted by the owner on 22 October 2026, per
+ # place, with the Money cost below (#1327: https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6350226175);
+ # design values the balance pass (#813) may revisit. "Large" is read as 1.5
+ # times the largest single event move on either parameter in content (0.10). The drag and the ceiling drop count per
+ # place deported (DisplacedByPlayer counts places, Q-CAP-2 (b)). None is a historical figure.
+ deport_cohesion_cost: 0.15 # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-DEP-5: Social cohesion lost at once)
+ deport_support_cost: 0.15 # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-DEP-5: International Support lost at once)
+ deport_support_drag_per_turn: 0.005 # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-DEP-5: International Support lost each turn after, per place)
+ deport_support_ceiling_drop: 0.25 # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-DEP-5: International Support ceiling lowered for good, per place)
+ # Deport's Money cost (owner decision, 22 October 2026: https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6337946480):
+ # set so that Deport's Money is at or below Occupy's and Raid's in every state. Occupy pays at most
+ # occupation_upkeep_per_turn for all 44 turns (0.22); a depopulated hex shared with a city takes no new project, so the
+ # city may spend less, and the dearest project is housing (6, projects.yaml). 0.22 + 6, rounded up to a quarter million.
+ deport_money_cost: 6.25 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, #1327: IL millions paid at once for a Deport)
+ # Deport stays out of play until the owner has reviewed its cards (Phase 6 PR 9) and its dialog (PR 10): with this off,
+ # ResolveCapture(..., deport) is refused as not built yet (R-CTRL-007; plan, PR 8 sensitivity gate). PR 10 lifts it.
+ deport_in_play: false
# Coalition stability lost by replacing a minister (Cabinet.Appoint): a seat taken from the minister's party, or a
# reshuffle within it.
appoint_stability_cost_other_party: 0.06
diff --git a/docs/determinism.md b/docs/determinism.md
index 3a603477e..ef11bec39 100644
--- a/docs/determinism.md
+++ b/docs/determinism.md
@@ -33,6 +33,12 @@ The simulation must produce the same state, bit for bit, on .NET, Unity Mono and
`OccupationDrawsNothing`). No golden occupies a place, so none moves. The `mvp-occupy-cost` golden is deferred by the
owner's ruling of 22 October 2026 (#1324), and it is the next step now that a capture can be reached in play (#1314; a
manifest golden plays the real content); `OccupyTests` plays the same run on fixture content.
+- **Deport (resolver step 10, after the occupation timers):** the units leave as in Raid; the costs, the drag (each turn,
+ per place in `DisplacedByPlayer`) and the International Support ceiling are plain arithmetic on the indicator's shift,
+ with no RNG draw (R-CTRL-018; `DeportTests.DeportDrawsNothing`). `DisplacedByPlayer` is hashed as `displaced=` only when
+ non-zero. The real content keeps Deport out of play (`mvp.deport_in_play: false`), and no golden captures a place, so
+ none moves. The `mvp-deport-cost` golden, paired with `mvp-occupy-cost`, waits for the same capture (#1304);
+ `DeportNeverDominatesTests` plays both runs from the same fixture states.
## Combat draws
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 33a9de38b..d059c1bd8 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -42,7 +42,7 @@ R-CTRL-004: Resolver step 3 is the capture check, after combat (step 2), in ordi
R-CTRL-005: Capture writes the settlement state only. It changes no resident field (the place stays inhabited), no unit, no resource, parameter, city or score, and counts towards no objective (constraint 6 of the Phase 6 plan; impact plan section 4.3).
-R-CTRL-007: `ResolveCapture(settlement, outcome)` answers a capture. It is one command kind for every outcome, with one `attention_cost.resolve_capture` (Q-TECH-3, owner, 18 October 2026, #783 batch 1), set at 0 as a design value proposed on #797 (D-A6: unit orders are free). It is valid only for a settlement whose record is awaiting the choice, from the turn after its capture until it is answered, and only for an outcome that is built. Otherwise it is refused with a reason, the state unchanged and the Attention refunded: the place is not awaiting a decision, the outcome is not known, or Deport is not built yet (Phase 6 PR 8). The legacy loop refuses it before charging Attention.
+R-CTRL-007: `ResolveCapture(settlement, outcome)` answers a capture. It is one command kind for every outcome, with one `attention_cost.resolve_capture` (Q-TECH-3, owner, 18 October 2026, #783 batch 1), set at 0 as a design value proposed on #797 (D-A6: unit orders are free). It is valid only for a settlement whose record is awaiting the choice, from the turn after its capture until it is answered, and only for an outcome that is built. Otherwise it is refused with a reason, the state unchanged and the Attention refunded: the place is not awaiting a decision, the outcome is not known, or Deport is not in play: with `mvp.deport_in_play` off, as in the real content until the owner has reviewed Deport's cards and dialog (Phase 6 PRs 9 and 10), it is refused as "not built yet" (R-CTRL-018). The legacy loop refuses it before charging Attention.
R-CTRL-008: `SettlementControl.CaptureOptions(content, state, settlement)` lists the outcomes in one fixed order, Raid and withdraw, Occupy, Deport, so Deport is never first (impact plan section 4.1 item 1). An option carries no default or selected flag. Each option has either the reason it is refused or a preview: the change resolving it makes at once to Attention, Money (the Treasury and the debt), Food, Arms, Social cohesion, International Support and the score, computed by resolving it on a copy of the state, so the preview is the outcome (spec section 2.6). A place not awaiting the choice offers no option. A capture the player does not answer waits, and the units stay (Q-HIST-1 (a), owner, 18 October 2026, #783 batch 3). On the turn that reaches the game's end, where resolver step 10 sits and before objectives and score, every capture still awaiting the choice counts as Raid, in ordinal id order (owner, 18 October 2026 on #797, "Counts as Raid"): the units leave as R-CTRL-010 says, nothing changes for the residents and the score gains nothing. A unit with nowhere to go stays while the others leave, and the record goes all the same. No unanswered choice ever resolves as Deport.
@@ -56,6 +56,16 @@ R-CTRL-012: The occupation timer (Q-OCC-3 (a), owner, 18 October 2026, #783 batc
R-CTRL-013: Withdrawal before the timer ends (Q-OCC-2 (a), owner, 18 October 2026, #783 batch 3: allowed, and it becomes a Raid). An occupation lasts while an Israeli military unit is on the place's hex. When step 10 finds none on an occupied or `awaiting_end` place (the player moved them out, or they were lost), the occupation ends as a Raid does: the record is removed, so the place is under enemy control again at once, its residents unchanged, and no upkeep is paid that turn. Nothing else changes, and nothing is refunded. A halutz left on the hex keeps nothing.
+R-CTRL-018: Deport (impact plan section 4.1; owner ruling 1, "honest cost, no reward"; Q-DEP-1 (a), Q-DEP-5 (c) and Q-DEP-7 (c), which includes (a), owner, 18 October 2026, #783 "Accept all 16 drafts"): `ResolveCapture(settlement, deport)`, only while `mvp.deport_in_play` is on (R-CTRL-007). The player's units on the place's hex leave exactly as in Raid (R-CTRL-010), and Deport is refused the same way, the state unchanged, when one has nowhere to go: it gives no military advantage over Raid and pays no occupation upkeep. Social cohesion (`morale`) falls at once by `mvp.deport_cohesion_cost` and International Support (`intl_standing`) by `mvp.deport_support_cost`, through the permanent event shift. The Treasury pays `mvp.deport_money_cost` at once, borrowing what it lacks (R-MONEY-003), so Deport never pays on Money (owner decision, 22 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6337946480): a design value set at or above the most Occupy can pay in upkeep over the whole game plus the dearest city project, IL 6.25m. The place is added to `DisplacedByPlayer`. From then on, every turn's resolver step 10, after the occupation timers, International Support falls by `mvp.deport_support_drag_per_turn` for each place in `DisplacedByPlayer`, the Deport turn included, for the rest of the game; and International Support's ceiling is 1 less `mvp.deport_support_ceiling_drop` for each such place (never below 0), which every write to it respects. The four indicator values (0.15, 0.15, 0.005 and 0.25, the drag and the ceiling drop per place) and the IL 6.25m were proposed on #800 and #1327 and accepted by the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6350226175); they stay design values the balance pass (#813) may revisit. Nothing draws from the RNG.
+
+R-CTRL-019: The residents (Q-DEP-2 (a), every resident the state holds; Q-DEP-3 (a), a count only, with no destination on the board): a Deport adds 1 to `DisplacedByPlayer`, a count of places, not people (Q-CAP-2 (b)), written to the hash as `displaced=` only when non-zero. They are outside the player's control: never refugee units, civilians, cohorts, units, prisoners, labour, housing occupants or score.
+
+R-CTRL-020: A depopulated place (impact plan section 4.1 item 4; Q-DEP-7 (c); Q-SENS-2 (c)). Deport leaves the place's record with its capture date and `depopulated=1` only: no owner, state or timer. It stays on `mvp.enemy_held_localities`, so the player's units cannot enter it (R-MOVE-005) and it is never captured again, as a raided place is for the enemy. It adds no housing, jobs, Food, Money, Arms or score, and counts towards no objective. With no timer, resolver step 10 neither counts it down nor charges upkeep for it. No city project may be started on its hex (refused with the reason kind `depopulated`), and no corridor segment through it (this stops new starts; one already under way there is not cancelled); no designated site can be on a 1948 settlement's hex at all, and no event effect can name a place.
+
+R-CTRL-021: Buildings (D-F3; Q-DEP-4 (a)): deportation and razing are separate rules, and there is no razing option in the MVP. The record's buildings stay at their default, and a capture offers only Raid, Occupy and Deport.
+
+R-CTRL-022: `DeportNeverDominates` (impact plan section 4.1 item 5; Q-TECH-4 as drafted; Q-DEP-7 (b); Q-DEP-5 (c), "must hold with a margin"). From any state where Deport is offered, the state is cloned for Raid, Occupy and Deport, each clone resolves its outcome and is stepped by the reference policy to the game's end. At the turn's end and at the end, Deport is no better than Raid or Occupy on any measure, with no exception (owner decision, 22 October 2026, #1327): Money, foreign currency, Food, Arms, Attention, coalition stability, any indicator, the score, the objectives and the day each was met, the player's units and their strength, housing, jobs, people, built sites and the war loss, and it is below both on Social cohesion and International Support by a margin. Where a city shares the place's hex (as Tel Aviv shares Jaffa's), the city cannot build there after a Deport, so it may spend less; `mvp.deport_money_cost` covers that too, and Money is compared there as everywhere. Until a capture is reachable in the real content (#1304) the fixture's capture states carry the test.
+
## Saves
R-SAVE-001: A save names the ruleset it was played under (`ruleset legacy` or `ruleset gdd-0.1`, save schema 2). A game refuses a save made under another ruleset. A schema 1 save has no ruleset line and is legacy, so the GDD game refuses it as made under earlier rules. The refusal carries a code (`older_rules`) the UI translates, and the sim's reason does not itself ask for a new game: the player reads that once (N4).
diff --git a/sim/Statecraft.Sim.Tests/CaptureTests.cs b/sim/Statecraft.Sim.Tests/CaptureTests.cs
index 389e9f18c..be3603dcd 100644
--- a/sim/Statecraft.Sim.Tests/CaptureTests.cs
+++ b/sim/Statecraft.Sim.Tests/CaptureTests.cs
@@ -27,7 +27,11 @@ public class CaptureTests
/// <summary>MovementTests' 6 x 3 coastal plain with the four places; <paramref name="targets"/> lists the targets in
/// file order.</summary>
- internal static Content Load(params string[] targets)
+ internal static Content Load(params string[] targets) => Load(null, targets);
+
+ /// <summary>As <see cref="Load(string[])"/>, with <paramref name="edit"/> run on the files before they load (DeportTests
+ /// turns Deport on with it, Q-TECH-3).</summary>
+ internal static Content Load(Action<Dictionary<string, string>>? edit, params string[] targets)
{
var files = Fixture.Gdd(new Dictionary<string, string>
{
@@ -38,6 +42,7 @@ public class CaptureTests
["settlement_targets.yaml"] = targets.Length == 0 ? "targets: []\n" : "targets:\n" + string.Concat(targets.Select(id => { var p = Places.Single(x => x.Id == id); return Target(p.Id, p.Q, p.R); })),
});
files["rules.yaml"] = files["rules.yaml"].Replace("enemy_held_localities: []", "enemy_held_localities: [town_a, town_c, town_e]");
+ edit?.Invoke(files);
return ContentLoader.Load(Fixture.Write(files));
}
diff --git a/sim/Statecraft.Sim.Tests/DeportNeverDominatesTests.cs b/sim/Statecraft.Sim.Tests/DeportNeverDominatesTests.cs
new file mode 100644
index 000000000..6d8728087
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/DeportNeverDominatesTests.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>R-CTRL-022, DeportNeverDominates (impact plan section 4.1 item 5; Q-TECH-4 as drafted, with Q-DEP-7 (b) and (c);
+/// Q-DEP-5 (c): "must hold with a margin"). From each capture state, the state is cloned three times and each clone answers
+/// the capture with one outcome, then steps with the reference policy (GoldenRun's orders) to the game's end. At the turn's
+/// end and at the end, Deport is no better than Raid or Occupy on any measure, Money included in every state (owner, 22
+/// October 2026, #1327: the fixture's deport_money_cost covers Occupy's upkeep to the end and the shared hex). The measures: Money,
+/// foreign currency, Food, Arms, Attention, coalition stability, every indicator, the score, the objectives and the day each
+/// was met (the war objective's timing), the player's units and their strength, housing, jobs, people, built sites, and not
+/// losing the war (Q-DEP-7 (b)). On Social cohesion and International Support it is below both by at least
+/// <see cref="Margin"/>. The goldens hold no capture state until a capture is reachable in the real content (#1304), so the
+/// fixture states carry the test: town_a captured at full and at minimum strength, with a halutz, with an enemy beside it,
+/// and with a second place awaiting, with the fixture's one city moved to town_d's hex, out of reach. "shared hex" keeps the
+/// city on town_a's own hex, as Tel Aviv shares Jaffa's: there no city project can be started on the depopulated hex
+/// (R-CTRL-020), so the reference policy builds less and spends less (IL 3.0m in the fixture), which the Money cost covers.
+/// Food ends the same under all three outcomes in these states, so a Food gain from Deport shows only in
+/// DeportTests.TheCostsApplyAtOnce, not here. Each run is also the fixture stand-in for the paired mvp-occupy-cost and mvp-deport-cost scenarios
+/// (spec section 3).</summary>
+public class DeportNeverDominatesTests
+{
+ /// <summary>How far below both other outcomes Deport must leave Social cohesion and International Support (Q-DEP-5 (c));
+ /// test code, a quarter of the fixture's smaller cost.</summary>
+ const double Margin = 0.025;
+
+ static readonly string[] Outcomes = { SettlementControl.Raid, SettlementControl.Occupy, SettlementControl.Deport };
+
+ public static IEnumerable<object[]> CaptureStates() => new[] { "full", "minimum", "halutz", "enemy beside", "two places", "shared hex" }.Select(x => new object[] { x });
+
+ static GameState State(Content c, string name)
+ {
+ var soldier = DeportTests.Soldier(1, 1, 0);
+ var s = name switch
+ {
+ "full" => DeportTests.Awaiting(c, soldier),
+ "minimum" => DeportTests.Awaiting(c, new Unit(1, "soldier", 1, 0, side: Movement.PlayerSide, strength: 1)),
+ "halutz" => DeportTests.Awaiting(c, soldier, new Unit(2, "halutz", 1, 0)),
+ "enemy beside" => DeportTests.Awaiting(c, soldier, CaptureTests.Enemy(2, 3, 0)),
+ "two places" => DeportTests.Awaiting(c, soldier, DeportTests.Soldier(2, 4, 0)),
+ _ => DeportTests.Awaiting(c, soldier),
+ };
+ if (name == "two places") s.Settlements["town_c"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, s.Date);
+ return s;
+ }
+
+ [Theory]
+ [MemberData(nameof(CaptureStates))]
+ public void DeportNeverDominates(string name)
+ {
+ var shared = name == "shared hex";
+ var c = shared ? DeportTests.Load() : DeportTests.Load(files => files["cities.yaml"] = files["cities.yaml"].Replace("id: town_a,", "id: town_d,"));
+ Assert.Equal(shared ? "town_a" : "town_d", Assert.Single(c.Cities).Id);
+ var s = State(c, name);
+ var turnEnd = new Dictionary<string, GameState>();
+ var end = new Dictionary<string, GameState>();
+ foreach (var outcome in Outcomes)
+ {
+ var first = Simulation.Step(c, s.Clone(), new Command[] { new ResolveCapture("town_a", outcome) });
+ Assert.Empty(first.Rejected);
+ turnEnd[outcome] = first.State;
+ end[outcome] = ToTheEnd(c, first.State);
+ }
+ foreach (var at in new[] { turnEnd, end })
+ {
+ var raid = Measures(at[SettlementControl.Raid]);
+ var occupy = Measures(at[SettlementControl.Occupy]);
+ var deport = Measures(at[SettlementControl.Deport]);
+ foreach (var key in deport.Keys)
+ {
+ var margin = key == "ind:morale" || key == "ind:intl_standing" ? Margin : 0.0;
+ foreach (var (other, values) in new[] { ("Raid", raid), ("Occupy", occupy) })
+ {
+ var v = values.GetValueOrDefault(key, double.MinValue);
+ Assert.True(deport[key] <= v - margin + 1e-9, $"{name}, {(at == end ? "the end" : "the turn's end")}: Deport's {key} is {deport[key]}, {other}'s {v}");
+ }
+ }
+ }
+ }
+
+ /// <summary>Steps <paramref name="s"/> with GoldenRun's orders until the game ends.</summary>
+ static GameState ToTheEnd(Content c, GameState s)
+ {
+ while (s.GameOver == null && s.Date < c.End) s = Simulation.Step(c, s, GoldenRun.Orders(c, s)).State;
+ return s;
+ }
+
+ /// <summary>Every measure compared, each read so that more is better for the player.</summary>
+ static Dictionary<string, double> Measures(GameState s)
+ {
+ var m = new Dictionary<string, double>(StringComparer.Ordinal)
+ {
+ ["money"] = s.Treasury - s.Debt, ["fx"] = s.FxReserves, ["food"] = s.Food, ["arms"] = s.Arms, ["attention"] = s.Attention,
+ ["stability"] = s.CoalitionStability, ["score"] = s.Score, ["objectives"] = s.Objectives.Count,
+ ["units"] = s.Units.Values.Count(u => u.Side == Movement.PlayerSide || u.Side == ""),
+ ["strength"] = s.Units.Values.Where(u => u.Side == Movement.PlayerSide).Sum(u => u.Strength),
+ ["housing"] = s.Cities.Values.Sum(x => x.HousingCapacity), ["jobs"] = s.Cities.Values.Sum(x => x.JobSlots),
+ ["people"] = s.TotalPopulation, ["sites"] = s.Sites.Values.Count(w => w.BuiltOn != null),
+ ["not lost"] = s.GameOver == GameOverCodes.DefeatWar || s.GameOver == GameOverCodes.DefeatEconomy ? 0 : 1,
+ };
+ foreach (var kv in s.Indicators) m["ind:" + kv.Key] = kv.Value;
+ foreach (var kv in s.Objectives) m["met:" + kv.Key] = -kv.Value.Ticks; // earlier is better
+ return m;
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/DeportTests.cs b/sim/Statecraft.Sim.Tests/DeportTests.cs
new file mode 100644
index 000000000..bc2f89b9a
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/DeportTests.cs
@@ -0,0 +1,300 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>Deport (GDD Phase 6 PR 8, #800), under owner ruling 1, "honest cost, no reward" (GDD; CONTENT_POLICY section 4;
+/// impact plan section 4.1). The owner's picks of 18 October 2026 (#783, "Accept all 16 drafts"): Q-DEP-2 (a), every resident
+/// the state holds; Q-DEP-3 (a), a DisplacedByPlayer count only; Q-DEP-4 (a), no razing in the MVP; Q-DEP-5 (c), fixed costs,
+/// a drag and a lower International Support ceiling; Q-DEP-7 (c). The real content keeps Deport out of play
+/// (mvp.deport_in_play: false); these tests reach it through fixture content (Q-TECH-3). The places are CaptureTests'
+/// fixture values, not history, and the fixture's costs are 0.2 Social cohesion and 0.1 International Support, a drag of 0.01
+/// a turn and a ceiling 0.3 lower, per place.</summary>
+public class DeportTests
+{
+ /// <summary>CaptureTests' fixture with Deport in play and International Support in the model (the fixture's model has
+ /// none; the real one has it, model.yaml). <paramref name="edit"/> changes the files further.</summary>
+ internal static Content Load(Action<Dictionary<string, string>>? edit = null) => CaptureTests.Load(files =>
+ {
+ files["rules.yaml"] = files["rules.yaml"].Replace("enemy_held_localities:", "deport_in_play: true\n enemy_held_localities:");
+ files["model.yaml"] = Fixture.Files["model.yaml"].Replace("indicators:\n", "indicators:\n - id: intl_standing\n base: 0.5\n name: International support\n");
+ edit?.Invoke(files);
+ }, CaptureTests.AllTargets);
+
+ internal static Unit Soldier(int id, int q, int r) => CaptureTests.Soldier(id, q, r);
+
+ /// <summary>A new game with <paramref name="units"/> and town_a captured and awaiting the choice.</summary>
+ internal static GameState Awaiting(Content c, params Unit[] units)
+ {
+ var s = CombatTests.With(c, units);
+ s.Settlements["town_a"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, s.Date);
+ return s;
+ }
+
+ static StepResult Step(Content c, GameState s, params Command[] commands) => Simulation.Step(c, s, commands);
+ static ResolveCapture Answer(string outcome, string id = "town_a") => new ResolveCapture(id, outcome);
+ static double Support(GameState s) => s.Indicators["intl_standing"];
+ static double Cohesion(GameState s) => s.Indicators["morale"];
+
+ /// <summary><paramref name="s"/> with <paramref name="outcome"/> resolved on a copy.</summary>
+ static GameState Resolved(Content c, GameState s, string outcome, string id = "town_a")
+ {
+ var t = s.Clone();
+ Assert.Null(SettlementControl.Resolve(c, t, id, outcome, new List<Cause>()));
+ return t;
+ }
+
+ // R-CTRL-018 (Q-DEP-5 (c)): Social cohesion and International Support fall at once by the labelled costs, the place is
+ // counted in DisplacedByPlayer, and the options helper shows exactly that as Deport's preview (spec section 2.6).
+ [Fact]
+ public void TheCostsApplyAtOnce()
+ {
+ var c = Load();
+ var s = Awaiting(c, Soldier(1, 1, 0));
+ var raid = Resolved(c, s, SettlementControl.Raid);
+ var deport = Resolved(c, s, SettlementControl.Deport);
+ Assert.Equal(Cohesion(raid) - 0.2, Cohesion(deport), 9);
+ Assert.Equal(Support(raid) - 0.1, Support(deport), 9);
+ Assert.Equal(raid.Treasury - raid.Debt - 121, deport.Treasury - deport.Debt, 9); // the fixture's deport_money_cost, borrowed where the Treasury lacks it
+ Assert.Equal((0, 1), (raid.DisplacedByPlayer, deport.DisplacedByPlayer));
+ Assert.Contains("displaced=1", deport.Describe());
+ var option = SettlementControl.CaptureOptions(c, s, "town_a").Single(o => o.Outcome == SettlementControl.Deport);
+ Assert.Null(option.Refusal);
+ var p = option.Preview!;
+ Assert.Equal((0.0, 0, 0, 0), (p.Attention, p.Food, p.Arms, p.Score));
+ Assert.Equal(-121, p.Money - p.Debt, 9);
+ Assert.Equal((-0.2, -0.1), (Math.Round(p.SocialCohesion, 9), Math.Round(p.InternationalSupport, 9)));
+ }
+
+ // R-CTRL-018: the International Support drag runs every turn's step 10 from the Deport turn on, for the rest of the game,
+ // per place deported, on top of the one-time cost. Nothing in the fixture moves International Support otherwise.
+ [Fact]
+ public void TheDragIsPermanent()
+ {
+ var c = Load();
+ var s = Awaiting(c, Soldier(1, 1, 0), Soldier(2, 4, 0));
+ s.Settlements["town_c"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, s.Date);
+ var one = Step(c, s, Answer(SettlementControl.Deport));
+ Assert.Empty(one.Rejected);
+ Assert.Contains(one.Why, x => x.Target == "intl_standing" && x.Message.Contains("Deport"));
+ var a = one.State;
+ var b = Step(c, s, Answer(SettlementControl.Deport), Answer(SettlementControl.Deport, "town_c")).State;
+ Assert.Equal(2, b.DisplacedByPlayer);
+ for (int turn = 1; turn <= 12; turn++)
+ {
+ Assert.Equal(0.5 - 0.1 - 0.01 * turn, Support(a), 9);
+ Assert.Equal(0.5 - 0.2 - 0.02 * turn, Support(b), 9);
+ a = Step(c, a).State;
+ b = Step(c, b).State;
+ }
+ }
+
+ // R-CTRL-018 (Q-DEP-5 (c)): International Support has a lower ceiling for the rest of the game, 1 less the drop per place,
+ // and no later change can lift it above that.
+ [Fact]
+ public void TheCeilingHoldsForTheRestOfTheGame()
+ {
+ var c = Load();
+ var s = Step(c, Awaiting(c, Soldier(1, 1, 0)), Answer(SettlementControl.Deport)).State;
+ EffectsSystem.Shift(c, s, "intl_standing", 1.0);
+ Assert.Equal(0.7, Support(s), 9);
+ for (int turn = 0; turn < 3; turn++) s = Step(c, s).State;
+ EffectsSystem.Shift(c, s, "intl_standing", 1.0);
+ Assert.Equal(0.7, Support(s), 9);
+ Assert.Equal(0.5, EffectsSystem.Shift(c, CombatTests.With(c), "intl_standing", 1.0), 9); // no Deport, no ceiling: 0.5 to 1
+ }
+
+ // R-CTRL-018: the ceiling holds on the effects step too, where the level is recomputed (EffectsSystem.Level), not only
+ // where a shift writes it. A fixture effect lifts International Support by 1.0 in one turn (inertia 1). The turn's drag
+ // (step 10) comes first, 0.39 to 0.38; the effects step then stops the level at the ceiling, 0.7, not at 0.88.
+ [Fact]
+ public void TheCeilingHoldsWhenAnEffectLiftsSupport()
+ {
+ var c = Load(files => files["model.yaml"] = files["model.yaml"].Replace("effects:\n",
+ "effects:\n - id: support_lift\n source: rationing\n target: intl_standing\n k: 1.0\n inertia: 1\n name: Support lift\n"));
+ var s = Step(c, Awaiting(c, Soldier(1, 1, 0)), Answer(SettlementControl.Deport)).State;
+ Assert.Equal(0.4 - 0.01, Support(s), 9);
+ s.Policies["rationing"] = 1.0;
+ var next = Step(c, s);
+ Assert.Equal(0.7 - 0.38, next.Why.Single(x => x.System == "effects" && x.Target == "intl_standing").Delta, 9);
+ Assert.Equal(0.7, Support(next.State), 9);
+ }
+
+ // R-CTRL-019 (Q-DEP-2 (a), Q-DEP-3 (a)): the residents become the DisplacedByPlayer count only, outside the player's
+ // control. No city's refugees, civilians or other people, no cohort, no unit and no prisoner count grows: the turn ends
+ // as Raid's does in all of them.
+ [Fact]
+ public void ResidentsNeverBecomePlayerUnits()
+ {
+ var c = Load();
+ var s = Awaiting(c, Soldier(1, 1, 0), new Unit(2, "halutz", 1, 0));
+ var raid = Step(c, s, Answer(SettlementControl.Raid)).State;
+ var deport = Step(c, s, Answer(SettlementControl.Deport)).State;
+ Assert.Equal(raid.Cities.Values.Select(x => x.Canonical(false)), deport.Cities.Values.Select(x => x.Canonical(false)));
+ Assert.Equal(raid.Units.Values.Select(x => x.Canonical()), deport.Units.Values.Select(x => x.Canonical()));
+ Assert.Equal(raid.Cohorts.Values.Select(x => x.Canonical()), deport.Cohorts.Values.Select(x => x.Canonical()));
+ Assert.Equal(raid.PrisonersHeld, deport.PrisonersHeld);
+ Assert.Equal(raid.PrisonersReturned, deport.PrisonersReturned);
+ Assert.Equal(raid.SoldiersHeld, deport.SoldiersHeld);
+ Assert.Equal(raid.Population, deport.Population);
+ Assert.Equal(raid.TotalPopulation, deport.TotalPopulation);
+ }
+
+ // R-CTRL-018 (Q-DEP-7 (a)): the player's units leave the hex exactly as in Raid (R-CTRL-010), so Deport frees no unit and
+ // keeps none there, and it is refused the same way when a unit has nowhere to go.
+ [Fact]
+ public void TheUnitsLeaveAsInARaid()
+ {
+ var c = Load();
+ var s = Awaiting(c, Soldier(1, 1, 0), Soldier(2, 1, 0));
+ var raid = Resolved(c, s, SettlementControl.Raid);
+ var deport = Resolved(c, s, SettlementControl.Deport);
+ Assert.Equal(raid.Units.Values.Select(x => x.Canonical()), deport.Units.Values.Select(x => x.Canonical()));
+ Assert.Contains(Movement.NoEntry(c, deport), h => h == (1, 0));
+ var boxed = Awaiting(c, Soldier(1, 1, 0), CaptureTests.Enemy(2, 0, 0), CaptureTests.Enemy(3, 2, 0), CaptureTests.Enemy(4, 1, 1), CaptureTests.Enemy(5, 0, 1));
+ var before = boxed.Describe();
+ var why = new List<Cause>();
+ var raidRefusal = SettlementControl.Resolve(c, boxed.Clone(), "town_a", SettlementControl.Raid, why);
+ Assert.NotNull(raidRefusal);
+ Assert.Equal(raidRefusal, SettlementControl.Resolve(c, boxed, "town_a", SettlementControl.Deport, why));
+ Assert.Equal(before, boxed.Describe());
+ }
+
+ // R-CTRL-020 (impact plan section 4.1 item 4; Q-DEP-7 (c); Q-SENS-2 (c)): a depopulated place adds nothing. A reflection
+ // test over every command kind: each that can name a place or a hex is aimed at the depopulated one and refused, and
+ // every other names none. The fixture puts a road segment on the place's hex, which is also town_a's city's own hex, and
+ // no site can be on a settlement's hex. No effect target can name a place. The record keeps no timer, so step 10 neither counts it down nor
+ // charges upkeep, and a later capture check never takes it again.
+ [Fact]
+ public void ADepopulatedPlaceAddsNothing()
+ {
+ var c = Load(files => files["corridors.yaml"] = Fixture.GddCorridors.Replace("hexes: [[2, 0], [3, 0]]", "hexes: [[1, 0], [2, 0]]"));
+ // No designated site can be on a 1948 settlement's hex at all: the loader refuses it (so no pioneer site needs a check).
+ var onThePlace = Assert.Throws<ContentException>(() => Load(files => files["sites.yaml"] = files["sites.yaml"].Replace("q: 2\n r: 0\n kinds: [yishuv]", "q: 1\n r: 0\n kinds: [yishuv]")));
+ Assert.Contains("holds the 1948 settlement town_a", onThePlace.Message);
+ var s = Step(c, Awaiting(c, Soldier(1, 1, 0), new Unit(2, "halutz", 1, 0)), Answer(SettlementControl.Deport)).State;
+ var ctrl = s.Settlements["town_a"];
+ Assert.Equal(("", "", true, 0, ""), (ctrl.Owner, ctrl.State, ctrl.Depopulated, ctrl.Turns, ctrl.Buildings));
+ var segment = c.Corridors[0].Id + ":1";
+ var aimed = new Dictionary<Type, Command[]?>
+ {
+ [typeof(MapAction)] = new Command[] { new MapAction(MapActions.Housing, 1, 0) },
+ [typeof(StartProject)] = c.ProjectKinds.Select(k => (Command)new StartProject(k.Id, "town_a", 1, 0)).ToArray(),
+ [typeof(PioneerWork)] = new Command[] { new PioneerWork(2, Corridors.BuildRoad, segment) },
+ [typeof(Move)] = new Command[] { new Move(1, 1, 0), new Move(2, 1, 0) },
+ [typeof(UnitOrder)] = new Command[] { new UnitOrder(1, Combat.Attack, 1, 0) },
+ [typeof(ResolveCapture)] = new Command[] { Answer(SettlementControl.Raid), Answer(SettlementControl.Occupy), Answer(SettlementControl.Deport) },
+ // These name no place or hex: a city, a cohort, a unit's own work, a policy, a budget, an event, an office or a count.
+ [typeof(SetPolicy)] = null, [typeof(AllocateBudget)] = null, [typeof(ChooseEventOption)] = null, [typeof(SetMobilization)] = null,
+ [typeof(SecurityOrder)] = null, [typeof(Appoint)] = null, [typeof(AssignWorkers)] = null, [typeof(Train)] = null,
+ [typeof(CancelTraining)] = null, [typeof(StopWork)] = null, [typeof(CancelProject)] = null, [typeof(BuyArms)] = null,
+ };
+ var kinds = typeof(Command).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Command)) && !t.IsAbstract).OrderBy(t => t.Name, StringComparer.Ordinal);
+ Assert.Equal(kinds.Select(t => t.Name), aimed.Keys.OrderBy(t => t.Name, StringComparer.Ordinal).Select(t => t.Name));
+ var checkedByTheRule = 0;
+ foreach (var command in aimed.Values.Where(x => x != null).SelectMany(x => x!))
+ {
+ var refused = Assert.Single(Step(c, s, command).Rejected);
+ // StartProject and PioneerWork: what a raided place would allow, the depopulated one refuses for that reason.
+ var raided = s.Clone();
+ raided.Settlements.Remove("town_a");
+ if ((command is StartProject || command is PioneerWork) && Step(c, raided, command).Rejected.Count == 0)
+ {
+ Assert.Contains("depopulated", refused.Reason);
+ checkedByTheRule++;
+ }
+ }
+ Assert.True(checkedByTheRule >= 2); // the road segment and at least one city project
+ var hexes = c.SettlementHexes.Select(h => h.Id).ToHashSet();
+ Assert.DoesNotContain(EventRules.SpecialTargets.Concat(c.Indicators.Select(i => i.Id)), hexes.Contains);
+ var next = Step(c, s);
+ Assert.Equal(ctrl.Canonical(), next.State.Settlements["town_a"].Canonical());
+ Assert.DoesNotContain(next.Why, x => x.System == "map" && x.Target == "town_a"); // no timer, no upkeep, no capture
+ var back = s.Clone();
+ back.Units[1] = Soldier(1, 1, 0);
+ SettlementControl.Capture(c, back, back.Date.AddDays(7), new List<Cause>());
+ Assert.Equal(ctrl.Canonical(), back.Settlements["town_a"].Canonical());
+ }
+
+ // R-CTRL-021 (Q-DEP-4 (a), D-F3): deportation and razing are separate rules, with no razing option in the MVP. The
+ // buildings field stays at its default, and the capture offers no fourth outcome.
+ [Fact]
+ public void ThereIsNoRazing()
+ {
+ var c = Load();
+ var s = Awaiting(c, Soldier(1, 1, 0));
+ Assert.Equal("", Resolved(c, s, SettlementControl.Deport).Settlements["town_a"].Buildings);
+ Assert.Equal(new[] { SettlementControl.Raid, SettlementControl.Occupy, SettlementControl.Deport },
+ SettlementControl.CaptureOptions(c, s, "town_a").Select(o => o.Outcome));
+ }
+
+ // R-CTRL-007 (Q-TECH-3; plan, PR 8 sensitivity gate): with mvp.deport_in_play off, as in the real content, Deport keeps
+ // the "not built yet" refusal and the state is unchanged.
+ [Fact]
+ public void DeportStaysOutOfPlayUntilItIsSwitchedOn()
+ {
+ var c = CaptureTests.Load(CaptureTests.AllTargets);
+ var s = Awaiting(c, Soldier(1, 1, 0));
+ var before = s.Describe();
+ Assert.Contains("not built yet", SettlementControl.Resolve(c, s, "town_a", SettlementControl.Deport, new List<Cause>()));
+ Assert.Equal(before, s.Describe());
+ }
+
+ // R-CTRL-007 in the real content (#1327 nit 3): with deport_in_play off in rules.yaml, a player unit on Jaffa's hex with
+ // Jaffa awaiting the choice still has Deport refused, and nothing is depopulated or displaced.
+ [Fact]
+ public void TheRealContentRefusesDeport()
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ Assert.False(c.RulesAt(s.Date).Mvp!.DeportInPlay);
+ var jaffa = c.SettlementTargets.Single(t => t.Id == "jaffa");
+ var u = s.Units.Values.First(x => x.Side == Movement.PlayerSide);
+ s.Units[u.Id] = new Unit(u.Id, u.Type, jaffa.Q, jaffa.R, side: u.Side, strength: u.Strength);
+ s.Settlements["jaffa"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, s.Date);
+ var result = Simulation.Step(c, s, new Command[] { new ResolveCapture("jaffa", SettlementControl.Deport) });
+ Assert.Contains("not built yet", Assert.Single(result.Rejected).Reason);
+ Assert.Equal(0, result.State.DisplacedByPlayer);
+ Assert.False(result.State.Settlements["jaffa"].Depopulated);
+ }
+
+ // R-CTRL-018, the real content's deport_money_cost (owner, 22 October 2026, #1327): at least the most Occupy can pay in
+ // upkeep, every turn of the game, plus the dearest city project a depopulated hex shared with a city no longer takes.
+ // DeportNeverDominates checks the fixture; this keeps the real value on the same side of that bound.
+ [Fact]
+ public void TheRealDeportCostCoversOccupyAndTheDearestProject()
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ var m = c.Rules.Mvp!;
+ var turns = (c.End.Year - c.Rules.Start.Year) * 12 + c.End.Month - c.Rules.Start.Month; // monthly turns (D-B1)
+ Assert.Equal(44, turns);
+ Assert.True(m.DeportMoneyCost >= m.OccupationUpkeepPerTurn * turns + c.ProjectKinds.Max(k => k.Cost));
+ }
+
+ // Determinism: Deport and the drag draw nothing from the RNG.
+ [Fact]
+ public void DeportDrawsNothing()
+ {
+ var c = Load();
+ var s = Awaiting(c, Soldier(1, 1, 0));
+ var rng = s.RngState;
+ Assert.Null(SettlementControl.Resolve(c, s, "town_a", SettlementControl.Deport, new List<Cause>()));
+ SettlementControl.Drag(c, s, c.RulesAt(s.Date).Mvp!, new List<Cause>());
+ Assert.Equal(rng, s.RngState);
+ }
+
+ [Theory]
+ [InlineData("deport_cohesion_cost: 0.2", "", "mvp.deport_cohesion_cost", "required")]
+ [InlineData("deport_support_cost: 0.1", "deport_support_cost: -0.1", "mvp.deport_support_cost", "must be a finite number >= 0")]
+ [InlineData("deport_support_drag_per_turn: 0.01", "", "mvp.deport_support_drag_per_turn", "required")]
+ [InlineData("deport_support_ceiling_drop: 0.3", "deport_support_ceiling_drop: -1", "mvp.deport_support_ceiling_drop", "must be a finite number >= 0")]
+ [InlineData("deport_money_cost: 121", "", "mvp.deport_money_cost", "required")]
+ public void BadValuesFailNamingTheField(string from, string to, string field, string message)
+ {
+ var files = Fixture.Gdd();
+ files["rules.yaml"] = files["rules.yaml"].Replace(from, to);
+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(files)));
+ Assert.Equal(("rules.yaml", field), (ex.File, ex.Field));
+ Assert.Contains(message, ex.Message);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
index 589035834..49a0c0518 100644
--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
@@ -192,6 +192,12 @@ public class DesignValuesTests
// Occupation (Phase 6 PR 6, #798; Q-OCC-1 (a), Q-OCC-3 (a)): proposed on #798 and #1324, accepted by the owner on 22 October 2026 (#1324).
("rules.yaml", "mvp.occupation_turns"),
("rules.yaml", "mvp.occupation_upkeep_per_turn"),
+ // Deport (Phase 6 PR 8, #800; Q-DEP-5 (c)): proposed on #800 and #1327, accepted by the owner on 22 October 2026 (#1327).
+ ("rules.yaml", "mvp.deport_cohesion_cost"),
+ ("rules.yaml", "mvp.deport_support_cost"),
+ ("rules.yaml", "mvp.deport_support_drag_per_turn"),
+ ("rules.yaml", "mvp.deport_support_ceiling_drop"),
+ ("rules.yaml", "mvp.deport_money_cost"),
}.Concat(CombatTableCells()).ToArray();
/// <summary>rules.yaml mvp.combat_table, every cell: its five rows (below 1:2, 1:2, 1:1, 2:1, 3:1) with their start ratio
@@ -299,6 +305,8 @@ public class DesignValuesTests
Assert.Equal((1, 5, 6), (m.ArmsPerAttack, m.CombatTable.Count, m.CombatTable[0].AttackerLoss.Count)); // #747 (D-G6, D-G3), accepted by the owner 20 Oct 2026
Assert.Equal((1, 0.01, 10, 0.005), (m.FoodPerPrisonerUnit, m.PrisonerShortfallCohesion, m.PointsPerPrisonerUnitReturned, m.HeldSoldierCostPerTurn)); // #751 (Q-POW-2, Q-POW-4, Q-POW-5), accepted by the owner (owner, 21 October 2026, #751)
Assert.Equal((6, 0.005), (m.OccupationTurns, m.OccupationUpkeepPerTurn)); // #798 (Q-OCC-1 (a), Q-OCC-3 (a)): proposed, for owner override
+ Assert.Equal((0.15, 0.15, 0.005, 0.25), (m.DeportCohesionCost, m.DeportSupportCost, m.DeportSupportDragPerTurn, m.DeportSupportCeilingDrop)); // #800 (Q-DEP-5 (c)): proposed, for owner override
+ Assert.False(m.DeportInPlay); // R-CTRL-007: Deport stays out of play until its cards and dialog are reviewed (PR 10 lifts it)
Assert.Equal(12, c.Cities.Count);
foreach (var x in c.Cities) // the listed housing and job values are the ones Cities.Init starts from
Assert.Equal(((int)x.Housing!.Value, (int)x.Jobs!.Value), (x.HousingCapacity, x.JobSlots));
diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.cs
index a66e68909..46fa1f07a 100644
--- a/sim/Statecraft.Sim.Tests/Fixture.cs
+++ b/sim/Statecraft.Sim.Tests/Fixture.cs
@@ -302,6 +302,11 @@ mvp:
held_soldier_cost_per_turn: 0.5
occupation_turns: 3
occupation_upkeep_per_turn: 0.25
+ deport_cohesion_cost: 0.2
+ deport_support_cost: 0.1
+ deport_support_drag_per_turn: 0.01
+ deport_support_ceiling_drop: 0.3
+ deport_money_cost: 121 # >= occupation_upkeep_per_turn x the 449 turns to the end (112.25) + the dearest project (housing, 8)
combat_terrain_percent: { coastal_plain: 100, hills: 150, desert: 100 }
combat_table:
- { min_ratio_percent: 0, attacker_loss: [1, 1], defender_loss: [1, 1], defender_retreats: [0, 0] }
diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.cs
index 9fff2362b..0571a07c8 100644
--- a/sim/Statecraft.Sim/Content.cs
+++ b/sim/Statecraft.Sim/Content.cs
@@ -659,6 +659,23 @@ namespace Statecraft.Sim
/// <summary>IL millions the Treasury pays a turn for each occupied place (R-CTRL-011; Q-OCC-1 (a)). Required in the GDD
/// loop, &gt;= 0.</summary>
public double? OccupationUpkeepPerTurn { get; set; }
+ /// <summary>Social cohesion (morale) lost at once by a Deport (R-CTRL-018; Q-DEP-5 (c)). Required in the GDD loop, &gt;= 0.</summary>
+ public double? DeportCohesionCost { get; set; }
+ /// <summary>International Support (intl_standing) lost at once by a Deport (R-CTRL-018; Q-DEP-5 (c)). Required in the GDD
+ /// loop, &gt;= 0.</summary>
+ public double? DeportSupportCost { get; set; }
+ /// <summary>International Support lost each turn in resolver step 10 for each place in DisplacedByPlayer, for the rest
+ /// of the game (R-CTRL-018; Q-DEP-5 (c)). Required in the GDD loop, &gt;= 0.</summary>
+ public double? DeportSupportDragPerTurn { get; set; }
+ /// <summary>How far International Support's ceiling falls below 1 for each place in DisplacedByPlayer, for the rest of
+ /// the game (R-CTRL-018; Q-DEP-5 (c)). Required in the GDD loop, &gt;= 0.</summary>
+ public double? DeportSupportCeilingDrop { get; set; }
+ /// <summary>IL millions the Treasury pays at once for a Deport, borrowing what it lacks (R-CTRL-018; owner, 22 October
+ /// 2026, #1327: Deport's Money at or below Occupy's and Raid's in every state). Required in the GDD loop, &gt;= 0.</summary>
+ public double? DeportMoneyCost { get; set; }
+ /// <summary>Whether ResolveCapture may answer with Deport (R-CTRL-007). Off, the default and the real content's value,
+ /// Deport is refused as not built yet until its cards and dialog are reviewed (Phase 6 PRs 9 and 10).</summary>
+ public bool DeportInPlay { get; set; }
}
/// <summary>One row of rules.yaml mvp.combat_table (R-COMBAT-002, R-COMBAT-003): it applies from an attack : defence
diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.cs
index f1a93cbad..27c83fb04 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -1298,7 +1298,11 @@ namespace Statecraft.Sim
// that never ends or costs nothing.
if (m.OccupationTurns == null) throw new ContentException(file, "mvp.occupation_turns", "required when eras.yaml systems.loop is gdd");
if (m.OccupationTurns < 1) throw new ContentException(file, "mvp.occupation_turns", "must be >= 1");
- foreach (var (key, v) in new[] { ("prisoner_shortfall_cohesion", m.PrisonerShortfallCohesion), ("held_soldier_cost_per_turn", m.HeldSoldierCostPerTurn), ("occupation_upkeep_per_turn", m.OccupationUpkeepPerTurn) })
+ foreach (var (key, v) in new[] { ("prisoner_shortfall_cohesion", m.PrisonerShortfallCohesion), ("held_soldier_cost_per_turn", m.HeldSoldierCostPerTurn), ("occupation_upkeep_per_turn", m.OccupationUpkeepPerTurn),
+ // R-CTRL-018 (Q-DEP-5 (c)): required, so a missing key is never read as a Deport that costs nothing
+ ("deport_cohesion_cost", m.DeportCohesionCost), ("deport_support_cost", m.DeportSupportCost),
+ ("deport_support_drag_per_turn", m.DeportSupportDragPerTurn), ("deport_support_ceiling_drop", m.DeportSupportCeilingDrop),
+ ("deport_money_cost", m.DeportMoneyCost) })
{
if (v == null) throw new ContentException(file, "mvp." + key, "required when eras.yaml systems.loop is gdd");
if (!(v >= 0 && IsFinite(v.Value))) throw new ContentException(file, "mvp." + key, "must be a finite number >= 0");
diff --git a/sim/Statecraft.Sim/Corridors.cs b/sim/Statecraft.Sim/Corridors.cs
index 4fc06f1b0..c5f049dd0 100644
--- a/sim/Statecraft.Sim/Corridors.cs
+++ b/sim/Statecraft.Sim/Corridors.cs
@@ -50,6 +50,8 @@ namespace Statecraft.Sim
if ((def.Kind == Rail) != wantRail) return wantRail ? $"{def.Name} is not a railway" : $"{def.Name} is not a road";
var index = n - 1;
var name = SegmentName(def, index);
+ if (def.Segments[index].Hexes.Any(h => SettlementControl.DepopulatedAt(c, s, h[0], h[1]))) // R-CTRL-020 (Q-DEP-7 (c))
+ return $"{name} crosses a depopulated place, where nothing can be built";
s.Corridors.TryGetValue(def.Id, out var work);
if (work?.Segments[index] is SegmentWork seg)
return seg.BuiltOn == null ? $"{name} is already being built" : $"{name} is already built";
diff --git a/sim/Statecraft.Sim/EffectsSystem.cs b/sim/Statecraft.Sim/EffectsSystem.cs
index 5600e20f0..350a6b93a 100644
--- a/sim/Statecraft.Sim/EffectsSystem.cs
+++ b/sim/Statecraft.Sim/EffectsSystem.cs
@@ -119,18 +119,26 @@ namespace Statecraft.Sim
static double Base(Content c, GameState s, Indicator i) =>
c.IsGdd && i.Id == Cities.HousingIndicator ? Cities.HousingLevel(s) ?? i.Base : i.Base;
- /// <summary>clamp(inner + event shift) to [0, 1].</summary>
+ /// <summary>clamp(inner + event shift) to [0, its <see cref="Ceiling"/>].</summary>
internal static double Level(Content c, GameState s, Indicator i) =>
- Math.Max(0, Math.Min(1, Inner(c, s, i) + s.IndicatorShifts[i.Id]));
+ Math.Max(0, Math.Min(Ceiling(c, s, i.Id), Inner(c, s, i) + s.IndicatorShifts[i.Id]));
+
+ /// <summary>The most an indicator can reach: 1, except International Support after a Deport, whose ceiling is 1 less
+ /// mvp.deport_support_ceiling_drop for each place in DisplacedByPlayer, never below 0, for the rest of the game
+ /// (R-CTRL-018; Q-DEP-5 (c)). Every write goes through <see cref="Level"/> or <see cref="Shift"/>, so none passes it.</summary>
+ static double Ceiling(Content c, GameState s, string id) =>
+ id == SettlementControl.SupportIndicator && s.DisplacedByPlayer > 0
+ ? Math.Max(0, 1 - c.RulesAt(s.Date).Mvp!.DeportSupportCeilingDrop!.Value * s.DisplacedByPlayer)
+ : 1;
/// <summary>Moves an indicator's level by <paramref name="delta"/> through its permanent shift (the layer event
- /// choices and crises use), clamped to [0, 1]. The shift is set so the level lands exactly on the visible result.
+ /// choices and crises use), clamped to [0, its <see cref="Ceiling"/>]. The shift is set so the level lands exactly on the visible result.
/// Returns the change actually applied (0 when the indicator was already at the clamp).</summary>
public static double Shift(Content c, GameState s, string indicator, double delta)
{
var ind = c.At(s.Date).Indicators.First(i => i.Id == indicator);
var level = Level(c, s, ind);
- var newLevel = Math.Max(0, Math.Min(1, level + delta));
+ var newLevel = Math.Max(0, Math.Min(Ceiling(c, s, ind.Id), level + delta));
s.IndicatorShifts[ind.Id] = newLevel - Inner(c, s, ind);
s.Indicators[ind.Id] = newLevel;
return newLevel - level;
diff --git a/sim/Statecraft.Sim/GameState.cs b/sim/Statecraft.Sim/GameState.cs
index c8d5168ca..33dfc8a25 100644
--- a/sim/Statecraft.Sim/GameState.cs
+++ b/sim/Statecraft.Sim/GameState.cs
@@ -107,6 +107,9 @@ namespace Statecraft.Sim
public SortedDictionary<string, int> PrisonersReturned = new SortedDictionary<string, int>(StringComparer.Ordinal);
/// <summary>The player's soldiers held by the enemy, in population units, by the side that took them (R-POW-005; Q-POW-4).</summary>
public SortedDictionary<string, int> SoldiersHeld = new SortedDictionary<string, int>(StringComparer.Ordinal);
+ /// <summary>The places the player has deported, the permanent record of R-CTRL-018 and R-CTRL-019: a count of places,
+ /// not people (Q-CAP-2 (b)), with no destination on the board (Q-DEP-3 (a)).</summary>
+ public int DisplacedByPlayer;
public double TotalPopulation => Population.Values.Sum();
@@ -251,6 +254,7 @@ namespace Statecraft.Sim
if (PrisonersHeld.Count > 0) Section("pow", '{', '}', Counts(PrisonersHeld));
if (PrisonersReturned.Count > 0) Section("powret", '{', '}', Counts(PrisonersReturned));
if (SoldiersHeld.Count > 0) Section("ownheld", '{', '}', Counts(SoldiersHeld));
+ if (DisplacedByPlayer != 0) { Sep(); Nl(); sb.Append("displaced=").Append(DisplacedByPlayer.ToString(CultureInfo.InvariantCulture)); } // R-CTRL-019: only after a Deport
return sb.ToString();
}
}
diff --git a/sim/Statecraft.Sim/Movement.cs b/sim/Statecraft.Sim/Movement.cs
index 8a8edeb37..571a532bc 100644
--- a/sim/Statecraft.Sim/Movement.cs
+++ b/sim/Statecraft.Sim/Movement.cs
@@ -238,13 +238,15 @@ namespace Statecraft.Sim
/// <summary>R-MOVE-005 in Phase 6 (#1304): the hexes a move and its path may not enter. For the player, those of
/// mvp.enemy_held_localities that are not curated targets (settlement_targets.yaml), so a target can be captured in play
- /// (the owner's #793 ruling) while the rest, Gaza today, stay closed; for the enemy, <see cref="NoEntry"/>'s mirror
- /// unchanged. Raid's withdrawal and combat retreat still read <see cref="NoEntry"/>, so neither ends on an enemy-held
- /// place.</summary>
+ /// (the owner's #793 ruling) while the rest, Gaza today, stay closed, and so does a depopulated target (R-CTRL-020);
+ /// for the enemy, <see cref="NoEntry"/>'s mirror unchanged. Raid's withdrawal and combat retreat still read
+ /// <see cref="NoEntry"/>, so neither ends on an enemy-held place.</summary>
static HashSet<(int Q, int R)> Closed(Content c, GameState s, bool enemy)
{
if (enemy) return NoEntry(c, s, true);
- var ids = c.RulesAt(s.Date).Mvp!.EnemyHeldLocalities.Except(c.SettlementTargets.Select(t => t.Id));
+ // A depopulated target (R-CTRL-020) stays closed: Deport leaves nothing to capture there again.
+ var ids = c.RulesAt(s.Date).Mvp!.EnemyHeldLocalities.Except(c.SettlementTargets.Select(t => t.Id)
+ .Where(id => !(s.Settlements.TryGetValue(id, out var x) && x.Depopulated)));
return new HashSet<(int Q, int R)>(c.SettlementHexes.Where(h => ids.Contains(h.Id)).Select(h => (h.Q, h.R)));
}
diff --git a/sim/Statecraft.Sim/Projects.cs b/sim/Statecraft.Sim/Projects.cs
index e007e5879..5f230b527 100644
--- a/sim/Statecraft.Sim/Projects.cs
+++ b/sim/Statecraft.Sim/Projects.cs
@@ -269,6 +269,7 @@ namespace Statecraft.Sim
return new MapActionReason("no_resource", $"{PlayerText.Settlement(c, city)} has no {k.Requires} for {k.Name}", city, k.Requires, kind);
var hex = c.HexAt(q, r);
if (hex == null || !hex.Land) return new MapActionReason("not_land", "This hex is not land");
+ if (SettlementControl.DepopulatedAt(c, s, q, r)) return new MapActionReason("depopulated", "Nothing can be built on a depopulated place"); // R-CTRL-020
var rules = c.RulesAt(s.Date); // the era the turn starts in
var max = rules.MapActionMaxDistance;
var name = PlayerText.Settlement(c, city);
diff --git a/sim/Statecraft.Sim/SettlementControl.cs b/sim/Statecraft.Sim/SettlementControl.cs
index 11c0a90d4..9c1e318f6 100644
--- a/sim/Statecraft.Sim/SettlementControl.cs
+++ b/sim/Statecraft.Sim/SettlementControl.cs
@@ -79,7 +79,8 @@ namespace Statecraft.Sim
static double Indicator(GameState s, string id) => s.Indicators.TryGetValue(id, out var v) ? v : 0;
/// <summary>R-CTRL-007: carries out ResolveCapture. Null when done, else the reason, with the state unchanged: the place
- /// is not awaiting the choice, the outcome is not known, or it is not built yet (Deport is PR 8).</summary>
+ /// is not awaiting the choice, the outcome is not known, or Deport is not in play (mvp.deport_in_play, off in the real
+ /// content until PR 10 lifts it).</summary>
internal static string? Resolve(Content c, GameState s, string id, string outcome, List<Cause> why)
{
if (NotAwaiting(s, id) is string no) return no;
@@ -87,7 +88,7 @@ namespace Statecraft.Sim
{
case Raid: return Withdraw(c, s, id, why, false);
case Occupy: return StartOccupation(c, s, id, why);
- case Deport: return "Deport is not built yet";
+ case Deport: return c.RulesAt(s.Date).Mvp!.DeportInPlay ? Depopulate(c, s, id, why) : "Deport is not built yet";
default: return "That outcome is not known";
}
}
@@ -105,29 +106,77 @@ namespace Statecraft.Sim
{
var t = c.SettlementTargets.First(x => x.Id == id); // only a target gets a record (R-CTRL-004)
var name = c.SettlementNames[id];
- var moved = new List<(Unit From, Unit To)>();
+ var moved = new List<Unit>();
+ if (MoveOut(c, s, t, name, atTheEnd, moved) is string no) return no;
+ s.Settlements.Remove(id);
+ Withdrew(name, moved, why);
+ why.Add(new Cause("map", id, 0, moved.Count > 0
+ ? $"{name}: Israeli units withdrew and it is under enemy control again. Its residents are unchanged"
+ : $"{name} is under enemy control again. Its residents are unchanged"));
+ return null;
+ }
+
+ /// <summary>R-CTRL-010's move: the units leave <paramref name="t"/>'s hex as <see cref="Withdraw"/> says, into
+ /// <paramref name="moved"/>. Raid and Deport share it (R-CTRL-018). The reason, with every unit back where it was, when
+ /// one has nowhere to go, unless <paramref name="atTheEnd"/>.</summary>
+ static string? MoveOut(Content c, GameState s, SettlementTarget t, string name, bool atTheEnd, List<Unit> moved)
+ {
+ var from = new List<Unit>();
foreach (var u in s.Units.Values.Where(u => u.Q == t.Q && u.R == t.R && !IsEnemy(u)).ToList()) // ascending id
{
var to = Movement.Neighbours.Select(d => ((int Q, int R)?)(t.Q + d.Q, t.R + d.R)).FirstOrDefault(h => Free(c, s, u, h!.Value.Q, h.Value.R));
if (to == null && atTheEnd) continue;
if (to == null)
{
- foreach (var (from, _) in moved) s.Units[from.Id] = from; // back as it was
+ foreach (var x in from) s.Units[x.Id] = x; // back as it was
+ moved.Clear();
return $"Unit {u.Id} has no free hex next to {name} to withdraw to";
}
var w = new Unit(u.Id, u.Type, to.Value.Q, to.Value.R, u.Service, u.Side, u.Strength, u.Order, u.OrderTarget, u.HomeCity);
s.Units[u.Id] = w;
- moved.Add((u, w));
+ from.Add(u);
+ moved.Add(w);
}
- s.Settlements.Remove(id);
- foreach (var (_, w) in moved)
+ return null;
+ }
+
+ static void Withdrew(string name, List<Unit> moved, List<Cause> why)
+ {
+ foreach (var w in moved)
why.Add(new Cause("map", w.Id.ToString(CultureInfo.InvariantCulture), 0, FormattableString.Invariant($"Unit {w.Id} withdrew from {name} to hex {w.Q},{w.R}")));
- why.Add(new Cause("map", id, 0, moved.Count > 0
- ? $"{name}: Israeli units withdrew and it is under enemy control again. Its residents are unchanged"
- : $"{name} is under enemy control again. Its residents are unchanged"));
+ }
+
+ /// <summary>R-CTRL-018 to R-CTRL-021, Deport (impact plan section 4.1; Q-DEP-1 (a) to Q-DEP-5 (c), Q-DEP-7 (c)). The
+ /// player's units leave as in Raid, refused the same way (Q-DEP-7 (a): no military advantage over Raid). The record
+ /// keeps only the capture date and depopulated: no owner, state or timer, and the buildings at their default (Q-DEP-4
+ /// (a), no razing in the MVP). The place counts once in DisplacedByPlayer, its residents nowhere else (Q-DEP-2 (a),
+ /// Q-DEP-3 (a)). Social cohesion and International Support fall at once by the labelled costs, through the permanent
+ /// shift. It draws nothing from the RNG.</summary>
+ static string? Depopulate(Content c, GameState s, string id, List<Cause> why)
+ {
+ var t = c.SettlementTargets.First(x => x.Id == id); // only a target gets a record (R-CTRL-004)
+ var name = c.SettlementNames[id];
+ var moved = new List<Unit>();
+ if (MoveOut(c, s, t, name, false, moved) is string no) return no;
+ s.Settlements[id] = new SettlementControl(since: s.Settlements[id].Since, depopulated: true);
+ s.DisplacedByPlayer++;
+ Withdrew(name, moved, why);
+ why.Add(new Cause("map", id, 0, $"{name}: Deport. Its residents are displaced and the place is depopulated"));
+ var r = c.RulesAt(s.Date).Mvp!; // the loader requires both costs in the GDD loop
+ foreach (var (indicator, cost) in new[] { ("morale", r.DeportCohesionCost!.Value), (SupportIndicator, r.DeportSupportCost!.Value) })
+ {
+ var change = EffectsSystem.Shift(c, s, indicator, -cost);
+ why.Add(new Cause("map", indicator, change, $"{PlayerText.Change(c, indicator, change)} (Deport of {name})"));
+ }
+ // Deport never pays (owner, 22 October 2026, #1327): its Money stays at or below Occupy's and Raid's.
+ why.Add(new Cause("economy", "treasury", -r.DeportMoneyCost!.Value, $"{PlayerText.Change(c, "treasury", -r.DeportMoneyCost.Value)} (Deport of {name})"));
+ EconomySystem.PayOrBorrow(c, s, r.DeportMoneyCost.Value, $"for the Deport of {name}", why);
return null;
}
+ /// <summary>International Support, the indicator Deport's costs, drag and ceiling act on (R-CTRL-018).</summary>
+ internal const string SupportIndicator = "intl_standing";
+
/// <summary>R-CTRL-011, R-CTRL-012 (Q-OCC-1 (a), Q-OCC-3 (a)): Occupy keeps the place under the player's control and
/// starts its timer at mvp.occupation_turns, the one X for every place. It needs an Israeli military unit on the hex,
/// the one unit that stays (a halutz holds nothing, #796), and is refused with the state unchanged otherwise. It moves
@@ -194,6 +243,21 @@ namespace Statecraft.Sim
}
}
+ /// <summary>Resolver step 10, after the occupation timers (R-CTRL-018; Q-DEP-5 (c)): International Support falls by
+ /// mvp.deport_support_drag_per_turn for each place in DisplacedByPlayer, every turn from the Deport turn to the game's
+ /// end. It draws nothing from the RNG.</summary>
+ internal static void Drag(Content c, GameState s, MvpRules r, List<Cause> why)
+ {
+ if (s.DisplacedByPlayer == 0) return;
+ var change = EffectsSystem.Shift(c, s, SupportIndicator, -r.DeportSupportDragPerTurn!.Value * s.DisplacedByPlayer);
+ if (change != 0) why.Add(new Cause("map", SupportIndicator, change, $"{PlayerText.Change(c, SupportIndicator, change)} (the places depopulated by Deport)"));
+ }
+
+ /// <summary>R-CTRL-020 (Q-DEP-7 (c), Q-SENS-2 (c)): whether (q, r) is the hex of a place the player has depopulated,
+ /// where no city project or corridor segment may be started (no designated site can be on a settlement's hex at all).</summary>
+ internal static bool DepopulatedAt(Content c, GameState s, int q, int r) =>
+ s.Settlements.Any(kv => kv.Value.Depopulated && c.SettlementTargets.Any(t => t.Id == kv.Key && t.Q == q && t.R == r));
+
const string Enemy = "enemy";
/// <summary>Who holds (q, r): <see cref="Movement.PlayerSide"/> when only Israeli military units are on it,
diff --git a/sim/Statecraft.Sim/TurnResolver.cs b/sim/Statecraft.Sim/TurnResolver.cs
index a06cca78f..26bf943a5 100644
--- a/sim/Statecraft.Sim/TurnResolver.cs
+++ b/sim/Statecraft.Sim/TurnResolver.cs
@@ -34,6 +34,7 @@ namespace Statecraft.Sim
Cities.Arrive(c, s, r, next, why); // 9. arrivals
StartingForces.Arrive(c, s, next); // and the brigades dated after the start (R-UNIT-009)
SettlementControl.Tick(c, s, r, why); // 10. occupation timers, in ordinal settlement id (R-CTRL-011 to R-CTRL-013)
+ SettlementControl.Drag(c, s, r, why); // then the International Support drag of the places deported (R-CTRL-018)
if (next >= c.End) SettlementControl.EndPending(c, s, why); // and on the turn that reaches the game's end, a capture still awaiting the choice counts as Raid (R-CTRL-008, #797)
Objectives.Complete(c, s, r, next, why); // 11. objectives and score
Defeat(s, r, why); // then the economic defeat (D-B5, R-END-002)