mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 20:59:18 +07:00
When spreading a religion with a great prophet, other religions are now removed (#5055)
This commit is contained in:
@ -1516,9 +1516,9 @@
|
|||||||
"name": "Great Prophet",
|
"name": "Great Prophet",
|
||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniques": ["Can construct [Holy site] if it hasn't used other actions yet", "Can [Spread Religion] [4] times",
|
"uniques": ["Can construct [Holy site] if it hasn't used other actions yet", "Can [Spread Religion] [4] times",
|
||||||
"May found a religion", "May enhance a religion", "May enter foreign tiles without open borders",
|
"Removes other religions when spreading religion", "May found a religion", "May enhance a religion",
|
||||||
"[-1] Visibility Range", "Great Person - [Faith]", "Unbuildable", "Religious Unit",
|
"May enter foreign tiles without open borders", "[-1] Visibility Range", "Great Person - [Faith]",
|
||||||
"Hidden when religion is disabled"],
|
"Unbuildable", "Religious Unit", "Hidden when religion is disabled"],
|
||||||
"movement": 2,
|
"movement": 2,
|
||||||
"religiousStrength": 1000
|
"religiousStrength": 1000
|
||||||
},
|
},
|
||||||
|
@ -59,8 +59,7 @@ class CityInfoReligionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getUniques(): Sequence<Unique> {
|
fun getUniques(): Sequence<Unique> {
|
||||||
val majorityReligion = getMajorityReligion()
|
val majorityReligion = getMajorityReligion() ?: return sequenceOf()
|
||||||
if (majorityReligion == null) return sequenceOf()
|
|
||||||
return majorityReligion.getFollowerUniques()
|
return majorityReligion.getFollowerUniques()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ class CityInfoReligionManager {
|
|||||||
return pressures.clone()
|
return pressures.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clearAllPressures() {
|
private fun clearAllPressures() {
|
||||||
pressures.clear()
|
pressures.clear()
|
||||||
// We add pressure for following no religion
|
// We add pressure for following no religion
|
||||||
// Basically used as a failsafe so that there is always some religion,
|
// Basically used as a failsafe so that there is always some religion,
|
||||||
@ -92,8 +91,11 @@ class CityInfoReligionManager {
|
|||||||
|
|
||||||
fun removeAllPressuresExceptFor(religion: String) {
|
fun removeAllPressuresExceptFor(religion: String) {
|
||||||
val pressureFromThisReligion = pressures[religion]!!
|
val pressureFromThisReligion = pressures[religion]!!
|
||||||
|
// Atheism is never removed
|
||||||
|
val pressureFromAtheism = pressures[Constants.noReligionName]
|
||||||
clearAllPressures()
|
clearAllPressures()
|
||||||
pressures.add(religion, pressureFromThisReligion)
|
pressures.add(religion, pressureFromThisReligion)
|
||||||
|
if (pressureFromAtheism != null) pressures[Constants.noReligionName] = pressureFromAtheism
|
||||||
updateNumberOfFollowers()
|
updateNumberOfFollowers()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,6 +557,8 @@ object UnitActions {
|
|||||||
unit.civInfo.addStat(Stat.valueOf(unique.params[1]), followersOfOtherReligions * unique.params[0].toInt())
|
unit.civInfo.addStat(Stat.valueOf(unique.params[1]), followersOfOtherReligions * unique.params[0].toInt())
|
||||||
}
|
}
|
||||||
city.religion.addPressure(unit.religion!!, unit.getPressureAddedFromSpread())
|
city.religion.addPressure(unit.religion!!, unit.getPressureAddedFromSpread())
|
||||||
|
if (unit.hasUnique("Removes other religions when spreading religion"))
|
||||||
|
city.religion.removeAllPressuresExceptFor(unit.religion!!)
|
||||||
unit.currentMovement = 0f
|
unit.currentMovement = 0f
|
||||||
useActionWithLimitedUses(unit, Constants.spreadReligionAbilityCount)
|
useActionWithLimitedUses(unit, Constants.spreadReligionAbilityCount)
|
||||||
}.takeIf { unit.currentMovement > 0 && !blockedByInquisitor }
|
}.takeIf { unit.currentMovement > 0 && !blockedByInquisitor }
|
||||||
|
Reference in New Issue
Block a user