mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-25 10:26:05 +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
|
// Unique unit for militaristic city-states
|
||||||
if (uniqueTypes.contains(UniqueType.CityStateMilitaryUnits)) {
|
if (uniqueTypes.contains(UniqueType.CityStateMilitaryUnits)) {
|
||||||
val possibleUnits = ruleset.units.values.filter { it.requiredTechs().any()
|
val possibleUnits = ruleset.units.values.filter {
|
||||||
&& ruleset.eras[ruleset.technologies[it.requiredTech!!]!!.era()]!!.eraNumber > ruleset.eras[startingEra]!!.eraNumber // Not from the start era or before
|
val era = it.era(ruleset)
|
||||||
&& it.uniqueTo != null && it.uniqueTo in unusedMajorCivs // Must be from a major civ not in the game
|
return@filter era != null && era.eraNumber > ruleset.eras[startingEra]!!.eraNumber // Not from the start era or before
|
||||||
&& ruleset.unitTypes[it.unitType]!!.isLandUnit() && ( it.strength > 0 || it.rangedStrength > 0 ) } // Must be a land military unit
|
&& 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())
|
if (possibleUnits.isNotEmpty())
|
||||||
civInfo.cityStateUniqueUnit = possibleUnits.random().name
|
civInfo.cityStateUniqueUnit = possibleUnits.random().name
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user