mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Disable auto building of forts while a human can do that (#2436)
* Automate building forts for AI players only * Using constants
This commit is contained in:
@ -47,6 +47,9 @@ object Constants {
|
|||||||
const val random = "Random"
|
const val random = "Random"
|
||||||
val greatImprovements = listOf("Academy", "Landmark", "Manufactory", "Customs house", "Citadel")
|
val greatImprovements = listOf("Academy", "Landmark", "Manufactory", "Customs house", "Citadel")
|
||||||
|
|
||||||
|
const val fort = "Fort"
|
||||||
|
const val citadel = "Citadel"
|
||||||
|
|
||||||
const val unitActionSetUp = "Set Up"
|
const val unitActionSetUp = "Set Up"
|
||||||
const val unitActionSleep = "Sleep"
|
const val unitActionSleep = "Sleep"
|
||||||
const val unitActionSleepUntilHealed = "Sleep until healed"
|
const val unitActionSleepUntilHealed = "Sleep until healed"
|
||||||
|
@ -194,7 +194,8 @@ class WorkerAutomation(val unit: MapUnit) {
|
|||||||
tile.containsUnfinishedGreatImprovement() -> null
|
tile.containsUnfinishedGreatImprovement() -> null
|
||||||
|
|
||||||
// Defence is more important that civilian improvements
|
// Defence is more important that civilian improvements
|
||||||
evaluateFortPlacement(tile,civInfo) -> "Fort"
|
// While AI sucks in strategical placement of forts, allow a human does it manually
|
||||||
|
!civInfo.isPlayerCivilization() && evaluateFortPlacement(tile,civInfo) -> Constants.fort
|
||||||
// I think we can assume that the unique improvement is better
|
// I think we can assume that the unique improvement is better
|
||||||
uniqueImprovement!=null && tile.canBuildImprovement(uniqueImprovement,civInfo) -> uniqueImprovement.name
|
uniqueImprovement!=null && tile.canBuildImprovement(uniqueImprovement,civInfo) -> uniqueImprovement.name
|
||||||
|
|
||||||
@ -228,7 +229,7 @@ class WorkerAutomation(val unit: MapUnit) {
|
|||||||
// don't build fort in the city
|
// don't build fort in the city
|
||||||
if (tile.isCityCenter()) return false
|
if (tile.isCityCenter()) return false
|
||||||
// don't build fort if it is already here
|
// don't build fort if it is already here
|
||||||
if (tile.improvement == "Fort") return false
|
if (tile.improvement == Constants.fort) return false
|
||||||
// don't build on resource tiles
|
// don't build on resource tiles
|
||||||
if (tile.hasViewableResource(civInfo)) return false
|
if (tile.hasViewableResource(civInfo)) return false
|
||||||
// don't build on great improvements
|
// don't build on great improvements
|
||||||
@ -249,8 +250,8 @@ class WorkerAutomation(val unit: MapUnit) {
|
|||||||
// don't build forts too close to the cities
|
// don't build forts too close to the cities
|
||||||
if (closeTile.isCityCenter()) return false
|
if (closeTile.isCityCenter()) return false
|
||||||
// don't build forts too close to other forts
|
// don't build forts too close to other forts
|
||||||
if (closeTile.improvement == "Fort" || closeTile.improvement == "Citadel"
|
if (closeTile.improvement == Constants.fort || closeTile.improvement == Constants.citadel
|
||||||
|| closeTile.improvementInProgress == "Fort") return false
|
|| closeTile.improvementInProgress == Constants.fort) return false
|
||||||
// there is another better tile for the fort
|
// there is another better tile for the fort
|
||||||
if (!isHills && tile.getBaseTerrain().name == Constants.hill &&
|
if (!isHills && tile.getBaseTerrain().name == Constants.hill &&
|
||||||
isAcceptableTileForFort(closeTile, civInfo)) return false
|
isAcceptableTileForFort(closeTile, civInfo)) return false
|
||||||
|
Reference in New Issue
Block a user