mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 15:29:32 +07:00
Gold per turn is worth less the more turns 'in the future' we're talking about
This commit is contained in:
@ -13,6 +13,7 @@ import com.unciv.models.ruleset.unique.UniqueType
|
|||||||
import com.unciv.ui.components.extensions.toPercent
|
import com.unciv.ui.components.extensions.toPercent
|
||||||
import com.unciv.ui.screens.victoryscreen.RankingType
|
import com.unciv.ui.screens.victoryscreen.RankingType
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
import kotlin.math.pow
|
||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
|
|
||||||
class TradeEvaluation {
|
class TradeEvaluation {
|
||||||
@ -80,7 +81,8 @@ class TradeEvaluation {
|
|||||||
fun evaluateBuyCost(offer: TradeOffer, civInfo: Civilization, tradePartner: Civilization): Int {
|
fun evaluateBuyCost(offer: TradeOffer, civInfo: Civilization, tradePartner: Civilization): Int {
|
||||||
when (offer.type) {
|
when (offer.type) {
|
||||||
TradeType.Gold -> return offer.amount
|
TradeType.Gold -> return offer.amount
|
||||||
TradeType.Gold_Per_Turn -> return offer.amount * offer.duration
|
// GPT loses 1% of value for each 'future' turn, meaning: gold now is more valuable than gold in the future
|
||||||
|
TradeType.Gold_Per_Turn -> return (1..offer.duration).sumOf { (offer.amount * 0.99f.pow(offer.duration)).toInt() }
|
||||||
TradeType.Treaty -> {
|
TradeType.Treaty -> {
|
||||||
return when (offer.name) {
|
return when (offer.name) {
|
||||||
// Since it will be evaluated twice, once when they evaluate our offer and once when they evaluate theirs
|
// Since it will be evaluated twice, once when they evaluate our offer and once when they evaluate theirs
|
||||||
|
Reference in New Issue
Block a user