mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-10 02:47:24 +07:00
AI no longer purchases non-contiguous tiles
This commit is contained in:
parent
0536c5f24b
commit
a6e4b72cf4
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user