Skip to content

Commit 8b5cff1

Browse files
Update TileImprovementFunctions.kt
1 parent 7e1bfea commit 8b5cff1

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

core/src/com/unciv/logic/map/tile/TileImprovementFunctions.kt

+14-8
Original file line numberDiff line numberDiff line change
@@ -314,24 +314,30 @@ class TileImprovementFunctions(val tile: Tile) {
314314
var stats = Stats()
315315
for (unique in tile.getTerrainMatchingUniques(UniqueType.ProductionBonusWhenRemoved)) {
316316
stats.add(unique.stats)
317+
if (stats.isEmpty()) return
317318
}
318319
val ruleset = civ.gameInfo.ruleset
319-
val choppingYieldsIncreaseWithGameProgress = ruleset.modOptions.constants.choppingYieldsIncreaseWithGameProgress
320+
val choppingYieldsIncreaseWithGameProgress =
321+
ruleset.modOptions.constants.choppingYieldsIncreaseWithGameProgress
320322
// Civ6 yields increase with game progression: https://www.reddit.com/r/civ/comments/gvx44v/comment/fsrifc2/
321323
if (choppingYieldsIncreaseWithGameProgress) {
322-
val gameProgress = max(civ.tech.researchedTechnologies.size.toFloat() / ruleset.technologies.size, civ.policies.adoptedPolicies.size.toFloat() / ruleset.policies.size)
324+
val gameProgress = max(
325+
civ.tech.researchedTechnologies.size.toFloat() / ruleset.technologies.size,
326+
civ.policies.adoptedPolicies.size.toFloat() / ruleset.policies.size
327+
)
323328
stats *= (1 + 9 * gameProgress)
324329
}
325-
if (distance != 1) stats *= (6-distance)/4
326-
if (tile.owningCity == null || tile.owningCity!!.civ != civ) stats *= 2/3
330+
if (distance > 5) stats *= 0
331+
else if (distance != 1) stats *= (6 - distance) / 4
332+
if (tile.owningCity == null || tile.owningCity!!.civ != civ) stats *= 2 / 3f
327333
stats *= civ.gameInfo.speed.productionCostModifier
334+
if (closestCity != null) {
328335
for ((stat, value) in stats) {
329-
if (closestCity != null) {
330-
closestCity.addStat(stat, value.toInt())
331-
}
336+
closestCity.addStat(stat, value.toInt())
337+
}
332338
val locations = LocationAction(tile.position, closestCity.location)
333339
civ.addNotification(
334-
"Clearing a [$removedTerrainFeature] has created [${stats.toStringWithoutIcons()}] for [${closestCity.name}]",
340+
"Clearing a [$removedTerrainFeature] has created [${stats.toStringForNotifications()}] for [${closestCity.name}]",
335341
locations, NotificationCategory.Production, NotificationIcon.Construction
336342
)
337343
}

0 commit comments

Comments
 (0)