From 8aab8f71e4105fcd6a91bd93123c2562bda0ce1d Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 25 Jan 2024 22:49:34 +0200 Subject: [PATCH] Replaced special "hidden after generating a Great Prophet" with a more multi-purpose conditional --- android/assets/jsons/Civ V - Gods & Kings/Ruins.json | 2 +- core/src/com/unciv/models/ruleset/unique/Unique.kt | 6 ++++++ core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/android/assets/jsons/Civ V - Gods & Kings/Ruins.json b/android/assets/jsons/Civ V - Gods & Kings/Ruins.json index 5a19dea5ea..4fa79b258d 100644 --- a/android/assets/jsons/Civ V - Gods & Kings/Ruins.json +++ b/android/assets/jsons/Civ V - Gods & Kings/Ruins.json @@ -64,7 +64,7 @@ { "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", + "uniques": ["Hidden when religion is disabled", "Gain enough Faith for [33]% of a Great Prophet", "Unavailable ", "Only available ", "Only available "], "color": "#CDDDF4" } diff --git a/core/src/com/unciv/models/ruleset/unique/Unique.kt b/core/src/com/unciv/models/ruleset/unique/Unique.kt index e0dfad21e7..c0d54d2fe4 100644 --- a/core/src/com/unciv/models/ruleset/unique/Unique.kt +++ b/core/src/com/unciv/models/ruleset/unique/Unique.kt @@ -260,12 +260,14 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s checkOnCiv { stats.happiness in condition.params[0].toInt() until condition.params[1].toInt() } UniqueType.ConditionalBelowHappiness -> checkOnCiv { stats.happiness < condition.params[0].toInt() } UniqueType.ConditionalGoldenAge -> checkOnCiv { goldenAges.isGoldenAge() } + UniqueType.ConditionalBeforeEra -> compareEra(condition.params[0]) { current, param -> current < param } UniqueType.ConditionalStartingFromEra -> compareEra(condition.params[0]) { current, param -> current >= param } UniqueType.ConditionalDuringEra -> compareEra(condition.params[0]) { current, param -> current == param } UniqueType.ConditionalIfStartingInEra -> checkOnCiv { gameInfo.gameParameters.startingEra == condition.params[0] } UniqueType.ConditionalTech -> checkOnCiv { tech.isResearched(condition.params[0]) } UniqueType.ConditionalNoTech -> checkOnCiv { !tech.isResearched(condition.params[0]) } + UniqueType.ConditionalAfterPolicyOrBelief -> checkOnCiv { policies.isAdopted(condition.params[0]) || religionManager.religion?.hasBelief(condition.params[0]) == true } UniqueType.ConditionalBeforePolicyOrBelief -> @@ -282,6 +284,9 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s checkOnCiv { religionManager.religionState < ReligionState.EnhancedReligion } UniqueType.ConditionalAfterEnhancingReligion -> checkOnCiv { religionManager.religionState >= ReligionState.EnhancedReligion } + UniqueType.ConditionalAfterGeneratingGreatProphet -> + checkOnCiv { religionManager.greatProphetsEarned() > 0 } + UniqueType.ConditionalBuildingBuilt -> checkOnCiv { cities.any { it.cityConstructions.containsBuildingOrEquivalent(condition.params[0]) } } UniqueType.ConditionalBuildingBuiltByAnybody -> @@ -314,6 +319,7 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s UniqueType.ConditionalHasNotUsedOtherActions -> state.unit == null || // So we get the action as a valid action in BaseUnit.hasUnique() state.unit.abilityToTimesUsed.isEmpty() + UniqueType.ConditionalInTiles -> relevantTile?.matchesFilter(condition.params[0], state.civInfo) == true UniqueType.ConditionalInTilesNot -> diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index da10ecfcdb..76dc72f439 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -638,6 +638,7 @@ enum class UniqueType( ConditionalAfterReligion("after founding a religion", UniqueTarget.Conditional), ConditionalBeforeEnhancingReligion("before enhancing a religion", UniqueTarget.Conditional), ConditionalAfterEnhancingReligion("after enhancing a religion", UniqueTarget.Conditional), + ConditionalAfterGeneratingGreatProphet("after generating a Great Prophet", UniqueTarget.Conditional), ConditionalBuildingBuilt("if [buildingFilter] is constructed", UniqueTarget.Conditional), ConditionalBuildingBuiltByAnybody("if [buildingFilter] is constructed by anybody", UniqueTarget.Conditional), @@ -794,6 +795,7 @@ enum class UniqueType( UniqueTarget.Unit, UniqueTarget.Building, UniqueTarget.Ruins, UniqueTarget.Tutorial, flags = UniqueFlag.setOfHiddenToUsers), + @Deprecated("as of 4.9.0", ReplaceWith("Unavailable ")) HiddenAfterGreatProphet("Hidden after generating a Great Prophet", UniqueTarget.Ruins), 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),