From 6617504c057fde0b1fc16cf7a6cdd1dbf91c68e0 Mon Sep 17 00:00:00 2001 From: PLynx Date: Thu, 30 Nov 2023 18:12:39 +0100 Subject: [PATCH] Stats per Stat unique (#10591) * Added Stats per Stat unique * Applied the suggestions of @yairm210 --- .../logic/civilization/transients/CivInfoStatsForNextTurn.kt | 5 +++++ core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 2 +- docs/Modders/uniques.md | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/civilization/transients/CivInfoStatsForNextTurn.kt b/core/src/com/unciv/logic/civilization/transients/CivInfoStatsForNextTurn.kt index beae33854e..272b3d5f85 100644 --- a/core/src/com/unciv/logic/civilization/transients/CivInfoStatsForNextTurn.kt +++ b/core/src/com/unciv/logic/civilization/transients/CivInfoStatsForNextTurn.kt @@ -311,6 +311,11 @@ class CivInfoStatsForNextTurn(val civInfo: Civilization) { if (unique.sourceObjectType != UniqueTarget.Building && unique.sourceObjectType != UniqueTarget.Wonder) statMap.add(unique.sourceObjectType!!.name, unique.stats) + for (unique in civInfo.getMatchingUniques(UniqueType.StatsPerStat)) { + val amount = civInfo.getStatReserve(Stat.valueOf(unique.params[2])) / unique.params[1].toInt() + statMap.add("Stats", unique.stats.times(amount)) + } + val statsPerNaturalWonder = Stats(happiness = 1f) for (unique in civInfo.getMatchingUniques(UniqueType.StatsFromNaturalWonders)) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index ab490f02a0..1d96aefe8a 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -28,7 +28,7 @@ enum class UniqueType( StatsFromSpecialist("[stats] from every specialist [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief), StatsPerPopulation("[stats] per [amount] population [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief), StatsPerPolicies("[stats] per [amount] social policies adopted", UniqueTarget.Global), - + StatsPerStat("[stats] per every [amount] [civWideStat]", UniqueTarget.Global), StatsFromCitiesOnSpecificTiles("[stats] in cities on [terrainFilter] tiles", UniqueTarget.Global, UniqueTarget.FollowerBelief), StatsFromBuildings("[stats] from all [buildingFilter] buildings", UniqueTarget.Global, UniqueTarget.FollowerBelief), diff --git a/docs/Modders/uniques.md b/docs/Modders/uniques.md index b1354e0d22..eb2e3fa8bc 100644 --- a/docs/Modders/uniques.md +++ b/docs/Modders/uniques.md @@ -210,6 +210,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl Applicable to: Global +??? example "[stats] per every [amount] [civWideStat]" + Example: "[+1 Gold, +2 Production] per every [3] [Gold]" + + Applicable to: Global + ??? example "[stats] in cities on [terrainFilter] tiles" Example: "[+1 Gold, +2 Production] in cities on [Fresh Water] tiles"