mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 23:40:01 +07:00
Fixed errors caused by siege unit's movement points not being calculated correctly
This commit is contained in:
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 195
|
versionCode 197
|
||||||
versionName "2.12.4"
|
versionName "2.12.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
@ -146,7 +146,6 @@ class UnitAutomation{
|
|||||||
val tilesWithEnemies = unit.civInfo.viewableTiles
|
val tilesWithEnemies = unit.civInfo.viewableTiles
|
||||||
.filter { containsAttackableEnemy(it, MapUnitCombatant(unit)) }
|
.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 rangeOfAttack = unit.getRange()
|
||||||
|
|
||||||
val attackableTiles = ArrayList<AttackableTile>()
|
val attackableTiles = ArrayList<AttackableTile>()
|
||||||
@ -155,8 +154,14 @@ class UnitAutomation{
|
|||||||
// and then later we round it off to a whole.
|
// 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!
|
// 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
|
// Silly floats, basically
|
||||||
|
|
||||||
|
val unitMustBeSetUp = unit.hasUnique("Must set up to ranged attack")
|
||||||
val tilesToAttackFrom = unitDistanceToTiles.asSequence()
|
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 }
|
.map { it.key }
|
||||||
.filter { unit.canMoveTo(it) || it==unit.getTile() }
|
.filter { unit.canMoveTo(it) || it==unit.getTile() }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user