diff --git a/core/src/com/unciv/logic/GameStarter.kt b/core/src/com/unciv/logic/GameStarter.kt index ab9bb3df7f..4fbcd62260 100644 --- a/core/src/com/unciv/logic/GameStarter.kt +++ b/core/src/com/unciv/logic/GameStarter.kt @@ -9,6 +9,7 @@ import com.unciv.logic.map.TileMap import com.unciv.logic.map.mapgenerator.MapGenerator import com.unciv.models.metadata.GameParameters import com.unciv.models.ruleset.Era +import com.unciv.models.ruleset.ModOptionsConstants import com.unciv.models.ruleset.Ruleset import com.unciv.models.ruleset.RulesetCache import com.unciv.models.ruleset.tile.ResourceType @@ -235,6 +236,7 @@ object GameStarter { // An unusually bad spawning location addConsolationPrize(gameInfo, startingLocation, 45 - startingLocation.getTileStartScore().toInt()) } + if(civ.isCityState()) addCityStateLuxury(gameInfo, startingLocation) @@ -308,13 +310,21 @@ object GameStarter { return civ.getEquivalentUnit(unit).name } - // City states & one city challengers should spawn with one settler only regardless of era and difficulty - if (civ.isCityState() || civ.playerType==PlayerType.Human && gameInfo.gameParameters.oneCityChallenge) { + // City states should only spawn with one settler regardless of difficulty, but this may be disabled in mods + if (civ.isCityState() && !ruleSet.modOptions.uniques.contains(ModOptionsConstants.allowCityStatesSpawnUnits)) { val startingSettlers = startingUnits.filter { settlerLikeUnits.contains(it) } startingUnits.clear() startingUnits.add(startingSettlers.random()) } + + // One city challengers should spawn with one settler only regardless of era and difficulty + if (civ.playerType == PlayerType.Human && gameInfo.gameParameters.oneCityChallenge) { + val startingSettlers = startingUnits.filter { settlerLikeUnits.contains(it) } + + startingUnits.removeAll(startingSettlers) + startingUnits.add(startingSettlers.random()) + } for (unit in startingUnits) { val unitToAdd = getEquivalentUnit(civ, unit) diff --git a/core/src/com/unciv/logic/city/CityStats.kt b/core/src/com/unciv/logic/city/CityStats.kt index 7ff08ef7de..56e767ad26 100644 --- a/core/src/com/unciv/logic/city/CityStats.kt +++ b/core/src/com/unciv/logic/city/CityStats.kt @@ -6,6 +6,7 @@ import com.unciv.logic.civilization.diplomacy.RelationshipLevel import com.unciv.logic.map.RoadStatus import com.unciv.models.Counter import com.unciv.models.ruleset.Building +import com.unciv.models.ruleset.ModOptionsConstants import com.unciv.models.ruleset.Unique import com.unciv.models.ruleset.unit.BaseUnit import com.unciv.models.stats.Stat @@ -457,7 +458,7 @@ class CityStats { } // AFTER we've gotten all the gold stats figured out, only THEN do we plonk that gold into Science - if (cityInfo.getRuleset().modOptions.uniques.contains("Can convert gold to science with sliders")) { + if (cityInfo.getRuleset().modOptions.uniques.contains(ModOptionsConstants.convertGoldToScience)) { val amountConverted = (newFinalStatList.values.sumByDouble { it.gold.toDouble() } * cityInfo.civInfo.tech.goldPercentConvertedToScience).toInt().toFloat() if (amountConverted > 0) // Don't want you converting negative gold to negative science yaknow diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index 96b4aed837..80612a6f1b 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -21,6 +21,8 @@ import kotlin.collections.set object ModOptionsConstants { const val diplomaticRelationshipsCannotChange = "Diplomatic relationships cannot change" + const val convertGoldToScience = "Can convert gold to science with sliders" + const val allowCityStatesSpawnUnits = "Allow City States to spawn with additional units" } class ModOptions { @@ -29,13 +31,15 @@ class ModOptions { var buildingsToRemove = HashSet() var unitsToRemove = HashSet() var nationsToRemove = HashSet() - var uniques = HashSet() - val maxXPfromBarbarians = 30 + var lastUpdated = "" var modUrl = "" var author = "" var modSize = 0 + + val maxXPfromBarbarians = 30 + var uniques = HashSet() } class Ruleset { diff --git a/core/src/com/unciv/ui/overviewscreen/StatsOverviewTable.kt b/core/src/com/unciv/ui/overviewscreen/StatsOverviewTable.kt index 42b6256876..956b4c493e 100644 --- a/core/src/com/unciv/ui/overviewscreen/StatsOverviewTable.kt +++ b/core/src/com/unciv/ui/overviewscreen/StatsOverviewTable.kt @@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Slider import com.badlogic.gdx.scenes.scene2d.ui.Table import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.GreatPersonManager +import com.unciv.models.ruleset.ModOptionsConstants import com.unciv.models.translations.tr import com.unciv.ui.utils.* import kotlin.math.roundToInt @@ -62,7 +63,7 @@ class StatsOverviewTable ( goldTable.add("Total".tr()) goldTable.add(total.roundToInt().toString()).right() - if (viewingPlayer.gameInfo.ruleSet.modOptions.uniques.contains("Can convert gold to science with sliders")) { + if (viewingPlayer.gameInfo.ruleSet.modOptions.uniques.contains(ModOptionsConstants.convertGoldToScience)) { goldTable.addSeparator() val sliderTable = Table() sliderTable.add("Convert gold to science".toLabel()).row()