From 072226ff9a40b62ba50b9cec6892b62d94e52f09 Mon Sep 17 00:00:00 2001 From: givehub99 <71454921+givehub99@users.noreply.github.com> Date: Sun, 22 Nov 2020 01:55:34 -0800 Subject: [PATCH] Added "All [] Cities get a free []" unique. (#3352) * Added "All [] Cities get a free []" unique. The first parameter is for city type. Currently "new" and "coastal" are supported. "new" matches every city and "coastal" matches cities on a coastal tile. "new" and "coastal" were added to template.properties for translation. Upon city founding, the second parameter building is added to the city. In civ 5 G&K, Carthage gets a free harbor for every coastal city. * -Syntax changed to "Get a free [] []" First paramater is the building and second is the city filter. Supports "in every city" and "in every coastal city" -new and coastal was removed from template.properties -in every coastal city was added to template.properties * Changed syntax to "Gain a free [] []" --- android/assets/jsons/translations/template.properties | 1 + core/src/com/unciv/logic/city/CityInfo.kt | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index 8e900cb5a6..27d93211a1 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -930,3 +930,4 @@ Must be on [terrain] = in this city = in every city = in capital = +in every coastal city = \ No newline at end of file diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 757ab5932a..8229d406cc 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -88,6 +88,15 @@ class CityInfo { civInfo.policies.tryAddLegalismBuildings() + for (unique in civInfo.getMatchingUniques("Gain a free [] []")) { + val freeBuildingName = unique.params[0] + val cityFilter = unique.params[1] + if (cityFilter == "in every city" || (cityFilter == "in every coastal city" && getCenterTile().isCoastalTile()) ) { + if (!cityConstructions.isBuilt(freeBuildingName)) + cityConstructions.addBuilding(freeBuildingName) + } + } + expansion.reset()