mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Culture-oriented AI much more predisposed to peace agreements
This commit is contained in:
parent
b8e5b34489
commit
00153ab456
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 256
|
versionCode 257
|
||||||
versionName "2.17.5"
|
versionName "2.17.6"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
@ -233,10 +233,9 @@ class NextTurnAutomation{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun offerPeaceTreaty(civInfo: CivilizationInfo) {
|
private fun offerPeaceTreaty(civInfo: CivilizationInfo) {
|
||||||
if (civInfo.cities.isNotEmpty() && civInfo.diplomacy.isNotEmpty()) {
|
if (!civInfo.isAtWar() || civInfo.cities.isEmpty() || civInfo.diplomacy.isEmpty()) return
|
||||||
|
|
||||||
val ourCombatStrength = Automation().evaluteCombatStrength(civInfo)
|
val ourCombatStrength = Automation().evaluteCombatStrength(civInfo)
|
||||||
if (civInfo.isAtWar()) { //evaluate peace
|
|
||||||
val enemiesCiv = civInfo.diplomacy.filter { it.value.diplomaticStatus == DiplomaticStatus.War }
|
val enemiesCiv = civInfo.diplomacy.filter { it.value.diplomaticStatus == DiplomaticStatus.War }
|
||||||
.map { it.value.otherCiv() }
|
.map { it.value.otherCiv() }
|
||||||
.filterNot { it == civInfo || it.isBarbarianCivilization() || it.cities.isEmpty() }
|
.filterNot { it == civInfo || it.isBarbarianCivilization() || it.cities.isEmpty() }
|
||||||
@ -244,7 +243,8 @@ class NextTurnAutomation{
|
|||||||
|
|
||||||
for (enemy in enemiesCiv) {
|
for (enemy in enemiesCiv) {
|
||||||
val enemiesStrength = Automation().evaluteCombatStrength(enemy)
|
val enemiesStrength = Automation().evaluteCombatStrength(enemy)
|
||||||
if (enemiesStrength < ourCombatStrength * 2) {
|
if (civInfo.getNation().preferredVictoryType!=VictoryType.Cultural
|
||||||
|
&& enemiesStrength < ourCombatStrength*2 ) {
|
||||||
continue //We're losing, but can still fight. Refuse peace.
|
continue //We're losing, but can still fight. Refuse peace.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,9 +264,9 @@ class NextTurnAutomation{
|
|||||||
|
|
||||||
if (enemy.isPlayerCivilization())
|
if (enemy.isPlayerCivilization())
|
||||||
enemy.tradeRequests.add(TradeRequest(civInfo.civName, tradeLogic.currentTrade.reverse()))
|
enemy.tradeRequests.add(TradeRequest(civInfo.civName, tradeLogic.currentTrade.reverse()))
|
||||||
|
|
||||||
else {
|
else {
|
||||||
if (enemy.getCivUnits().filter { !it.type.isCivilian() }.size > enemy.cities.size
|
if (enemy.getNation().preferredVictoryType!=VictoryType.Cultural
|
||||||
|
&& enemy.getCivUnits().filter { !it.type.isCivilian() }.size > enemy.cities.size
|
||||||
&& enemy.happiness > 0) {
|
&& enemy.happiness > 0) {
|
||||||
continue //enemy AI has too large army and happiness. It continues to fight for profit.
|
continue //enemy AI has too large army and happiness. It continues to fight for profit.
|
||||||
}
|
}
|
||||||
@ -274,8 +274,6 @@ class NextTurnAutomation{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateDiplomaticRelationship(civInfo: CivilizationInfo) {
|
private fun updateDiplomaticRelationship(civInfo: CivilizationInfo) {
|
||||||
// Check if city-state invaded by other civs
|
// Check if city-state invaded by other civs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user