From c4263867ffa4be63d789329d900af391cadf621a Mon Sep 17 00:00:00 2001 From: Duan Tao Date: Fri, 25 Oct 2019 12:47:57 +0800 Subject: [PATCH] Better work actions. Improvement time scales with game speed. --- core/src/com/unciv/logic/automation/WorkerAutomation.kt | 7 ++++--- .../com/unciv/models/gamebasics/tile/TileImprovement.kt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index 175884fc..eb5eb870 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -140,7 +140,7 @@ class WorkerAutomation(val unit: MapUnit) { } private fun tileCanBeImproved(tile: TileInfo, civInfo: CivilizationInfo): Boolean { - if (!tile.isLand || tile.getBaseTerrain().impassable) + if (!tile.isLand || tile.getBaseTerrain().impassable || tile.isCityCenter()) return false val city=tile.getCity() if (city == null || city.civInfo != civInfo) @@ -149,11 +149,12 @@ class WorkerAutomation(val unit: MapUnit) { if(tile.improvement==null){ if(tile.improvementInProgress!=null) return true val chosenImprovement = chooseImprovement(tile, civInfo) - if(chosenImprovement!=null) return true + if(chosenImprovement!=null && tile.canBuildImprovement(chosenImprovement, civInfo)) return true } else{ if(!tile.containsGreatImprovement() && tile.hasViewableResource(civInfo) - && tile.getTileResource().improvement != tile.improvement) + && tile.getTileResource().improvement != tile.improvement + && tile.canBuildImprovement(chooseImprovement(tile, civInfo)!!, civInfo)) return true } diff --git a/core/src/com/unciv/models/gamebasics/tile/TileImprovement.kt b/core/src/com/unciv/models/gamebasics/tile/TileImprovement.kt index 05e65bd3..eaeec558 100644 --- a/core/src/com/unciv/models/gamebasics/tile/TileImprovement.kt +++ b/core/src/com/unciv/models/gamebasics/tile/TileImprovement.kt @@ -22,7 +22,7 @@ class TileImprovement : NamedStats(), ICivilopedia { fun getTurnsToBuild(civInfo: CivilizationInfo): Int { - var realTurnsToBuild = turnsToBuild.toFloat() + var realTurnsToBuild = turnsToBuild.toFloat() * civInfo.gameInfo.gameParameters.gameSpeed.getModifier() if (civInfo.containsBuildingUnique("Worker construction increased 25%")) realTurnsToBuild *= 0.75f if (civInfo.policies.isAdopted("Citizenship"))