mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-20 09:17:47 +07:00
Fixed errors caused by siege unit's movement points not being calculated correctly
This commit is contained in:
parent
5ab6c6c991
commit
653cb556cf
@ -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
|
||||
|
@ -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<AttackableTile>()
|
||||
@ -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() }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user