Added info of tile's unit defence bonus to tile info (not everyone is a veteren Civ player...)

This commit is contained in:
Yair Morgenstern 2018-10-28 12:37:00 +02:00
parent f7021154f3
commit cc0e76ba00
4 changed files with 14 additions and 8 deletions

View file

@ -1046,6 +1046,8 @@
Spanish:"Ataque"
}
"[percentage] to unit defence":{} // e.g. +25% to unit defence
// Terrains
"Grassland":{

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 150
versionName "2.9.3"
versionCode 151
versionName "2.9.5"
}
buildTypes {
release {

View file

@ -218,6 +218,12 @@ open class TileInfo {
if(militaryUnit!!.health<100) milUnitString += "(" + militaryUnit!!.health + ")"
SB.appendln(milUnitString)
}
if(getDefensiveBonus()!=0f){
var defencePercentString = (getDefensiveBonus()*100).toInt().toString()+"%"
if(!defencePercentString.startsWith("-")) defencePercentString = "+$defencePercentString"
SB.appendln("[$defencePercentString] to unit defence".tr())
}
return SB.toString().trim()
}

View file

@ -156,21 +156,19 @@ fun String.tr(): String {
val fontCache = HashMap<Int,BitmapFont>()
fun getFont(size: Int): BitmapFont {
if(fontCache.containsKey(size)) return fontCache[size]!!
// var screenScale = Gdx.graphics.width / 1000f // screen virtual width as defined in CameraStageBaseScreen
// if(screenScale<1) screenScale=1f
val generator = FreeTypeFontGenerator(Gdx.files.internal("skin/Arial.ttf"))
val parameter = FreeTypeFontGenerator.FreeTypeFontParameter()
parameter.size = size
// parameter.genMipMaps = true
parameter.minFilter = Texture.TextureFilter.Linear
parameter.magFilter = Texture.TextureFilter.Linear
parameter.characters = "ABCČĆDĐEFGHIJKLMNOPQRSŠTUVWXYZŽaäàâăbcčćdđeéfghiîjklmnoöpqrsșštțuüvwxyzžАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơưáéíóú1234567890?'“!”(%)[#]{@}/&\\<-+÷×=>®©\$€£¥¢:;,.*|"
//generator.scaleForPixelHeight(size)
parameter.characters = "ABCČĆDĐEFGHIJKLMNOPQRSŠTUVWXYZŽaäàâăbcčćdđeéfghiîjklmnoöpqrsșštțuüvwxyzž" +
"АБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюя" +
"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơưáéíóú1234567890" +
"?'“!”(%)[#]{@}/&\\<-+÷×=>®©\$€£¥¢:;,.*|"
val font = generator.generateFont(parameter)
// font.data.setScale(1f/screenScale)
generator.dispose() // don't forget to dispose to avoid memory leaks!
fontCache[size]=font
return font