Added Barracks and Armory buildings to increase XP of units built in the city

This commit is contained in:
Yair Morgenstern 2018-06-24 22:09:16 +03:00
parent a56e7e43aa
commit fe31e4121a
4 changed files with 22 additions and 2 deletions

View File

@ -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",

View File

@ -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"
}

View File

@ -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()
}

View File

@ -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