mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Merge pull request #412 from ninjatao/auto_fix_pillage
Avoid pillaged great improvement from being replaced by resource impr…
This commit is contained in:
commit
c7dbad1085
@ -102,7 +102,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
|||||||
&& (it.improvement == null || (it.hasViewableResource(unit.civInfo) && !it.containsGreatImprovement() && 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.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
|
&& {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()
|
}.sortedByDescending { getPriority(it, unit.civInfo) }.toMutableList()
|
||||||
|
|
||||||
@ -145,6 +145,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
|||||||
tile.improvementInProgress != null -> tile.improvementInProgress
|
tile.improvementInProgress != null -> tile.improvementInProgress
|
||||||
improvementStringForResource != null -> improvementStringForResource
|
improvementStringForResource != null -> improvementStringForResource
|
||||||
tile.containsGreatImprovement() -> null
|
tile.containsGreatImprovement() -> null
|
||||||
|
tile.containsUnfinishedGreatImprovement() -> null
|
||||||
tile.terrainFeature == "Jungle" -> "Trading post"
|
tile.terrainFeature == "Jungle" -> "Trading post"
|
||||||
tile.terrainFeature == "Marsh" -> "Remove Marsh"
|
tile.terrainFeature == "Marsh" -> "Remove Marsh"
|
||||||
tile.terrainFeature == "Forest" -> "Lumber mill"
|
tile.terrainFeature == "Forest" -> "Lumber mill"
|
||||||
|
@ -45,8 +45,13 @@ open class TileInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun containsGreatImprovement(): Boolean {
|
fun containsGreatImprovement(): Boolean {
|
||||||
if (getTileImprovement() == null) return false
|
if (improvement in listOf("Academy", "Landmark", "Manufactory", "Customs house")) return true
|
||||||
return getTileImprovement()!!.name in listOf("Academy", "Landmark", "Manufactory", "Customs house")
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun containsUnfinishedGreatImprovement(): Boolean {
|
||||||
|
if (improvementInProgress in listOf("Academy", "Landmark", "Manufactory", "Customs house")) return true
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
//region pure functions
|
//region pure functions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user