mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
AI prioritizes its path to buying highly desirable tiles
This commit is contained in:
parent
b776790556
commit
c3db8ba971
@ -161,7 +161,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
|
||||
val bfs = BFS(cityInfo.getCenterTile()) {
|
||||
(it.isWater || it.isCityCenter()) && (it.getOwner() == null || it.isFriendlyTerritory(civInfo))
|
||||
}
|
||||
repeat(20) { bfs.nextStep() } //
|
||||
repeat(20) { bfs.nextStep() }
|
||||
|
||||
if (!bfs.getReachedTiles()
|
||||
.any { tile ->
|
||||
|
@ -384,7 +384,10 @@ object NextTurnAutomation {
|
||||
val cityWithLeastCostToBuy = highlyDesirableTile.value.minBy {
|
||||
it.getCenterTile().aerialDistanceTo(highlyDesirableTile.key)
|
||||
}
|
||||
val bfs = BFS(cityWithLeastCostToBuy.getCenterTile()) {
|
||||
val bfs = BFS(cityWithLeastCostToBuy.getCenterTile(),
|
||||
// Give higher priority on the way to intermediate tiles with higher ranking stats
|
||||
{ Automation.rankStatsValue(it.stats.getTileStats(cityWithLeastCostToBuy, civInfo), civInfo).toInt() })
|
||||
{
|
||||
it.getOwner() == null || it.getOwner() == civInfo
|
||||
}
|
||||
bfs.stepUntilDestination(highlyDesirableTile.key)
|
||||
|
Loading…
x
Reference in New Issue
Block a user