mirror of
https://github.com/yairm210/Unciv.git
synced 2025-10-04 01:13:48 -04:00
Worker automation leaves great tile improvement alone.
This commit is contained in:
parent
922a29e60f
commit
be80aaecda
@ -98,7 +98,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
|||||||
val workableTiles = currentTile.getTilesInDistance(4)
|
val workableTiles = currentTile.getTilesInDistance(4)
|
||||||
.filter {
|
.filter {
|
||||||
(it.civilianUnit== null || it == currentTile)
|
(it.civilianUnit== null || it == currentTile)
|
||||||
&& (it.improvement == null || (it.hasViewableResource(unit.civInfo) && it.getTileResource().improvement != it.improvement))
|
&& (it.improvement == null || (it.hasViewableResource(unit.civInfo) && !it.containsGreatImprovement() && it.getTileResource().improvement != it.improvement))
|
||||||
&& it.isLand()
|
&& it.isLand()
|
||||||
&& !it.getBaseTerrain().impassable
|
&& !it.getBaseTerrain().impassable
|
||||||
&& it.canBuildImprovement(chooseImprovement(it, unit.civInfo), unit.civInfo)
|
&& it.canBuildImprovement(chooseImprovement(it, unit.civInfo), unit.civInfo)
|
||||||
|
@ -44,6 +44,11 @@ open class TileInfo {
|
|||||||
return toReturn
|
return toReturn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun containsGreatImprovement(): Boolean {
|
||||||
|
if (getTileImprovement() == null) return false
|
||||||
|
return getTileImprovement()!!.name in listOf("Academy", "Landmark", "Manufactory", "Customs house")
|
||||||
|
}
|
||||||
|
|
||||||
//region pure functions
|
//region pure functions
|
||||||
fun getUnits(): List<MapUnit> {
|
fun getUnits(): List<MapUnit> {
|
||||||
val list = ArrayList<MapUnit>(2)
|
val list = ArrayList<MapUnit>(2)
|
||||||
@ -162,7 +167,7 @@ open class TileInfo {
|
|||||||
if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!)) stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines
|
if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!)) stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines
|
||||||
if (improvement.name == "Trading post" && city != null && city.civInfo.policies.isAdopted("Free Thought"))
|
if (improvement.name == "Trading post" && city != null && city.civInfo.policies.isAdopted("Free Thought"))
|
||||||
stats.science += 1f
|
stats.science += 1f
|
||||||
if (improvement.name in listOf("Academy", "Landmark", "Manufactory", "Customs house") && observingCiv.policies.isAdopted("Freedom Complete"))
|
if (containsGreatImprovement() && observingCiv.policies.isAdopted("Freedom Complete"))
|
||||||
stats.add(improvement) // again, for the double effect
|
stats.add(improvement) // again, for the double effect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user