CS vulnerable to ally unhappiness (#5134)

This commit is contained in:
SimonCeder 2021-09-08 20:02:34 +02:00 committed by GitHub
parent ab5083173d
commit 7297139594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import com.unciv.ui.utils.toPercent
import java.util.*
import kotlin.collections.set
import kotlin.math.max
import kotlin.math.min
import kotlin.math.pow
import kotlin.math.roundToInt
@ -38,7 +39,10 @@ object BattleDamage {
modifiers.add("Combat Strength", unique.params[0].toInt())
//https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
val civHappiness = civInfo.getHappiness()
val civHappiness = if (civInfo.isCityState() && civInfo.getAllyCiv() != null)
// If we are a city state with an ally we are vulnerable to their unhappiness.
min(civInfo.gameInfo.getCivilization(civInfo.getAllyCiv()!!).getHappiness(), civInfo.getHappiness())
else civInfo.getHappiness()
if (civHappiness < 0)
modifiers["Unhappiness"] = max(
2 * civHappiness,