Merge pull request #355 from ninjatao/fish_boat

AI uses work boats.
This commit is contained in:
yairm210 2018-12-17 11:47:33 +02:00 committed by GitHub
commit 978dac806f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,6 +73,10 @@ class Automation {
val militaryUnits = civUnits.filter { !it.type.isCivilian()}.size val militaryUnits = civUnits.filter { !it.type.isCivilian()}.size
val workers = civUnits.filter { it.name == CityConstructions.Worker }.size val workers = civUnits.filter { it.name == CityConstructions.Worker }.size
val cities = cityInfo.civInfo.cities.size val cities = cityInfo.civInfo.cities.size
val canBuildWorkboat = cityInfo.cityConstructions.getConstructableUnits().map { it.name }.contains("Work Boats")
&& !cityInfo.getTiles().any { it.civilianUnit?.name == "Work Boats" }
val needWorkboat = canBuildWorkboat
&& cityInfo.getTiles().any { it.isWater() && it.hasViewableResource(cityInfo.civInfo) && it.improvement == null }
val goldBuildings = buildableNotWonders.filter { it.gold>0 } val goldBuildings = buildableNotWonders.filter { it.gold>0 }
val wartimeBuildings = buildableNotWonders.filter { it.xpForNewUnits>0 || it.cityStrength>0 }.sortedBy { it.maintenance } val wartimeBuildings = buildableNotWonders.filter { it.xpForNewUnits>0 || it.cityStrength>0 }.sortedBy { it.maintenance }
@ -94,6 +98,7 @@ class Automation {
zeroMaintenanceBuildings.isNotEmpty() -> currentConstruction = zeroMaintenanceBuildings.getRandom().name zeroMaintenanceBuildings.isNotEmpty() -> currentConstruction = zeroMaintenanceBuildings.getRandom().name
isAtWar && militaryUnits<cities -> trainCombatUnit(cityInfo) isAtWar && militaryUnits<cities -> trainCombatUnit(cityInfo)
isAtWar && wartimeBuildings.isNotEmpty() -> currentConstruction = wartimeBuildings.getRandom().name isAtWar && wartimeBuildings.isNotEmpty() -> currentConstruction = wartimeBuildings.getRandom().name
needWorkboat -> currentConstruction = "Work Boats"
workers<cities/2 -> currentConstruction = CityConstructions.Worker workers<cities/2 -> currentConstruction = CityConstructions.Worker
militaryUnits<cities -> trainCombatUnit(cityInfo) militaryUnits<cities -> trainCombatUnit(cityInfo)
buildableNotWonders.isNotEmpty() -> currentConstruction = buildableNotWonders.minBy { it.maintenance }!!.name buildableNotWonders.isNotEmpty() -> currentConstruction = buildableNotWonders.minBy { it.maintenance }!!.name