mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Modding: Replaced "Hidden when [victoryType] Victory is disabled" with "Only available <when [victoryType] Victory is enabled>"
This commit is contained in:
parent
46644bcc05
commit
579ea79d09
@ -1110,8 +1110,8 @@
|
||||
"name": "Apollo Program",
|
||||
"cost": 750,
|
||||
"isNationalWonder": true,
|
||||
"uniques": ["Enables construction of Spaceship parts", "Triggers a global alert upon completion",
|
||||
"Hidden when [Scientific] Victory is disabled", "Cannot be hurried"],
|
||||
"uniques": ["Enables construction of Spaceship parts", "Triggers a global alert upon completion",
|
||||
"Only available <when [Scientific] Victory is enabled>", "Cannot be hurried"],
|
||||
"requiredTech": "Rocketry"
|
||||
},
|
||||
{
|
||||
@ -1167,7 +1167,7 @@
|
||||
"culture": 1,
|
||||
"greatPersonPoints": {"Great Merchant": 2},
|
||||
"requiredTech": "Globalization",
|
||||
"uniques": ["Triggers voting for the Diplomatic Victory", "Hidden when [Diplomatic] Victory is disabled", "Triggers a global alert upon completion"],
|
||||
"uniques": ["Triggers voting for the Diplomatic Victory", "Only available <when [Diplomatic] Victory is enabled>", "Triggers a global alert upon completion"],
|
||||
"quote": "'More than ever before in human history, we share a common destiny. We can master it only if we face it together. And that is why we have the United Nations.' - Kofi Annan"
|
||||
},
|
||||
|
||||
@ -1178,7 +1178,7 @@
|
||||
"cost": 1500,
|
||||
"isNationalWonder": true,
|
||||
"uniques": ["Hidden until [5] social policy branches have been completed", "Triggers a global alert upon build start",
|
||||
"Triggers a Cultural Victory upon completion", "Hidden when [Cultural] Victory is disabled", "Cannot be hurried"]
|
||||
"Triggers a Cultural Victory upon completion", "Only available <when [Cultural] Victory is enabled>", "Cannot be hurried"]
|
||||
},
|
||||
|
||||
// Religious buildings
|
||||
|
@ -933,7 +933,7 @@
|
||||
"cost": 750,
|
||||
"isNationalWonder": true,
|
||||
"uniques": ["Enables construction of Spaceship parts", "Triggers a global alert upon completion",
|
||||
"Hidden when [Scientific] Victory is disabled", "Cannot be hurried"],
|
||||
"Only available <when [Scientific] Victory is enabled>", "Cannot be hurried"],
|
||||
"requiredTech": "Rocketry"
|
||||
},
|
||||
|
||||
@ -956,7 +956,7 @@
|
||||
"culture": 1,
|
||||
"greatPersonPoints": {"Great Merchant": 2},
|
||||
"requiredTech": "Globalization",
|
||||
"uniques": ["Triggers voting for the Diplomatic Victory", "Hidden when [Diplomatic] Victory is disabled", "Triggers a global alert upon completion"],
|
||||
"uniques": ["Triggers voting for the Diplomatic Victory", "Only available <when [Diplomatic] Victory is enabled>", "Triggers a global alert upon completion"],
|
||||
"quote": "'More than ever before in human history, we share a common destiny. We can master it only if we face it together. And that is why we have the United Nations.' - Kofi Annan"
|
||||
},
|
||||
|
||||
@ -967,7 +967,7 @@
|
||||
"cost": 1500,
|
||||
"isNationalWonder": true,
|
||||
"uniques": ["Hidden until [5] social policy branches have been completed", "Triggers a global alert upon build start",
|
||||
"Triggers a Cultural Victory upon completion", "Hidden when [Cultural] Victory is disabled", "Cannot be hurried"]
|
||||
"Triggers a Cultural Victory upon completion", "Only available <when [Cultural] Victory is enabled>", "Cannot be hurried"]
|
||||
}
|
||||
|
||||
]
|
||||
|
@ -31,7 +31,7 @@ object Conditionals {
|
||||
/** Helper to simplify conditional tests requiring gameInfo */
|
||||
fun checkOnGameInfo(predicate: (GameInfo.() -> Boolean)): Boolean {
|
||||
if (state.gameInfo == null) return false
|
||||
return state.gameInfo!!.predicate()
|
||||
return state.gameInfo.predicate()
|
||||
}
|
||||
|
||||
/** Helper to simplify conditional tests requiring a Civilization */
|
||||
@ -49,7 +49,7 @@ object Conditionals {
|
||||
/** Helper to simplify the "compare civ's current era with named era" conditions */
|
||||
fun compareEra(eraParam: String, compare: (civEra: Int, paramEra: Int) -> Boolean): Boolean {
|
||||
if (state.gameInfo == null) return false
|
||||
val era = state.gameInfo!!.ruleset.eras[eraParam] ?: return false
|
||||
val era = state.gameInfo.ruleset.eras[eraParam] ?: return false
|
||||
return compare(state.relevantCiv!!.getEraNumber(), era.eraNumber)
|
||||
}
|
||||
|
||||
@ -62,15 +62,15 @@ object Conditionals {
|
||||
compare: (current: Int, lowerLimit: Float, upperLimit: Float) -> Boolean
|
||||
): Boolean {
|
||||
if (state.gameInfo == null) return false
|
||||
var gameSpeedModifier = if (modifyByGameSpeed) state.gameInfo!!.speed.modifier else 1f
|
||||
var gameSpeedModifier = if (modifyByGameSpeed) state.gameInfo.speed.modifier else 1f
|
||||
|
||||
if (state.gameInfo!!.ruleset.tileResources.containsKey(resourceOrStatName))
|
||||
if (state.gameInfo.ruleset.tileResources.containsKey(resourceOrStatName))
|
||||
return compare(state.getResourceAmount(resourceOrStatName), lowerLimit * gameSpeedModifier, upperLimit * gameSpeedModifier)
|
||||
val stat = Stat.safeValueOf(resourceOrStatName)
|
||||
?: return false
|
||||
val statReserve = state.getStatAmount(stat)
|
||||
|
||||
gameSpeedModifier = if (modifyByGameSpeed) state.gameInfo!!.speed.statCostModifiers[stat]!! else 1f
|
||||
gameSpeedModifier = if (modifyByGameSpeed) state.gameInfo.speed.statCostModifiers[stat]!! else 1f
|
||||
return compare(statReserve, lowerLimit * gameSpeedModifier, upperLimit * gameSpeedModifier)
|
||||
}
|
||||
|
||||
|
@ -96,9 +96,33 @@ interface IHasUniques : INamed {
|
||||
* - Overrides need to deal with e.g. Era-specific wonder disabling, no-nukes, ruin rewards by difficulty, and so on!
|
||||
*/
|
||||
fun isUnavailableBySettings(gameInfo: GameInfo): Boolean {
|
||||
val gameBasedConditionals = setOf(
|
||||
UniqueType.ConditionalVictoryDisabled,
|
||||
UniqueType.ConditionalVictoryEnabled,
|
||||
UniqueType.ConditionalSpeed,
|
||||
)
|
||||
val stateForConditionals = StateForConditionals(gameInfo = gameInfo)
|
||||
|
||||
if (getMatchingUniques(UniqueType.Unavailable, StateForConditionals.IgnoreConditionals)
|
||||
.any { unique ->
|
||||
unique.modifiers.any {
|
||||
it.type in gameBasedConditionals
|
||||
&& Conditionals.conditionalApplies(null, it, stateForConditionals) } })
|
||||
return true
|
||||
|
||||
if (getMatchingUniques(UniqueType.OnlyAvailable, StateForConditionals.IgnoreConditionals)
|
||||
.any { unique ->
|
||||
unique.modifiers.any {
|
||||
it.type in gameBasedConditionals
|
||||
&& !Conditionals.conditionalApplies(null, it, stateForConditionals) } })
|
||||
return true
|
||||
|
||||
if (!gameInfo.isReligionEnabled() && hasUnique(UniqueType.HiddenWithoutReligion)) return true
|
||||
if (!gameInfo.isEspionageEnabled() && hasUnique(UniqueType.HiddenWithoutEspionage)) return true
|
||||
if (getMatchingUniques(UniqueType.HiddenWithoutVictoryType).any { it.params[0] !in gameInfo.gameParameters.victoryTypes }) return true
|
||||
|
||||
|
||||
if (getMatchingUniques(UniqueType.HiddenWithoutVictoryType)
|
||||
.any { it.params[0] !in gameInfo.gameParameters.victoryTypes }) return true
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -654,11 +654,17 @@ enum class UniqueType(
|
||||
///////////////////////////////////////// region 08 CONDITIONALS /////////////////////////////////////////
|
||||
|
||||
|
||||
/////// general conditionals
|
||||
ConditionalChance("with [amount]% chance", UniqueTarget.Conditional),
|
||||
/////// game conditionals
|
||||
ConditionalEveryTurns("every [positiveAmount] turns", UniqueTarget.Conditional),
|
||||
ConditionalBeforeTurns("before turn number [amount]", UniqueTarget.Conditional),
|
||||
ConditionalAfterTurns("after turn number [amount]", UniqueTarget.Conditional),
|
||||
ConditionalSpeed("on [speed] game speed", UniqueTarget.Conditional),
|
||||
ConditionalVictoryEnabled("when [victoryType] Victory is enabled", UniqueTarget.Conditional),
|
||||
ConditionalVictoryDisabled("when [victoryType] Victory is disabled", UniqueTarget.Conditional),
|
||||
|
||||
|
||||
/////// general conditionals
|
||||
ConditionalChance("with [amount]% chance", UniqueTarget.Conditional),
|
||||
ConditionalTutorialsEnabled("if tutorials are enabled", UniqueTarget.Conditional, flags = UniqueFlag.setOfHiddenToUsers), // Hidden as no translations needed for now
|
||||
ConditionalTutorialCompleted("if tutorial [comment] is completed", UniqueTarget.Conditional, flags = UniqueFlag.setOfHiddenToUsers), // Hidden as no translations needed for now
|
||||
|
||||
@ -681,10 +687,6 @@ enum class UniqueType(
|
||||
ConditionalStartingFromEra("starting from the [era]", UniqueTarget.Conditional),
|
||||
ConditionalIfStartingInEra("if starting in the [era]", UniqueTarget.Conditional),
|
||||
|
||||
ConditionalSpeed("on [speed] game speed", UniqueTarget.Conditional),
|
||||
ConditionalVictoryEnabled("when [victoryType] Victory is enabled", UniqueTarget.Conditional),
|
||||
ConditionalVictoryDisabled("when [victoryType] Victory is disabled", UniqueTarget.Conditional),
|
||||
|
||||
ConditionalFirstCivToResearch("if no other Civilization has researched this", UniqueTarget.Conditional),
|
||||
ConditionalTech("after discovering [tech]", UniqueTarget.Conditional),
|
||||
ConditionalNoTech("before discovering [tech]", UniqueTarget.Conditional),
|
||||
@ -944,6 +946,7 @@ enum class UniqueType(
|
||||
AiChoiceWeight("[relativeAmount]% weight to this choice for AI decisions", UniqueTarget.Tech,
|
||||
UniqueTarget.Promotion, UniqueTarget.Policy, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
|
||||
@Deprecated("As of 4.13.18", ReplaceWith("Only available <when [victoryType] Victory is enabled>"))
|
||||
HiddenWithoutVictoryType("Hidden when [victoryType] Victory is disabled", UniqueTarget.Building, UniqueTarget.Unit, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
HiddenFromCivilopedia("Will not be displayed in Civilopedia", *UniqueTarget.Displayable, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
ModifierHiddenFromUsers("hidden from users", UniqueTarget.MetaModifier),
|
||||
|
@ -1556,11 +1556,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "Hidden when espionage is disabled"
|
||||
Applicable to: Building
|
||||
|
||||
??? example "Hidden when [victoryType] Victory is disabled"
|
||||
Example: "Hidden when [Domination] Victory is disabled"
|
||||
|
||||
Applicable to: Building, Unit
|
||||
|
||||
??? example "Will not be displayed in Civilopedia"
|
||||
Applicable to: Nation, Tech, Policy, FounderBelief, FollowerBelief, Building, Unit, UnitType, Promotion, Terrain, Improvement, Resource, Ruins, Speed, EventChoice
|
||||
|
||||
@ -2127,11 +2122,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "Hidden when religion is disabled"
|
||||
Applicable to: Building, Unit, Ruins, Tutorial
|
||||
|
||||
??? example "Hidden when [victoryType] Victory is disabled"
|
||||
Example: "Hidden when [Domination] Victory is disabled"
|
||||
|
||||
Applicable to: Building, Unit
|
||||
|
||||
??? example "Will not be displayed in Civilopedia"
|
||||
Applicable to: Nation, Tech, Policy, FounderBelief, FollowerBelief, Building, Unit, UnitType, Promotion, Terrain, Improvement, Resource, Ruins, Speed, EventChoice
|
||||
|
||||
@ -2758,11 +2748,6 @@ If your mod renames Coast or Lakes, do not use this with one of these as paramet
|
||||
|
||||
Modifiers that can be added to other uniques to limit when they will be active
|
||||
|
||||
??? example "<with [amount]% chance>"
|
||||
Example: "<with [3]% chance>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<every [positiveAmount] turns>"
|
||||
Example: "<every [3] turns>"
|
||||
|
||||
@ -2778,6 +2763,26 @@ If your mod renames Coast or Lakes, do not use this with one of these as paramet
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<on [speed] game speed>"
|
||||
Example: "<on [Quick] game speed>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when [victoryType] Victory is enabled>"
|
||||
Example: "<when [Domination] Victory is enabled>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when [victoryType] Victory is disabled>"
|
||||
Example: "<when [Domination] Victory is disabled>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<with [amount]% chance>"
|
||||
Example: "<with [3]% chance>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<if tutorials are enabled>"
|
||||
Applicable to: Conditional
|
||||
|
||||
@ -2841,21 +2846,6 @@ If your mod renames Coast or Lakes, do not use this with one of these as paramet
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<on [speed] game speed>"
|
||||
Example: "<on [Quick] game speed>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when [victoryType] Victory is enabled>"
|
||||
Example: "<when [Domination] Victory is enabled>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<when [victoryType] Victory is disabled>"
|
||||
Example: "<when [Domination] Victory is disabled>"
|
||||
|
||||
Applicable to: Conditional
|
||||
|
||||
??? example "<if no other Civilization has researched this>"
|
||||
Applicable to: Conditional
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user