Updated Liberty branch to G&K (#4115)

* Updated Liberty branch to G&K, improved modularity of uniques

* Updated meritocracy to only affect non-occupied cities

* Implemented requsted changes
This commit is contained in:
Xander Lenstra 2021-06-13 07:06:35 +02:00 committed by GitHub
parent 583bca56b8
commit 60809db065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 22 deletions

View File

@ -136,7 +136,7 @@
"culture": 1, "culture": 1,
"greatPersonPoints": {"production": 1}, "greatPersonPoints": {"production": 1},
"isWonder": true, "isWonder": true,
"uniques": ["Worker construction increased 25%","[2] free [Worker] units appear"], "uniques": ["-[25]% tile improvement construction time","[2] free [Worker] units appear"],
"requiredTech": "Masonry", "requiredTech": "Masonry",
"quote": "'O, let not the pains of death which come upon thee enter into my body. I am the god Tem, and I am the foremost part of the sky, and the power which protecteth me is that which is with all the gods forever.' - The Book of the Dead, translated by Sir Ernest Alfred Wallis Budge" "quote": "'O, let not the pains of death which come upon thee enter into my body. I am the god Tem, and I am the foremost part of the sky, and the power which protecteth me is that which is with all the gods forever.' - The Book of the Dead, translated by Sir Ernest Alfred Wallis Budge"
}, },

View File

@ -48,21 +48,21 @@
"uniques": ["[+1 Culture] [in all cities]"], "uniques": ["[+1 Culture] [in all cities]"],
"policies": [ "policies": [
{ {
"name": "Collective Rule", "name": "Republic",
"uniques": ["+[50]% Production when constructing [Settler] units [in capital]", "Free [Settler] appears"], "uniques": ["[+1 Production] [in all cities]", "+[5]% Production when constructing [Buildings]"],
"row": 1, "row": 1,
"column": 1 "column": 1
}, },
{ {
"name": "Citizenship", "name": "Citizenship",
"uniques": ["Tile improvement speed +25%", "Free [Worker] appears"], "uniques": ["-[25]% tile improvement construction time", "Free [Worker] appears"],
"row": 1, "row": 1,
"column": 4 "column": 4
}, },
{ {
"name": "Republic", "name": "Collective Rule",
"uniques": ["[+1 Production] [in all cities]", "+[5]% Production when constructing [Buildings]"], "uniques": ["+[50]% Production when constructing [Settler] units [in capital]", "Free [Settler] appears"],
"requires": ["Collective Rule"], "requires": ["Republic"],
"row": 2, "row": 2,
"column": 1 "column": 1
}, },
@ -75,7 +75,7 @@
}, },
{ {
"name": "Meritocracy", "name": "Meritocracy",
"uniques": ["[+1 Happiness] [in all cities connected to capital]", "Unhappiness from population decreased by [5]%"], "uniques": ["[+1 Happiness] [in all cities connected to capital]", "Unhappiness from population decreased by [5]% [in all non-occupied cities]"],
"requires": ["Citizenship"], "requires": ["Citizenship"],
"row": 2, "row": 2,
"column": 5 "column": 5

View File

@ -467,14 +467,15 @@ class CityInfo {
} }
fun matchesFilter(filter: String): Boolean { fun matchesFilter(filter: String): Boolean {
return when { return when (filter) {
filter == "in this city" -> true "in this city" -> true
filter == "in all cities" -> true "in all cities" -> true
filter == "in all coastal cities" && getCenterTile().isCoastalTile() -> true "in all coastal cities" -> getCenterTile().isCoastalTile()
filter == "in capital" && isCapital() -> true "in capital" -> isCapital()
filter == "in all cities with a world wonder" && cityConstructions.getBuiltBuildings().any { it.isWonder } -> true "in all non-occupied cities" -> !cityStats.hasExtraAnnexUnhappiness() || isPuppet
filter == "in all cities connected to capital" -> isConnectedToCapital() "in all cities with a world wonder" -> cityConstructions.getBuiltBuildings().any { it.isWonder }
filter == "in all cities with a garrison" && getCenterTile().militaryUnit != null -> true "in all cities connected to capital" -> isConnectedToCapital()
"in all cities with a garrison" -> getCenterTile().militaryUnit != null
else -> false else -> false
} }
} }

View File

@ -196,6 +196,10 @@ class CityStats {
for (unique in civInfo.getMatchingUniques("Unhappiness from population decreased by []%")) for (unique in civInfo.getMatchingUniques("Unhappiness from population decreased by []%"))
unhappinessFromCitizens *= (1 - unique.params[0].toFloat() / 100) unhappinessFromCitizens *= (1 - unique.params[0].toFloat() / 100)
for (unique in civInfo.getMatchingUniques("Unhappiness from population decreased by []% []"))
if (cityInfo.matchesFilter(unique.params[1]))
unhappinessFromCitizens *= (1 - unique.params[0].toFloat() / 100)
newHappinessList["Population"] = -unhappinessFromCitizens * unhappinessModifier newHappinessList["Population"] = -unhappinessFromCitizens * unhappinessModifier
var happinessFromPolicies = getStatsFromUniques(civInfo.policies.policyUniques.getAllUniques()).happiness var happinessFromPolicies = getStatsFromUniques(civInfo.policies.policyUniques.getAllUniques()).happiness
@ -222,7 +226,7 @@ class CityStats {
} }
private fun hasExtraAnnexUnhappiness(): Boolean { fun hasExtraAnnexUnhappiness(): Boolean {
if (cityInfo.civInfo.civName == cityInfo.foundingCiv || cityInfo.foundingCiv == "" || cityInfo.isPuppet) return false if (cityInfo.civInfo.civName == cityInfo.foundingCiv || cityInfo.foundingCiv == "" || cityInfo.isPuppet) return false
return !cityInfo.containsBuildingUnique("Remove extra unhappiness from annexed cities") return !cityInfo.containsBuildingUnique("Remove extra unhappiness from annexed cities")
} }

View File

@ -28,11 +28,17 @@ class TileImprovement : NamedStats() {
fun getTurnsToBuild(civInfo: CivilizationInfo): Int { fun getTurnsToBuild(civInfo: CivilizationInfo): Int {
var realTurnsToBuild = turnsToBuild.toFloat() * civInfo.gameInfo.gameParameters.gameSpeed.modifier var realTurnsToBuild = turnsToBuild.toFloat() * civInfo.gameInfo.gameParameters.gameSpeed.modifier
// todo UNIFY THESE for (unique in civInfo.getMatchingUniques("-[]% tile improvement construction time")) {
realTurnsToBuild *= 1 - unique.params[0].toFloat() / 100f
// Deprecated since 3.14.17
if (civInfo.hasUnique("Worker construction increased 25%")) if (civInfo.hasUnique("Worker construction increased 25%"))
realTurnsToBuild *= 0.75f realTurnsToBuild *= 0.75f
if (civInfo.hasUnique("Tile improvement speed +25%")) if (civInfo.hasUnique("Tile improvement speed +25%"))
realTurnsToBuild *= 0.75f realTurnsToBuild *= 0.75f
//
}
// In some weird cases it was possible for something to take 0 turns, leading to it instead never finishing
if (realTurnsToBuild < 1) realTurnsToBuild = 1f
return realTurnsToBuild.roundToInt() return realTurnsToBuild.roundToInt()
} }