From b131372b13b41d1e738c367ccf54d0e87b2c79f2 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 27 Jul 2019 22:34:57 +0300 Subject: [PATCH] Fixed "units from ruins block activating unit" bug and fixed colors for new city states --- android/assets/jsons/Nations.json | 8 ++++---- android/build.gradle | 4 ++-- .../com/unciv/logic/automation/UnitAutomation.kt | 3 ++- .../com/unciv/logic/map/UnitMovementAlgorithms.kt | 13 ++++++++++--- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/android/assets/jsons/Nations.json b/android/assets/jsons/Nations.json index a39a24331b..52328c28a6 100644 --- a/android/assets/jsons/Nations.json +++ b/android/assets/jsons/Nations.json @@ -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"] }, diff --git a/android/build.gradle b/android/build.gradle index c992c215ab..194dfe0d08 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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 diff --git a/core/src/com/unciv/logic/automation/UnitAutomation.kt b/core/src/com/unciv/logic/automation/UnitAutomation.kt index 25c0a4bf5e..adf38e7c5e 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -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 diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 2666c193c7..1c43cf6026 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -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)