From 2c96c6f244733a624db4c6b8d9cfe36b15440785 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Tue, 20 Feb 2024 22:25:16 +0100 Subject: [PATCH] ConditionalWhileResearching as suggested by @woo1127 (#11156) --- core/src/com/unciv/models/ruleset/unique/Conditionals.kt | 1 + core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 2 ++ docs/Modders/uniques.md | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/core/src/com/unciv/models/ruleset/unique/Conditionals.kt b/core/src/com/unciv/models/ruleset/unique/Conditionals.kt index 312b31b35e..2fefcd8b54 100644 --- a/core/src/com/unciv/models/ruleset/unique/Conditionals.kt +++ b/core/src/com/unciv/models/ruleset/unique/Conditionals.kt @@ -142,6 +142,7 @@ object Conditionals { UniqueType.ConditionalIfStartingInEra -> checkOnGameInfo { gameParameters.startingEra == condition.params[0] } UniqueType.ConditionalTech -> checkOnCiv { tech.isResearched(condition.params[0]) } UniqueType.ConditionalNoTech -> checkOnCiv { !tech.isResearched(condition.params[0]) } + UniqueType.ConditionalWhileResearching -> checkOnCiv { tech.currentTechnologyName() == condition.params[0] } UniqueType.ConditionalAfterPolicyOrBelief -> checkOnCiv { policies.isAdopted(condition.params[0]) || religionManager.religion?.hasBelief(condition.params[0]) == true } diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 2cb202fcef..cbdb508eb3 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -634,6 +634,8 @@ enum class UniqueType( ConditionalFirstCivToResearch("if no other Civilization has researched this", UniqueTarget.Conditional), ConditionalTech("after discovering [tech]", UniqueTarget.Conditional), ConditionalNoTech("before discovering [tech]", UniqueTarget.Conditional), + ConditionalWhileResearching("while researching [tech]", UniqueTarget.Conditional, + docDescription = "This condition is fulfilled while the technology is actively being researched (it is the one research points are added to)"), ConditionalFirstCivToAdopt("if no other Civilization has adopted this", UniqueTarget.Conditional), ConditionalAfterPolicyOrBelief("after adopting [policy/belief]", UniqueTarget.Conditional), diff --git a/docs/Modders/uniques.md b/docs/Modders/uniques.md index 7ade215789..94c96f1662 100644 --- a/docs/Modders/uniques.md +++ b/docs/Modders/uniques.md @@ -1937,6 +1937,12 @@ Due to performance considerations, this unique is cached, thus conditionals may Applicable to: Conditional +??? example "<while researching [tech]>" + This condition is fulfilled while the technology is actively being researched (it is the one research points are added to) + Example: "<while researching [Agriculture]>" + + Applicable to: Conditional + ??? example "<if no other Civilization has adopted this>" Applicable to: Conditional