Fixed bug where great prophets could be given when religion was disabled (#4502)

This commit is contained in:
Xander Lenstra 2021-07-13 16:40:54 +02:00 committed by GitHub
parent f54c76ec42
commit 68b40cf860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -778,7 +778,9 @@ class CivilizationInfo {
/** Gain a random great person from a random city state */ /** Gain a random great person from a random city state */
private fun gainGreatPersonFromCityState() { private fun gainGreatPersonFromCityState() {
val givingCityState = getKnownCivs().filter { it.isCityState() && it.getAllyCiv() == civName}.random() val givingCityState = getKnownCivs().filter { it.isCityState() && it.getAllyCiv() == civName}.random()
val giftedUnit = gameInfo.ruleSet.units.values.filter { it.isGreatPerson() }.random() var giftableUnits = gameInfo.ruleSet.units.values.filter { it.isGreatPerson() }
if (!gameInfo.hasReligionEnabled()) giftableUnits = giftableUnits.filterNot { it.uniques.contains("Great Person - [Faith]")}
val giftedUnit = giftableUnits.random()
val cities = NextTurnAutomation.getClosestCities(this, givingCityState) val cities = NextTurnAutomation.getClosestCities(this, givingCityState)
val placedUnit = placeUnitNearTile(cities.city1.location, giftedUnit.name) val placedUnit = placeUnitNearTile(cities.city1.location, giftedUnit.name)
if (placedUnit == null) return if (placedUnit == null) return