Added "Must be next to []" unique for tile improvements

This commit is contained in:
Yair Morgenstern 2020-10-08 17:35:25 +03:00
parent 0543c6473f
commit e292c210c8
2 changed files with 11 additions and 2 deletions

View File

@ -6,7 +6,9 @@
"food": 1,
"turnsToBuild": 7,
"techRequired": "Agriculture",
"uniques": ["Can also be built on tiles adjacent to fresh water", "[+1 Food] on [fresh water] tiles once [Civil Service] is discovered", "[+1 Food] on [non-fresh water] tiles once [Fertilizer] is discovered"],
"uniques": ["Can also be built on tiles adjacent to fresh water",
"[+1 Food] on [fresh water] tiles once [Civil Service] is discovered",
"[+1 Food] on [non-fresh water] tiles once [Fertilizer] is discovered"],
},
{
"name": "Lumber mill",
@ -184,7 +186,9 @@
"terrainsCanBeBuiltOn": ["Hill"],
"food": 1,
"turnsToBuild": 7,
"uniques": ["[+1 Food] for each adjacent [Mountain]", "Cannot be built on bonus resource", "[+1 Food] on [fresh water] tiles once [Civil Service] is discovered", "[+1 Food] on [non-fresh water] tiles once [Fertilizer] is discovered"],
"uniques": ["[+1 Food] for each adjacent [Mountain]", "Cannot be built on bonus resource",
"[+1 Food] on [fresh water] tiles once [Civil Service] is discovered",
"[+1 Food] on [non-fresh water] tiles once [Fertilizer] is discovered"],
"techRequired": "Construction"
},

View File

@ -307,6 +307,11 @@ open class TileInfo {
"Cannot be built on bonus resource" in improvement.uniques && resource != null
&& getTileResource().resourceType == ResourceType.Bonus -> false
improvement.terrainsCanBeBuiltOn.contains(topTerrain.name) -> true
improvement.uniqueObjects.filter { it.placeholderText == "Must be next to []" }.any {
val filter = it.params[0]
if (filter == "River") return@any !isAdjacentToRiver()
else return@any !neighbors.any { it.matchesUniqueFilter(filter) }
} -> false
improvement.name == "Road" && roadStatus == RoadStatus.None -> true
improvement.name == "Railroad" && this.roadStatus != RoadStatus.Railroad -> true
improvement.name == "Remove Road" && this.roadStatus == RoadStatus.Road -> true