mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 20:59:18 +07:00
Fixed hurry cost modifiers, and unit gold costs scaling according to game speed
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user