mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
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:
parent
a76147dc9e
commit
882ca6f22b
@ -83,7 +83,7 @@ class BarbarianAutomation(val civInfo: CivilizationInfo) {
|
|||||||
if (unit.health < 100 && UnitAutomation().tryHealUnit(unit, unitDistanceToTiles)) return
|
if (unit.health < 100 && UnitAutomation().tryHealUnit(unit, unitDistanceToTiles)) return
|
||||||
|
|
||||||
// 6 - wander
|
// 6 - wander
|
||||||
UnitAutomation.wander(unit, unitDistanceToTiles)
|
UnitAutomation.wander(unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun automateScout(unit: MapUnit) {
|
private fun automateScout(unit: MapUnit) {
|
||||||
@ -111,7 +111,7 @@ class BarbarianAutomation(val civInfo: CivilizationInfo) {
|
|||||||
if (unit.health < 100 && UnitAutomation().tryHealUnit(unit, unitDistanceToTiles)) return
|
if (unit.health < 100 && UnitAutomation().tryHealUnit(unit, unitDistanceToTiles)) return
|
||||||
|
|
||||||
// 5 - wander
|
// 5 - wander
|
||||||
UnitAutomation.wander(unit, unitDistanceToTiles)
|
UnitAutomation.wander(unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findFurthestTileCanMoveTo(
|
private fun findFurthestTileCanMoveTo(
|
||||||
|
@ -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.
|
if (bestCityLocation == null) { // We got a badass over here, all tiles within 5 are taken? Screw it, random walk.
|
||||||
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
|
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
|
||||||
if (UnitAutomation.tryExplore(unit, unitDistanceToTiles)) return // try to find new areas
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,11 +44,13 @@ class UnitAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun wander(unit: MapUnit, unitDistanceToTiles: PathsToTilesWithinTurn) {
|
fun wander(unit: MapUnit) {
|
||||||
|
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
|
||||||
val reachableTiles = unitDistanceToTiles
|
val reachableTiles = unitDistanceToTiles
|
||||||
.filter { unit.movement.canMoveTo(it.key) && unit.movement.canReach(it.key) }
|
.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)
|
if (reachableTilesMaxWalkingDistance.any()) unit.movement.moveToTile(reachableTilesMaxWalkingDistance.toList().random().first)
|
||||||
else if (reachableTiles.any()) unit.movement.moveToTile(reachableTiles.keys.random())
|
else if (reachableTiles.any()) unit.movement.moveToTile(reachableTiles.keys.random())
|
||||||
}
|
}
|
||||||
@ -171,7 +173,7 @@ class UnitAutomation {
|
|||||||
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
.sortedBy { it.aerialDistanceTo(unit.currentTile) }
|
||||||
.firstOrNull { unit.movement.canReach(it) }
|
.firstOrNull { unit.movement.canReach(it) }
|
||||||
if (reachableCityTile != null) unit.movement.headTowards(reachableCityTile)
|
if (reachableCityTile != null) unit.movement.headTowards(reachableCityTile)
|
||||||
else wander(unit, unitDistanceToTiles)
|
else wander(unit)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val updatePlay
|
|||||||
ImageGetter.setTextureRegionDrawables()
|
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) }
|
val modCheckboxTable = Table().apply { defaults().pad(5f) }
|
||||||
for(mod in modRulesets){
|
for(mod in modRulesets){
|
||||||
val checkBox = CheckBox(mod.name.tr(),CameraStageBaseScreen.skin)
|
val checkBox = CheckBox(mod.name.tr(),CameraStageBaseScreen.skin)
|
||||||
|
@ -111,7 +111,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
|
diplomacyTable.add(getRelationshipTable(otherCivDiplomacyManager)).row()
|
||||||
if (nextLevelString != "") {
|
if (nextLevelString != "") {
|
||||||
diplomacyTable.add(nextLevelString.tr().toLabel()).row()
|
diplomacyTable.add(nextLevelString.toLabel()).row()
|
||||||
}
|
}
|
||||||
|
|
||||||
val friendBonusText = when (otherCiv.getCityStateType()) {
|
val friendBonusText = when (otherCiv.getCityStateType()) {
|
||||||
|
@ -33,6 +33,7 @@ class TileInfoTests {
|
|||||||
val terrain = improvement.terrainsCanBeBuiltOn.firstOrNull() ?: continue
|
val terrain = improvement.terrainsCanBeBuiltOn.firstOrNull() ?: continue
|
||||||
tile.baseTerrain = terrain
|
tile.baseTerrain = terrain
|
||||||
tile.setTransients()
|
tile.setTransients()
|
||||||
|
if(improvement.uniqueTo!=null) civInfo.civName = improvement.uniqueTo!!
|
||||||
val canBeBuilt = tile.canBuildImprovement(improvement, civInfo)
|
val canBeBuilt = tile.canBuildImprovement(improvement, civInfo)
|
||||||
Assert.assertTrue( improvement.name, canBeBuilt)
|
Assert.assertTrue( improvement.name, canBeBuilt)
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,6 @@ class TranslationTests {
|
|||||||
translations.size > 0)
|
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
|
@Test
|
||||||
fun allUnitActionsHaveTranslation() {
|
fun allUnitActionsHaveTranslation() {
|
||||||
val actions: MutableSet<String> = HashSet()
|
val actions: MutableSet<String> = HashSet()
|
||||||
@ -140,13 +132,6 @@ class TranslationTests {
|
|||||||
allStringsHaveTranslation)
|
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 {
|
private fun allStringAreTranslated(strings: Set<String>): Boolean {
|
||||||
var allStringsHaveTranslation = true
|
var allStringsHaveTranslation = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user