Added Shrine, option for enabling religion (#4291)

* Added option in-game to enable faith (highly discouraged)

* Added shrine for generating Faith

* Made Shrine hidden in games without religion
This commit is contained in:
Xander Lenstra 2021-06-28 13:25:34 +02:00 committed by GitHub
parent 4add686bcd
commit 168f984a65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 70 additions and 34 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -592,206 +592,213 @@ Seaport
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Sistine Chapel Shrine
rotate: false rotate: false
xy: 868, 328 xy: 868, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Solar Plant Sistine Chapel
rotate: false rotate: false
xy: 976, 436 xy: 976, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Spaceship Factory Solar Plant
rotate: false rotate: false
xy: 1084, 544 xy: 1084, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Stable Spaceship Factory
rotate: false rotate: false
xy: 1192, 652 xy: 1192, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Stadium Stable
rotate: false rotate: false
xy: 1300, 760 xy: 1300, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Statue of Liberty Stadium
rotate: false rotate: false
xy: 1408, 868 xy: 1408, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Statue of Zeus Statue of Liberty
rotate: false rotate: false
xy: 652, 4 xy: 652, 4
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Stock Exchange Statue of Zeus
rotate: false rotate: false
xy: 760, 112 xy: 760, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Stone Works Stock Exchange
rotate: false rotate: false
xy: 868, 220 xy: 868, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Stonehenge Stone Works
rotate: false rotate: false
xy: 976, 328 xy: 976, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Sydney Opera House Stonehenge
rotate: false rotate: false
xy: 1084, 436 xy: 1084, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Taj Mahal Sydney Opera House
rotate: false rotate: false
xy: 1192, 544 xy: 1192, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Temple Taj Mahal
rotate: false rotate: false
xy: 1300, 652 xy: 1300, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Temple of Artemis Temple
rotate: false rotate: false
xy: 1408, 760 xy: 1408, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Terracotta Army Temple of Artemis
rotate: false rotate: false
xy: 1516, 868 xy: 1516, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
The Great Library Terracotta Army
rotate: false rotate: false
xy: 760, 4 xy: 760, 4
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
The Great Lighthouse The Great Library
rotate: false rotate: false
xy: 868, 112 xy: 868, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
The Louvre The Great Lighthouse
rotate: false rotate: false
xy: 976, 220 xy: 976, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
The Oracle The Louvre
rotate: false rotate: false
xy: 1084, 328 xy: 1084, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
The Pyramids The Oracle
rotate: false rotate: false
xy: 1192, 436 xy: 1192, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Theatre The Pyramids
rotate: false rotate: false
xy: 1300, 544 xy: 1300, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
University Theatre
rotate: false rotate: false
xy: 1408, 652 xy: 1408, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Utopia Project University
rotate: false rotate: false
xy: 1516, 760 xy: 1516, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Walls Utopia Project
rotate: false rotate: false
xy: 1624, 868 xy: 1624, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Walls of Babylon Walls
rotate: false rotate: false
xy: 868, 4 xy: 868, 4
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Wat Walls of Babylon
rotate: false rotate: false
xy: 976, 112 xy: 976, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Water Mill Wat
rotate: false rotate: false
xy: 1084, 220 xy: 1084, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Windmill Water Mill
rotate: false rotate: false
xy: 1192, 328 xy: 1192, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Workshop Windmill
rotate: false rotate: false
xy: 1300, 436 xy: 1300, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Workshop
rotate: false
xy: 1408, 544
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View File

@ -31,6 +31,14 @@
"[+1 Food] from [Wheat] tiles in this city"], "[+1 Food] from [Wheat] tiles in this city"],
"requiredTech": "Pottery" "requiredTech": "Pottery"
}, },
{
"name": "Shrine",
"faith": 1,
"cost": 40,
"maintenance": 1,
"requiredTech": "Pottery",
"uniques": ["Hidden when religion is disabled"]
},
{ {
"name": "Temple of Artemis", "name": "Temple of Artemis",
"culture": 1, "culture": 1,

View File

@ -411,6 +411,8 @@ class GameInfo {
cityConstructions.inProgressConstructions.remove(oldBuildingName) cityConstructions.inProgressConstructions.remove(oldBuildingName)
} }
} }
fun hasRelgionEnabled() = gameParameters.religionEnabled || ruleSet.hasReligion() // Temporary function to check whether religion should be used for this game
} }
// reduced variant only for load preview // reduced variant only for load preview

View File

@ -372,7 +372,7 @@ class CityInfo {
} }
} else population.nextTurn(foodForNextTurn()) } else population.nextTurn(foodForNextTurn())
if (getRuleset().hasReligion()) religion.getAffectedBySurroundingCities() if (civInfo.gameInfo.hasRelgionEnabled()) religion.getAffectedBySurroundingCities()
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

@ -21,6 +21,7 @@ class GameParameters { // Default values are the default new game
var oneCityChallenge = false var oneCityChallenge = false
var godMode = false var godMode = false
var nuclearWeaponsEnabled = true var nuclearWeaponsEnabled = true
var religionEnabled = false
var victoryTypes: ArrayList<VictoryType> = arrayListOf(VictoryType.Cultural, VictoryType.Domination, VictoryType.Scientific) // By default, all victory types var victoryTypes: ArrayList<VictoryType> = arrayListOf(VictoryType.Cultural, VictoryType.Domination, VictoryType.Scientific) // By default, all victory types
var startingEra = Constants.ancientEra var startingEra = Constants.ancientEra

View File

@ -41,6 +41,7 @@ class GameSettings {
var visualMods = HashSet<String>() var visualMods = HashSet<String>()
var showExperimentalWorldWrap = false // We're keeping this as a config due to ANR problems on Android phones for people who don't know what they're doing :/ var showExperimentalWorldWrap = false // We're keeping this as a config due to ANR problems on Android phones for people who don't know what they're doing :/
var showExperimentalRelgion = false
var lastOverviewPage: String = "Cities" var lastOverviewPage: String = "Cities"

View File

@ -283,6 +283,7 @@ class Building : NamedStats(), IConstruction {
"Can only be built in annexed cities" -> if (construction.cityInfo.isPuppet || construction.cityInfo.foundingCiv == "" "Can only be built in annexed cities" -> if (construction.cityInfo.isPuppet || construction.cityInfo.foundingCiv == ""
|| construction.cityInfo.civInfo.civName == construction.cityInfo.foundingCiv) return unique.text || construction.cityInfo.civInfo.civName == construction.cityInfo.foundingCiv) return unique.text
"Obsolete with []" -> if (civInfo.tech.isResearched(unique.params[0])) return unique.text "Obsolete with []" -> if (civInfo.tech.isResearched(unique.params[0])) return unique.text
"Hidden when religion is disabled" -> if (!civInfo.gameInfo.hasRelgionEnabled()) return unique.text
} }
if (uniqueTo != null && uniqueTo != civInfo.civName) return "Unique to $uniqueTo" if (uniqueTo != null && uniqueTo != civInfo.civName) return "Unique to $uniqueTo"

View File

@ -211,7 +211,7 @@ class Ruleset {
} }
fun getEras(): List<String> = technologies.values.map { it.column!!.era }.distinct() fun getEras(): List<String> = technologies.values.map { it.column!!.era }.distinct()
fun hasReligion() = beliefs.any() fun hasReligion() = beliefs.any()
fun getEraNumber(era: String) = getEras().indexOf(era) fun getEraNumber(era: String) = getEras().indexOf(era)
fun getSummary(): String { fun getSummary(): String {

View File

@ -47,6 +47,7 @@ class Technology {
val regularBuildings = enabledBuildings.filter { val regularBuildings = enabledBuildings.filter {
!it.isWonder && !it.isNationalWonder !it.isWonder && !it.isNationalWonder
&& "Will not be displayed in Civilopedia" !in it.uniques && "Will not be displayed in Civilopedia" !in it.uniques
&& !(!viewingCiv.gameInfo.hasRelgionEnabled() && it.uniques.contains("Hidden when religion is disabled"))
} }
if (regularBuildings.isNotEmpty()) { if (regularBuildings.isNotEmpty()) {
lineList += "{Buildings enabled}: " lineList += "{Buildings enabled}: "
@ -90,6 +91,9 @@ class Technology {
if (!civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled) if (!civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled)
enabledBuildings = enabledBuildings.filterNot { it.name == "Manhattan Project" } enabledBuildings = enabledBuildings.filterNot { it.name == "Manhattan Project" }
if (!civInfo.gameInfo.hasRelgionEnabled())
enabledBuildings = enabledBuildings.filterNot { it.uniques.contains("Hidden when religion is disabled") }
return enabledBuildings return enabledBuildings
} }

View File

@ -31,7 +31,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
val ministatsTable = Table() val ministatsTable = Table()
for ((stat, amount) in cityInfo.cityStats.currentCityStats.toHashMap()) { for ((stat, amount) in cityInfo.cityStats.currentCityStats.toHashMap()) {
if (stat == Stat.Faith && !cityInfo.getRuleset().hasReligion()) continue if (stat == Stat.Faith && !cityInfo.civInfo.gameInfo.hasRelgionEnabled()) 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().toString().toLabel()).padRight(10f) ministatsTable.add(round(valueToDisplay).toInt().toString().toLabel()).padRight(10f)

View File

@ -50,6 +50,8 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick
checkboxTable.addOneCityChallengeCheckbox() checkboxTable.addOneCityChallengeCheckbox()
checkboxTable.addNuclearWeaponsCheckbox() checkboxTable.addNuclearWeaponsCheckbox()
checkboxTable.addIsOnlineMultiplayerCheckbox() checkboxTable.addIsOnlineMultiplayerCheckbox()
if (UncivGame.Current.settings.showExperimentalRelgion)
checkboxTable.addReligionCheckbox()
checkboxTable.addModCheckboxes() checkboxTable.addModCheckboxes()
add(checkboxTable).colspan(2).row() add(checkboxTable).colspan(2).row()
@ -83,6 +85,10 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick
gameParameters.isOnlineMultiplayer = it gameParameters.isOnlineMultiplayer = it
updatePlayerPickerTable("") updatePlayerPickerTable("")
} }
private fun Table.addReligionCheckbox() =
addCheckbox("Enable Religion", gameParameters.religionEnabled)
{ gameParameters.religionEnabled = it }
private fun addCityStatesSelectBox() { private fun addCityStatesSelectBox() {
add("{Number of City-States}:".toLabel()) add("{Number of City-States}:".toLabel())

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.ruleSet.hasReligion()) add("Faith") } .apply { if (viewingPlayer.gameInfo.hasRelgionEnabled()) add("Faith") }
init { init {
val numHeaderCells = columnsNames.size + 2 // +1 City +1 Filler val numHeaderCells = columnsNames.size + 2 // +1 City +1 Filler

View File

@ -124,7 +124,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
cultureLabel.onClick(invokePoliciesPage) cultureLabel.onClick(invokePoliciesPage)
cultureImage.onClick(invokePoliciesPage) cultureImage.onClick(invokePoliciesPage)
if(worldScreen.gameInfo.ruleSet.hasReligion()) { if(worldScreen.gameInfo.hasRelgionEnabled()) {
statsTable.add(faithLabel).padLeft(20f) statsTable.add(faithLabel).padLeft(20f)
statsTable.add(ImageGetter.getStatIcon("Faith")).padBottom(6f).size(20f) statsTable.add(ImageGetter.getStatIcon("Faith")).padBottom(6f).size(20f)
} }

View File

@ -134,10 +134,16 @@ class OptionsPopup(val previousScreen:CameraStageBaseScreen) : Popup(previousScr
addHeader("Other options") addHeader("Other options")
addYesNoRow("{Show experimental world wrap for maps}\n{HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED!}".tr(), addYesNoRow("{Show experimental world wrap for maps}\n{HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED!}".tr(),
settings.showExperimentalWorldWrap) { settings.showExperimentalWorldWrap) {
settings.showExperimentalWorldWrap = it settings.showExperimentalWorldWrap = it
} }
addYesNoRow("{Enable experimental religion in start games}\n{HIHGLY EXPERIMENTAL - UPDATES WILL BREAK SAVES!}".tr(),
settings.showExperimentalRelgion) {
settings.showExperimentalRelgion = it
}
if (previousScreen.game.limitOrientationsHelper != null) { if (previousScreen.game.limitOrientationsHelper != null) {
addYesNoRow("Enable portrait orientation", settings.allowAndroidPortrait) { addYesNoRow("Enable portrait orientation", settings.allowAndroidPortrait) {