From 35c925531b670275801c7d7057fb3b5c46985c92 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Tue, 10 Dec 2024 18:21:08 +0100
Subject: Eliminate subordinate general in mixed stacks if too many hits.

---
 rules.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rules.js b/rules.js
index ca03f0e..b2164de 100644
--- a/rules.js
+++ b/rules.js
@@ -4113,13 +4113,15 @@ function goto_retreat() {
 
 	let loser = get_loser()
 
+	let xfer = is_mixed_stack(loser) ? 0 : 1
+
 	// no more fighting for the loser
 	remove_stack_from_combat(loser)
 
 	// apply hits
 	for (let i = game.selected.length - 1; i >= 0 && hits > 0; --i) {
 		let p = game.selected[i]
-		while (game.troops[p] > 1 && hits > 0) {
+		while (game.troops[p] > xfer && hits > 0) {
 			lost[piece_power[p]]++
 			--game.troops[p]
 			--hits
-- 
cgit v1.2.3