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
This commit is contained in:
Xander Lenstra 2021-09-19 16:56:38 +02:00 committed by GitHub
parent 027057874d
commit cb4feb29ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -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)
}

View File

@ -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
}