Unitfilter now accepts multiple filters (see wiki/uniques for details)

This commit is contained in:
Yair Morgenstern
2021-06-17 19:49:20 +03:00
parent 6b75283f6d
commit 67820e8870
5 changed files with 7 additions and 5 deletions

View File

@ -203,8 +203,8 @@
"greatPersonPoints": {"gold": 1},
"isWonder": true,
"providesFreeBuilding": "Lighthouse",
"uniques": ["Must be next to [Coast]", "+[1] Movement for all [military water] units",
"+[1] Sight for all [military water] units"],
"uniques": ["Must be next to [Coast]", "+[1] Movement for all [{Military} {Water}] units",
"+[1] Sight for all [{Military} {Water}] units"],
"requiredTech": "Optics",
"quote": "'They that go down to the sea in ships, that do business in great waters; these see the works of the Lord, and his wonders in the deep.' - The Bible, Psalms 107:23-24"
},

View File

@ -262,7 +262,7 @@
"outerColor": [ 28,51,119],
"innerColor": [255,255,255],
"uniqueName": "Manifest Destiny",
"uniques": ["+[1] Sight for all [military land] units", "-[50]% Gold cost of acquiring tiles [in all cities]"],
"uniques": ["+[1] Sight for all [{Military} {Land}] units", "-[50]% Gold cost of acquiring tiles [in all cities]"],
"cities": ["Washington","New York","Boston","Philadelphia","Atlanta","Chicago","Seattle","San Francisco","Los Angeles","Houston",
"Portland","St. Louis","Miami","Buffalo","Detroit","New Orleans","Baltimore","Denver","Cincinnati","Dallas","Memphis",
"Cleveland","Kansas City","San Diego","Richmond","Las Vegas","Phoenix","Albuquerque","Minneapolis","Pittsburgh",

View File

@ -226,7 +226,7 @@
"policies": [
{
"name": "Naval Tradition",
"uniques": ["+[1] Movement for all [military water] units", "+[1] Sight for all [military water] units",
"uniques": ["+[1] Movement for all [{Military} {Water}] units", "+[1] Sight for all [{Military} {Water}] units",
"Free [Great Admiral] appears", "+[2] Movement for all [Great Admiral] units"
],
"row": 1,

View File

@ -892,6 +892,9 @@ class MapUnit {
}
fun matchesFilter(filter: String): Boolean {
if (filter.contains('{')) // multiple types at once - AND logic. Looks like:"{Military} {Land}"
return filter.removePrefix("{").removeSuffix("}").split("} {")
.all { matchesFilter(it) }
return when (filter) {
"Wounded", "wounded units" -> health < 100
"Barbarians", "Barbarian" -> civInfo.isBarbarian()

View File

@ -242,7 +242,6 @@ class BaseUnit : INamed, IConstruction {
"non-air" -> !unitType.isAirUnit()
"Military", "military units" -> unitType.isMilitary()
"military water" -> unitType.isMilitary() && unitType.isWaterUnit()
"military land" -> unitType.isMilitary() && unitType.isLandUnit()
else -> false
}
}