Added before/after X turns conditionals - see #3242

This commit is contained in:
Yair Morgenstern 2022-11-07 22:56:58 +02:00
parent 3e05b875bd
commit c98a36c10f
5 changed files with 21 additions and 10 deletions

View File

@ -20,7 +20,7 @@
{
"name": "your exploring unit receives training",
"notification": "An ancient tribe trained us in their ways of combat!",
"uniques": ["This Unit gains [10] XP", "Only available after [10] turns"]
"uniques": ["This Unit gains [10] XP", "Only available <after [10] turns>"]
},
{
"name": "survivors (adds population to a city)",
@ -58,14 +58,14 @@
{
"name": "discover holy symbols",
"notification": "We have found holy symbols in the ruins, giving us a deeper understanding of religion! (+[faithAmount] Faith)",
"uniques": ["Hidden when religion is disabled", "Gain enough Faith for a Pantheon", "Only available <before founding a Pantheon>", "Only available after [20] turns"],
"uniques": ["Hidden when religion is disabled", "Gain enough Faith for a Pantheon", "Only available <before founding a Pantheon>", "Only available <after [20] turns>"],
"color": "#CDDDF4"
},
{
"name": "an ancient prophecy",
"notification": "We have found an ancient prophecy in the ruins, greatly increasing our spiritual connection! (+[faithAmount] Faith)",
"uniques": ["Hidden when religion is disabled", "Gain enough Faith for [33]% of a Great Prophet", "Hidden after generating a Great Prophet",
"Only available <after founding a Pantheon>", "Only available after [20] turns"],
"Only available <after founding a Pantheon>", "Only available <after [20] turns>"],
"color": "#CDDDF4"
}
]

View File

@ -20,7 +20,7 @@
{
"name": "your exploring unit receives training",
"notification": "An ancient tribe trained us in their ways of combat!",
"uniques": ["This Unit gains [10] XP", "Only available after [10] turns"]
"uniques": ["This Unit gains [10] XP", "Only available <after [10] turns>"]
},
{
"name": "survivors (adds population to a city)",

View File

@ -142,6 +142,9 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
UniqueType.ConditionalTimedUnique -> true
UniqueType.ConditionalConsumeUnit -> true
UniqueType.ConditionalBeforeTurns -> state.civInfo != null && state.civInfo.gameInfo.turns < condition.params[0].toInt()
UniqueType.ConditionalAfterTurns -> state.civInfo != null && state.civInfo.gameInfo.turns >= condition.params[0].toInt()
UniqueType.ConditionalChance -> stateBasedRandom.nextFloat() < condition.params[0].toFloat() / 100f
UniqueType.ConditionalWar -> state.civInfo?.isAtWar() == true

View File

@ -585,6 +585,9 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
ConditionalConsumeUnit("by consuming this unit", UniqueTarget.Conditional),
ConditionalChance("with [amount]% chance", UniqueTarget.Conditional),
ConditionalBeforeTurns("before [amount] turns", UniqueTarget.Conditional),
ConditionalAfterTurns("after [amount] turns", UniqueTarget.Conditional),
/////// civ conditionals
ConditionalWar("when at war", UniqueTarget.Conditional),
ConditionalNotWar("when not at war", UniqueTarget.Conditional),
@ -694,7 +697,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
//endregion
///////////////////////////////////////////// region META /////////////////////////////////////////////
@Deprecated("as of 4.2.18", ReplaceWith("Only available <after [amount] turns>"))
AvailableAfterCertainTurns("Only available after [amount] turns", UniqueTarget.Ruins),
HiddenWithoutReligion("Hidden when religion is disabled", UniqueTarget.Unit, UniqueTarget.Building, UniqueTarget.Ruins, flags = UniqueFlag.setOfHiddenToUsers),

View File

@ -1619,11 +1619,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
??? example "This Unit upgrades for free including special upgrades"
Applicable to: Ruins
??? example "Only available after [amount] turns"
Example: "Only available after [3] turns"
Applicable to: Ruins
??? example "Hidden after generating a Great Prophet"
Applicable to: Ruins
@ -1665,6 +1660,16 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
Applicable to: Conditional
??? example "&lt;before [amount] turns&gt;"
Example: "&lt;before [3] turns&gt;"
Applicable to: Conditional
??? example "&lt;after [amount] turns&gt;"
Example: "&lt;after [3] turns&gt;"
Applicable to: Conditional
??? example "&lt;when at war&gt;"
Applicable to: Conditional