diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 261ad72253..904b7a2910 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -593,7 +593,7 @@ class MapUnit { destroy() if (currentTile.getOwner() == civInfo) - civInfo.gold += baseUnit.getDisbandGold() + civInfo.gold += baseUnit.getDisbandGold(civInfo) if (civInfo.isDefeated()) civInfo.destroy() } diff --git a/core/src/com/unciv/models/ruleset/Building.kt b/core/src/com/unciv/models/ruleset/Building.kt index a5f6312b79..7def7da5cf 100644 --- a/core/src/com/unciv/models/ruleset/Building.kt +++ b/core/src/com/unciv/models/ruleset/Building.kt @@ -240,7 +240,7 @@ class Building : NamedStats(), IConstruction { override fun getGoldCost(civInfo: CivilizationInfo): Int { // https://forums.civfanatics.com/threads/rush-buying-formula.393892/ - var cost = (30 * getProductionCost(civInfo)).toDouble().pow(0.75) * (1 + hurryCostModifier / 100) + var cost = (30 * getProductionCost(civInfo)).toDouble().pow(0.75) * (1 + hurryCostModifier / 100f) for (unique in civInfo.getMatchingUniques("Cost of purchasing items in cities reduced by []%")) cost *= 1 - (unique.params[0].toFloat() / 100) diff --git a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt index 8540050378..a33e40ca0b 100644 --- a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt @@ -106,17 +106,17 @@ class BaseUnit : INamed, IConstruction { return productionCost.toInt() } - fun getBaseGoldCost() = (30.0 * cost).pow(0.75) * (1 + hurryCostModifier / 100) + fun getBaseGoldCost(civInfo: CivilizationInfo) = (30.0 * cost).pow(0.75) * (1 + hurryCostModifier / 100f) * civInfo.gameInfo.gameParameters.gameSpeed.modifier override fun getGoldCost(civInfo: CivilizationInfo): Int { - var cost = getBaseGoldCost() + var cost = getBaseGoldCost(civInfo) if (civInfo.hasUnique("Gold cost of purchasing units -33%")) cost *= 0.66f for (unique in civInfo.getMatchingUniques("Cost of purchasing items in cities reduced by []%")) cost *= 1 - (unique.params[0].toFloat() / 100) return (cost / 10).toInt() * 10 // rounded down o nearest ten } - fun getDisbandGold() = getBaseGoldCost().toInt() / 20 + fun getDisbandGold(civInfo: CivilizationInfo) = getBaseGoldCost(civInfo).toInt() / 20 override fun shouldBeDisplayed(construction: CityConstructions): Boolean { val rejectionReason = getRejectionReason(construction) diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt index 912199379f..bd4f2edc01 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt @@ -77,7 +77,7 @@ object UnitActions { action = { if (!worldScreen.hasOpenPopups()) { val disbandText = if (unit.currentTile.getOwner() == unit.civInfo) - "Disband this unit for [${unit.baseUnit.getDisbandGold()}] gold?".tr() + "Disband this unit for [${unit.baseUnit.getDisbandGold(unit.civInfo)}] gold?".tr() else "Do you really want to disband this unit?".tr() YesNoPopup(disbandText, { unit.disband(); worldScreen.shouldUpdate = true }).open() }