mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Resolved #13838 - Only heal on current tile if it's not a dangerous tile
This commit is contained in:
parent
539ae5248d
commit
7b8a05ccdf
@ -366,7 +366,7 @@ object UnitAutomation {
|
|||||||
return false // will heal anyway, and attacks don't hurt
|
return false // will heal anyway, and attacks don't hurt
|
||||||
|
|
||||||
// Try pillage improvements until healed
|
// Try pillage improvements until healed
|
||||||
while(tryPillageImprovement(unit, false)) {
|
while (tryPillageImprovement(unit, false)) {
|
||||||
// If we are fully healed and can still do things, lets keep on going by returning false
|
// If we are fully healed and can still do things, lets keep on going by returning false
|
||||||
if (!unit.hasMovement() || unit.health == 100) return !unit.hasMovement()
|
if (!unit.hasMovement() || unit.health == 100) return !unit.hasMovement()
|
||||||
}
|
}
|
||||||
@ -374,12 +374,14 @@ object UnitAutomation {
|
|||||||
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
|
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
|
||||||
if (unitDistanceToTiles.isEmpty()) return true // can't move, so...
|
if (unitDistanceToTiles.isEmpty()) return true // can't move, so...
|
||||||
|
|
||||||
|
val dangerousTiles = unit.civ.threatManager.getDangerousTiles(unit, 3)
|
||||||
|
|
||||||
// If the unit can heal on this tile in two turns, just heal here
|
// If the unit can heal on this tile in two turns, just heal here
|
||||||
if (canUnitHealInTurnsOnCurrentTile(unit,3)) return true
|
if (unit.currentTile !in dangerousTiles
|
||||||
|
&& canUnitHealInTurnsOnCurrentTile(unit,3)) return true
|
||||||
|
|
||||||
val currentUnitTile = unit.getTile()
|
val currentUnitTile = unit.getTile()
|
||||||
|
|
||||||
val dangerousTiles = unit.civ.threatManager.getDangerousTiles(unit, 3)
|
|
||||||
|
|
||||||
val viableTilesForHealing = unitDistanceToTiles.keys
|
val viableTilesForHealing = unitDistanceToTiles.keys
|
||||||
.filter { it !in dangerousTiles && unit.movement.canMoveTo(it) }
|
.filter { it !in dangerousTiles && unit.movement.canMoveTo(it) }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user