Scouts ignore river movement penalties

This commit is contained in:
Yair Morgenstern 2020-07-31 11:40:02 +03:00
parent 86f500b266
commit 2d3daa8c3b

View File

@ -24,17 +24,16 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
return 1 / 10f + extraCost return 1 / 10f + extraCost
val areConnectedByRoad = from.hasConnection(civInfo) && to.hasConnection(civInfo) val areConnectedByRoad = from.hasConnection(civInfo) && to.hasConnection(civInfo)
if(from.isConnectedByRiver(to) && val areConnectedByRiver = from.isConnectedByRiver(to)
(!areConnectedByRoad || !civInfo.tech.roadsConnectAcrossRivers)){
return 100f // Rivers take the entire turn to cross
}
if (areConnectedByRoad) if (areConnectedByRoad && (!areConnectedByRiver || civInfo.tech.roadsConnectAcrossRivers))
{ {
return if (unit.civInfo.tech.movementSpeedOnRoadsImproved) 1 / 3f + extraCost return if (unit.civInfo.tech.movementSpeedOnRoadsImproved) 1 / 3f + extraCost
else 1 / 2f + extraCost else 1 / 2f + extraCost
} }
if (unit.ignoresTerrainCost) return 1f + extraCost if (unit.ignoresTerrainCost) return 1f + extraCost
if (areConnectedByRiver) return 100f // Rivers take the entire turn to cross
if (unit.doubleMovementInForestAndJungle && (to.terrainFeature == Constants.forest || to.terrainFeature == Constants.jungle)) if (unit.doubleMovementInForestAndJungle && (to.terrainFeature == Constants.forest || to.terrainFeature == Constants.jungle))
return 1f + extraCost // usually forest and jungle take 2 movements, so here it is 1 return 1f + extraCost // usually forest and jungle take 2 movements, so here it is 1
if (civInfo.nation.greatAndeanRoad && to.baseTerrain == Constants.hill) if (civInfo.nation.greatAndeanRoad && to.baseTerrain == Constants.hill)