mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-24 05:31:22 +07:00
Avoid pillaged great improvement from being replaced by resource improvement.
This commit is contained in:
parent
eeb494364b
commit
f237adef4b
@ -102,7 +102,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
&& (it.improvement == null || (it.hasViewableResource(unit.civInfo) && !it.containsGreatImprovement() && it.getTileResource().improvement != it.improvement))
|
||||
&& it.isLand()
|
||||
&& !it.getBaseTerrain().impassable
|
||||
&& it.canBuildImprovement(chooseImprovement(it, unit.civInfo), unit.civInfo)
|
||||
&& (it.containsUnfinishedGreatImprovement() || it.canBuildImprovement(chooseImprovement(it, unit.civInfo), unit.civInfo))
|
||||
&& {val city=it.getCity(); city==null || it.getCity()?.civInfo == unit.civInfo}() // don't work tiles belonging to another civ
|
||||
}.sortedByDescending { getPriority(it, unit.civInfo) }.toMutableList()
|
||||
|
||||
@ -145,6 +145,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
tile.improvementInProgress != null -> tile.improvementInProgress
|
||||
improvementStringForResource != null -> improvementStringForResource
|
||||
tile.containsGreatImprovement() -> null
|
||||
tile.containsUnfinishedGreatImprovement() -> null
|
||||
tile.terrainFeature == "Jungle" -> "Trading post"
|
||||
tile.terrainFeature == "Marsh" -> "Remove Marsh"
|
||||
tile.terrainFeature == "Forest" -> "Lumber mill"
|
||||
|
@ -45,8 +45,13 @@ open class TileInfo {
|
||||
}
|
||||
|
||||
fun containsGreatImprovement(): Boolean {
|
||||
if (getTileImprovement() == null) return false
|
||||
return getTileImprovement()!!.name in listOf("Academy", "Landmark", "Manufactory", "Customs house")
|
||||
if (improvement in listOf("Academy", "Landmark", "Manufactory", "Customs house")) return true
|
||||
return false
|
||||
}
|
||||
|
||||
fun containsUnfinishedGreatImprovement(): Boolean {
|
||||
if (improvementInProgress in listOf("Academy", "Landmark", "Manufactory", "Customs house")) return true
|
||||
return false
|
||||
}
|
||||
|
||||
//region pure functions
|
||||
|
Loading…
Reference in New Issue
Block a user