AI: declare less war against humans on higher difficulties (#13830)

* Update MotivationToAttackAutomation.kt

* Update MotivationToAttackAutomation.kt

* Update MotivationToAttackAutomation.kt
This commit is contained in:
EmperorPinguin 2025-08-20 12:09:57 +02:00 committed by GitHub
parent db55209032
commit 0c29341f5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,7 @@ import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.models.ruleset.unit.BaseUnit
import com.unciv.ui.screens.victoryscreen.RankingType
import yairm210.purity.annotations.Readonly
import kotlin.math.pow
object MotivationToAttackAutomation {
@ -276,10 +277,8 @@ object MotivationToAttackAutomation {
// At higher difficulty levels the AI gets a unit production boost.
// In that case while we may have more units than them, we don't nessesarily want to be more aggressive.
// This is to reduce the amount that the AI targets players at these higher levels somewhat.
if (civInfo.isAI() && targetCiv.isHuman() && combatStrengthRatio > 1) {
val ourCombatModifiers = civInfo.gameInfo.getDifficulty().aiUnitCostModifier
val theirCombatModifiers = civInfo.gameInfo.getDifficulty().unitCostModifier
combatStrengthRatio *= ourCombatModifiers / theirCombatModifiers
if (civInfo.isAI() && targetCiv.isHuman()) {
combatStrengthRatio *= civInfo.gameInfo.getDifficulty().aiUnitCostModifier.pow(1.5f)
}
val combatStrengthModifier = when {
combatStrengthRatio > 5f -> 20f