From e40ab3e9da0172d247c340dccbb2de12fefc7475 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 19 Feb 2023 08:11:34 +0200 Subject: [PATCH] Allow settlers to be captured when worker replacements exist --- core/src/com/unciv/logic/battle/Battle.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index 2fd50e8342..8e5745a97a 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -631,7 +631,12 @@ object Battle { // This is so that future checks which check if a unit has been captured are caught give the right answer // For example, in postBattleMoveToAttackedTile capturedUnit.civ = attacker.getCivInfo() - attacker.getCivInfo().units.placeUnitNearTile(capturedUnitTile.position, Constants.worker) + + val workerTypeUnit = attacker.getCivInfo().gameInfo.ruleset.units.values + .firstOrNull { it.isCivilian() && it.getMatchingUniques(UniqueType.BuildImprovements).any { it.params[0] == "Land" } } + + if (workerTypeUnit != null) + attacker.getCivInfo().units.placeUnitNearTile(capturedUnitTile.position, workerTypeUnit.name) } else -> capturedUnit.capturedBy(attacker.getCivInfo()) }