Removed translation tests that are no longer necessary - 'check' passes successfully

'Wander' now gets its own distance to tiles, solving a really niche bug
This commit is contained in:
Yair Morgenstern 2020-03-28 21:29:52 +03:00
parent a76147dc9e
commit 882ca6f22b
7 changed files with 11 additions and 23 deletions

View File

@ -83,7 +83,7 @@ class BarbarianAutomation(val civInfo: CivilizationInfo) {
if (unit.health < 100 && UnitAutomation().tryHealUnit(unit, unitDistanceToTiles)) return
// 6 - wander
UnitAutomation.wander(unit, unitDistanceToTiles)
UnitAutomation.wander(unit)
}
private fun automateScout(unit: MapUnit) {
@ -111,7 +111,7 @@ class BarbarianAutomation(val civInfo: CivilizationInfo) {
if (unit.health < 100 && UnitAutomation().tryHealUnit(unit, unitDistanceToTiles)) return
// 5 - wander
UnitAutomation.wander(unit, unitDistanceToTiles)
UnitAutomation.wander(unit)
}
private fun findFurthestTileCanMoveTo(

View File

@ -135,7 +135,7 @@ class SpecificUnitAutomation {
if (bestCityLocation == null) { // We got a badass over here, all tiles within 5 are taken? Screw it, random walk.
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
if (UnitAutomation.tryExplore(unit, unitDistanceToTiles)) return // try to find new areas
UnitAutomation.wander(unit, unitDistanceToTiles) // go around aimlessly
UnitAutomation.wander(unit) // go around aimlessly
return
}

View File

@ -44,11 +44,13 @@ class UnitAutomation {
}
@JvmStatic
fun wander(unit: MapUnit, unitDistanceToTiles: PathsToTilesWithinTurn) {
fun wander(unit: MapUnit) {
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
val reachableTiles = unitDistanceToTiles
.filter { unit.movement.canMoveTo(it.key) && unit.movement.canReach(it.key) }
val reachableTilesMaxWalkingDistance = reachableTiles.filter { it.value.totalDistance == unit.currentMovement }
val reachableTilesMaxWalkingDistance = reachableTiles
.filter { it.value.totalDistance == unit.currentMovement }
if (reachableTilesMaxWalkingDistance.any()) unit.movement.moveToTile(reachableTilesMaxWalkingDistance.toList().random().first)
else if (reachableTiles.any()) unit.movement.moveToTile(reachableTiles.keys.random())
}
@ -171,7 +173,7 @@ class UnitAutomation {
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
.firstOrNull { unit.movement.canReach(it) }
if (reachableCityTile != null) unit.movement.headTowards(reachableCityTile)
else wander(unit, unitDistanceToTiles)
else wander(unit)
return true
}

View File

@ -200,7 +200,7 @@ class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val updatePlay
ImageGetter.setTextureRegionDrawables()
}
add("Mods:".tr().toLabel(fontSize = 24)).padTop(16f).colspan(2).row()
add("Mods:".toLabel(fontSize = 24)).padTop(16f).colspan(2).row()
val modCheckboxTable = Table().apply { defaults().pad(5f) }
for(mod in modRulesets){
val checkBox = CheckBox(mod.name.tr(),CameraStageBaseScreen.skin)

View File

@ -111,7 +111,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
}
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
if (nextLevelString != "") {
diplomacyTable.add(nextLevelString.tr().toLabel()).row()
diplomacyTable.add(nextLevelString.toLabel()).row()
}
val friendBonusText = when (otherCiv.getCityStateType()) {

View File

@ -33,6 +33,7 @@ class TileInfoTests {
val terrain = improvement.terrainsCanBeBuiltOn.firstOrNull() ?: continue
tile.baseTerrain = terrain
tile.setTransients()
if(improvement.uniqueTo!=null) civInfo.civName = improvement.uniqueTo!!
val canBeBuilt = tile.canBuildImprovement(improvement, civInfo)
Assert.assertTrue( improvement.name, canBeBuilt)
}

View File

@ -31,14 +31,6 @@ class TranslationTests {
translations.size > 0)
}
@Test
fun allUnitsHaveTranslation() {
val allUnitsHaveTranslation = allStringAreTranslated(ruleset.units.keys)
Assert.assertTrue("This test will only pass when there is a translation for all units",
allUnitsHaveTranslation)
}
@Test
fun allUnitActionsHaveTranslation() {
val actions: MutableSet<String> = HashSet()
@ -140,13 +132,6 @@ class TranslationTests {
allStringsHaveTranslation)
}
@Test
fun allPromotionsHaveTranslation() {
val strings: Set<String> = ruleset.unitPromotions.keys
val allStringsHaveTranslation = allStringAreTranslated(strings)
Assert.assertTrue("This test will only pass when there is a translation for all promotions",
allStringsHaveTranslation)
}
private fun allStringAreTranslated(strings: Set<String>): Boolean {
var allStringsHaveTranslation = true