mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Fixed a bug where AI would not found religions (#5544)
This commit is contained in:
parent
074676c342
commit
e9d36ea0ce
@ -378,11 +378,13 @@ object SpecificUnitAutomation {
|
||||
}
|
||||
|
||||
fun foundReligion(unit: MapUnit) {
|
||||
val cityToFoundReligionAt = unit.civInfo.cities.firstOrNull {
|
||||
!it.isHolyCity()
|
||||
&& unit.movement.canMoveTo(it.getCenterTile())
|
||||
&& unit.movement.canReach(it.getCenterTile())
|
||||
}
|
||||
val cityToFoundReligionAt =
|
||||
if (unit.getTile().isCityCenter() && !unit.getTile().owningCity!!.isHolyCity()) unit.getTile().owningCity
|
||||
else 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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user