From 39483d78bdef33ef8240b0b84fd07d44102b3cd9 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Sat, 29 Jan 2022 17:37:53 +0100 Subject: [PATCH] Resources can now again provide uniques applying to the entire civ (#6072) --- core/src/com/unciv/logic/civilization/CivilizationInfo.kt | 5 +++++ core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index f2af77cc5f..8e8cd45329 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -404,6 +404,11 @@ class CivilizationInfo { if (religionManager.religion != null) yieldAll(religionManager.religion!!.getFounderUniques().filter { it.isOfType(uniqueType) }) + yieldAll(getCivResources().asSequence() + .filter { it.amount > 0 } + .flatMap { it.resource.getMatchingUniques(uniqueType, stateForConditionals) } + ) + yieldAll(gameInfo.ruleSet.globalUniques.getMatchingUniques(uniqueType, stateForConditionals)) }.filter { diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 790454f85e..8df1d429b7 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -32,6 +32,7 @@ enum class UniqueTarget(val inheritsFrom: UniqueTarget? = null) { // These are a bit of a lie. There's no "Promotion only" or "UnitType only" uniques, // they're all just Unit uniques in different places. // So there should be no uniqueType that has a Promotion or UnitType target. + // Except meta-level uniques, such as 'incompatible with [promotion]', of course Unit, UnitType(Unit), Promotion(Unit), @@ -39,7 +40,7 @@ enum class UniqueTarget(val inheritsFrom: UniqueTarget? = null) { // Tile-specific Terrain, Improvement, - Resource, + Resource(Global), Ruins, // Other @@ -99,7 +100,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags: NullifiesStat("Nullifies [stat] [cityFilter]", UniqueTarget.Global), NullifiesGrowth("Nullifies Growth [cityFilter]", UniqueTarget.Global), - PercentProductionWonders("[amount]% Production when constructing [buildingFilter] wonders [cityFilter]", UniqueTarget.Global, UniqueTarget.Resource, UniqueTarget.FollowerBelief), + PercentProductionWonders("[amount]% Production when constructing [buildingFilter] wonders [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief), PercentProductionBuildings("[amount]% Production when constructing [buildingFilter] buildings [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief), PercentProductionUnits("[amount]% Production when constructing [baseUnitFilter] units [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),