Translation stuff

Fixed ultra rare bug where a unit that expends all its movement points on roads right before attacking will think that it can attack when it can't
This commit is contained in:
Yair Morgenstern
2018-06-25 20:08:57 +03:00
parent a235167116
commit a59d6e7a46
8 changed files with 39 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -1170,6 +1170,8 @@
// Technologies (Ancient Era) // Technologies (Ancient Era)
"Agriculture":{}
"Pottery":{ "Pottery":{
Italian:"Ceramica" Italian:"Ceramica"
Russian:"Керамика" Russian:"Керамика"
@ -1325,6 +1327,7 @@
Romanian:"Serviciu civil" Romanian:"Serviciu civil"
German:"Zivildienst" German:"Zivildienst"
} }
"Guilds":{}
"Physics":{ "Physics":{
Italian:"Fisica" Italian:"Fisica"
Russian:"Физика" Russian:"Физика"
@ -1332,6 +1335,7 @@
Romanian:"Fizică" Romanian:"Fizică"
German:"Physik" German:"Physik"
} }
"Steel":{}
"Metal Casting":{ "Metal Casting":{
Italian:"colata di metallo" Italian:"colata di metallo"
Russian:"Литье" Russian:"Литье"
@ -1399,6 +1403,7 @@
Romanian:"Presă de tipar" Romanian:"Presă de tipar"
German:"Druckpresse" German:"Druckpresse"
} }
"Gunpowder":{}
"Navigation":{ "Navigation":{
Italian:"Navigazione" Italian:"Navigazione"
Russian:"Навигация" Russian:"Навигация"
@ -1420,6 +1425,9 @@
Romanian:"Economie" Romanian:"Economie"
German:"Ökonomie" German:"Ökonomie"
} }
"Metallurgy":{}
"Chemistry":{ "Chemistry":{
Italian:"Chimica" Italian:"Chimica"
Russian:"Химия" Russian:"Химия"
@ -1437,6 +1445,11 @@
Romanian:"Teoria științifică" Romanian:"Teoria științifică"
German:"Wissenschaftliche Thorie" German:"Wissenschaftliche Thorie"
} }
"Industrialization":{}
"Rifling":{}
"Military Science":{}
"Fertilizer":{ "Fertilizer":{
Italian:"Fertilizzante" Italian:"Fertilizzante"
Russian:"Yдобрение" Russian:"Yдобрение"
@ -1466,6 +1479,8 @@
German:"Dampfkraft" German:"Dampfkraft"
} }
"Dynamite":{}
// Technologies (Modern Era) // Technologies (Modern Era)
@ -1594,6 +1609,16 @@
German:"Zukünftige Technologien" German:"Zukünftige Technologien"
} }
// Tech Eras
"Ancient":{}
"Classical":{}
"Medieval":{}
"Renaissance":{}
"Industrial":{}
"Modern":{}
"Information":{}
"Future":{}
// Building unique abilities // Building unique abilities
"+1 Science Per 2 Population":{ "+1 Science Per 2 Population":{

View File

@ -234,9 +234,8 @@
cost: 150, cost: 150,
requiredTech:"Gunpowder", requiredTech:"Gunpowder",
hurryCostModifier:20 hurryCostModifier:20
} },
{
,{
name:"Lancer", name:"Lancer",
unitType:"Mounted", unitType:"Mounted",
movement:4, movement:4,
@ -245,10 +244,11 @@
requiredTech:"Metallurgy", requiredTech:"Metallurgy",
requiredResource:"Horses", requiredResource:"Horses",
hurryCostModifier:20 hurryCostModifier:20
uniques:["Can move after attacking","No defensive terrain bonus","Penalty vs City 33%","Bonus vs Mounted 50%" ], uniques:["Can move after attacking","No defensive terrain bonus","Penalty vs City 33%","Bonus vs Mounted 33%" ],
}, },
// UNITS FROM HERE NEED IMAGES // Industrial Era
{ {
name:"Rifleman", name:"Rifleman",
unitType:"Melee", unitType:"Melee",

View File

@ -49,7 +49,13 @@ class UnitAutomation{
val rangeOfAttack = if(MapUnitCombatant(unit).isMelee()) 1 else unit.getBaseUnit().range val rangeOfAttack = if(MapUnitCombatant(unit).isMelee()) 1 else unit.getBaseUnit().range
val attackableTiles = ArrayList<AttackableTile>() val attackableTiles = ArrayList<AttackableTile>()
val tilesToAttackFrom = distanceToTiles.filter { it.value!=unit.currentMovement }.map { it.key } // The +0.09 solves a bug where you've moved 2/3 road tiles,
// you come to move a third (distance is less that remaining movements),
// and then later we round it off to a whole.
// So the poor unit thought it could attack from the tile, but when it comes to do so it has no moveement points!
// Silly floats, basically
val tilesToAttackFrom = distanceToTiles.filter { (it.value+0.09) < unit.currentMovement }
.map { it.key }
.filter { unit.canMoveTo(it) || it==unit.getTile() } .filter { unit.canMoveTo(it) || it==unit.getTile() }
for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there
attackableTiles += reachableTile.getTilesInDistance(rangeOfAttack).filter { it in tilesWithEnemies } attackableTiles += reachableTile.getTilesInDistance(rangeOfAttack).filter { it in tilesWithEnemies }

View File

@ -30,7 +30,7 @@ class Technology : ICivilopedia {
if(wonders.isNotEmpty()) SB.appendln("{Wonders enabled}: "+wonders.map { "\n * "+it.name+ " ("+it.getShortDescription()+")" }.joinToString()) if(wonders.isNotEmpty()) SB.appendln("{Wonders enabled}: "+wonders.map { "\n * "+it.name+ " ("+it.getShortDescription()+")" }.joinToString())
val revealedResource = GameBasics.TileResources.values.filter { it.revealedBy==name }.map { it.name }.firstOrNull() // can only be one val revealedResource = GameBasics.TileResources.values.filter { it.revealedBy==name }.map { it.name }.firstOrNull() // can only be one
if(revealedResource!=null) SB.appendln("Reveals [$revealedResource] on map".tr()) if(revealedResource!=null) SB.appendln("Reveals [$revealedResource] on the map".tr())
val tileImprovements = GameBasics.TileImprovements.values.filter { it.techRequired==name } val tileImprovements = GameBasics.TileImprovements.values.filter { it.techRequired==name }
if(tileImprovements.isNotEmpty()) SB.appendln("{Tile improvements enabled}: "+tileImprovements.map { it.name }.joinToString()) if(tileImprovements.isNotEmpty()) SB.appendln("{Tile improvements enabled}: "+tileImprovements.map { it.name }.joinToString())

View File

@ -160,7 +160,7 @@ fun String.tr(): String {
var languageSpecificPlaceholder = GameBasics.Translations[englishTranslationPlaceholder]!![UnCivGame.Current.settings.language]!! var languageSpecificPlaceholder = GameBasics.Translations[englishTranslationPlaceholder]!![UnCivGame.Current.settings.language]!!
for(i in 0 until termsInMessage.size){ for(i in 0 until termsInMessage.size){
languageSpecificPlaceholder = languageSpecificPlaceholder.replace(termsInTranslationPlaceholder[i], termsInMessage[i]) languageSpecificPlaceholder = languageSpecificPlaceholder.replace(termsInTranslationPlaceholder[i], termsInMessage[i].tr())
} }
return languageSpecificPlaceholder.tr() return languageSpecificPlaceholder.tr()
} }