mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 15:27:27 +07:00
Resolved #10626 - city-state units work with 'get era' function
This commit is contained in:
parent
34dce70142
commit
d840b4fd4d
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user