AI won't declare war if it doesn't know the location of any enemy city

This commit is contained in:
Yair Morgenstern 2020-11-11 21:22:15 +02:00
parent ab8b4405f2
commit e8e9c97c92

View File

@ -360,7 +360,11 @@ object NextTurnAutomation {
//evaluate war
val enemyCivs = civInfo.getKnownCivs()
.filterNot { it == civInfo || it.cities.isEmpty() || !civInfo.getDiplomacyManager(it).canDeclareWar() }
.filterNot { it == civInfo || it.cities.isEmpty() || !civInfo.getDiplomacyManager(it).canDeclareWar()
|| (it.cities.none { civInfo.exploredTiles.contains(it.location) }) }
// If the AI declares war on a civ without knowing the location of any cities, it'll just keep amassing an army and not sending it anywhere,
// and end up at a massive disadvantage
if (enemyCivs.isEmpty()) return
val civWithBestMotivationToAttack = enemyCivs