Added much-needed "+[]% Production when constructing [] units" unique

This commit is contained in:
Yair Morgenstern 2020-12-13 09:27:31 +02:00
parent 11fb6b4b67
commit 963fee3552
4 changed files with 12 additions and 5 deletions

View File

@ -106,7 +106,7 @@
"isWonder": true,
"cost": 185,
"greatPersonPoints": {"production": 1},
"uniques": ["+[10]% growth in all cities", "+[15]% Production when constructing [ranged units]"],
"uniques": ["+[10]% growth in all cities", "+[15]% Production when constructing [Ranged] units"],
"requiredTech": "Archery",
"quote": "'It is not so much for its beauty that the forest makes a claim upon men's hearts, as for that subtle something, that quality of air, that emanation from old trees, that so wonderfully changes and renews a weary spirit.' - Robert Louis Stevenson"
},

View File

@ -93,7 +93,7 @@
"policies": [
{
"name": "Warrior Code",
"uniques":["+[20]% Production when constructing [melee units]"],
"uniques":["+[20]% Production when constructing [Melee] units"],
"row": 1,
"column": 2
},
@ -413,7 +413,7 @@
},
{
"name": "Total War",
"uniques": ["+[15]% Production when constructing [military units]", "New [military] units start with [15] Experience"],
"uniques": ["+[15]% Production when constructing [Military] units", "New [Military] units start with [15] Experience"],
"requires": ["Police State","Fascism"],
"row": 3,
"column": 4

View File

@ -358,6 +358,11 @@ class CityStats {
stats.production += unique.params[0].toInt()
}
for (unique in uniques.filter { it.placeholderText == "+[]% Production when constructing [] units" }) {
if (currentConstruction is BaseUnit && currentConstruction.matchesFilter(unique.params[1]))
stats.production += unique.params[0].toInt()
}
if (cityInfo.cityConstructions.getBuiltBuildings().any { it.isWonder }
&& uniques.any { it.text == "+33% culture in all cities with a world wonder" })
@ -375,12 +380,14 @@ class CityStats {
fun constructionMatchesFilter(construction:IConstruction, filter:String): Boolean {
return construction.name == filter
// All of these are deprecated as of 3.11.20
|| filter == "land units" && construction is BaseUnit && construction.unitType.isLandUnit()
|| filter == "naval units" && construction is BaseUnit && construction.unitType.isWaterUnit()
|| filter == "ranged units" && construction is BaseUnit && construction.unitType == UnitType.Ranged
|| filter == "mounted units" && construction is BaseUnit && construction.unitType == UnitType.Mounted
|| filter == "military units" && construction is BaseUnit && !construction.unitType.isCivilian()
|| filter == "melee units" && construction is BaseUnit && construction.unitType.isMelee()
|| filter == "Buildings" && construction is Building && !(construction.isWonder || construction.isNationalWonder)
|| filter == "Wonders" && construction is Building && (construction.isWonder || construction.isNationalWonder)
|| construction is Building && construction.uniques.contains(filter)

View File

@ -212,7 +212,7 @@ class BaseUnit : INamed, IConstruction {
else ruleset.units[replaces!!]!!
}
fun matchesFilter(filter:String):Boolean{
fun matchesFilter(filter:String):Boolean {
if (filter == unitType.name) return true
if (filter == name) return true
if (filter == "All") return true
@ -220,7 +220,7 @@ class BaseUnit : INamed, IConstruction {
if ((filter == "Water" || filter == "water units") && unitType.isWaterUnit()) return true
if ((filter == "Air" || filter == "air units") && unitType.isAirUnit()) return true
if (filter == "non-air" && !unitType.isAirUnit()) return true
if ((filter == "military" || filter == "military units") && unitType.isMilitary()) return true
if ((filter == "military" || filter == "Military" || filter == "military units") && unitType.isMilitary()) return true
return false
}
}