mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 17:28:57 +07:00
AI no longer purchases non-contiguous tiles
This commit is contained in:
@ -391,6 +391,7 @@ object NextTurnAutomation {
|
||||
bfs.stepUntilDestination(highlyDesirableTile.key)
|
||||
val tilesThatNeedBuying =
|
||||
bfs.getPathTo(highlyDesirableTile.key).filter { it.getOwner() != civInfo }
|
||||
.toList().reversed() // getPathTo is from destination to source
|
||||
|
||||
// We're trying to acquire everything and revert if it fails, because of the difficult
|
||||
// way how tile acquisition cost is calculated. Everytime you buy a tile, the next one
|
||||
|
@ -68,6 +68,10 @@ class CityExpansionManager : IsPartOfGameInfoSerialization {
|
||||
fun buyTile(tile: Tile) {
|
||||
val goldCost = getGoldCostOfTile(tile)
|
||||
|
||||
class TriedToBuyNonContiguousTileException:Exception()
|
||||
if (tile.neighbors.none { it.getCity() == city })
|
||||
throw TriedToBuyNonContiguousTileException()
|
||||
|
||||
class NotEnoughGoldToBuyTileException : Exception()
|
||||
if (city.civ.gold < goldCost && !city.civ.gameInfo.gameParameters.godMode)
|
||||
throw NotEnoughGoldToBuyTileException()
|
||||
|
Reference in New Issue
Block a user