From 3e05b875bd6455a5e92d993ea86dfcc22da9698a Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 7 Nov 2022 22:39:55 +0200 Subject: [PATCH] Added before/after Pantheon conditionals - see #3242 --- .../assets/jsons/Civ V - Gods & Kings/Ruins.json | 5 +++-- .../civilization/RuinsManager/RuinsManager.kt | 1 + core/src/com/unciv/models/ruleset/unique/Unique.kt | 5 +++++ .../com/unciv/models/ruleset/unique/UniqueType.kt | 6 ++++++ core/src/com/unciv/ui/options/ModCheckTab.kt | 2 ++ docs/Modders/uniques.md | 14 +++++++------- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/android/assets/jsons/Civ V - Gods & Kings/Ruins.json b/android/assets/jsons/Civ V - Gods & Kings/Ruins.json index c84af54b09..0864494b24 100644 --- a/android/assets/jsons/Civ V - Gods & Kings/Ruins.json +++ b/android/assets/jsons/Civ V - Gods & Kings/Ruins.json @@ -58,13 +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", "Hidden after founding a Pantheon", "Only available after [20] turns"], + "uniques": ["Hidden when religion is disabled", "Gain enough Faith for a Pantheon", "Only available ", "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", "Hidden before founding a Pantheon", "Only available after [20] turns"], + "uniques": ["Hidden when religion is disabled", "Gain enough Faith for [33]% of a Great Prophet", "Hidden after generating a Great Prophet", + "Only available ", "Only available after [20] turns"], "color": "#CDDDF4" } ] diff --git a/core/src/com/unciv/logic/civilization/RuinsManager/RuinsManager.kt b/core/src/com/unciv/logic/civilization/RuinsManager/RuinsManager.kt index ba3504da1e..91eeb2e13e 100644 --- a/core/src/com/unciv/logic/civilization/RuinsManager/RuinsManager.kt +++ b/core/src/com/unciv/logic/civilization/RuinsManager/RuinsManager.kt @@ -49,6 +49,7 @@ class RuinsManager : IsPartOfGameInfoSerialization { if (possibleReward.hasUnique(UniqueType.HiddenAfterGreatProphet) && (civInfo.civConstructions.boughtItemsWithIncreasingPrice[civInfo.religionManager.getGreatProphetEquivalent()] ?: 0) > 0 ) continue + if (possibleReward.hasUnique(UniqueType.HiddenAfterPantheon) && civInfo.religionManager.religionState >= ReligionState.Pantheon) continue if (possibleReward.hasUnique(UniqueType.HiddenBeforePantheon) && civInfo.religionManager.religionState == ReligionState.None) diff --git a/core/src/com/unciv/models/ruleset/unique/Unique.kt b/core/src/com/unciv/models/ruleset/unique/Unique.kt index 4fffaaf319..4040f91f7f 100644 --- a/core/src/com/unciv/models/ruleset/unique/Unique.kt +++ b/core/src/com/unciv/models/ruleset/unique/Unique.kt @@ -6,6 +6,7 @@ import com.unciv.logic.battle.CombatAction import com.unciv.logic.battle.MapUnitCombatant import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.CivilizationInfo +import com.unciv.logic.civilization.ReligionState import com.unciv.models.ruleset.Ruleset import com.unciv.models.stats.Stats import com.unciv.models.translations.getConditionals @@ -173,6 +174,10 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s state.civInfo != null && state.civInfo.policies.isAdopted(condition.params[0]) UniqueType.ConditionalNoPolicy -> state.civInfo != null && !state.civInfo.policies.isAdopted(condition.params[0]) + UniqueType.ConditionalBeforePantheon -> + state.civInfo != null && state.civInfo.religionManager.religionState == ReligionState.None + UniqueType.ConditionalAfterPantheon -> + state.civInfo != null && state.civInfo.religionManager.religionState != ReligionState.None UniqueType.ConditionalBuildingBuilt -> state.civInfo != null && state.civInfo.cities.any { it.cityConstructions.containsBuildingOrEquivalent(condition.params[0]) } diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 68a2edbda3..8c564f916b 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -607,6 +607,9 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags: ConditionalPolicy("after adopting [policy]", UniqueTarget.Conditional), ConditionalNoPolicy("before adopting [policy]", UniqueTarget.Conditional), + ConditionalBeforePantheon("before founding a Pantheon", UniqueTarget.Conditional), + ConditionalAfterPantheon("after founding a Pantheon", UniqueTarget.Conditional), + ConditionalBuildingBuilt("if [buildingName] is constructed", UniqueTarget.Conditional), ConditionalWithResource("with [resource]", UniqueTarget.Conditional), ConditionalWithoutResource("without [resource]", UniqueTarget.Conditional), @@ -694,7 +697,10 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags: AvailableAfterCertainTurns("Only available after [amount] turns", UniqueTarget.Ruins), HiddenWithoutReligion("Hidden when religion is disabled", UniqueTarget.Unit, UniqueTarget.Building, UniqueTarget.Ruins, flags = UniqueFlag.setOfHiddenToUsers), + + @Deprecated("as of 4.2.18", ReplaceWith("Only available ")) HiddenBeforePantheon("Hidden before founding a Pantheon", UniqueTarget.Ruins), + @Deprecated("as of 4.2.18", ReplaceWith("Only available ")) HiddenAfterPantheon("Hidden after founding a Pantheon", UniqueTarget.Ruins), HiddenAfterGreatProphet("Hidden after generating a Great Prophet", UniqueTarget.Ruins), HiddenWithoutVictoryType("Hidden when [victoryType] Victory is disabled", UniqueTarget.Building, UniqueTarget.Unit, flags = UniqueFlag.setOfHiddenToUsers), diff --git a/core/src/com/unciv/ui/options/ModCheckTab.kt b/core/src/com/unciv/ui/options/ModCheckTab.kt index fc3058cd01..4aa93d83ce 100644 --- a/core/src/com/unciv/ui/options/ModCheckTab.kt +++ b/core/src/com/unciv/ui/options/ModCheckTab.kt @@ -170,6 +170,7 @@ class ModCheckTab( mod.unitPromotions, mod.unitTypes, mod.units, + mod.ruinRewards ) val allDeprecatedUniques = HashSet() val deprecatedUniquesToReplacementText = HashMap() @@ -238,6 +239,7 @@ class ModCheckTab( "UnitPromotions.json", "UnitTypes.json", "Units.json", + "Ruins.json" ) val jsonFolder = mod.folderLocation!!.child("jsons") diff --git a/docs/Modders/uniques.md b/docs/Modders/uniques.md index 302e4ceadd..0a151d9171 100644 --- a/docs/Modders/uniques.md +++ b/docs/Modders/uniques.md @@ -815,7 +815,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl Applicable to: Tech ??? example "Only available" - Applicable to: Tech, Policy, Building, Unit, Promotion, Improvement + Applicable to: Tech, Policy, Building, Unit, Promotion, Improvement, Ruins ??? example "Cannot be hurried" Applicable to: Tech, Building @@ -1624,12 +1624,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl Applicable to: Ruins -??? example "Hidden before founding a Pantheon" - Applicable to: Ruins - -??? example "Hidden after founding a Pantheon" - Applicable to: Ruins - ??? example "Hidden after generating a Great Prophet" Applicable to: Ruins @@ -1739,6 +1733,12 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl Applicable to: Conditional +??? example "<before founding a Pantheon>" + Applicable to: Conditional + +??? example "<after founding a Pantheon>" + Applicable to: Conditional + ??? example "<if [buildingName] is constructed>" Example: "<if [Library] is constructed>"