From 68b40cf86030e6f5cd846448be327fb7d4d54dd3 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Tue, 13 Jul 2021 16:40:54 +0200 Subject: [PATCH] Fixed bug where great prophets could be given when religion was disabled (#4502) --- core/src/com/unciv/logic/civilization/CivilizationInfo.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index cfca8d7b17..eafd79bf3b 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -778,7 +778,9 @@ class CivilizationInfo { /** Gain a random great person from a random city state */ private fun gainGreatPersonFromCityState() { 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 placedUnit = placeUnitNearTile(cities.city1.location, giftedUnit.name) if (placedUnit == null) return