mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 15:29:32 +07:00
Update TradeEvaluation.kt (#10713)
This commit is contained in:
@ -338,7 +338,10 @@ class TradeEvaluation {
|
|||||||
val percentageAdvantage = absoluteAdvantage / theirCombatStrength.toFloat()
|
val percentageAdvantage = absoluteAdvantage / theirCombatStrength.toFloat()
|
||||||
// We don't add the same constraint here. We should not make peace easily if we're
|
// We don't add the same constraint here. We should not make peace easily if we're
|
||||||
// heavily advantaged.
|
// heavily advantaged.
|
||||||
return (absoluteAdvantage * percentageAdvantage).toInt() * 10
|
val totalAdvantage = (absoluteAdvantage * percentageAdvantage).toInt() * 10
|
||||||
|
if(totalAdvantage < 0) //May be a negative number if strength disparity is such that it leads to integer overflow
|
||||||
|
return 10000 //in that rare case, the AI would accept peace against a defeated foe.
|
||||||
|
return totalAdvantage
|
||||||
} else {
|
} else {
|
||||||
// This results in huge values for large power imbalances. However, we should not give
|
// This results in huge values for large power imbalances. However, we should not give
|
||||||
// up everything just because there is a big power imbalance. There's a better chance to
|
// up everything just because there is a big power imbalance. There's a better chance to
|
||||||
|
Reference in New Issue
Block a user