From cb4feb29ed9ec731fb1df6b5c333a5aa5e7ea8e1 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Sun, 19 Sep 2021 16:56:38 +0200 Subject: [PATCH] Fixed a few bugs relating to earning great prophets (#5267) * Fixed bug where great prophets gifted by city-states wouldn't have a religion * Fixed bug where earning/buying great prophets whithout having founded a religion would result in great prophets of your pantheon, regardless of the religious state of the city --- core/src/com/unciv/logic/civilization/CityStateFunctions.kt | 4 ++-- core/src/com/unciv/logic/civilization/CivilizationInfo.kt | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/CityStateFunctions.kt b/core/src/com/unciv/logic/civilization/CityStateFunctions.kt index 6d68fb0a8c..b998b5d022 100644 --- a/core/src/com/unciv/logic/civilization/CityStateFunctions.kt +++ b/core/src/com/unciv/logic/civilization/CityStateFunctions.kt @@ -77,8 +77,8 @@ class CityStateFunctions(val civInfo: CivilizationInfo) { return val giftedUnit = giftableUnits.random() val cities = NextTurnAutomation.getClosestCities(receivingCiv, civInfo) - val placedUnit = receivingCiv.placeUnitNearTile(cities.city1.location, giftedUnit.name) - if (placedUnit == null) return + val placedUnit = receivingCiv.addUnit(giftedUnit.name, cities.city1) + ?: return val locations = LocationAction(listOf(placedUnit.getTile().position, cities.city2.location)) receivingCiv.addNotification( "[${civInfo.civName}] gave us a [${giftedUnit.name}] as a gift!", locations, civInfo.civName, giftedUnit.name) } diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index e46babc1c0..ce47c3fbe1 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -921,8 +921,9 @@ class CivilizationInfo { if (placedUnit.hasUnique("Religious Unit") && gameInfo.isReligionEnabled()) { placedUnit.religion = when { - placedUnit.hasUnique("Takes your religion over the one in their birth city") -> - religionManager.religion?.name + placedUnit.hasUnique("Takes your religion over the one in their birth city") + && religionManager.religion?.isMajorReligion() == true -> + religionManager.religion!!.name city != null -> city.cityConstructions.cityInfo.religion.getMajorityReligionName() else -> religionManager.religion?.name }