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 } )
@ -213,7 +217,7 @@ object GameStarter {
val unusedMercantileResources = Stack<String>() val unusedMercantileResources = Stack<String>()
unusedMercantileResources.addAll(allMercantileResources.shuffled()) unusedMercantileResources.addAll(allMercantileResources.shuffled())
var addedCityStates = 0 var addedCityStates = 0
// Keep trying to add city states until we reach the target number. // Keep trying to add city states until we reach the target number.
while (addedCityStates < newGameParameters.numberOfCityStates) { while (addedCityStates < newGameParameters.numberOfCityStates) {

View File

@ -58,9 +58,9 @@ enum class UniqueTarget(val inheritsFrom:UniqueTarget?=null) {
enum class UniqueType(val text:String, vararg targets: UniqueTarget) { enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
//////////////////////////////////////// GLOBAL UNIQUES //////////////////////////////////////// //////////////////////////////////////// GLOBAL UNIQUES ////////////////////////////////////////
/////// Stat providing uniques /////// Stat providing uniques
Stats("[stats]", UniqueTarget.Global), Stats("[stats]", UniqueTarget.Global),
StatsPerCity("[stats] [cityFilter]", UniqueTarget.Global), StatsPerCity("[stats] [cityFilter]", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[stats] <if this city has at least [amount] specialists>"), DeprecationLevel.WARNING) @Deprecated("As of 3.16.16", ReplaceWith("[stats] <if this city has at least [amount] specialists>"), DeprecationLevel.WARNING)
@ -68,7 +68,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
StatPercentBonus("[amount]% [Stat]", UniqueTarget.Global), StatPercentBonus("[amount]% [Stat]", UniqueTarget.Global),
BonusStatsFromCityStates("[amount]% [stat] from City-States", UniqueTarget.Global), BonusStatsFromCityStates("[amount]% [stat] from City-States", UniqueTarget.Global),
RemoveAnnexUnhappiness("Remove extra unhappiness from annexed cities", UniqueTarget.Building), RemoveAnnexUnhappiness("Remove extra unhappiness from annexed cities", UniqueTarget.Building),
/////// City-State related uniques /////// City-State related uniques
@ -86,16 +86,17 @@ 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
FreeUnits("[amount] units cost no maintenance", UniqueTarget.Global), FreeUnits("[amount] units cost no maintenance", UniqueTarget.Global),
UnitMaintenanceDiscount("[amount]% maintenance costs for [mapUnitFilter] units", UniqueTarget.Global), UnitMaintenanceDiscount("[amount]% maintenance costs for [mapUnitFilter] units", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING) @Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs", UniqueTarget.Global), DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs", UniqueTarget.Global),
@Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING) @Deprecated("As of 3.16.16", ReplaceWith("[amount]% maintenance costs for [mapUnitFilter] units"), DeprecationLevel.WARNING)
DecreasedUnitMaintenanceCostsGlobally("-[amount]% unit upkeep costs", UniqueTarget.Global), DecreasedUnitMaintenanceCostsGlobally("-[amount]% unit upkeep costs", UniqueTarget.Global),
ConsumesResources("Consumes [amount] [resource]", ConsumesResources("Consumes [amount] [resource]",
UniqueTarget.Improvement, UniqueTarget.Building, UniqueTarget.Unit), UniqueTarget.Improvement, UniqueTarget.Building, UniqueTarget.Unit),
ProvidesResources("Provides [amount] [resource]", ProvidesResources("Provides [amount] [resource]",
@ -115,7 +116,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
FreeExtraAnyBeliefs("May choose [amount] additional of any type when [foundingOrEnhancing] a religion", UniqueTarget.Global), FreeExtraAnyBeliefs("May choose [amount] additional of any type when [foundingOrEnhancing] a religion", UniqueTarget.Global),
///////////////////////////////////////// UNIT UNIQUES ///////////////////////////////////////// ///////////////////////////////////////// UNIT UNIQUES /////////////////////////////////////////
Strength("[amount]% Strength", UniqueTarget.Unit, UniqueTarget.Global), Strength("[amount]% Strength", UniqueTarget.Unit, UniqueTarget.Global),
@Deprecated("As of 3.17.3", ReplaceWith("[amount]% Strength"), DeprecationLevel.WARNING) @Deprecated("As of 3.17.3", ReplaceWith("[amount]% Strength"), DeprecationLevel.WARNING)
@ -147,7 +148,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
CannotEnterOceanUntilAstronomy("Cannot enter ocean tiles until Astronomy", UniqueTarget.Unit), CannotEnterOceanUntilAstronomy("Cannot enter ocean tiles until Astronomy", UniqueTarget.Unit),
//////////////////////////////////////// TERRAIN UNIQUES //////////////////////////////////////// //////////////////////////////////////// TERRAIN UNIQUES ////////////////////////////////////////
NaturalWonderNeighborCount("Must be adjacent to [amount] [simpleTerrain] tiles", UniqueTarget.Terrain), NaturalWonderNeighborCount("Must be adjacent to [amount] [simpleTerrain] tiles", UniqueTarget.Terrain),
NaturalWonderNeighborsRange("Must be adjacent to [amount] to [amount] [simpleTerrain] tiles", UniqueTarget.Terrain), NaturalWonderNeighborsRange("Must be adjacent to [amount] to [amount] [simpleTerrain] tiles", UniqueTarget.Terrain),
NaturalWonderSmallerLandmass("Must not be on [amount] largest landmasses", UniqueTarget.Terrain), NaturalWonderSmallerLandmass("Must not be on [amount] largest landmasses", UniqueTarget.Terrain),
@ -155,15 +156,15 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
NaturalWonderLatitude("Occurs on latitudes from [amount] to [amount] percent of distance equator to pole", UniqueTarget.Terrain), NaturalWonderLatitude("Occurs on latitudes from [amount] to [amount] percent of distance equator to pole", UniqueTarget.Terrain),
NaturalWonderGroups("Occurs in groups of [amount] to [amount] tiles", UniqueTarget.Terrain), NaturalWonderGroups("Occurs in groups of [amount] to [amount] tiles", UniqueTarget.Terrain),
NaturalWonderConvertNeighbors("Neighboring tiles will convert to [baseTerrain]", UniqueTarget.Terrain), NaturalWonderConvertNeighbors("Neighboring tiles will convert to [baseTerrain]", UniqueTarget.Terrain),
// The "Except [terrainFilter]" could theoretically be implemented with a conditional // The "Except [terrainFilter]" could theoretically be implemented with a conditional
NaturalWonderConvertNeighborsExcept("Neighboring tiles except [baseTerrain] will convert to [baseTerrain]", UniqueTarget.Terrain), NaturalWonderConvertNeighborsExcept("Neighboring tiles except [baseTerrain] will convert to [baseTerrain]", UniqueTarget.Terrain),
TerrainGrantsPromotion("Grants [promotion] ([comment]) to adjacent [mapUnitFilter] units for the rest of the game", UniqueTarget.Terrain), TerrainGrantsPromotion("Grants [promotion] ([comment]) to adjacent [mapUnitFilter] units for the rest of the game", UniqueTarget.Terrain),
TileProvidesYieldWithoutPopulation("Tile provides yield without assigned population", UniqueTarget.Terrain, UniqueTarget.Improvement), TileProvidesYieldWithoutPopulation("Tile provides yield without assigned population", UniqueTarget.Terrain, UniqueTarget.Improvement),
NullifyYields("Nullifies all other stats this tile provides", UniqueTarget.Terrain), NullifyYields("Nullifies all other stats this tile provides", UniqueTarget.Terrain),
NoNaturalGeneration("Doesn't generate naturally", UniqueTarget.Terrain), NoNaturalGeneration("Doesn't generate naturally", UniqueTarget.Terrain),
///////////////////////////////////////// CONDITIONALS ///////////////////////////////////////// ///////////////////////////////////////// CONDITIONALS /////////////////////////////////////////

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)
@ -89,23 +92,32 @@ class GameOptionsTable(
gameParameters.isOnlineMultiplayer = it gameParameters.isOnlineMultiplayer = it
updatePlayerPickerTable("") updatePlayerPickerTable("")
} }
private fun Table.addReligionCheckbox() =
addCheckbox("Enable Religion", gameParameters.religionEnabled)
{ gameParameters.religionEnabled = it }
private fun Table.addCityStatesSlider() { private fun numberOfCityStates() = ruleset.nations.values.count {
val numberOfCityStates = ruleset.nations.filter { it.value.isCityState() }.size it.isCityState() &&
if (numberOfCityStates == 0) return (it.cityStateType != CityStateType.Religious || gameParameters.religionEnabled) &&
!it.hasUnique(UniqueType.CityStateDeprecated)
}
private fun Table.addReligionCheckbox(cityStateSlider: UncivSlider?) =
addCheckbox("Enable Religion", gameParameters.religionEnabled) {
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"
@ -125,7 +129,7 @@ class UncivSlider (
if (vertical) padTop(padding) else padRight(padding) if (vertical) padTop(padding) else padRight(padding)
} }
} else plusButton = null } else plusButton = null
row() row()
value = initial // set initial value late so the tooltip can work with the layout value = initial // set initial value late so the tooltip can work with the layout
@ -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}
@ -165,7 +172,7 @@ class UncivSlider (
plusButton?.touchable = if(enablePlus) Touchable.enabled else Touchable.disabled plusButton?.touchable = if(enablePlus) Touchable.enabled else Touchable.disabled
plusButton?.apply {circle.color.a = if(enablePlus) 1f else 0.5f} plusButton?.apply {circle.color.a = if(enablePlus) 1f else 0.5f}
} }
private fun stepChanged() { private fun stepChanged() {
tipFormat = when { tipFormat = when {
stepSize > 0.99f -> "%.0f" stepSize > 0.99f -> "%.0f"
@ -208,7 +215,7 @@ class UncivSlider (
killedCaptureListeners.remove(widget) killedCaptureListeners.remove(widget)
} }
} }
// Helpers to manage the light-weight "tooltip" showing the value // Helpers to manage the light-weight "tooltip" showing the value
private fun showTip() { private fun showTip() {
if (tipContainer.hasParent()) return if (tipContainer.hasParent()) return