Iroquis can now use Forest and Jungles to connect cities

Persian +1 movement only activaes when in golden age
This commit is contained in:
Yair Morgenstern 2019-09-20 10:26:15 +03:00
parent 12e3ae1761
commit a3889a549e
7 changed files with 30 additions and 26 deletions

View file

@ -573,7 +573,7 @@
outerColor:[54,72,72],
innerColor:[246,205,137],
uniqueName:"The Great Warpath"
unique:"All units move through Forest and Jungle tiles in friendly territory as if it is Road. These tiles can be used to establish City Connections upon researching the Wheel.",
unique: "All units move through Forest and Jungle Tiles in friendly territory as if they have roads. These tiles can be used to establish City Connections upon researching the Wheel.",
cities:["Onoondaga","Osininka","Grand River","Akwesasme","Buffalo Creek","Brantford","Montreal","Genesse River",
"Canandaigua Lake","Lake Simcoe","Salamanca","Gowanda","Cuba","Akron","Kanesatake","Ganienkeh","Cayuga Castle",
"Chondote","Canajoharie","Nedrow","Oneida Lake","Kanonwalohale","Green Bay","Southwold","Mohawk Valley",

View file

@ -1229,7 +1229,7 @@
Italian:"Hiawatha"//Same as in Italian
}
"All units move through Forest and Jungle Tiles in friendly territory as if it is Road. These tiles can be used to establish City Connections upon researching the Wheel.":{
"All units move through Forest and Jungle Tiles in friendly territory as if they have roads. These tiles can be used to establish City Connections upon researching the Wheel.":{
Italian:"Le caselle di Foreste e Giungle in territorio amico agiscono come strade, e sono usate per stabilire Rotte Commerciali quando scopri la Ruota."
Portuguese:"Mova-se por florestas e selvas em território amigo como se fossem estradas. Estas terras podem ser usadas para estabelecer rotas de comércio após pesquisar a roda."
French:"Les Forêt et les Jungles en territoire alliés ont les mêmes attributs que les routes. A la découverte de la Roue, elles peuvent établir des routes commerciales."
@ -1246,7 +1246,7 @@
Italian:"Dario I"
}
"Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strenght.":{
"Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength":{
Italian:"+50% durata delle Età dell'Oro, durante le quali le unità ricevono +1 Movimento e +10% Forza."
Portuguese:"Idades douradas duram 50% mais, unidades recebem 1 movimento a mais e um bonus de +10% em força de combate."
French:"Les Ages d'Or durent 50% plus longtemps. Durant les Ages d'Or, les unités gagnent +1 mouvement et +10% de force de Combat."

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 29
versionCode 299
versionName "3.0.6"
versionCode 300
versionName "3.0.7"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View file

@ -3,11 +3,9 @@ package com.unciv.logic.civilization
import com.badlogic.gdx.graphics.Color
import com.unciv.logic.city.CityInfo
import com.unciv.logic.map.BFS
import com.unciv.logic.map.RoadStatus
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.tile.ResourceSupplyList
import com.unciv.models.gamebasics.tr
import java.util.*
import kotlin.collections.HashMap
import kotlin.collections.set
@ -78,15 +76,20 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){
citiesReachedToMediums[civInfo.getCapital()] = arrayListOf("Start")
val allCivCities = civInfo.gameInfo.civilizations.flatMap { it.cities }
val theWheelIsResearched = civInfo.tech.isResearched("The Wheel")
val road = "Road"
val harbor = "Harbor"
while(citiesToCheck.isNotEmpty() && citiesReachedToMediums.size<allCivCities.size){
val newCitiesToCheck = mutableListOf<CityInfo>()
for(cityToConnectFrom in citiesToCheck){
val reachedMediums = citiesReachedToMediums[cityToConnectFrom]!!
// This is copypasta and can be cleaned up
if(!reachedMediums.contains("Road")){
if(theWheelIsResearched && !reachedMediums.contains(road)){
val roadBfs = BFS(cityToConnectFrom.getCenterTile()) { it.roadStatus != RoadStatus.None }
val roadBfs = BFS(cityToConnectFrom.getCenterTile()) { it.hasRoad(civInfo) }
roadBfs.stepToEnd()
val reachedCities = allCivCities.filter { roadBfs.tilesReached.containsKey(it.getCenterTile())}
for(reachedCity in reachedCities){
@ -95,14 +98,14 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){
citiesReachedToMediums[reachedCity] = arrayListOf()
}
val cityReachedByMediums = citiesReachedToMediums[reachedCity]!!
if(!cityReachedByMediums.contains("Road"))
cityReachedByMediums.add("Road")
if(!cityReachedByMediums.contains(road))
cityReachedByMediums.add(road)
}
citiesReachedToMediums[cityToConnectFrom]!!.add("Road")
citiesReachedToMediums[cityToConnectFrom]!!.add(road)
}
if(!reachedMediums.contains("Harbor")
&& cityToConnectFrom.cityConstructions.containsBuildingOrEquivalent("Harbor")){
if(!reachedMediums.contains(harbor)
&& cityToConnectFrom.cityConstructions.containsBuildingOrEquivalent(harbor)){
val seaBfs = BFS(cityToConnectFrom.getCenterTile()) { it.isWater || it.isCityCenter() }
seaBfs.stepToEnd()
val reachedCities = allCivCities.filter { seaBfs.tilesReached.containsKey(it.getCenterTile())}
@ -112,10 +115,10 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){
citiesReachedToMediums[reachedCity] = arrayListOf()
}
val cityReachedByMediums = citiesReachedToMediums[reachedCity]!!
if(!cityReachedByMediums.contains("Harbor"))
cityReachedByMediums.add("Harbor")
if(!cityReachedByMediums.contains(harbor))
cityReachedByMediums.add(harbor)
}
citiesReachedToMediums[cityToConnectFrom]!!.add("Harbor")
citiesReachedToMediums[cityToConnectFrom]!!.add(harbor)
}
}
citiesToCheck = newCitiesToCheck

View file

@ -94,7 +94,8 @@ class MapUnit {
if (type.isWaterUnit() && civInfo.nation.unique == "+2 movement for all naval units")
movement += 2
if(civInfo.nation.unique=="Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength")
if(civInfo.goldenAges.isGoldenAge() &&
civInfo.nation.unique=="Golden Ages last 50% longer. During a Golden Age, units receive +1 Movement and +10% Strength")
movement+=1
return movement

View file

@ -324,5 +324,12 @@ open class TileInfo {
}
return false
}
fun hasRoad(civInfo: CivilizationInfo): Boolean {
if(roadStatus != RoadStatus.None) return true
if(civInfo.nation.forestsAndJunglesAreRoads && (terrainFeature==Constants.jungle || terrainFeature==Constants.forest))
return true
return false
}
//endregion
}

View file

@ -21,7 +21,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
if (from.roadStatus === RoadStatus.Railroad && to.roadStatus === RoadStatus.Railroad)
return 1 / 10f + extraCost
if (hasRoad(from,civInfo) && hasRoad(to,civInfo))
if (from.hasRoad(civInfo) && to.hasRoad(civInfo))
{
if (unit.civInfo.tech.movementSpeedOnRoadsImproved) return 1 / 3f + extraCost
else return 1 / 2f + extraCost
@ -40,13 +40,6 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
return to.getLastTerrain().movementCost.toFloat() + extraCost // no road
}
fun hasRoad(tileInfo:TileInfo, civInfo: CivilizationInfo): Boolean {
if(tileInfo.roadStatus!==RoadStatus.None) return true
if(civInfo.nation.forestsAndJunglesAreRoads && tileInfo.terrainFeature!=null
&& (tileInfo.terrainFeature==Constants.jungle || tileInfo.terrainFeature==Constants.forest)) return true
return false
}
class ParentTileAndTotalDistance(val parentTile:TileInfo, val totalDistance: Float)
fun getDistanceToTilesWithinTurn(origin: Vector2, unitMovement: Float): PathsToTilesWithinTurn {