Fix "religions to be founded" expanders accumulating (#9214)

* Fix my own dumb blunder re "Religions to be founded" expander

* Faith required for next Prophet should be visible
This commit is contained in:
SomeTroglodyte 2023-04-19 07:19:22 +02:00 committed by GitHub
parent 4da4d35a28
commit 2b1f2513fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -155,11 +155,11 @@ class ReligionManager : IsPartOfGameInfoSerialization {
return faithCost.toInt()
}
fun canGenerateProphet(): Boolean {
fun canGenerateProphet(ignoreFaithAmount: Boolean = false): Boolean {
if (!civInfo.gameInfo.isReligionEnabled()) return false // No religion, no prophets
if (religion == null || religionState == ReligionState.None) return false // First get a pantheon, then we'll talk about a real religion
if (getGreatProphetEquivalent() == null) return false
if (storedFaith < faithForNextGreatProphet()) return false
if (!ignoreFaithAmount && storedFaith < faithForNextGreatProphet()) return false
if (!civInfo.isMajorCiv()) return false
if (civInfo.hasUnique(UniqueType.MayNotGenerateGreatProphet)) return false
if (religionState == ReligionState.Pantheon && remainingFoundableReligions() == 0) return false // too many have been founded

View File

@ -41,20 +41,23 @@ class ReligionOverviewTab(
private val religionButtonLabel = "Click an icon to see the stats of this religion".toLabel()
private val statsTable = Table()
private val beliefsTable = Table()
private val headerTable = Table()
override fun getFixedContent() = Table().apply {
override fun getFixedContent() = headerTable
init {
civStatsTable.defaults().left().pad(5f)
civStatsTable.addCivSpecificStats()
headerTable.apply {
defaults().pad(5f)
align(Align.top)
civStatsTable.defaults().left().pad(5f)
civStatsTable.addCivSpecificStats()
add(civStatsTable).row()
add(religionButtons).row()
add(religionButtonLabel)
addSeparator()
}
init {
defaults().pad(5f)
align(Align.top)
loadReligionButtons()
@ -86,7 +89,7 @@ class ReligionOverviewTab(
}
add(religionCountExpander).colspan(2).growX().row()
if (manager.canGenerateProphet()) {
if (manager.canGenerateProphet(ignoreFaithAmount = true)) {
add("Minimal Faith required for\nthe next [great prophet equivalent]:"
.fillPlaceholders(manager.getGreatProphetEquivalent()!!)
.toLabel()