From 0f97c5eb59dd7824252af83312c02648556192b5 Mon Sep 17 00:00:00 2001 From: HadeanLake <69697985+HadeanLake@users.noreply.github.com> Date: Sat, 26 Sep 2020 20:59:22 +0300 Subject: [PATCH] parameterized few uniques, fixed "Mass Media" tech in mods (#3184) * parameterized "Culture cost of adopting new Policies reduced by [10]%" and "Each city founded increases culture cost of policies [33]% less than normal" * removed old fix for abcense of "Mass Media" tech so mods can have this tech --- .../jsons/Civ V - Vanilla/Buildings.json | 2 +- .../jsons/Civ V - Vanilla/Policies.json | 4 ++-- .../unciv/logic/civilization/PolicyManager.kt | 7 ++++++ .../unciv/logic/civilization/TechManager.kt | 23 ------------------- 4 files changed, 10 insertions(+), 26 deletions(-) diff --git a/android/assets/jsons/Civ V - Vanilla/Buildings.json b/android/assets/jsons/Civ V - Vanilla/Buildings.json index 1a246d6a0d..f47216e8b6 100644 --- a/android/assets/jsons/Civ V - Vanilla/Buildings.json +++ b/android/assets/jsons/Civ V - Vanilla/Buildings.json @@ -896,7 +896,7 @@ "culture": 5, "isWonder": true, "greatPersonPoints": {"culture": 2}, - "uniques": ["Culture cost of adopting new Policies reduced by 10%"], + "uniques": ["Culture cost of adopting new Policies reduced by [10]%"], "requiredTech": "Flight", "quote": "'Come to me, all who labor and are heavy burdened, and I will give you rest.' - New Testament, Matthew 11:28" }, diff --git a/android/assets/jsons/Civ V - Vanilla/Policies.json b/android/assets/jsons/Civ V - Vanilla/Policies.json index dc19efc218..190dea8aac 100644 --- a/android/assets/jsons/Civ V - Vanilla/Policies.json +++ b/android/assets/jsons/Civ V - Vanilla/Policies.json @@ -80,7 +80,7 @@ { "name": "Representation", "effect": "Each city founded increases culture cost of policies 33% less than normal. Starts a golden age.", - "uniques": ["Each city founded increases culture cost of policies 33% less than normal", "Empire enters golden age"], + "uniques": ["Each city founded increases culture cost of policies [33]% less than normal", "Empire enters golden age"], "requires": ["Citizenship"], "row": 2, "column": 3 @@ -199,7 +199,7 @@ { "name": "Piety Complete", "effect": "Reduce culture cost of future policies by 10%", - "uniques": ["Culture cost of adopting new Policies reduced by 10%"] + "uniques": ["Culture cost of adopting new Policies reduced by [10]%"] } ] },/*{ diff --git a/core/src/com/unciv/logic/civilization/PolicyManager.kt b/core/src/com/unciv/logic/civilization/PolicyManager.kt index 8ab5b39388..6d57f3b90d 100644 --- a/core/src/com/unciv/logic/civilization/PolicyManager.kt +++ b/core/src/com/unciv/logic/civilization/PolicyManager.kt @@ -76,10 +76,17 @@ class PolicyManager { var policyCultureCost = 25 + (numberOfAdoptedPolicies * 6).toDouble().pow(1.7) var cityModifier = 0.3f * (civInfo.cities.count { !it.isPuppet } - 1) + // As of 3.10.11 These are to be deprecated. Keeping it here so that mods with this can still work for now. + // Use "Culture cost of adopting new Policies reduced by [10]%" and "Each city founded increases culture cost of policies [33]% less than normal" instead if (civInfo.hasUnique("Each city founded increases culture cost of policies 33% less than normal")) cityModifier *= (2 / 3f) for(unique in civInfo.getMatchingUniques("Culture cost of adopting new Policies reduced by 10%")) policyCultureCost *= 0.9 + + for (unique in civInfo.getMatchingUniques("Each city founded increases culture cost of policies []% less than normal")) + cityModifier *= 1 - unique.params[0].toFloat() / 100 + for (unique in civInfo.getMatchingUniques("Culture cost of adopting new Policies reduced by []%")) + policyCultureCost *= 1 - unique.params[0].toFloat() / 100 if (civInfo.isPlayerCivilization()) policyCultureCost *= civInfo.getDifficulty().policyCostModifier policyCultureCost *= civInfo.gameInfo.gameParameters.gameSpeed.modifier diff --git a/core/src/com/unciv/logic/civilization/TechManager.kt b/core/src/com/unciv/logic/civilization/TechManager.kt index fbde51e421..9503d030fc 100644 --- a/core/src/com/unciv/logic/civilization/TechManager.kt +++ b/core/src/com/unciv/logic/civilization/TechManager.kt @@ -290,29 +290,6 @@ class TechManager { } fun setTransients() { - // As of 2.10.16, removed mass media, since our tech tree is like G&K - techsResearched.remove("Mass Media") - techsToResearch.remove("Mass Media") - techsInProgress.remove("Mass Media") - - // As of 2.13.15, "Replacable parts" is renamed to "Replaceable Parts" - val badTechName = "Replacable Parts" - val goodTechName = "Replaceable Parts" - if (techsResearched.contains(badTechName)) { - techsResearched.remove(badTechName) - techsResearched.add(goodTechName) - } - if (techsInProgress.containsKey(badTechName)) { - techsInProgress[goodTechName] = techsInProgress[badTechName]!! - techsInProgress.remove(badTechName) - } - if (techsToResearch.contains(badTechName)) { - val newTechToReseach = ArrayList() - for (tech in techsToResearch) - newTechToReseach.add(if (tech != badTechName) tech else goodTechName) - techsToResearch = newTechToReseach - } - researchedTechnologies.addAll(techsResearched.map { getRuleset().technologies[it]!! }) researchedTechUniques.addAll(researchedTechnologies.flatMap { it.uniques }) updateTransientBooleans()