mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 13:49:54 +07:00
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:
@ -49,7 +49,13 @@ class UnitAutomation{
|
||||
val rangeOfAttack = if(MapUnitCombatant(unit).isMelee()) 1 else unit.getBaseUnit().range
|
||||
|
||||
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() }
|
||||
for(reachableTile in tilesToAttackFrom){ // tiles we'll still have energy after we reach there
|
||||
attackableTiles += reachableTile.getTilesInDistance(rangeOfAttack).filter { it in tilesWithEnemies }
|
||||
|
@ -30,7 +30,7 @@ class Technology : ICivilopedia {
|
||||
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
|
||||
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 }
|
||||
if(tileImprovements.isNotEmpty()) SB.appendln("{Tile improvements enabled}: "+tileImprovements.map { it.name }.joinToString())
|
||||
|
@ -160,7 +160,7 @@ fun String.tr(): String {
|
||||
|
||||
var languageSpecificPlaceholder = GameBasics.Translations[englishTranslationPlaceholder]!![UnCivGame.Current.settings.language]!!
|
||||
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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user