Sort City States, replace+deprecate Dublin and Edinburgh (#5386)

This commit is contained in:
SomeTroglodyte 2021-10-03 18:03:54 +02:00 committed by GitHub
parent 462888fd46
commit edfc66aa2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 332 additions and 279 deletions

View File

@ -865,19 +865,18 @@
}, },
// City-States sorted by cityStateType, name
//City-States
{ {
"name": "Milan", "name": "Brussels",
"adjective": ["Milanese"], "adjective": ["Bruxellois"],
"cityStateType": "Cultured", "cityStateType": "Cultured",
"declaringWar": "You leave us no choice. War it must be.", "declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.", "attacked": "Very well, this shall not be forgotten.",
"defeated": "You fiend! History shall remember this!", "defeated": "I guess you weren't here for the sprouts after all...",
"outerColor": [0, 0, 0], "outerColor": [0, 0, 0],
"innerColor": [185,132,66], "innerColor": [153,255,51],
"cities": ["Milan"] "cities": ["Brussels"]
}, },
{ {
"name": "Florence", "name": "Florence",
@ -892,106 +891,16 @@
"cities": ["Florence"] "cities": ["Florence"]
}, },
{ {
"name": "Rio de Janeiro", "name": "Hanoi",
"adjective": ["Carioca"], "adjective": ["Hanoi"],
"cityStateType": "Maritime",
"startBias": ["Coast"],
"declaringWar": "I have to do this, for the sake of progress if nothing else. You must be opposed!",
"attacked": "You can see how fruitless this will be for you... right?",
"defeated": "May God grant me these last wishes - peace and prosperity for Brazil.",
"outerColor": [0, 0, 0],
"innerColor": [211, 220, 103],
"cities": ["Rio de Janeiro"]
},
{
"name": "Antwerp",
"adjective": ["Antwerp"],
"cityStateType": "Mercantile",
"startBias": ["Coast"],
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "They will write songs of this.... pray that they shall be in your favor.",
"outerColor": [0, 0, 0],
"innerColor": [194,97,255],
"cities": ["Antwerp"]
},
{
"name": "Dublin",
"adjective": ["Dubliner"],
"cityStateType": "Militaristic",
"declaringWar": "War lingers in our hearts. Why carry on with a false peace?",
"attacked": "You gormless radger! You'll dine on your own teeth before you set foot in Ireland!",
"defeated": "A lonely wind blows through the highlands today. A dirge for Ireland. Can you hear it?",
"outerColor": [0, 0, 0],
"innerColor": [211,180,113],
"cities": ["Dublin"]
},
{
"name": "Tyre",
"adjective": ["Tyrian"],
"cityStateType": "Mercantile",
"startBias": ["Coast"],
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "We never fully trusted you from the start.",
"outerColor": [0, 0, 0],
"innerColor": [255,97,255],
"cities": ["Tyre"]
},
{
"name": "Ur",
"adjective": ["Ur"],
"cityStateType": "Maritime",
"startBias": ["Coast"],
"declaringWar": "I will enjoy hearing your last breath as you witness the destruction of your realm!",
"attacked": "Why do we fight? Because Inanna demands it. Now, witness the power of the Sumerians!",
"defeated": "What treachery has struck us? No, what evil?",
"outerColor": [0, 0, 0],
"innerColor": [255,69,0],
"cities": ["Ur"]
},
{
"name": "Genoa",
"adjective": ["Genoese"],
"cityStateType": "Mercantile",
"startBias": ["Coast"],
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "How barbaric. Those who live by the sword shall perish by the sword.",
"outerColor": [0, 0, 0],
"innerColor": [45,255,86],
"cities": ["Genoa"]
},
{
"name": "Venice",
"adjective": ["Venetian"],
"cityStateType": "Maritime",
"startBias": ["Coast"],
"declaringWar": "You have revealed your purposes a bit too early, my friend...",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "A wrong calculation, on my part.",
"outerColor": [0, 0, 0],
"innerColor": [153,204,255],
"cities": ["Venice"]
},
{
"name": "Brussels",
"adjective": ["Bruxellois"],
"cityStateType": "Cultured", "cityStateType": "Cultured",
"declaringWar": "You leave us no choice. War it must be.", "declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.", "attacked": "Very well, this shall not be forgotten.",
"defeated": "I guess you weren't here for the sprouts after all...", "defeated": "So this is how it feels to die...",
"outerColor": [0, 0, 0], "outerColor": [0, 0, 0],
"innerColor": [153,255,51], "innerColor": [0,0,255],
"cities": ["Brussels"] "cities": ["Hanoi"]
}, },
{ {
"name": "Kabul", "name": "Kabul",
@ -1005,138 +914,6 @@
"innerColor": [153,0,76], "innerColor": [153,0,76],
"cities": ["Kabul"] "cities": ["Kabul"]
}, },
{
"name": "Sidon",
"adjective": ["Sidon"],
"cityStateType": "Militaristic",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "What a fine battle! Sidon is willing to serve you!",
"outerColor": [0, 0, 0],
"innerColor": [250,128,114],
"cities": ["Sidon"]
},
{
"name": "Almaty",
"adjective": ["Almaty"],
"cityStateType": "Militaristic",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "How could we fall to the likes of you?!",
"outerColor": [0, 0, 0],
"innerColor": [152,0,241],
"cities": ["Almaty"]
},
{
"name": "Edinburgh",
"adjective": ["Edinburghensian"],
"cityStateType": "Militaristic",
"declaringWar": "You shall stain this land no longer with your vileness! To arms, my countrymen - we ride to war!",
"attacked": "Traitorous man! The Celtic peoples will not stand for such wanton abuse and slander - I shall have your head!",
"defeated": "Vile ruler, know that you 'won' this war in name only!",
"outerColor": [0, 0, 0],
"innerColor": [0,102,102],
"cities": ["Edinburgh"]
},
{
"name": "Singapore",
"adjective": ["Singaporean"],
"cityStateType": "Mercantile",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "Perhaps, in another world, we could have been friends...",
"outerColor": [0, 0, 0],
"innerColor": [255,255,0],
"cities": ["Singapore"]
},
{
"name": "Zanzibar",
"adjective": ["Zanzibar"],
"cityStateType": "Mercantile",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "May the Heavens forgive you for inflicting this humiliation to our people.",
"outerColor": [0, 0, 0],
"innerColor": [255,153,255],
"cities": ["Zanzibar"]
},
{
"name": "Sydney",
"adjective": ["Sydney"],
"cityStateType": "Maritime",
"declaringWar": "After thorough deliberation, Australia finds itself at a crossroads. Prepare yourself, for war is upon us.",
"attacked": "We will mobilize every means of resistance to stop this transgression against our nation!",
"defeated": "The principles for which we have fought will survive longer than any nation you could ever build.",
"outerColor": [0, 0, 0],
"innerColor": [255,204,204],
"cities": ["Sydney"]
},
{
"name": "Cape Town",
"adjective": ["Cape Town"],
"cityStateType": "Maritime",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "I have failed. May you, at least, know compassion towards our people.",
"outerColor": [0, 0, 0],
"innerColor": [255,153,153],
"cities": ["Cape Town"]
},
{
"name": "Kathmandu",
"adjective": ["Kathmandu"],
"cityStateType": "Mercantile",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "We... defeated? No... we had so much work to do!",
"outerColor": [0, 0, 0],
"innerColor": [151,125,0],
"cities": ["Kathmandu"]
},
{
"name": "Hanoi",
"adjective": ["Hanoi"],
"cityStateType": "Cultured",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "So this is how it feels to die...",
"outerColor": [0, 0, 0],
"innerColor": [0,0,255],
"cities": ["Hanoi"]
},
{
"name": "Quebec City",
"adjective": ["Québécois"],
"cityStateType": "Cultured",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "We were too weak to protect ourselves...",
"outerColor": [0, 0, 0],
"innerColor": [51,102,0],
"cities": ["Quebec City"]
},
{
"name": "Helsinki",
"adjective": ["Helsinki"],
"cityStateType": "Maritime",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "The day of judgement has come to us. But rest assured, the same will go for you!",
"outerColor": [0, 0, 0],
"innerColor": [255,178,102],
"cities": ["Helsinki"]
},
{ {
"name": "Kuala Lumpur", "name": "Kuala Lumpur",
"adjective": ["KLite"], "adjective": ["KLite"],
@ -1149,18 +926,6 @@
"innerColor": [0,102,102], "innerColor": [0,102,102],
"cities": ["Kuala Lumpur"] "cities": ["Kuala Lumpur"]
}, },
{
"name": "Manila",
"adjective": ["Manilan"],
"cityStateType": "Maritime",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "Ah, Gods! Why have you forsaken us?",
"outerColor": [0, 0, 0],
"innerColor": [96,96,96],
"cities": ["Manila"]
},
{ {
"name": "Lhasa", "name": "Lhasa",
"translatedName": "Lhasa", "translatedName": "Lhasa",
@ -1174,6 +939,117 @@
"innerColor": [204,102,0], "innerColor": [204,102,0],
"cities": ["Lhasa"] "cities": ["Lhasa"]
}, },
{
"name": "Milan",
"adjective": ["Milanese"],
"cityStateType": "Cultured",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "You fiend! History shall remember this!",
"outerColor": [0, 0, 0],
"innerColor": [185,132,66],
"cities": ["Milan"]
},
{
"name": "Quebec City",
"adjective": ["Québécois"],
"cityStateType": "Cultured",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "We were too weak to protect ourselves...",
"outerColor": [0, 0, 0],
"innerColor": [51,102,0],
"cities": ["Quebec City"]
},
{
"name": "Cape Town",
"adjective": ["Cape Town"],
"cityStateType": "Maritime",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "I have failed. May you, at least, know compassion towards our people.",
"outerColor": [0, 0, 0],
"innerColor": [255,153,153],
"cities": ["Cape Town"]
},
{
"name": "Helsinki",
"adjective": ["Helsinki"],
"cityStateType": "Maritime",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "The day of judgement has come to us. But rest assured, the same will go for you!",
"outerColor": [0, 0, 0],
"innerColor": [255,178,102],
"cities": ["Helsinki"]
},
{
"name": "Manila",
"adjective": ["Manilan"],
"cityStateType": "Maritime",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "Ah, Gods! Why have you forsaken us?",
"outerColor": [0, 0, 0],
"innerColor": [96,96,96],
"cities": ["Manila"]
},
{
"name": "Mogadishu",
"adjective": ["Mogadishu"],
"cityStateType": "Maritime",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "Congratulations, conqueror. This tribe serves you now.",
"outerColor": [0, 0, 0],
"innerColor": [224,224,224],
"cities": ["Mogadishu"]
},
{
"name": "Rio de Janeiro",
"adjective": ["Carioca"],
"cityStateType": "Maritime",
"startBias": ["Coast"],
"declaringWar": "I have to do this, for the sake of progress if nothing else. You must be opposed!",
"attacked": "You can see how fruitless this will be for you... right?",
"defeated": "May God grant me these last wishes - peace and prosperity for Brazil.",
"outerColor": [0, 0, 0],
"innerColor": [211, 220, 103],
"cities": ["Rio de Janeiro"]
},
{
"name": "Sydney",
"adjective": ["Sydney"],
"cityStateType": "Maritime",
"declaringWar": "After thorough deliberation, Australia finds itself at a crossroads. Prepare yourself, for war is upon us.",
"attacked": "We will mobilize every means of resistance to stop this transgression against our nation!",
"defeated": "The principles for which we have fought will survive longer than any nation you could ever build.",
"outerColor": [0, 0, 0],
"innerColor": [255,204,204],
"cities": ["Sydney"]
},
{
"name": "Ur",
"adjective": ["Ur"],
"cityStateType": "Maritime",
"startBias": ["Coast"],
"declaringWar": "I will enjoy hearing your last breath as you witness the destruction of your realm!",
"attacked": "Why do we fight? Because Inanna demands it. Now, witness the power of the Sumerians!",
"defeated": "What treachery has struck us? No, what evil?",
"outerColor": [0, 0, 0],
"innerColor": [255,69,0],
"cities": ["Ur"]
},
{ {
"name": "Vancouver", "name": "Vancouver",
"translatedName": "Vancouver", "translatedName": "Vancouver",
@ -1187,6 +1063,146 @@
"innerColor": [0,255,128], "innerColor": [0,255,128],
"cities": ["Vancouver"] "cities": ["Vancouver"]
}, },
{
"name": "Venice",
"adjective": ["Venetian"],
"cityStateType": "Maritime",
"startBias": ["Coast"],
"declaringWar": "You have revealed your purposes a bit too early, my friend...",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "A wrong calculation, on my part.",
"outerColor": [0, 0, 0],
"innerColor": [153,204,255],
"cities": ["Venice"]
},
{
"name": "Antwerp",
"adjective": ["Antwerp"],
"cityStateType": "Mercantile",
"startBias": ["Coast"],
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "They will write songs of this.... pray that they shall be in your favor.",
"outerColor": [0, 0, 0],
"innerColor": [194,97,255],
"cities": ["Antwerp"]
},
{
"name": "Genoa",
"adjective": ["Genoese"],
"cityStateType": "Mercantile",
"startBias": ["Coast"],
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "How barbaric. Those who live by the sword shall perish by the sword.",
"outerColor": [0, 0, 0],
"innerColor": [45,255,86],
"cities": ["Genoa"]
},
{
"name": "Kathmandu",
"adjective": ["Kathmandu"],
"cityStateType": "Mercantile",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "We... defeated? No... we had so much work to do!",
"outerColor": [0, 0, 0],
"innerColor": [151,125,0],
"cities": ["Kathmandu"]
},
{
"name": "Singapore",
"adjective": ["Singaporean"],
"cityStateType": "Mercantile",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "Perhaps, in another world, we could have been friends...",
"outerColor": [0, 0, 0],
"innerColor": [255,255,0],
"cities": ["Singapore"]
},
{
"name": "Tyre",
"adjective": ["Tyrian"],
"cityStateType": "Mercantile",
"startBias": ["Coast"],
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "We never fully trusted you from the start.",
"outerColor": [0, 0, 0],
"innerColor": [255,97,255],
"cities": ["Tyre"]
},
{
"name": "Zanzibar",
"adjective": ["Zanzibar"],
"cityStateType": "Mercantile",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "May the Heavens forgive you for inflicting this humiliation to our people.",
"outerColor": [0, 0, 0],
"innerColor": [255,153,255],
"cities": ["Zanzibar"]
},
{
"name": "Almaty",
"adjective": ["Almaty"],
"cityStateType": "Militaristic",
"declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.",
"defeated": "How could we fall to the likes of you?!",
"outerColor": [0, 0, 0],
"innerColor": [152,0,241],
"cities": ["Almaty"]
},
{
"name": "Belgrade",
"adjective": ["Belgrade"],
"cityStateType": "Militaristic",
"declaringWar": "Let's have a nice little War, shall we?",
"attacked": "If you need your nose bloodied, we'll happily serve.",
"defeated": "The serbian guerilla will never stop haunting you!",
"outerColor": [0, 0, 0],
"innerColor": [211,180,113],
"cities": ["Belgrade"]
},
{
"name": "Dublin",
"adjective": ["Dubliner"],
"cityStateType": "Militaristic",
"declaringWar": "War lingers in our hearts. Why carry on with a false peace?",
"attacked": "You gormless radger! You'll dine on your own teeth before you set foot in Ireland!",
"defeated": "A lonely wind blows through the highlands today. A dirge for Ireland. Can you hear it?",
"outerColor": [0, 0, 0],
"innerColor": [211,180,113],
"cities": ["Dublin"],
"uniques": ["Will not be displayed in Civilopedia", "Will not be chosen for new games"]
},
{
"name": "Edinburgh",
"adjective": ["Edinburghensian"],
"cityStateType": "Militaristic",
"declaringWar": "You shall stain this land no longer with your vileness! To arms, my countrymen - we ride to war!",
"attacked": "Traitorous man! The Celtic peoples will not stand for such wanton abuse and slander - I shall have your head!",
"defeated": "Vile ruler, know that you 'won' this war in name only!",
"outerColor": [0, 0, 0],
"innerColor": [0,102,102],
"cities": ["Edinburgh"],
"uniques": ["Will not be displayed in Civilopedia", "Will not be chosen for new games"]
},
{ {
"name": "M'Banza-Kongo", "name": "M'Banza-Kongo",
"adjective": ["M'Banza-Kongo"], "adjective": ["M'Banza-Kongo"],
@ -1200,17 +1216,30 @@
"cities": ["M'Banza-Kongo"] "cities": ["M'Banza-Kongo"]
}, },
{ {
"name": "Mogadishu", "name": "Sidon",
"adjective": ["Mogadishu"], "adjective": ["Sidon"],
"cityStateType": "Maritime", "cityStateType": "Militaristic",
"declaringWar": "You leave us no choice. War it must be.", "declaringWar": "You leave us no choice. War it must be.",
"attacked": "Very well, this shall not be forgotten.", "attacked": "Very well, this shall not be forgotten.",
"defeated": "Congratulations, conqueror. This tribe serves you now.", "defeated": "What a fine battle! Sidon is willing to serve you!",
"outerColor": [0, 0, 0], "outerColor": [0, 0, 0],
"innerColor": [224,224,224], "innerColor": [250,128,114],
"cities": ["Mogadishu"] "cities": ["Sidon"]
}, },
{
"name": "Valletta",
"adjective": ["maltese"],
"cityStateType": "Militaristic",
"declaringWar": "We don't like your face. To arms!",
"attacked": "You will see you have just bitten off more than you can chew.",
"defeated": "This ship may sink, but our spirits will linger.",
"outerColor": [0, 0, 0],
"innerColor": [0,102,102],
"cities": ["Valletta"]
},
{ {
"name": "Bratislava", "name": "Bratislava",
"adjective": ["Bratislava"], "adjective": ["Bratislava"],

View File

@ -12,6 +12,7 @@ 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 com.unciv.models.ruleset.tile.ResourceType import com.unciv.models.ruleset.tile.ResourceType
import com.unciv.models.ruleset.unique.UniqueType
import java.util.* import java.util.*
import kotlin.collections.HashMap import kotlin.collections.HashMap
import kotlin.collections.HashSet import kotlin.collections.HashSet
@ -200,8 +201,11 @@ object GameStarter {
// since we shuffle and then order by, we end up with all the City-States with starting tiles first in a random order, // since we shuffle and then order by, we end up with all the City-States with starting tiles first in a random order,
// and then all the other City-States in a random order! Because the sortedBy function is stable! // and then all the other City-States in a random order! Because the sortedBy function is stable!
availableCityStatesNames.addAll( ruleset.nations availableCityStatesNames.addAll( ruleset.nations
.filter { it.value.isCityState() && (it.value.cityStateType != CityStateType.Religious || newGameParameters.religionEnabled) } .filter {
.keys it.value.isCityState() &&
(it.value.cityStateType != CityStateType.Religious || newGameParameters.religionEnabled) &&
!it.value.hasUnique(UniqueType.CityStateDeprecated)
}.keys
.shuffled() .shuffled()
.sortedByDescending { it in civNamesWithStartingLocations } ) .sortedByDescending { it in civNamesWithStartingLocations } )

View File

@ -86,6 +86,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
CityStateCanBeBoughtForGold("Can spend Gold to annex or puppet a City-State that has been your ally for [amount] turns.", UniqueTarget.Global), CityStateCanBeBoughtForGold("Can spend Gold to annex or puppet a City-State that has been your ally for [amount] turns.", UniqueTarget.Global),
CityStateTerritoryAlwaysFriendly("City-State territory always counts as friendly territory", UniqueTarget.Global), CityStateTerritoryAlwaysFriendly("City-State territory always counts as friendly territory", UniqueTarget.Global),
CityStateDeprecated("Will not be chosen for new games", UniqueTarget.Nation), // implemented for CS only for now
/////// Other global uniques /////// Other global uniques

View File

@ -2,10 +2,12 @@ package com.unciv.ui.newgamescreen
import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.UncivGame import com.unciv.UncivGame
import com.unciv.logic.civilization.CityStateType
import com.unciv.models.metadata.BaseRuleset import com.unciv.models.metadata.BaseRuleset
import com.unciv.models.metadata.GameSpeed import com.unciv.models.metadata.GameSpeed
import com.unciv.models.ruleset.RulesetCache import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.ruleset.VictoryType import com.unciv.models.ruleset.VictoryType
import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.ui.audio.MusicMood import com.unciv.ui.audio.MusicMood
import com.unciv.ui.audio.MusicTrackChooserFlags import com.unciv.ui.audio.MusicTrackChooserFlags
import com.unciv.ui.utils.* import com.unciv.ui.utils.*
@ -29,6 +31,7 @@ class GameOptionsTable(
} }
private fun getGameOptionsTable() { private fun getGameOptionsTable() {
val cityStateSlider: UncivSlider?
top() top()
defaults().pad(5f) defaults().pad(5f)
@ -40,7 +43,7 @@ class GameOptionsTable(
addEraSelectBox() addEraSelectBox()
// align left and right edges with other SelectBoxes but allow independent dropdown width // align left and right edges with other SelectBoxes but allow independent dropdown width
add(Table().apply { add(Table().apply {
addCityStatesSlider() cityStateSlider = addCityStatesSlider()
}).colspan(2).fillX().row() }).colspan(2).fillX().row()
}).row() }).row()
addVictoryTypeCheckboxes() addVictoryTypeCheckboxes()
@ -51,7 +54,7 @@ class GameOptionsTable(
checkboxTable.addOneCityChallengeCheckbox() checkboxTable.addOneCityChallengeCheckbox()
checkboxTable.addNuclearWeaponsCheckbox() checkboxTable.addNuclearWeaponsCheckbox()
checkboxTable.addIsOnlineMultiplayerCheckbox() checkboxTable.addIsOnlineMultiplayerCheckbox()
checkboxTable.addReligionCheckbox() checkboxTable.addReligionCheckbox(cityStateSlider)
add(checkboxTable).center().row() add(checkboxTable).center().row()
if (!withoutMods) if (!withoutMods)
@ -90,22 +93,31 @@ class GameOptionsTable(
updatePlayerPickerTable("") updatePlayerPickerTable("")
} }
private fun Table.addReligionCheckbox() = private fun numberOfCityStates() = ruleset.nations.values.count {
addCheckbox("Enable Religion", gameParameters.religionEnabled) it.isCityState() &&
{ gameParameters.religionEnabled = it } (it.cityStateType != CityStateType.Religious || gameParameters.religionEnabled) &&
!it.hasUnique(UniqueType.CityStateDeprecated)
}
private fun Table.addCityStatesSlider() { private fun Table.addReligionCheckbox(cityStateSlider: UncivSlider?) =
val numberOfCityStates = ruleset.nations.filter { it.value.isCityState() }.size addCheckbox("Enable Religion", gameParameters.religionEnabled) {
if (numberOfCityStates == 0) return gameParameters.religionEnabled = it
cityStateSlider?.run { setRange(0f, numberOfCityStates().toFloat()) }
}
private fun Table.addCityStatesSlider(): UncivSlider? {
val maxCityStates = numberOfCityStates()
if (maxCityStates == 0) return null
add("{Number of City-States}:".toLabel()).left().expandX() add("{Number of City-States}:".toLabel()).left().expandX()
val slider = UncivSlider(0f,numberOfCityStates.toFloat(),1f) { val slider = UncivSlider(0f, maxCityStates.toFloat(), 1f) {
gameParameters.numberOfCityStates = it.toInt() gameParameters.numberOfCityStates = it.toInt()
} }
slider.permanentTip = true slider.permanentTip = true
slider.isDisabled = locked slider.isDisabled = locked
add(slider).padTop(10f).row() add(slider).padTop(10f).row()
slider.value = gameParameters.numberOfCityStates.toFloat() slider.value = gameParameters.numberOfCityStates.toFloat()
return slider
} }
private fun Table.addSelectBox(text: String, values: Collection<String>, initialState: String, onChange: (newValue: String) -> Unit) { private fun Table.addSelectBox(text: String, values: Collection<String>, initialState: String, onChange: (newValue: String) -> Unit) {

View File

@ -78,6 +78,10 @@ class UncivSlider (
var isDisabled: Boolean var isDisabled: Boolean
get() = slider.isDisabled get() = slider.isDisabled
set(value) { slider.isDisabled = value } set(value) { slider.isDisabled = value }
fun setRange(min: Float, max: Float) {
slider.setRange(min, max)
setPlusMinusEnabled()
}
// Value tip format // Value tip format
var tipFormat = "%.1f" var tipFormat = "%.1f"
@ -157,7 +161,10 @@ class UncivSlider (
tipHideTask.cancel() tipHideTask.cancel()
if (!permanentTip) if (!permanentTip)
Timer.schedule(tipHideTask, hideDelay) Timer.schedule(tipHideTask, hideDelay)
setPlusMinusEnabled()
}
private fun setPlusMinusEnabled() {
val enableMinus = slider.value > slider.minValue val enableMinus = slider.value > slider.minValue
minusButton?.touchable = if(enableMinus) Touchable.enabled else Touchable.disabled minusButton?.touchable = if(enableMinus) Touchable.enabled else Touchable.disabled
minusButton?.apply {circle.color.a = if(enableMinus) 1f else 0.5f} minusButton?.apply {circle.color.a = if(enableMinus) 1f else 0.5f}