Victory screen no longer shows every turn on "one more turn" mode

Moved Nation jsons
This commit is contained in:
Yair Morgenstern
2019-09-14 23:06:34 +03:00
parent 3688622d06
commit f6323edbc8
11 changed files with 371 additions and 363 deletions

View File

@ -41,6 +41,7 @@ class GameInfo {
toReturn.difficulty=difficulty
toReturn.gameParameters = gameParameters
toReturn.gameId = gameId
toReturn.oneMoreTurnMode = oneMoreTurnMode
return toReturn
}

View File

@ -109,8 +109,8 @@ class CivilizationInfo {
fun getTranslatedNation(): Nation {
val language = UnCivGame.Current.settings.language.replace(" ","_")
if(!Gdx.files.internal("jsons/Nations_$language.json").exists()) return nation
val translatedNation = GameBasics.getFromJson(Array<Nation>::class.java, "Nations_$language")
if(!Gdx.files.internal("jsons/Nations/Nations_$language.json").exists()) return nation
val translatedNation = GameBasics.getFromJson(Array<Nation>::class.java, "Nations/Nations_$language")
.firstOrNull { it.name==civName}
if(translatedNation==null) // this language's trnslation doesn't contain this nation yet,
return nation // default to english

View File

@ -5,40 +5,39 @@ import com.unciv.Constants
import com.unciv.logic.civilization.CivilizationInfo
class UnitMovementAlgorithms(val unit:MapUnit) {
// This function is called ALL THE TIME and should be as time-optimal as possible!
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float {
var cost = getMovementCostBetweenAdjacentTiles(from,to)
val toOwner = to.getOwner()
if(toOwner!=null && to.isLand && civInfo.isAtWarWith(toOwner) && toOwner.hasActiveGreatWall)
cost += 1
return cost
}
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo): Float {
if(unit.type.isLandUnit() && (from.isLand != to.isLand))
if ((from.isLand != to.isLand) && unit.type.isLandUnit())
return 100f // this is embarkment or disembarkment, and will take the entire turn
var extraCost = 0f
val toOwner = to.getOwner()
if (toOwner != null && to.isLand && toOwner.hasActiveGreatWall && civInfo.isAtWarWith(toOwner))
extraCost += 1
if (from.roadStatus === RoadStatus.Railroad && to.roadStatus === RoadStatus.Railroad)
return 1 / 10f
return 1 / 10f + extraCost
if (from.roadStatus !== RoadStatus.None && to.roadStatus !== RoadStatus.None) //Road
{
if (unit.civInfo.tech.movementSpeedOnRoadsImproved) return 1 / 3f
else return 1 / 2f
if (unit.civInfo.tech.movementSpeedOnRoadsImproved) return 1 / 3f + extraCost
else return 1 / 2f + extraCost
}
if (unit.ignoresTerrainCost) return 1f
if(unit.doubleMovementInForestAndJungle && (to.baseTerrain==Constants.forest || to.baseTerrain==Constants.jungle))
return 1f
if (unit.ignoresTerrainCost) return 1f + extraCost
if (unit.doubleMovementInForestAndJungle && (to.baseTerrain == Constants.forest || to.baseTerrain == Constants.jungle))
return 1f + extraCost
if (unit.roughTerrainPenalty
&& (to.baseTerrain == Constants.hill || to.terrainFeature == Constants.forest || to.terrainFeature == Constants.jungle))
return 4f
return 4f + extraCost
if(unit.doubleMovementInCoast && to.baseTerrain==Constants.coast)
return 1/2f
if (unit.doubleMovementInCoast && to.baseTerrain == Constants.coast)
return 1 / 2f + extraCost
return to.getLastTerrain().movementCost.toFloat() // no road
return to.getLastTerrain().movementCost.toFloat() + extraCost // no road
}
class ParentTileAndTotalDistance(val parentTile:TileInfo, val totalDistance: Float)

View File

@ -45,7 +45,7 @@ object GameBasics {
Units += createHashmap(getFromJson(Array<BaseUnit>::class.java, "Units"))
UnitPromotions += createHashmap(getFromJson(Array<Promotion>::class.java, "UnitPromotions"))
PolicyBranches += createHashmap(getFromJson(Array<PolicyBranch>::class.java, "Policies"))
Nations += createHashmap(getFromJson(Array<Nation>::class.java, "Nations"))
Nations += createHashmap(getFromJson(Array<Nation>::class.java, "Nations/Nations"))
Difficulties += createHashmap(getFromJson(Array<Difficulty>::class.java, "Difficulties"))
val techColumns = getFromJson(Array<TechColumn>::class.java, "Techs")