mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 22:22:51 +07:00
Cultural expansion pauses when no more tiles available (#2414)
* Cultural expansion pauses when no more tiles available * Cultural expansion stops when city owns whole 5-tile radius
This commit is contained in:
parent
096eb7935a
commit
9fb6ad29e5
@ -21,12 +21,13 @@ class CityExpansionManager {
|
||||
}
|
||||
|
||||
fun tilesClaimed() = cityInfo.tiles.size - 7
|
||||
fun isAreaMaxed(): Boolean = (cityInfo.tiles.size >= 90)
|
||||
|
||||
// This one has conflicting sources -
|
||||
// http://civilization.wikia.com/wiki/Mathematics_of_Civilization_V says it's 20+(10(t-1))^1.1
|
||||
// https://www.reddit.com/r/civ/comments/58rxkk/how_in_gods_name_do_borders_expand_in_civ_vi/ has it
|
||||
// (per game XML files) at 6*(t+0.4813)^1.3
|
||||
// The second seems to be more based, so I'll go with that
|
||||
|
||||
fun getCultureToNextTile(): Int {
|
||||
var cultureToNextTile = 6 * (tilesClaimed() + 1.4813).pow(1.3)
|
||||
if (cityInfo.civInfo.containsBuildingUnique("Cost of acquiring new tiles reduced by 25%"))
|
||||
@ -88,13 +89,18 @@ class CityExpansionManager {
|
||||
takeOwnership(tile)
|
||||
}
|
||||
|
||||
private fun addNewTileWithCulture() {
|
||||
cultureStored -= getCultureToNextTile()
|
||||
|
||||
val chosenTile = chooseNewTileToOwn()
|
||||
if(chosenTile!=null){
|
||||
takeOwnership(chosenTile)
|
||||
private fun addNewTileWithCulture(): Boolean {
|
||||
if ( isAreaMaxed() ) {
|
||||
cultureStored = 0
|
||||
return false
|
||||
}
|
||||
val chosenTile = chooseNewTileToOwn()
|
||||
if (chosenTile!=null) {
|
||||
cultureStored -= getCultureToNextTile()
|
||||
takeOwnership(chosenTile)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun relinquishOwnership(tileInfo: TileInfo){
|
||||
@ -128,7 +134,7 @@ class CityExpansionManager {
|
||||
fun nextTurn(culture: Float) {
|
||||
cultureStored += culture.toInt()
|
||||
if (cultureStored >= getCultureToNextTile()) {
|
||||
addNewTileWithCulture()
|
||||
if (addNewTileWithCulture())
|
||||
cityInfo.civInfo.addNotification("["+cityInfo.name + "] has expanded its borders!", cityInfo.location, Color.PURPLE)
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
||||
" " + cityInfo.population.getFreePopulation().toString() + "/" + cityInfo.population.population
|
||||
|
||||
var turnsToExpansionString =
|
||||
if (cityInfo.cityStats.currentCityStats.culture > 0) {
|
||||
if (cityInfo.cityStats.currentCityStats.culture > 0 && cityInfo.expansion.chooseNewTileToOwn() != null) {
|
||||
val remainingCulture = cityInfo.expansion.getCultureToNextTile() - cityInfo.expansion.cultureStored
|
||||
var turnsToExpansion = ceil(remainingCulture / cityInfo.cityStats.currentCityStats.culture).toInt()
|
||||
if (turnsToExpansion < 1) turnsToExpansion = 1
|
||||
@ -60,6 +60,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
||||
} else {
|
||||
"Stopped expansion".tr()
|
||||
}
|
||||
if (!cityInfo.expansion.isAreaMaxed())
|
||||
turnsToExpansionString += " (" + cityInfo.expansion.cultureStored + "/" +
|
||||
cityInfo.expansion.getCultureToNextTile() + ")"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user