Exploring units now take several turns to reach a ruin (but only if it is in vision, not behind fog of war) (#7285)

Re-did this because the last pull request was a mess and so was everything else I was doing
This commit is contained in:
Skekdog 2022-06-25 20:20:01 +01:00 committed by GitHub
parent efc095eaa1
commit 3e9a485b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,8 +48,8 @@ object UnitAutomation {
private fun tryGoToRuinAndEncampment(unit: MapUnit): Boolean { private fun tryGoToRuinAndEncampment(unit: MapUnit): Boolean {
if (!unit.civInfo.isMajorCiv()) return false // barbs don't have anything to do in ruins if (!unit.civInfo.isMajorCiv()) return false // barbs don't have anything to do in ruins
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
val tileWithRuinOrEncampment = unitDistanceToTiles.keys val tileWithRuinOrEncampment = unit.viewableTiles
.firstOrNull { .firstOrNull {
( (
(it.improvement != null && it.getTileImprovement()!!.isAncientRuinsEquivalent()) (it.improvement != null && it.getTileImprovement()!!.isAncientRuinsEquivalent())
@ -57,7 +57,7 @@ object UnitAutomation {
) )
&& unit.movement.canMoveTo(it) && unit.movement.canMoveTo(it)
} ?: return false } ?: return false
unit.movement.moveToTile(tileWithRuinOrEncampment) unit.movement.headTowards(tileWithRuinOrEncampment)
return true return true
} }