Better work actions. Improvement time scales with game speed.

This commit is contained in:
Duan Tao 2019-10-25 12:47:57 +08:00 committed by Yair Morgenstern
parent c751d5a670
commit c4263867ff
2 changed files with 5 additions and 4 deletions

View file

@ -140,7 +140,7 @@ class WorkerAutomation(val unit: MapUnit) {
} }
private fun tileCanBeImproved(tile: TileInfo, civInfo: CivilizationInfo): Boolean { private fun tileCanBeImproved(tile: TileInfo, civInfo: CivilizationInfo): Boolean {
if (!tile.isLand || tile.getBaseTerrain().impassable) if (!tile.isLand || tile.getBaseTerrain().impassable || tile.isCityCenter())
return false return false
val city=tile.getCity() val city=tile.getCity()
if (city == null || city.civInfo != civInfo) if (city == null || city.civInfo != civInfo)
@ -149,11 +149,12 @@ class WorkerAutomation(val unit: MapUnit) {
if(tile.improvement==null){ if(tile.improvement==null){
if(tile.improvementInProgress!=null) return true if(tile.improvementInProgress!=null) return true
val chosenImprovement = chooseImprovement(tile, civInfo) val chosenImprovement = chooseImprovement(tile, civInfo)
if(chosenImprovement!=null) return true if(chosenImprovement!=null && tile.canBuildImprovement(chosenImprovement, civInfo)) return true
} }
else{ else{
if(!tile.containsGreatImprovement() && tile.hasViewableResource(civInfo) if(!tile.containsGreatImprovement() && tile.hasViewableResource(civInfo)
&& tile.getTileResource().improvement != tile.improvement) && tile.getTileResource().improvement != tile.improvement
&& tile.canBuildImprovement(chooseImprovement(tile, civInfo)!!, civInfo))
return true return true
} }

View file

@ -22,7 +22,7 @@ class TileImprovement : NamedStats(), ICivilopedia {
fun getTurnsToBuild(civInfo: CivilizationInfo): Int { 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%")) if (civInfo.containsBuildingUnique("Worker construction increased 25%"))
realTurnsToBuild *= 0.75f realTurnsToBuild *= 0.75f
if (civInfo.policies.isAdopted("Citizenship")) if (civInfo.policies.isAdopted("Citizenship"))