diff --git a/core/src/com/unciv/logic/civilization/diplomacy/CityStateFunctions.kt b/core/src/com/unciv/logic/civilization/diplomacy/CityStateFunctions.kt index 0b520cd75d..96d185b09c 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/CityStateFunctions.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/CityStateFunctions.kt @@ -51,10 +51,12 @@ class CityStateFunctions(val civInfo: Civilization) { // Unique unit for militaristic city-states if (uniqueTypes.contains(UniqueType.CityStateMilitaryUnits)) { - val possibleUnits = ruleset.units.values.filter { it.requiredTechs().any() - && ruleset.eras[ruleset.technologies[it.requiredTech!!]!!.era()]!!.eraNumber > ruleset.eras[startingEra]!!.eraNumber // Not from the start era or before - && it.uniqueTo != null && it.uniqueTo in unusedMajorCivs // Must be from a major civ not in the game - && ruleset.unitTypes[it.unitType]!!.isLandUnit() && ( it.strength > 0 || it.rangedStrength > 0 ) } // Must be a land military unit + val possibleUnits = ruleset.units.values.filter { + val era = it.era(ruleset) + return@filter era != null && era.eraNumber > ruleset.eras[startingEra]!!.eraNumber // Not from the start era or before + && it.uniqueTo != null && it.uniqueTo in unusedMajorCivs // Must be from a major civ not in the game + && ruleset.unitTypes[it.unitType]!!.isLandUnit() && (it.strength > 0 || it.rangedStrength > 0) // Must be a land military unit + } if (possibleUnits.isNotEmpty()) civInfo.cityStateUniqueUnit = possibleUnits.random().name }