Fixed some bugs with spreading of religion (#4851)

* Fixed some bugs with spreading of religion

* Implemented requested changes
This commit is contained in:
Xander Lenstra
2021-08-17 12:58:19 +02:00
committed by GitHub
parent 74a1da8e17
commit 607e40a712
2 changed files with 17 additions and 2 deletions

View File

@ -263,7 +263,14 @@ class CivilizationInfo {
} + } +
policies.policyUniques.getUniques(uniqueTemplate) + policies.policyUniques.getUniques(uniqueTemplate) +
tech.techUniques.getUniques(uniqueTemplate) + tech.techUniques.getUniques(uniqueTemplate) +
temporaryUniques.filter { it.first.placeholderText == uniqueTemplate }.map { it.first } temporaryUniques
.asSequence()
.filter { it.first.placeholderText == uniqueTemplate }.map { it.first } +
if (religionManager.religion != null)
religionManager.religion!!.getFounderUniques()
.asSequence()
.filter { it.placeholderText == uniqueTemplate }
else sequenceOf()
} }
//region Units //region Units
@ -778,6 +785,15 @@ class CivilizationInfo {
if (unit.isGreatPerson()) { if (unit.isGreatPerson()) {
addNotification("A [${unit.name}] has been born in [${cityToAddTo.name}]!", placedUnit.getTile().position, unit.name) addNotification("A [${unit.name}] has been born in [${cityToAddTo.name}]!", placedUnit.getTile().position, unit.name)
} }
if (placedUnit.hasUnique("Religious Unit")) {
placedUnit.religion =
if (city != null) city.cityConstructions.cityInfo.religion.getMajorityReligion()
else religionManager.religion?.name
if (placedUnit.hasUnique("Can spread religion [] times"))
placedUnit.abilityUsedCount["Religion Spread"] = 0
}
return placedUnit return placedUnit
} }

View File

@ -117,7 +117,6 @@ class ReligionManager {
else civInfo.cities.firstOrNull { it.religion.religionThisIsTheHolyCityOf == religion!!.name } else civInfo.cities.firstOrNull { it.religion.religionThisIsTheHolyCityOf == religion!!.name }
val prophet = civInfo.addUnit("Great Prophet", birthCity) ?: return val prophet = civInfo.addUnit("Great Prophet", birthCity) ?: return
prophet.religion = religion!!.name prophet.religion = religion!!.name
prophet.abilityUsedCount["Religion Spread"] = 0
storedFaith -= faithForNextGreatProphet() storedFaith -= faithForNextGreatProphet()
greatProphetsEarned += 1 greatProphetsEarned += 1
} }