Skip to content

Commit

Permalink
CS vulnerable to ally unhappiness (#5134)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCeder authored Sep 8, 2021
1 parent ab50831 commit 7297139
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/com/unciv/logic/battle/BattleDamage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7297139

Please sign in to comment.