From fe31e4121a6cd65cd1d72b0172b6536556c8de22 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 24 Jun 2018 22:09:16 +0300 Subject: [PATCH] Added Barracks and Armory buildings to increase XP of units built in the city --- android/assets/jsons/Buildings.json | 16 +++++++++++++++- android/assets/jsons/Translations.json | 3 +++ core/src/com/unciv/models/gamebasics/Building.kt | 2 ++ .../src/com/unciv/models/gamebasics/unit/Unit.kt | 3 ++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/android/assets/jsons/Buildings.json b/android/assets/jsons/Buildings.json index 0077cb9405..153e0956fe 100644 --- a/android/assets/jsons/Buildings.json +++ b/android/assets/jsons/Buildings.json @@ -56,7 +56,6 @@ }, { name:"Library", - baseDescription: "Adds 1 science for each 2 population in the city.", hurryCostModifier:25, maintenance:1, unique:"+1 Science Per 2 Population", @@ -85,6 +84,13 @@ unique:"Worker construction increased 25%, provides 2 free workers", requiredTech:"Mathematics" }, + { + name:"Barracks", + xpForNewUnits:15, + hurryCostModifier:25, + maintenance:1, + requiredTech:"Bronze Working" + }, { name:"Temple", culture:3, @@ -282,6 +288,14 @@ requiredBuildingInAllCities:"Workshop", requiredTech:"Machinery" }, + { + name:"Armory", + xpForNewUnits:15, + hurryCostModifier:25, + maintenance:1, + requiredBuilding:"Barracks", + requiredTech:"Steel" + }, { name:"Observatory", baseDescription: "City must be bordering a mountain", diff --git a/android/assets/jsons/Translations.json b/android/assets/jsons/Translations.json index e57584765c..ddec66bb6d 100644 --- a/android/assets/jsons/Translations.json +++ b/android/assets/jsons/Translations.json @@ -397,6 +397,9 @@ German:"Zeigt [resource] auf der Karte" } + "XP for new units":{ + } + "provide":{ // as in "Camp, Customs House provide +1 Gold" German:"generieren" } diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 0e006a92ea..32ad35eb11 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -30,6 +30,7 @@ class Building : NamedStats(), IConstruction{ var cannotBeBuiltWith: String? = null var cityStrength=0 var cityHealth=0 + var xpForNewUnits=0 // Uniques var providesFreeBuilding: String? = null @@ -56,6 +57,7 @@ class Building : NamedStats(), IConstruction{ if(unique!=null) infoList += unique!!.tr() if(cityStrength!=0) infoList+="{City strength} +".tr()+cityStrength if(cityHealth!=0) infoList+="{City health} +".tr()+cityHealth + if(xpForNewUnits!=0) infoList+= "+$xpForNewUnits {XP for new units}".tr() return infoList.joinToString() } diff --git a/core/src/com/unciv/models/gamebasics/unit/Unit.kt b/core/src/com/unciv/models/gamebasics/unit/Unit.kt index c2ca187050..78b0890166 100644 --- a/core/src/com/unciv/models/gamebasics/unit/Unit.kt +++ b/core/src/com/unciv/models/gamebasics/unit/Unit.kt @@ -96,7 +96,8 @@ class Unit : INamed, IConstruction, ICivilopedia { } override fun postBuildEvent(construction: CityConstructions) { - construction.cityInfo.civInfo.placeUnitNearTile(construction.cityInfo.location, name) + val unit = construction.cityInfo.civInfo.placeUnitNearTile(construction.cityInfo.location, name) + unit.promotions.XP += construction.getBuiltBuildings().sumBy { it.xpForNewUnits } } override fun toString(): String = name