mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Resolved #12996 - "Will not be chosen for new games" works for major nations
This commit is contained in:
parent
3b2f4133c1
commit
733ad64f54
@ -250,7 +250,8 @@ object GameStarter {
|
||||
if (gameSetupInfo.gameParameters.enableRandomNationsPool)
|
||||
gameSetupInfo.gameParameters.randomNationsPool.asSequence()
|
||||
else
|
||||
ruleset.nations.filter { it.value.isMajorCiv }.keys.asSequence()
|
||||
ruleset.nations.filter { it.value.isMajorCiv && !it.value.hasUnique(UniqueType.WillNotBeChosenForNewGames) }
|
||||
.keys.asSequence()
|
||||
).filter { it !in selectedPlayerNames }
|
||||
.shuffled().toCollection(ArrayDeque(dequeCapacity))
|
||||
|
||||
@ -337,7 +338,7 @@ object GameStarter {
|
||||
ruleset.nations.asSequence()
|
||||
.filter {
|
||||
it.value.isCityState &&
|
||||
!it.value.hasUnique(UniqueType.CityStateDeprecated)
|
||||
!it.value.hasUnique(UniqueType.WillNotBeChosenForNewGames)
|
||||
}.map { it.key }
|
||||
.shuffled()
|
||||
.sortedByDescending { it in civNamesWithStartingLocations } // please those with location first
|
||||
|
@ -81,7 +81,6 @@ enum class UniqueType(
|
||||
CityStateTerritoryAlwaysFriendly("City-State territory always counts as friendly territory", UniqueTarget.Global),
|
||||
|
||||
CityStateCanGiftGreatPeople("Allied City-States will occasionally gift Great People", UniqueTarget.Global), // used in Policy
|
||||
CityStateDeprecated("Will not be chosen for new games", UniqueTarget.Nation), // implemented for CS only for now
|
||||
CityStateInfluenceDegradation("[relativeAmount]% City-State Influence degradation", UniqueTarget.Global),
|
||||
CityStateRestingPoint("Resting point for Influence with City-States is increased by [amount]", UniqueTarget.Global),
|
||||
|
||||
@ -929,9 +928,12 @@ enum class UniqueType(
|
||||
HiddenFromCivilopedia("Will not be displayed in Civilopedia", *UniqueTarget.Displayable, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
ShowsWhenUnbuilable("Shown while unbuilable", UniqueTarget.Building, UniqueTarget.Unit, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
ModifierHiddenFromUsers("hidden from users", UniqueTarget.MetaModifier),
|
||||
WillNotBeChosenForNewGames("Will not be chosen for new games", UniqueTarget.Nation),
|
||||
|
||||
ForEveryCountable("for every [countable]", UniqueTarget.MetaModifier),
|
||||
ForEveryAdjacentTile("for every adjacent [tileFilter]", UniqueTarget.MetaModifier),
|
||||
ForEveryAmountCountable("for every [amount] [countable]", UniqueTarget.MetaModifier),
|
||||
|
||||
ModifiedByGameSpeed("(modified by game speed)", UniqueTarget.MetaModifier,
|
||||
docDescription = "Can only be applied to certain uniques, see details of each unique for specifics"),
|
||||
Comment("Comment [comment]", *UniqueTarget.Displayable,
|
||||
|
@ -222,7 +222,7 @@ class GameOptionsTable(
|
||||
}
|
||||
|
||||
private fun numberOfCityStates() = ruleset.nations.values.count {
|
||||
it.isCityState && !it.hasUnique(UniqueType.CityStateDeprecated)
|
||||
it.isCityState && !it.hasUnique(UniqueType.WillNotBeChosenForNewGames)
|
||||
}
|
||||
|
||||
private fun Table.addNoStartBiasCheckbox() =
|
||||
@ -538,6 +538,7 @@ private class RandomNationPickerPopup(
|
||||
init {
|
||||
val sortedNations = previousScreen.ruleset.nations.values
|
||||
.filter { it.isMajorCiv }
|
||||
.filterNot { it.hasUnique(UniqueType.WillNotBeChosenForNewGames) }
|
||||
.sortedWith(compareBy(UncivGame.Current.settings.getCollatorFromLocale()) { it.name.tr(hideIcons = true) })
|
||||
allNationTables = ArrayList(
|
||||
sortedNations.map { NationTable(it, civBlocksWidth, 0f) } // no need for min height
|
||||
|
@ -15,6 +15,7 @@ import com.unciv.models.metadata.GameSetupInfo
|
||||
import com.unciv.models.metadata.Player
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.ruleset.nation.Nation
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.components.input.KeyCharAndCode
|
||||
import com.unciv.ui.components.widgets.UncivTextField
|
||||
@ -86,7 +87,8 @@ class PlayerPickerTable(
|
||||
val gameBasics = previousScreen.ruleset // the mod picking changes this ruleset
|
||||
|
||||
reassignRemovedModReferences()
|
||||
val newRulesetPlayableCivs = previousScreen.ruleset.nations.count { it.key != Constants.barbarians }
|
||||
val newRulesetPlayableCivs = previousScreen.ruleset.nations
|
||||
.count { it.key != Constants.barbarians && !it.value.hasUnique(UniqueType.WillNotBeChosenForNewGames) }
|
||||
if (gameParameters.players.size > newRulesetPlayableCivs)
|
||||
gameParameters.players = ArrayList(gameParameters.players.subList(0, newRulesetPlayableCivs))
|
||||
if (desiredCiv.isNotEmpty()) assignDesiredCiv(desiredCiv)
|
||||
@ -151,7 +153,9 @@ class PlayerPickerTable(
|
||||
*/
|
||||
private fun reassignRemovedModReferences() {
|
||||
for (player in gameParameters.players) {
|
||||
if (!previousScreen.ruleset.nations.containsKey(player.chosenCiv) || previousScreen.ruleset.nations[player.chosenCiv]!!.isCityState)
|
||||
if (!previousScreen.ruleset.nations.containsKey(player.chosenCiv)
|
||||
|| previousScreen.ruleset.nations[player.chosenCiv]!!.isCityState
|
||||
|| previousScreen.ruleset.nations[player.chosenCiv]!!.hasUnique(UniqueType.WillNotBeChosenForNewGames))
|
||||
player.chosenCiv = Constants.random
|
||||
}
|
||||
}
|
||||
@ -326,6 +330,7 @@ class PlayerPickerTable(
|
||||
internal fun getAvailablePlayerCivs(dontSkipNation: String? = null) =
|
||||
previousScreen.ruleset.nations.values.asSequence()
|
||||
.filter { it.isMajorCiv }
|
||||
.filterNot { it.hasUnique(UniqueType.WillNotBeChosenForNewGames) }
|
||||
.filter { it.name == dontSkipNation || gameParameters.players.none { player -> player.chosenCiv == it.name } }
|
||||
|
||||
/**
|
||||
|
@ -1027,9 +1027,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
Applicable to: Global, Unit
|
||||
|
||||
## Nation uniques
|
||||
??? example "Will not be chosen for new games"
|
||||
Applicable to: Nation
|
||||
|
||||
??? example "Starts with [tech]"
|
||||
Example: "Starts with [Agriculture]"
|
||||
|
||||
@ -1054,6 +1051,9 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "Will not be displayed in Civilopedia"
|
||||
Applicable to: Nation, Tech, Policy, FounderBelief, FollowerBelief, Building, Unit, UnitType, Promotion, Terrain, Improvement, Resource, Ruins, Speed, EventChoice
|
||||
|
||||
??? example "Will not be chosen for new games"
|
||||
Applicable to: Nation
|
||||
|
||||
??? example "Comment [comment]"
|
||||
Allows displaying arbitrary text in a Unique listing. Only the text within the '[]' brackets will be displayed, the rest serves to allow Ruleset validation to recognize the intent.
|
||||
Example: "Comment [comment]"
|
||||
|
Loading…
x
Reference in New Issue
Block a user