mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-11 00:08:58 +07:00
Patch: Fix automation breaking on unknown units with no improvement placements (#11877)
This commit is contained in:
@ -198,9 +198,10 @@ object SpecificUnitAutomation {
|
||||
/** @return whether there was any progress in placing the improvement. A return value of `false`
|
||||
* can be interpreted as: the unit doesn't know where to place the improvement or is stuck. */
|
||||
fun automateImprovementPlacer(unit: MapUnit) : Boolean {
|
||||
val improvementBuildingUniques = unit.getMatchingUniques(UniqueType.ConstructImprovementInstantly)
|
||||
val improvementBuildingUnique = unit.getMatchingUniques(UniqueType.ConstructImprovementInstantly).firstOrNull()
|
||||
?: return false
|
||||
|
||||
val improvementName = improvementBuildingUniques.first().params[0]
|
||||
val improvementName = improvementBuildingUnique.params[0]
|
||||
val improvement = unit.civ.gameInfo.ruleset.tileImprovements[improvementName]
|
||||
?: return false
|
||||
val relatedStat = improvement.maxByOrNull { it.value }?.key ?: Stat.Culture
|
||||
|
Reference in New Issue
Block a user