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
This commit is contained in:
HadeanLake
2020-09-26 20:59:22 +03:00
committed by GitHub
parent 33270baea2
commit 0f97c5eb59
4 changed files with 10 additions and 26 deletions

View File

@ -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"
},

View File

@ -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]%"]
}
]
},/*{

View File

@ -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

View File

@ -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<String>()
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()