From 3b5ca4cd1416f2458db156757bec76fdc3019626 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Sat, 28 Jan 2023 17:15:02 +0100
Subject: Remove Serfs immediately when assigned hits.

---
 rules.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/rules.js b/rules.js
index 4b08c55..d2f00c2 100644
--- a/rules.js
+++ b/rules.js
@@ -8859,6 +8859,11 @@ function rout_unit(lord, type) {
 	}
 }
 
+function remove_serf(lord) {
+	add_lord_forces(lord, SERFS, -1)
+	game.pieces.smerdi++
+}
+
 function use_warrior_monks(lord, type) {
 	if (type === KNIGHTS) {
 		let bit = 1 << lord
@@ -8925,9 +8930,12 @@ function action_assign_hits(lord, type) {
 				rout_unit(lord, type)
 			}
 		}
-	} else {
+	} else if (type !== SERFS) {
 		logi(`${FORCE_TYPE_NAME[type]} unprotected`)
 		rout_unit(lord, type)
+	} else {
+		logi(`${FORCE_TYPE_NAME[type]} removed`)
+		remove_serf(lord, type)
 	}
 
 	if (game.battle.xhits)
@@ -9504,8 +9512,6 @@ function action_losses(lord, type) {
 	} else {
 		logi(`${FORCE_TYPE_NAME[type]} ${range(target)}: ${HIT[die]}`)
 		add_lord_routed_forces(lord, type, -1)
-		if (type === SERFS)
-			game.pieces.smerdi++
 	}
 
 	resume_battle_losses()
-- 
cgit v1.2.3