mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 09:18:43 +07:00
Solved edge case where automated prophet couldn't head towards the city
This commit is contained in:
@ -378,14 +378,18 @@ object SpecificUnitAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun foundReligion(unit: MapUnit) {
|
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()) {
|
if (unit.getTile() != cityToFoundReligionAt.getCenterTile()) {
|
||||||
unit.movement.headTowards(cityToFoundReligionAt.getCenterTile())
|
unit.movement.headTowards(cityToFoundReligionAt.getCenterTile())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitActions.getFoundReligionAction(unit)()
|
UnitActions.getFoundReligionAction(unit)()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun enhanceReligion(unit: MapUnit) {
|
fun enhanceReligion(unit: MapUnit) {
|
||||||
|
Reference in New Issue
Block a user