diff --git a/android/build.gradle b/android/build.gradle index cc136f6d93..2b198d939f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 28 - versionCode 195 - versionName "2.12.4" + versionCode 197 + versionName "2.12.5" } // 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 52dab53de8..a173cfe758 100644 --- a/core/src/com/unciv/logic/automation/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/UnitAutomation.kt @@ -146,7 +146,6 @@ class UnitAutomation{ val tilesWithEnemies = unit.civInfo.viewableTiles .filter { containsAttackableEnemy(it, MapUnitCombatant(unit)) } - val minMovBeforeSetup = if (unit.hasUnique("Must set up to ranged attack") && unit.action != "Set Up" ) minMovementBeforeAttack+1.0f else minMovementBeforeAttack val rangeOfAttack = unit.getRange() val attackableTiles = ArrayList() @@ -155,8 +154,14 @@ class UnitAutomation{ // and then later we round it off to a whole. // So the poor unit thought it could attack from the tile, but when it comes to do so it has no movement points! // Silly floats, basically + + val unitMustBeSetUp = unit.hasUnique("Must set up to ranged attack") val tilesToAttackFrom = unitDistanceToTiles.asSequence() - .filter { unit.currentMovement - it.value >= minMovBeforeSetup } + .filter { + val movementPointsToExpendAfterMovement = if(unitMustBeSetUp) 1 else 0 + val movementPointsToExpendHere = if(unitMustBeSetUp && unit.action != "Set Up") 1 else 0 + val movementPointsToExpendBeforeAttack = if(it.key==unit.currentTile) movementPointsToExpendHere else movementPointsToExpendAfterMovement + unit.currentMovement - it.value - movementPointsToExpendBeforeAttack > 0 } // still got leftover movement points after all that, to attack .map { it.key } .filter { unit.canMoveTo(it) || it==unit.getTile() }