mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
CS vulnerable to ally unhappiness (#5134)
This commit is contained in:
parent
ab5083173d
commit
7297139594
@ -6,6 +6,7 @@ import com.unciv.ui.utils.toPercent
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
import kotlin.math.min
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@ -38,7 +39,10 @@ object BattleDamage {
|
|||||||
modifiers.add("Combat Strength", unique.params[0].toInt())
|
modifiers.add("Combat Strength", unique.params[0].toInt())
|
||||||
|
|
||||||
//https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
//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)
|
if (civHappiness < 0)
|
||||||
modifiers["Unhappiness"] = max(
|
modifiers["Unhappiness"] = max(
|
||||||
2 * civHappiness,
|
2 * civHappiness,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user