Skip to content

Commit 9768e0c

Browse files
Update TileImprovementFunctions.kt
1 parent 046db59 commit 9768e0c

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

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

+13-12
Original file line numberDiff line numberDiff line change
@@ -311,31 +311,32 @@ class TileImprovementFunctions(val tile: Tile) {
311311
val closestCity = civ.cities.minByOrNull { it.getCenterTile().aerialDistanceTo(tile) }
312312
?: return
313313
val distance = closestCity.getCenterTile().aerialDistanceTo(tile)
314-
var productionPoints = 0f
314+
var stats = Stats()
315315
for (unique in tile.getTerrainMatchingUniques(UniqueType.ProductionBonusWhenRemoved)) {
316-
productionPoints = unique.params[0].toFloatOrNull() ?: return
316+
//productionPoints = unique.params[0].toFloatOrNull() ?: return
317+
stats.add(unique.stats)
317318
}
318319
val ruleset = civ.gameInfo.ruleset
319320
val choppingYieldsIncreaseWithGameProgress = ruleset.modOptions.constants.choppingYieldsIncreaseWithGameProgress
320321
// Civ6 yields increase with game progression: https://www.reddit.com/r/civ/comments/gvx44v/comment/fsrifc2/
321322
if (choppingYieldsIncreaseWithGameProgress) {
322323
val gameProgress = max(civ.tech.researchedTechnologies.size.toFloat() / ruleset.technologies.size, civ.policies.adoptedPolicies.size.toFloat() / ruleset.policies.size)
323-
productionPoints *= (1 + 9 * gameProgress)
324+
stats *= (1 + 9 * gameProgress)
325+
}
326+
if (distance != 1) stats *= (6-distance)/4
327+
if (tile.owningCity == null || tile.owningCity!!.civ != civ) stats *= 2/3
328+
stats *= civ.gameInfo.speed.productionCostModifier
329+
for ((stat, value) in stats) {
330+
if (closestCity != null) {
331+
closestCity.addStat(stat, value.toInt())
332+
}
324333
}
325-
var productionPointsToAdd = if (distance == 1) productionPoints else productionPoints - (distance - 2) * productionPoints/4
326-
if (tile.owningCity == null || tile.owningCity!!.civ != civ) productionPointsToAdd =
327-
productionPointsToAdd * 2 / 3
328-
productionPointsToAdd *= civ.gameInfo.speed.productionCostModifier
329-
productionPointsToAdd = floor(productionPointsToAdd)
330-
if (productionPointsToAdd > 0) {
331-
closestCity.cityConstructions.addProductionPoints(productionPointsToAdd.toInt())
332334
val locations = LocationAction(tile.position, closestCity.location)
333335
civ.addNotification(
334-
"Clearing a [$removedTerrainFeature] has created [${productionPointsToAdd.toInt()}] Production for [${closestCity.name}]",
336+
"Clearing a [$removedTerrainFeature] has created [${stats.toStringWithoutIcons()}] for [${closestCity.name}]",
335337
locations, NotificationCategory.Production, NotificationIcon.Construction
336338
)
337339
}
338-
}
339340

340341
/** Marks tile as target tile for a building with a [UniqueType.CreatesOneImprovement] unique */
341342
fun markForCreatesOneImprovement(improvement: String) {

0 commit comments

Comments
 (0)