Fixed "units from ruins block activating unit" bug and fixed colors for new city states

This commit is contained in:
Yair Morgenstern 2019-07-27 22:34:57 +03:00
parent 42e5f3b883
commit b131372b13
4 changed files with 18 additions and 10 deletions

View File

@ -1056,8 +1056,8 @@
attacked:"Very well, this shall not be forgotten.",
afterPeace:"May peace forever bless our lands.",
mainColor:[0, 0, 0],
secondaryColor:[102,0,51],
outerColor:[0, 0, 0],
innerColor:[102,0,51],
cities:["Almaty"]
},
{
@ -1069,8 +1069,8 @@
attacked:"Very well, this shall not be forgotten.",
afterPeace:"May peace forever bless our lands.",
mainColor:[0, 0, 0],
secondaryColor:[0,102,102],
outerColor:[0, 0, 0],
innerColor:[0,102,102],
cities:["Edinburgh"]
},

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 278
versionName "2.18.6-patch1"
versionCode 279
versionName "2.18.6-patch2"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View File

@ -460,7 +460,8 @@ class UnitAutomation{
fun tryGoToRuin(unit:MapUnit, unitDistanceToTiles: PathsToTilesWithinTurn): Boolean {
if(!unit.civInfo.isMajorCiv()) return false // barbs don't have anything to do in ruins
val tileWithRuin = unitDistanceToTiles.keys.firstOrNull{unit.movement.canMoveTo(it) && it.improvement == Constants.ancientRuins}
val tileWithRuin = unitDistanceToTiles.keys
.firstOrNull{ it.improvement == Constants.ancientRuins && unit.movement.canMoveTo(it) }
if(tileWithRuin==null) return false
unit.movement.moveToTile(tileWithRuin)
return true

View File

@ -239,12 +239,18 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
// Move through all intermediate tiles to get ancient ruins, barb encampments
// and to view tiles along the way
val pathToFinalTile = distanceToTiles.getPathToTile(destination)
unit.removeFromTile()
unit.putInTile(destination)
// We only activate the moveThroughTile AFTER the putInTile because of a really weird bug -
// If you're going to (or past) a ruin, and you activate the ruin bonus, and A UNIT spawns.
// That unit could now be blocking your entrance to the destination, so the putInTile would fail! =0
// Instead, we move you to the destination directly, and only afterwards activate the various tileson the way.
for(tile in pathToFinalTile){
unit.moveThroughTile(tile)
}
unit.putInTile(destination)
}
@ -256,7 +262,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
if(unit.type.isAirUnit())
return tile.airUnits.size<6 && tile.isCityCenter() && tile.getCity()?.civInfo==unit.civInfo
if(!canPassThrough(tile)) return false
if(!canPassThrough(tile))
return false
if (unit.type.isCivilian())
return tile.civilianUnit==null && (tile.militaryUnit==null || tile.militaryUnit!!.owner==unit.owner)