Fixed bug where you could convince AI to declare war on defeated civs - kudos ninjatao!

This commit is contained in:
Yair Morgenstern 2018-12-01 22:40:14 +02:00
parent 8ec63f2e94
commit cd28358289
3 changed files with 5 additions and 5 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 168
versionName "2.10.7"
versionCode 169
versionName "2.10.8"
}
buildTypes {
release {

View File

@ -70,7 +70,7 @@ class WorkerAutomation(val unit: MapUnit) {
if(unit.currentTile in roadableTiles) tileToConstructRoadOn = unit.currentTile
else{
val reachableTiles = roadableTiles.filter { unit.canMoveTo(it)&& unit.movementAlgs().canReach(it)}
if(!reachableTiles.any()) continue
if(reachableTiles.isEmpty()) continue
tileToConstructRoadOn = reachableTiles.minBy { unit.movementAlgs().getShortestPath(it).size }!!
unit.movementAlgs().headTowards(tileToConstructRoadOn)
}

View File

@ -36,9 +36,9 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
offers.add(TradeOffer(city.name, TradeType.City, 0))
val otherCivsWeKnow = civInfo.diplomacy.values.map { it.otherCiv() }
.filter { it != otherCivilization && !it.isBarbarianCivilization() }
.filter { it != otherCivilization && !it.isBarbarianCivilization() && !it.isDefeated() }
val civsWeKnowAndTheyDont = otherCivsWeKnow
.filter { !otherCivilization.diplomacy.containsKey(it.civName) }
.filter { !otherCivilization.diplomacy.containsKey(it.civName) && !it.isDefeated() }
for(thirdCiv in civsWeKnowAndTheyDont){
offers.add(TradeOffer("Introduction to " + thirdCiv.civName, TradeType.Introduction, 0))
}