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.

GDD 0.3: the enemy attacks at 1.5:1 under gdd-0.3 (#2114) (#2141)

Beri3b987071fb85
diff --git a/changelog.d/2114.md b/changelog.d/2114.md
new file mode 100644
index 000000000..287eea9d5
--- /dev/null
+++ b/changelog.d/2114.md
@@ -0,0 +1,3 @@
+- GDD 0.3: an enemy unit off its script attacks a neighbouring player unit at 1.5:1 under `gdd-0.3`, read from the
+ catalogue's `combat.enemy_attack_ratio` (owner ruling O4, 1 November 2026; R-ENEMY-003, #2114). Legacy and `gdd-0.1`
+ keep 2:1.
diff --git a/content/gdd03-balance.yaml b/content/gdd03-balance.yaml
index 2c3de0788..98c2558f8 100644
--- a/content/gdd03-balance.yaml
+++ b/content/gdd03-balance.yaml
@@ -474,8 +474,8 @@
"values": [0, 9, 10, 69, 70, 99]
"note": "Inclusive pairs, in order: both hold, defender retreats, defender loss; no attacker loss in this row. #1668 balance.md at 605277df."
"combat.enemy_attack_ratio":
- "basis": "Default"
- "note": "Movement and engagement defaults: unitless minimum ratio for goal-driven enemy attack; Default. Source: #1668 balance.md at 605277df."
+ "basis": "Agreed"
+ "note": "Movement and engagement defaults: unitless minimum ratio for goal-driven enemy attack; Agreed. Source: #1668 balance.md at 605277df. owner ruling, 1 Nov 2026, O4 on #1668: \"1.5:1 in gdd-0.3 (Recommended)\"; gdd-0.1 keeps 2:1 (R-ENEMY-003, #2114)."
"values": [1.50]
"combat.retreat_hexes":
"basis": "Agreed"
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 44f103a92..74dd8211e 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -340,7 +340,7 @@ R-ENEMY-001: Resolver step 1, before combat, gives every enemy military unit its
R-ENEMY-002: In Historical mode each starting Arab force (R-UNIT-006) has a script from `map/units_1948.yaml` (Q-ENEMY-1; `research_notes/GDD phase 5/arab-forces-1948.md` section 10). Its 15 May 1948 position is the start. Its target is the row's first anchor from 11 June 1948 that cites at least two sources other than Wikipedia and Wikidata, on that anchor's hex (`map/unit_anchor_hexes.yaml`): Isdud for Egypt (the forward base), Latrun for the Arab Legion, the bridgehead at Mishmar HaYarden for Syria and Jenin for Iraq; the ALA has none. On each turn that starts before the anchor's window ends (its `to`, 8 July 1948 for all four), the unit moves along its cheapest path to the target (R-MOVE-002) as far as its movement points reach. A unit on its target, with no path to it or whose move is refused follows R-ENEMY-003 that turn, and so does every unit from the turn its window has ended. The script never places a unit anywhere but its own path to a sourced anchor.
-R-ENEMY-003: An enemy unit off its script attacks the first neighbouring hex, in the fixed order (R-MOVE-002), holding a player military unit where the attack preview (`Combat.Preview`, its own strength plus its side's units already ordered on that hex) reaches `mvp.enemy_attack_ratio_percent` (real value 200, the 2:1 row; a labelled design value). A standing attack on that hex is kept. Otherwise it fortifies its hex (R-ORDER-002; a fortify it has is kept). Step 2 resolves its attack in the same turn. Inside a truce it only fortifies (R-ENEMY-006).
+R-ENEMY-003: An enemy unit off its script attacks the first neighbouring hex, in the fixed order (R-MOVE-002), holding a player military unit where the attack preview (`Combat.Preview`, its own strength plus its side's units already ordered on that hex) reaches `mvp.enemy_attack_ratio_percent` (real value 200, the 2:1 row; a labelled design value). Under exact `gdd-0.3` the threshold is the catalogue's `combat.enemy_attack_ratio` instead, 1.5:1 (150): owner, 1 November 2026, O4 on #1668, "1.5:1 in gdd-0.3 (Recommended)" (#2114). A standing attack on that hex is kept. Otherwise it fortifies its hex (R-ORDER-002; a fortify it has is kept). Step 2 resolves its attack in the same turn. Inside a truce it only fortifies (R-ENEMY-006).
R-ENEMY-004: No enemy unit arrives or grows in Phase 5 (Q-ENEMY-3): no turn adds an enemy unit, until a dated per-army figure is chosen under CONTENT_POLICY section 1.
diff --git a/sim/Statecraft.Sim.Tests/EnemyAITests.cs b/sim/Statecraft.Sim.Tests/EnemyAITests.cs
index 7df1be026..d1e7cf1a7 100644
--- a/sim/Statecraft.Sim.Tests/EnemyAITests.cs
+++ b/sim/Statecraft.Sim.Tests/EnemyAITests.cs
@@ -436,4 +436,38 @@ public class EnemyAITests
s = r.State;
}
}
+
+ // R-ENEMY-003, #2114 (O4, owner ruling 1 Nov 2026): under exact gdd-0.3 the threshold is the catalogue's
+ // combat.enemy_attack_ratio, 1.5:1 (150%); gdd-0.1 keeps mvp.enemy_attack_ratio_percent (the fixture's 200).
+ static Content Gdd03() => ContentLoader.Load(Fixture.Write(Gdd03Files()));
+
+ static Dictionary<string, string> Gdd03Files()
+ {
+ var f = Fixture.Gdd(new Dictionary<string, string>
+ {
+ ["unit_types.yaml"] = Types, ["map/hexes.json"] = MovementTests.Board(), ["corridors.yaml"] = "corridors: []\n"
+ });
+ f["rules.yaml"] = f["rules.yaml"].Replace("move_cost: { coastal_plain: 1, hills: 2, desert: 3 }",
+ "move_cost: { coastal_plain: 1, lowland: 1, valley: 1, hills: 2, mountains: 3, desert: 3 }")
+ .Replace("combat_terrain_percent: { coastal_plain: 100, hills: 150, desert: 100 }",
+ "combat_terrain_percent: { coastal_plain: 100, lowland: 100, valley: 100, hills: 150, mountains: 150, desert: 100 }");
+ f["eras.yaml"] = f["eras.yaml"].Replace("loop: gdd", "loop: gdd, ruleset: " + SaveGame.Gdd03Ruleset);
+ f[Gdd03BalanceCatalogue.FileName] = System.IO.File.ReadAllText(System.IO.Path.Combine(RealContentTests.ContentRoot(), Gdd03BalanceCatalogue.FileName));
+ return f;
+ }
+
+ [Theory]
+ [InlineData(true, 30, 150, Combat.Attack, "3,0")] // gdd-0.3: exactly 1.5:1 attacks
+ [InlineData(true, 29, 145, Orders.Fortifying, "2,0")] // gdd-0.3: just under 1.5:1 holds
+ [InlineData(false, 30, 150, Orders.Fortifying, "2,0")] // gdd-0.1: 1.5:1 holds
+ [InlineData(false, 40, 200, Combat.Attack, "3,0")] // gdd-0.1: 2:1 attacks
+ public void Gdd03AttacksAtOneAndAHalfAndGdd01KeepsTwo(bool gdd03, int strength, int ratio, string order, string target)
+ {
+ var c = gdd03 ? Gdd03() : Load();
+ Assert.Equal(gdd03 ? SaveGame.Gdd03Ruleset : SaveGame.GddRuleset, c.Ruleset);
+ var s = CombatTests.With(c, Soldier(1, 3, 0, 20), Enemy(2, 2, 0, strength));
+ Assert.Equal(ratio, Combat.Preview(c, s, 2, 3, 0)!.Value.RatioPercent);
+ EnemyAI.Order(c, s, new List<Cause>());
+ Assert.Equal((order, target), (s.Units[2].Order, s.Units[2].OrderTarget));
+ }
}
diff --git a/sim/Statecraft.Sim/EnemyAI.cs b/sim/Statecraft.Sim/EnemyAI.cs
index 757c7a15d..9d2c8c44a 100644
--- a/sim/Statecraft.Sim/EnemyAI.cs
+++ b/sim/Statecraft.Sim/EnemyAI.cs
@@ -82,10 +82,12 @@ namespace Statecraft.Sim
/// attack.</summary>
static void Goals(Content c, GameState s, MvpRules mvp, Unit u, bool truce, List<Cause> why)
{
+ // #2114 (O4): exact gdd-0.3 reads its catalogue's 1.5:1; legacy and gdd-0.1 keep mvp.enemy_attack_ratio_percent.
+ var threshold = Gdd03Military.Applies(c) ? Gdd03Military.EnemyAttackRatioPercent(c) : mvp.EnemyAttackRatioPercent!.Value;
foreach (var (dq, dr) in truce ? Array.Empty<(int Q, int R)>() : Movement.Neighbours) // a truce: straight to fortify
{
int q = u.Q + dq, r = u.R + dr;
- if (!(Combat.Preview(c, s, u.Id, q, r) is (int ratio, _)) || ratio < mvp.EnemyAttackRatioPercent!.Value) continue;
+ if (!(Combat.Preview(c, s, u.Id, q, r) is (int ratio, _)) || ratio < threshold) continue;
var target = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0},{1}", q, r);
if (u.Order == Combat.Attack && u.OrderTarget == target) return;
if (Combat.Give(c, s, u.Id, q, r, why, enemy: true) == null) return;
diff --git a/sim/Statecraft.Sim/Gdd03Military.cs b/sim/Statecraft.Sim/Gdd03Military.cs
index 8679f8350..5d47b08e7 100644
--- a/sim/Statecraft.Sim/Gdd03Military.cs
+++ b/sim/Statecraft.Sim/Gdd03Military.cs
@@ -33,6 +33,20 @@ namespace Statecraft.Sim
internal static int Scalar(Content c, string key, bool positive = true) => Number(Entry(c, key), key, 1, 0, positive);
+ /// <summary>R-ENEMY-003, #2114: the off-script enemy attack threshold, combat.enemy_attack_ratio (a unitless ratio,
+ /// 1.50 by the owner's O4 ruling) in Combat.Preview's percent; it must be a whole percent.</summary>
+ internal static int EnemyAttackRatioPercent(Content c)
+ {
+ const string key = "combat.enemy_attack_ratio";
+ var value = Entry(c, key);
+ if (value.Values == null || value.Values.Count != 1 || value.Parts == null || value.Parts.Count != 0 || !string.IsNullOrEmpty(value.Expression))
+ throw Invalid(key, "requires one exact ratio");
+ var percent = value.Values[0] * 100;
+ if (percent != decimal.Truncate(percent) || percent < 1 || percent > int.MaxValue)
+ throw Invalid(key, "requires a positive ratio in whole percent");
+ return (int)percent;
+ }
+
static Gdd03DesignValue Part(Content c, string biome, string part)
{
var row = Entry(c, biome);
@@ -135,6 +149,7 @@ namespace Statecraft.Sim
foreach (var key in new[] { "military.move_infantry", "military.move_armoured", "military.move_road", "military.move_rail", "military.stack_limit" })
Scalar(c, key);
Scalar(c, "military.fort_bonus", false);
+ EnemyAttackRatioPercent(c);
Scalar(c, "military.fortify_bonus", false);
if (Scalar(c, "military.fortify_turns") != 1) throw Invalid("military.fortify_turns", "only the existing one-turn settlement is implemented");
foreach (var biome in new[] { "coastal_plain", "lowland", "valley", "hills", "mountains", "desert" })