Merge remote-tracking branch 'origin/master'

This commit is contained in:
yairm210 2021-09-15 00:59:40 +03:00
commit b7eb21b606
27 changed files with 73 additions and 38 deletions

View File

@ -256,8 +256,9 @@
{ {
"name": "Mount Fuji", "name": "Mount Fuji",
"type": "NaturalWonder", "type": "NaturalWonder",
"gold": 1, "gold": 2,
"culture": 5, "culture": 3,
"faith": 3,
"occursOn": ["Grassland","Plains"], "occursOn": ["Grassland","Plains"],
"turnsInto": "Mountain", "turnsInto": "Mountain",
"impassable": true, "impassable": true,

View File

@ -146,13 +146,13 @@
{ {
"name": "Medic", "name": "Medic",
"prerequisites": ["Shock I", "Drill I", "Scouting II", "Survivalism II"], "prerequisites": ["Shock I", "Drill I", "Scouting II", "Survivalism II"],
"uniques": ["[+5] HP when healing", "All adjacent units heal [5] HP when healing"], "uniques": ["All adjacent units heal [+5] HP when healing"],
"unitTypes": ["Sword","Gunpowder","Mounted","Scout"] "unitTypes": ["Sword","Gunpowder","Mounted","Scout"]
}, },
{ {
"name": "Medic II", "name": "Medic II",
"prerequisites": ["Medic"], "prerequisites": ["Medic"],
"uniques": ["[+5] HP when healing", "[+5] HP when healing in [Foreign Land] tiles", "All adjacent units heal [5] HP when healing"], "uniques": ["[+5] HP when healing in [Foreign Land] tiles", "All adjacent units heal [+5] HP when healing"],
"unitTypes": ["Sword","Gunpowder","Mounted","Scout"] "unitTypes": ["Sword","Gunpowder","Mounted","Scout"]
}, },

View File

@ -1537,7 +1537,7 @@
"uniqueTo": "Mongolia", "uniqueTo": "Mongolia",
"replaces": "Great General", "replaces": "Great General",
"uniques": ["Can start an [8]-turn golden age","Bonus for units in 2 tile radius 15%", "uniques": ["Can start an [8]-turn golden age","Bonus for units in 2 tile radius 15%",
"Heal adjacent units for an additional 15 HP per turn", "Can construct [Citadel]", "Great Person - [War]", "Unbuildable", "Uncapturable"], "All adjacent units heal [+15] HP when healing", "[+15] HP when healing", "Can construct [Citadel]", "Great Person - [War]", "Unbuildable", "Uncapturable"],
"movement": 5 "movement": 5
}, },

View File

@ -953,6 +953,8 @@ Tutorials =
Cost = Cost =
May contain [listOfResources] = May contain [listOfResources] =
May contain: = May contain: =
Can upgrade from [unit] =
Can upgrade from: =
Upgrades to [upgradedUnit] = Upgrades to [upgradedUnit] =
Obsolete with [obsoleteTech] = Obsolete with [obsoleteTech] =
Occurs on [listOfTerrains] = Occurs on [listOfTerrains] =

View File

@ -12,6 +12,7 @@ import com.unciv.logic.map.TileMap
import com.unciv.models.Religion import com.unciv.models.Religion
import com.unciv.models.metadata.GameParameters import com.unciv.models.metadata.GameParameters
import com.unciv.models.ruleset.Difficulty import com.unciv.models.ruleset.Difficulty
import com.unciv.models.ruleset.ModOptionsConstants
import com.unciv.models.ruleset.Ruleset import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.RulesetCache import com.unciv.models.ruleset.RulesetCache
import java.util.* import java.util.*
@ -131,10 +132,14 @@ class GameInfo {
it.setTransients() it.setTransients()
} }
fun hasReligionEnabled() = fun isReligionEnabled(): Boolean {
// Temporary function to check whether religion should be used for this game if (ruleSet.eras[gameParameters.startingEra]!!.hasUnique("Starting in this era disables religion")
(gameParameters.religionEnabled || ruleSet.hasReligion()) || ruleSet.modOptions.uniques.contains(ModOptionsConstants.disableReligion)
&& (ruleSet.eras.isEmpty() || !ruleSet.eras[gameParameters.startingEra]!!.hasUnique("Starting in this era disables religion")) ) {
return false
}
return gameParameters.religionEnabled
}
//endregion //endregion
//region State changing functions //region State changing functions

View File

@ -538,7 +538,7 @@ class CityInfo {
} else population.nextTurn(foodForNextTurn()) } else population.nextTurn(foodForNextTurn())
// This should go after the population change, as that might impact the amount of followers in this city // This should go after the population change, as that might impact the amount of followers in this city
if (civInfo.gameInfo.hasReligionEnabled()) religion.endTurn() if (civInfo.gameInfo.isReligionEnabled()) religion.endTurn()
if (this in civInfo.cities) { // city was not destroyed if (this in civInfo.cities) { // city was not destroyed
health = min(health + 20, getMaxHealth()) health = min(health + 20, getMaxHealth())

View File

@ -272,7 +272,7 @@ class CityInfoConquestFunctions(val city: CityInfo){
} }
} }
if (civInfo.gameInfo.hasReligionEnabled()) religion.removeUnknownPantheons() if (civInfo.gameInfo.isReligionEnabled()) religion.removeUnknownPantheons()
tryUpdateRoadStatus() tryUpdateRoadStatus()
cityStats.update() cityStats.update()

View File

@ -82,6 +82,7 @@ class CityInfoReligionManager {
} }
fun addPressure(religionName: String, amount: Int, shouldUpdateFollowers: Boolean = true) { fun addPressure(religionName: String, amount: Int, shouldUpdateFollowers: Boolean = true) {
if (!cityInfo.civInfo.gameInfo.isReligionEnabled()) return // No religion, no pressures
pressures.add(religionName, amount) pressures.add(religionName, amount)
if (shouldUpdateFollowers) { if (shouldUpdateFollowers) {
@ -112,11 +113,13 @@ class CityInfoReligionManager {
} }
private fun triggerReligionAdoption(newMajorityReligion: String) { private fun triggerReligionAdoption(newMajorityReligion: String) {
cityInfo.civInfo.addNotification("Your city [${cityInfo.name}] was converted to [$newMajorityReligion]!", cityInfo.location, NotificationIcon.Faith) val newMajorityReligionObject = cityInfo.civInfo.gameInfo.religions[newMajorityReligion]!!
cityInfo.civInfo.addNotification("Your city [${cityInfo.name}] was converted to [${newMajorityReligionObject.getReligionDisplayName()}]!", cityInfo.location, NotificationIcon.Faith)
if (newMajorityReligion in religionsAtSomePointAdopted) return if (newMajorityReligion in religionsAtSomePointAdopted) return
val religionOwningCiv = cityInfo.civInfo.gameInfo.getCivilization(cityInfo.civInfo.gameInfo.religions[newMajorityReligion]!!.foundingCivName) val religionOwningCiv = cityInfo.civInfo.gameInfo.getCivilization(newMajorityReligionObject.foundingCivName)
for (unique in cityInfo.civInfo.gameInfo.religions[newMajorityReligion]!!.getFounderUniques()) { for (unique in newMajorityReligionObject.getFounderUniques()) {
val statsGranted = when (unique.placeholderText) { val statsGranted = when (unique.placeholderText) {
"[] when a city adopts this religion for the first time (modified by game speed)" -> "[] when a city adopts this religion for the first time (modified by game speed)" ->
unique.stats.times(cityInfo.civInfo.gameInfo.gameParameters.gameSpeed.modifier) unique.stats.times(cityInfo.civInfo.gameInfo.gameParameters.gameSpeed.modifier)
@ -230,6 +233,7 @@ class CityInfoReligionManager {
} }
private fun getAffectedBySurroundingCities() { private fun getAffectedBySurroundingCities() {
if (!cityInfo.civInfo.gameInfo.isReligionEnabled()) return // No religion, no spreading
// We don't update the amount of followers yet, as only the end result should matter // We don't update the amount of followers yet, as only the end result should matter
// If multiple religions would become the majority religion due to pressure, // If multiple religions would become the majority religion due to pressure,
// this will make it so we only receive a notification for the last one. // this will make it so we only receive a notification for the last one.

View File

@ -88,7 +88,8 @@ class PopulationManager {
autoAssignPopulation() autoAssignPopulation()
} }
cityInfo.religion.updatePressureOnPopulationChange(changedAmount) if (cityInfo.civInfo.gameInfo.isReligionEnabled())
cityInfo.religion.updatePressureOnPopulationChange(changedAmount)
} }
internal fun setPopulation(count: Int) { internal fun setPopulation(count: Int) {

View File

@ -69,7 +69,7 @@ class CityStateFunctions(val civInfo: CivilizationInfo) {
fun giveGreatPersonToPatron(receivingCiv: CivilizationInfo) { fun giveGreatPersonToPatron(receivingCiv: CivilizationInfo) {
var giftableUnits = civInfo.gameInfo.ruleSet.units.values.filter { it.isGreatPerson() } var giftableUnits = civInfo.gameInfo.ruleSet.units.values.filter { it.isGreatPerson() }
if (!civInfo.gameInfo.hasReligionEnabled()) giftableUnits = giftableUnits.filterNot { it.uniques.contains("Great Person - [Faith]")} if (!civInfo.gameInfo.isReligionEnabled()) giftableUnits = giftableUnits.filterNot { it.uniques.contains("Hidden when religion is disabled")}
if (giftableUnits.isEmpty()) // For badly defined mods that don't have great people but do have the policy that makes city states grant them if (giftableUnits.isEmpty()) // For badly defined mods that don't have great people but do have the policy that makes city states grant them
return return
val giftedUnit = giftableUnits.random() val giftedUnit = giftableUnits.random()

View File

@ -564,7 +564,7 @@ class CivilizationInfo {
fun getGreatPeople(): HashSet<BaseUnit> { fun getGreatPeople(): HashSet<BaseUnit> {
val greatPeople = gameInfo.ruleSet.units.values.asSequence() val greatPeople = gameInfo.ruleSet.units.values.asSequence()
.filter { it.isGreatPerson() }.map { getEquivalentUnit(it.name) } .filter { it.isGreatPerson() }.map { getEquivalentUnit(it.name) }
return if (!gameInfo.hasReligionEnabled()) greatPeople.filter { !it.uniques.contains("Great Person - [Faith]")}.toHashSet() return if (!gameInfo.isReligionEnabled()) greatPeople.filter { !it.uniques.contains("Hidden when religion is disabled")}.toHashSet()
else greatPeople.toHashSet() else greatPeople.toHashSet()
} }
@ -883,7 +883,7 @@ class CivilizationInfo {
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")) { if (placedUnit.hasUnique("Religious Unit") && gameInfo.isReligionEnabled()) {
placedUnit.religion = placedUnit.religion =
when { when {
placedUnit.hasUnique("Takes your religion over the one in their birth city") -> placedUnit.hasUnique("Takes your religion over the one in their birth city") ->

View File

@ -1,11 +1,9 @@
package com.unciv.logic.civilization package com.unciv.logic.civilization
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
import com.unciv.logic.map.MapUnit import com.unciv.logic.map.MapUnit
import com.unciv.models.Religion import com.unciv.models.Religion
import com.unciv.models.ruleset.Belief import com.unciv.models.ruleset.Belief
import com.unciv.models.ruleset.BeliefType import com.unciv.models.ruleset.BeliefType
import com.unciv.models.ruleset.Era
import com.unciv.ui.pickerscreens.BeliefContainer import com.unciv.ui.pickerscreens.BeliefContainer
import com.unciv.ui.utils.toPercent import com.unciv.ui.utils.toPercent
import kotlin.random.Random import kotlin.random.Random
@ -87,7 +85,7 @@ class ReligionManager {
10 + (civInfo.gameInfo.civilizations.count { it.isMajorCiv() && it.religionManager.religion != null } + additionalCivs) * 5 10 + (civInfo.gameInfo.civilizations.count { it.isMajorCiv() && it.religionManager.religion != null } + additionalCivs) * 5
fun canFoundPantheon(): Boolean { fun canFoundPantheon(): Boolean {
if (!civInfo.gameInfo.hasReligionEnabled()) return false if (!civInfo.gameInfo.isReligionEnabled()) return false
if (religionState != ReligionState.None) return false if (religionState != ReligionState.None) return false
if (!civInfo.isMajorCiv()) return false if (!civInfo.isMajorCiv()) return false
if (civInfo.gameInfo.ruleSet.beliefs.values.none { isPickablePantheonBelief(it) }) if (civInfo.gameInfo.ruleSet.beliefs.values.none { isPickablePantheonBelief(it) })
@ -130,6 +128,7 @@ class ReligionManager {
} }
private fun canGenerateProphet(): Boolean { private fun canGenerateProphet(): 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 (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 (getGreatProphetEquivalent() == null) return false
if (storedFaith < faithForNextGreatProphet()) return false if (storedFaith < faithForNextGreatProphet()) return false
@ -159,6 +158,8 @@ class ReligionManager {
} }
fun mayFoundReligionAtAll(prophet: MapUnit): Boolean { fun mayFoundReligionAtAll(prophet: MapUnit): Boolean {
if (!civInfo.gameInfo.isReligionEnabled()) return false // No religion
if (religionState >= ReligionState.Religion) return false // Already created a major religion if (religionState >= ReligionState.Religion) return false // Already created a major religion
// Already used its power for other things // Already used its power for other things
@ -256,6 +257,7 @@ class ReligionManager {
} }
fun mayEnhanceReligionAtAll(prophet: MapUnit): Boolean { fun mayEnhanceReligionAtAll(prophet: MapUnit): Boolean {
if (!civInfo.gameInfo.isReligionEnabled()) return false // No religion, no enhancing
if (religion == null) return false // First found a pantheon if (religion == null) return false // First found a pantheon
if (religionState != ReligionState.Religion) return false // First found an actual religion if (religionState != ReligionState.Religion) return false // First found an actual religion
// Already used its power for other things // Already used its power for other things

View File

@ -41,7 +41,7 @@ class RuinsManager {
for (possibleReward in possibleRewards) { for (possibleReward in possibleRewards) {
if (civInfo.gameInfo.difficulty in possibleReward.excludedDifficulties) continue if (civInfo.gameInfo.difficulty in possibleReward.excludedDifficulties) continue
if (Constants.hiddenWithoutReligionUnique in possibleReward.uniques && !civInfo.gameInfo.hasReligionEnabled()) continue if (Constants.hiddenWithoutReligionUnique in possibleReward.uniques && !civInfo.gameInfo.isReligionEnabled()) continue
if ("Hidden after generating a Great Prophet" in possibleReward.uniques if ("Hidden after generating a Great Prophet" in possibleReward.uniques
&& civInfo.civConstructions.boughtItemsWithIncreasingPrice[civInfo.religionManager.getGreatProphetEquivalent()] ?: 0 > 0 && civInfo.civConstructions.boughtItemsWithIncreasingPrice[civInfo.religionManager.getGreatProphetEquivalent()] ?: 0 > 0
) continue ) continue

View File

@ -571,7 +571,7 @@ class MapUnit {
amountToHealBy += getMatchingUniques("[] HP when healing").sumOf { it.params[0].toInt() } amountToHealBy += getMatchingUniques("[] HP when healing").sumOf { it.params[0].toInt() }
val maxAdjacentHealingBonus = currentTile.getTilesInDistance(1) val maxAdjacentHealingBonus = currentTile.neighbors
.flatMap { it.getUnits().asSequence() }.map { it.adjacentHealingBonus() }.maxOrNull() .flatMap { it.getUnits().asSequence() }.map { it.adjacentHealingBonus() }.maxOrNull()
if (maxAdjacentHealingBonus != null) if (maxAdjacentHealingBonus != null)
amountToHealBy += maxAdjacentHealingBonus amountToHealBy += maxAdjacentHealingBonus

View File

@ -35,7 +35,7 @@ class Belief : INamed, ICivilopediaText, IHasUniques {
private fun getBeliefsMatching(name: String, ruleset: Ruleset): Sequence<Belief> { private fun getBeliefsMatching(name: String, ruleset: Ruleset): Sequence<Belief> {
if (!UncivGame.isCurrentInitialized()) return sequenceOf() if (!UncivGame.isCurrentInitialized()) return sequenceOf()
if (!UncivGame.Current.isGameInfoInitialized()) return sequenceOf() if (!UncivGame.Current.isGameInfoInitialized()) return sequenceOf()
if (!UncivGame.Current.gameInfo.hasReligionEnabled()) return sequenceOf() if (!UncivGame.Current.gameInfo.isReligionEnabled()) return sequenceOf()
return ruleset.beliefs.asSequence().map { it.value } return ruleset.beliefs.asSequence().map { it.value }
.filter { belief -> belief.uniqueObjects.any { unique -> unique.params.any { it == name } } .filter { belief -> belief.uniqueObjects.any { unique -> unique.params.any { it == name } }
} }

View File

@ -464,7 +464,7 @@ class Building : NamedStats(), INonPerpetualConstruction, ICivilopediaText {
rejectionReasons.add(RejectionReason.Obsoleted.apply { errorMessage = unique.text }) rejectionReasons.add(RejectionReason.Obsoleted.apply { errorMessage = unique.text })
Constants.hiddenWithoutReligionUnique -> Constants.hiddenWithoutReligionUnique ->
if (!civInfo.gameInfo.hasReligionEnabled()) if (!civInfo.gameInfo.isReligionEnabled())
rejectionReasons.add(RejectionReason.DisabledBySetting) rejectionReasons.add(RejectionReason.DisabledBySetting)
} }
} }

View File

@ -27,6 +27,7 @@ object ModOptionsConstants {
const val convertGoldToScience = "Can convert gold to science with sliders" const val convertGoldToScience = "Can convert gold to science with sliders"
const val allowCityStatesSpawnUnits = "Allow City States to spawn with additional units" const val allowCityStatesSpawnUnits = "Allow City States to spawn with additional units"
const val tradeCivIntroductions = "Can trade civilization introductions for [] Gold" const val tradeCivIntroductions = "Can trade civilization introductions for [] Gold"
const val disableReligion = "Disable religion"
} }
class ModOptions : IHasUniques { class ModOptions : IHasUniques {

View File

@ -111,7 +111,7 @@ class Technology: INamed, ICivilopediaText, IHasUniques {
// Helper: common filtering for both getEnabledBuildings and getObsoletedBuildings, difference via predicate parameter // Helper: common filtering for both getEnabledBuildings and getObsoletedBuildings, difference via predicate parameter
private fun getFilteredBuildings(civInfo: CivilizationInfo, predicate: (Building)->Boolean): Sequence<Building> { private fun getFilteredBuildings(civInfo: CivilizationInfo, predicate: (Building)->Boolean): Sequence<Building> {
val nuclearWeaponsEnabled = civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled val nuclearWeaponsEnabled = civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled
val religionEnabled = civInfo.gameInfo.hasReligionEnabled() val religionEnabled = civInfo.gameInfo.isReligionEnabled()
return civInfo.gameInfo.ruleSet.buildings.values.asSequence() return civInfo.gameInfo.ruleSet.buildings.values.asSequence()
.filter { .filter {
@ -130,7 +130,7 @@ class Technology: INamed, ICivilopediaText, IHasUniques {
// Used for Civilopedia, Alert and Picker, so if any of these decide to ignore the "Will not be displayed in Civilopedia" unique this needs refactoring // Used for Civilopedia, Alert and Picker, so if any of these decide to ignore the "Will not be displayed in Civilopedia" unique this needs refactoring
fun getEnabledUnits(civInfo: CivilizationInfo): Sequence<BaseUnit> { fun getEnabledUnits(civInfo: CivilizationInfo): Sequence<BaseUnit> {
val nuclearWeaponsEnabled = civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled val nuclearWeaponsEnabled = civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled
val religionEnabled = civInfo.gameInfo.hasReligionEnabled() val religionEnabled = civInfo.gameInfo.isReligionEnabled()
return civInfo.gameInfo.ruleSet.units.values.asSequence() return civInfo.gameInfo.ruleSet.units.values.asSequence()
.filter { .filter {

View File

@ -163,7 +163,7 @@ class TileImprovement : NamedStats(), ICivilopediaText, IHasUniques {
if (isAncientRuinsEquivalent() && ruleset.ruinRewards.isNotEmpty()) { if (isAncientRuinsEquivalent() && ruleset.ruinRewards.isNotEmpty()) {
val difficulty = UncivGame.Current.gameInfo.gameParameters.difficulty val difficulty = UncivGame.Current.gameInfo.gameParameters.difficulty
val religionEnabled = UncivGame.Current.gameInfo.hasReligionEnabled() val religionEnabled = UncivGame.Current.gameInfo.isReligionEnabled()
textList += FormattedLine() textList += FormattedLine()
textList += FormattedLine("The possible rewards are:") textList += FormattedLine("The possible rewards are:")
ruleset.ruinRewards.values.asSequence() ruleset.ruinRewards.values.asSequence()

View File

@ -154,6 +154,24 @@ class BaseUnit : INamed, INonPerpetualConstruction, ICivilopediaText {
if (requiredTech != null || upgradesTo != null || obsoleteTech != null) textList += FormattedLine() if (requiredTech != null || upgradesTo != null || obsoleteTech != null) textList += FormattedLine()
if (requiredTech != null) textList += FormattedLine("Required tech: [$requiredTech]", link="Technology/$requiredTech") if (requiredTech != null) textList += FormattedLine("Required tech: [$requiredTech]", link="Technology/$requiredTech")
val canUpgradeFrom = ruleset.units
.filterValues {
(it.upgradesTo == name || it.upgradesTo != null && it.upgradesTo == replaces)
&& (it.uniqueTo == uniqueTo || it.uniqueTo == null)
}.keys
if (canUpgradeFrom.isNotEmpty()) {
if (canUpgradeFrom.size == 1)
textList += FormattedLine("Can upgrade from [${canUpgradeFrom.first()}]", link = "Unit/${canUpgradeFrom.first()}")
else {
textList += FormattedLine()
textList += FormattedLine("Can upgrade from:")
for (unitName in canUpgradeFrom.sorted())
textList += FormattedLine(unitName, indent = 2, link = "Unit/$unitName")
textList += FormattedLine()
}
}
if (upgradesTo != null) textList += FormattedLine("Upgrades to [$upgradesTo]", link="Unit/$upgradesTo") if (upgradesTo != null) textList += FormattedLine("Upgrades to [$upgradesTo]", link="Unit/$upgradesTo")
if (obsoleteTech != null) textList += FormattedLine("Obsolete with [$obsoleteTech]", link="Technology/$obsoleteTech") if (obsoleteTech != null) textList += FormattedLine("Obsolete with [$obsoleteTech]", link="Technology/$obsoleteTech")
@ -394,7 +412,7 @@ class BaseUnit : INamed, INonPerpetualConstruction, ICivilopediaText {
unit.currentMovement = 0f unit.currentMovement = 0f
// If this unit has special abilities that need to be kept track of, start doing so here // If this unit has special abilities that need to be kept track of, start doing so here
if (unit.hasUnique("Religious Unit")) { if (unit.hasUnique("Religious Unit") && civInfo.gameInfo.isReligionEnabled()) {
unit.religion = unit.religion =
if (unit.hasUnique("Takes your religion over the one in their birth city")) if (unit.hasUnique("Takes your religion over the one in their birth city"))
civInfo.religionManager.religion?.name civInfo.religionManager.religion?.name

View File

@ -29,7 +29,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
val miniStatsTable = Table() val miniStatsTable = Table()
for ((stat, amount) in cityInfo.cityStats.currentCityStats) { for ((stat, amount) in cityInfo.cityStats.currentCityStats) {
if (stat == Stat.Faith && !cityInfo.civInfo.gameInfo.hasReligionEnabled()) continue if (stat == Stat.Faith && !cityInfo.civInfo.gameInfo.isReligionEnabled()) continue
miniStatsTable.add(ImageGetter.getStatIcon(stat.name)).size(20f).padRight(5f) miniStatsTable.add(ImageGetter.getStatIcon(stat.name)).size(20f).padRight(5f)
val valueToDisplay = if (stat == Stat.Happiness) cityInfo.cityStats.happinessList.values.sum() else amount val valueToDisplay = if (stat == Stat.Happiness) cityInfo.cityStats.happinessList.values.sum() else amount
miniStatsTable.add(round(valueToDisplay).toInt().toLabel()).padRight(10f) miniStatsTable.add(round(valueToDisplay).toInt().toLabel()).padRight(10f)
@ -43,7 +43,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
innerTable.add(SpecialistAllocationTable(cityScreen).apply { update() }).row() innerTable.add(SpecialistAllocationTable(cityScreen).apply { update() }).row()
} }
if (cityInfo.religion.getNumberOfFollowers().isNotEmpty()) if (cityInfo.religion.getNumberOfFollowers().isNotEmpty() && cityInfo.civInfo.gameInfo.isReligionEnabled())
addReligionInfo() addReligionInfo()
pack() pack()

View File

@ -158,7 +158,7 @@ class CivilopediaScreen(
val imageSize = 50f val imageSize = 50f
onBackButtonClicked { UncivGame.Current.setWorldScreen() } onBackButtonClicked { UncivGame.Current.setWorldScreen() }
val hideReligionItems = !game.gameInfo.hasReligionEnabled() val hideReligionItems = !game.gameInfo.isReligionEnabled()
fun shouldBeDisplayed(uniqueObjects: List<Unique>): Boolean { fun shouldBeDisplayed(uniqueObjects: List<Unique>): Boolean {
val uniques = uniqueObjects.map { it.placeholderText } val uniques = uniqueObjects.map { it.placeholderText }

View File

@ -24,7 +24,7 @@ class CityOverviewTable(private val viewingPlayer: CivilizationInfo, private val
} }
private val columnsNames = arrayListOf("Population", "Food", "Gold", "Science", "Production", "Culture", "Happiness") private val columnsNames = arrayListOf("Population", "Food", "Gold", "Science", "Production", "Culture", "Happiness")
.apply { if (viewingPlayer.gameInfo.hasReligionEnabled()) add("Faith") } .apply { if (viewingPlayer.gameInfo.isReligionEnabled()) add("Faith") }
init { init {
val numHeaderCells = columnsNames.size + 2 // +1 City +1 Filler val numHeaderCells = columnsNames.size + 2 // +1 City +1 Filler

View File

@ -86,7 +86,7 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
addCategory("Units", UnitOverviewTable(viewingPlayer, this), viewingPlayer.getCivUnits().none()) addCategory("Units", UnitOverviewTable(viewingPlayer, this), viewingPlayer.getCivUnits().none())
addCategory("Diplomacy", DiplomacyOverviewTable(viewingPlayer, this), viewingPlayer.diplomacy.isEmpty()) addCategory("Diplomacy", DiplomacyOverviewTable(viewingPlayer, this), viewingPlayer.diplomacy.isEmpty())
addCategory("Resources", ResourcesOverviewTable(viewingPlayer, this), viewingPlayer.detailedCivResources.isEmpty()) addCategory("Resources", ResourcesOverviewTable(viewingPlayer, this), viewingPlayer.detailedCivResources.isEmpty())
if (viewingPlayer.gameInfo.hasReligionEnabled()) if (viewingPlayer.gameInfo.isReligionEnabled())
addCategory("Religion", ReligionOverviewTable(viewingPlayer, this), viewingPlayer.gameInfo.religions.isEmpty()) addCategory("Religion", ReligionOverviewTable(viewingPlayer, this), viewingPlayer.gameInfo.religions.isEmpty())
val closeButton = Constants.close.toTextButton().apply { val closeButton = Constants.close.toTextButton().apply {

View File

@ -131,7 +131,7 @@ class ReligiousBeliefsPickerScreen (
private fun setupVisibleReligionIcons() { private fun setupVisibleReligionIcons() {
topReligionIcons.clear() topReligionIcons.clear()
val descriptionLabel = choosingCiv.religionManager.religion!!.name.toLabel() val descriptionLabel = choosingCiv.religionManager.religion!!.getReligionDisplayName().toLabel()
val iconsTable = Table() val iconsTable = Table()

View File

@ -125,7 +125,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
cultureLabel.onClick(invokePoliciesPage) cultureLabel.onClick(invokePoliciesPage)
cultureImage.onClick(invokePoliciesPage) cultureImage.onClick(invokePoliciesPage)
if(worldScreen.gameInfo.hasReligionEnabled()) { if(worldScreen.gameInfo.isReligionEnabled()) {
statsTable.add(faithLabel).padLeft(20f) statsTable.add(faithLabel).padLeft(20f)
val faithImage = ImageGetter.getStatIcon("Faith") val faithImage = ImageGetter.getStatIcon("Faith")
statsTable.add(faithImage).padBottom(6f).size(20f) statsTable.add(faithImage).padBottom(6f).size(20f)

View File

@ -533,13 +533,13 @@ object UnitActions {
private fun useActionWithLimitedUses(unit: MapUnit, action: String) { private fun useActionWithLimitedUses(unit: MapUnit, action: String) {
unit.abilityUsesLeft[action] = unit.abilityUsesLeft[action]!! - 1 unit.abilityUsesLeft[action] = unit.abilityUsesLeft[action]!! - 1
if (unit.abilityUsesLeft[action]!! <= 0) { if (unit.abilityUsesLeft[action]!! <= 0) {
if (unit.isGreatPerson()) addStatsPerGreatPersonUsage(unit)
addStatsPerGreatPersonUsage(unit)
unit.destroy() unit.destroy()
} }
} }
private fun addSpreadReligionActions(unit: MapUnit, actionList: ArrayList<UnitAction>, city: CityInfo) { private fun addSpreadReligionActions(unit: MapUnit, actionList: ArrayList<UnitAction>, city: CityInfo) {
if (!unit.civInfo.gameInfo.isReligionEnabled()) return
val blockedByInquisitor = val blockedByInquisitor =
city.getCenterTile() city.getCenterTile()
.getTilesInDistance(1) .getTilesInDistance(1)
@ -565,6 +565,7 @@ object UnitActions {
} }
private fun addRemoveHeresyActions(unit: MapUnit, actionList: ArrayList<UnitAction>, city: CityInfo) { private fun addRemoveHeresyActions(unit: MapUnit, actionList: ArrayList<UnitAction>, city: CityInfo) {
if (!unit.civInfo.gameInfo.isReligionEnabled()) return
if (city.civInfo != unit.civInfo) return if (city.civInfo != unit.civInfo) return
// Only allow the action if the city actually has any foreign religion // Only allow the action if the city actually has any foreign religion
// This will almost be always due to pressure from cities close-by // This will almost be always due to pressure from cities close-by