Added uniques and deprecations for "Requires" and "Unlocked by" uniques - #6165

This commit is contained in:
Yair Morgenstern 2022-02-22 16:55:37 +02:00
parent 4ad9d58850
commit 09089cb60d
6 changed files with 49 additions and 14 deletions

View File

@ -1435,7 +1435,7 @@
"requiredTech": "Nuclear Fission", "requiredTech": "Nuclear Fission",
"requiredResource": "Uranium", "requiredResource": "Uranium",
"promotions" : ["Evasion"], "promotions" : ["Evasion"],
"uniques": ["Nuclear weapon of Strength [1]", "Requires [Manhattan Project]", "Self-destructs when attacking", "uniques": ["Nuclear weapon of Strength [1]", "Only available <if [Manhattan Project] is constructed>", "Self-destructs when attacking",
"Blast radius [2]"], "Blast radius [2]"],
"attackSound": "nuke" "attackSound": "nuke"
// Plane rather than a missile - can be based in city or Carrier only. // Plane rather than a missile - can be based in city or Carrier only.
@ -1489,7 +1489,7 @@
"range": 12, "range": 12,
"cost": 1000, "cost": 1000,
"requiredTech": "Advanced Ballistics", "requiredTech": "Advanced Ballistics",
"uniques": ["Nuclear weapon of Strength [2]", "Requires [Manhattan Project]", "uniques": ["Nuclear weapon of Strength [2]", "Only available <if [Manhattan Project] is constructed>",
"Blast radius [2]", "Consumes [2] [Uranium]"], "Blast radius [2]", "Consumes [2] [Uranium]"],
"attackSound": "nuke" "attackSound": "nuke"
}, },
@ -1685,7 +1685,7 @@
"cost": 750, "cost": 750,
"requiredTech": "Advanced Ballistics", "requiredTech": "Advanced Ballistics",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [3] per Civilization"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [3] per Civilization"]
// costs 1500 in BNW // costs 1500 in BNW
}, },
{ {
@ -1695,7 +1695,7 @@
"cost": 750, "cost": 750,
"requiredTech": "Satellites", "requiredTech": "Satellites",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [1] per Civilization"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [1] per Civilization"]
// costs 1500 in BNW // costs 1500 in BNW
}, },
{ {
@ -1705,7 +1705,7 @@
"cost": 750, "cost": 750,
"requiredTech": "Particle Physics", "requiredTech": "Particle Physics",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [1] per Civilization"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [1] per Civilization"]
// costs 1500 in BNW // costs 1500 in BNW
}, },
{ {
@ -1715,7 +1715,7 @@
"cost": 750, "cost": 750,
"requiredTech": "Nanotechnology", "requiredTech": "Nanotechnology",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [1] per Civilization"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital", "Limited to [1] per Civilization"]
// costs 1500 in BNW // costs 1500 in BNW
} }
] ]

View File

@ -1111,7 +1111,7 @@
"requiredTech": "Nuclear Fission", "requiredTech": "Nuclear Fission",
"requiredResource": "Uranium", "requiredResource": "Uranium",
"promotions" : ["Evasion"], "promotions" : ["Evasion"],
"uniques": ["Nuclear weapon of Strength [1]", "Requires [Manhattan Project]", "Self-destructs when attacking", "uniques": ["Nuclear weapon of Strength [1]", "Only available <if [Manhattan Project] is constructed>", "Self-destructs when attacking",
"Blast radius [2]"], "Blast radius [2]"],
"attackSound": "nuke" "attackSound": "nuke"
// Plane rather than a missile - can be based in city or Carrier only. // Plane rather than a missile - can be based in city or Carrier only.
@ -1165,7 +1165,7 @@
"range": 12, "range": 12,
"cost": 1000, "cost": 1000,
"requiredTech": "Advanced Ballistics", "requiredTech": "Advanced Ballistics",
"uniques": ["Nuclear weapon of Strength [2]", "Requires [Manhattan Project]", "uniques": ["Nuclear weapon of Strength [2]", "Only available <if [Manhattan Project] is constructed>",
"Blast radius [2]", "Consumes [2] [Uranium]"], "Blast radius [2]", "Consumes [2] [Uranium]"],
"attackSound": "nuke" "attackSound": "nuke"
}, },
@ -1360,7 +1360,7 @@
"cost": 500, "cost": 500,
"requiredTech": "Robotics", "requiredTech": "Robotics",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital"]
// costs 1500 in BNW // costs 1500 in BNW
}, },
{ {
@ -1370,7 +1370,7 @@
"cost": 750, "cost": 750,
"requiredTech": "Satellites", "requiredTech": "Satellites",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital"]
// costs 1500 in BNW // costs 1500 in BNW
}, },
{ {
@ -1380,7 +1380,7 @@
"cost": 750, "cost": 750,
"requiredTech": "Particle Physics", "requiredTech": "Particle Physics",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital"]
// costs 1500 in BNW // costs 1500 in BNW
}, },
{ {
@ -1390,7 +1390,7 @@
"cost": 750, "cost": 750,
"requiredTech": "Nanotechnology", "requiredTech": "Nanotechnology",
"requiredResource": "Aluminum", "requiredResource": "Aluminum",
"uniques": ["Spaceship part", "Cannot be purchased", "Requires [Apollo Program]", "Uncapturable", "Can be added to [The Spaceship] in the Capital"] "uniques": ["Spaceship part", "Cannot be purchased", "Only available <if [Apollo Program] is constructed>", "Uncapturable", "Can be added to [The Spaceship] in the Capital"]
// costs 1500 in BNW // costs 1500 in BNW
} }
] ]

View File

@ -538,7 +538,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
rejectionReasons.add(RejectionReason.RequiresTech.apply { "$requiredTech not researched!"}) rejectionReasons.add(RejectionReason.RequiresTech.apply { "$requiredTech not researched!"})
for (unique in uniqueObjects) { for (unique in uniqueObjects) {
if (unique.placeholderText != "Unlocked with []" && unique.placeholderText != "Requires []") continue if (unique.type != UniqueType.UnlockedWith && unique.type != UniqueType.Requires) continue
val filter = unique.params[0] val filter = unique.params[0]
when { when {
ruleSet.technologies.contains(filter) -> ruleSet.technologies.contains(filter) ->

View File

@ -317,6 +317,20 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
" OR \"Only available <if [buildingName/tech/resource/policy] is constructed>\"" + " OR \"Only available <if [buildingName/tech/resource/policy] is constructed>\"" +
" OR \"Only available <after discovering [buildingName/tech/resource/policy]>")) " OR \"Only available <after discovering [buildingName/tech/resource/policy]>"))
NotDisplayedWithout("Not displayed as an available construction without [buildingName/tech/resource/policy]", UniqueTarget.Building, UniqueTarget.Unit), NotDisplayedWithout("Not displayed as an available construction without [buildingName/tech/resource/policy]", UniqueTarget.Building, UniqueTarget.Unit),
@Deprecated("as of 3.19.12", ReplaceWith("Only available <after adopting [buildingName/tech/era/policy]>\"" +
" OR \"Only available <if [buildingName/tech/era/policy] is constructed>\"" +
" OR \"Only available <starting from the [buildingName/tech/era/policy]>\"" +
" OR \"Only available <after discovering [buildingName/tech/era/policy]>"))
UnlockedWith("Unlocked with [buildingName/tech/era/policy]", UniqueTarget.Building, UniqueTarget.Unit),
@Deprecated("as of 3.19.12", ReplaceWith("Only available <after adopting [buildingName/tech/era/policy]>\"" +
" OR \"Only available <if [buildingName/tech/era/policy] is constructed>\"" +
" OR \"Only available <starting from the [buildingName/tech/era/policy]>\"" +
" OR \"Only available <after discovering [buildingName/tech/era/policy]>"))
Requires("Requires [buildingName/tech/era/policy]", UniqueTarget.Building, UniqueTarget.Unit),
ConvertFoodToProductionWhenConstructed("Excess Food converted to Production when under construction", UniqueTarget.Building, UniqueTarget.Unit), ConvertFoodToProductionWhenConstructed("Excess Food converted to Production when under construction", UniqueTarget.Building, UniqueTarget.Unit),
RequiresPopulation("Requires at least [amount] population", UniqueTarget.Building, UniqueTarget.Unit), RequiresPopulation("Requires at least [amount] population", UniqueTarget.Building, UniqueTarget.Unit),

View File

@ -393,7 +393,8 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
if (!civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled && isNuclearWeapon()) if (!civInfo.gameInfo.gameParameters.nuclearWeaponsEnabled && isNuclearWeapon())
rejectionReasons.add(RejectionReason.DisabledBySetting) rejectionReasons.add(RejectionReason.DisabledBySetting)
for (unique in getMatchingUniques("Unlocked with []") + getMatchingUniques("Requires []")) { // This should be deprecated and replaced with the already-existing "only available when" unique, see above
for (unique in getMatchingUniques(UniqueType.UnlockedWith) + getMatchingUniques(UniqueType.Requires)) {
val filter = unique.params[0] val filter = unique.params[0]
when { when {
ruleSet.technologies.contains(filter) -> ruleSet.technologies.contains(filter) ->

View File

@ -837,6 +837,21 @@ Example: "Obsolete with [Agriculture]"
Applicable to: Building, Improvement, Resource Applicable to: Building, Improvement, Resource
#### Indicates the capital city
Applicable to: Building
#### Provides 1 extra copy of each improved luxury resource near this City
Applicable to: Building
#### Destroyed when the city is captured
Applicable to: Building
#### Never destroyed when the city is captured
Applicable to: Building
#### Doubles Gold given to enemy if city is captured
Applicable to: Building
#### Remove extra unhappiness from annexed cities #### Remove extra unhappiness from annexed cities
Applicable to: Building Applicable to: Building
@ -1237,6 +1252,9 @@ Applicable to: Improvement
#### Indestructible #### Indestructible
Applicable to: Improvement Applicable to: Improvement
#### Irremovable
Applicable to: Improvement
## Resource uniques ## Resource uniques
#### Generated with weight [amount] #### Generated with weight [amount]
Example: "Generated with weight [20]" Example: "Generated with weight [20]"
@ -1634,6 +1652,8 @@ Applicable to: Conditional
- "+50% attacking strength for cities with garrisoned units" - Deprecated Extremely old - used for auto-updates only, replace with "[+50]% Strength for cities <with a garrison> <when attacking>" - "+50% attacking strength for cities with garrisoned units" - Deprecated Extremely old - used for auto-updates only, replace with "[+50]% Strength for cities <with a garrison> <when attacking>"
- "Incompatible with [policy/tech/promotion]" - Deprecated as of 3.19.8, replace with "Only available <before adopting [policy/tech/promotion]>" OR "Only available <before discovering [policy/tech/promotion]>" OR "Only available <for units without [policy/tech/promotion]>" - "Incompatible with [policy/tech/promotion]" - Deprecated as of 3.19.8, replace with "Only available <before adopting [policy/tech/promotion]>" OR "Only available <before discovering [policy/tech/promotion]>" OR "Only available <for units without [policy/tech/promotion]>"
- "Not displayed as an available construction without [buildingName/tech/resource/policy]" - Deprecated as of 3.19.8, replace with "Only available <after adopting [buildingName/tech/resource/policy]>" OR "Only available <with [buildingName/tech/resource/policy]>" OR "Only available <if [buildingName/tech/resource/policy] is constructed>" OR "Only available <after discovering [buildingName/tech/resource/policy]>" - "Not displayed as an available construction without [buildingName/tech/resource/policy]" - Deprecated as of 3.19.8, replace with "Only available <after adopting [buildingName/tech/resource/policy]>" OR "Only available <with [buildingName/tech/resource/policy]>" OR "Only available <if [buildingName/tech/resource/policy] is constructed>" OR "Only available <after discovering [buildingName/tech/resource/policy]>"
- "Unlocked with [buildingName/tech/era/policy]" - Deprecated as of 3.19.12, replace with "Only available <after adopting [buildingName/tech/era/policy]>" OR "Only available <if [buildingName/tech/era/policy] is constructed>" OR "Only available <starting from the [buildingName/tech/era/policy]>" OR "Only available <after discovering [buildingName/tech/era/policy]>"
- "Requires [buildingName/tech/era/policy]" - Deprecated as of 3.19.12, replace with "Only available <after adopting [buildingName/tech/era/policy]>" OR "Only available <if [buildingName/tech/era/policy] is constructed>" OR "Only available <starting from the [buildingName/tech/era/policy]>" OR "Only available <after discovering [buildingName/tech/era/policy]>"
- "Cannot be built with [buildingName]" - Deprecated as of 3.19.9, replace with "Only available <in cities without a [buildingName]>" - "Cannot be built with [buildingName]" - Deprecated as of 3.19.9, replace with "Only available <in cities without a [buildingName]>"
- "Requires a [buildingName] in this city" - Deprecated as of 3.19.9, replace with "Only available <in cities with a [buildingName]>" - "Requires a [buildingName] in this city" - Deprecated as of 3.19.9, replace with "Only available <in cities with a [buildingName]>"
- "[stats] with [resource]" - Deprecated as of 3.19.7, replace with "[stats] <with [resource]>" - "[stats] with [resource]" - Deprecated as of 3.19.7, replace with "[stats] <with [resource]>"