mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Added "All" filter for units
This commit is contained in:
parent
4c48522de2
commit
bbcf5ffed7
@ -330,7 +330,7 @@ class CityStats {
|
||||
}
|
||||
|
||||
for (unique in cityInfo.cityConstructions.builtBuildingUniqueMap.getUniques("+[]% production when building [] in this city")) {
|
||||
if (constructionFitsFilter(currentConstruction, unique.params[1]))
|
||||
if (constructionMatchesFilter(currentConstruction, unique.params[1]))
|
||||
stats.production += unique.params[0].toInt()
|
||||
}
|
||||
|
||||
@ -354,7 +354,7 @@ class CityStats {
|
||||
|
||||
|
||||
for (unique in uniques.filter { it.placeholderText == "+[]% Production when constructing []" }) {
|
||||
if (constructionFitsFilter(currentConstruction, unique.params[1]))
|
||||
if (constructionMatchesFilter(currentConstruction, unique.params[1]))
|
||||
stats.production += unique.params[0].toInt()
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ class CityStats {
|
||||
return stats
|
||||
}
|
||||
|
||||
fun constructionFitsFilter(construction:IConstruction, filter:String): Boolean {
|
||||
fun constructionMatchesFilter(construction:IConstruction, filter:String): Boolean {
|
||||
return construction.name == filter
|
||||
|| filter == "land units" && construction is BaseUnit && construction.unitType.isLandUnit()
|
||||
|| filter == "naval units" && construction is BaseUnit && construction.unitType.isWaterUnit()
|
||||
|
@ -722,6 +722,7 @@ class MapUnit {
|
||||
fun matchesFilter(filter: String): Boolean {
|
||||
if (filter == type.name) return true
|
||||
if (filter == name) return true
|
||||
if (filter == "All") return true
|
||||
if ((filter == "Wounded" || filter == "wounded units") && health < 100) return true
|
||||
if ((filter == "Land" || filter == "land units") && type.isLandUnit()) return true
|
||||
if ((filter == "Water" || filter == "water units") && type.isWaterUnit()) return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user