mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-02 12:24:15 +07:00
Solved edge case where automated prophet couldn't head towards the city
This commit is contained in:
parent
55bed3bf30
commit
c708ebd7f0
@ -378,14 +378,18 @@ object SpecificUnitAutomation {
|
||||
}
|
||||
|
||||
fun foundReligion(unit: MapUnit) {
|
||||
val cityToFoundReligionAt = unit.civInfo.cities.first { !it.isHolyCity() }
|
||||
val cityToFoundReligionAt = unit.civInfo.cities.firstOrNull {
|
||||
!it.isHolyCity()
|
||||
&& unit.movement.canMoveTo(it.getCenterTile())
|
||||
&& unit.movement.canReach(it.getCenterTile())
|
||||
}
|
||||
if (cityToFoundReligionAt == null) return
|
||||
if (unit.getTile() != cityToFoundReligionAt.getCenterTile()) {
|
||||
unit.movement.headTowards(cityToFoundReligionAt.getCenterTile())
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
UnitActions.getFoundReligionAction(unit)()
|
||||
|
||||
}
|
||||
|
||||
fun enhanceReligion(unit: MapUnit) {
|
||||
|
Loading…
Reference in New Issue
Block a user