Land units can embark!

This commit is contained in:
Yair Morgenstern 2018-10-22 20:05:04 +03:00
parent 7537f59bda
commit 2c5f4e1529
4 changed files with 23 additions and 6 deletions

View file

@ -21,7 +21,7 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 148
versionCode 149
versionName "2.9.2"
}
buildTypes {

View file

@ -65,7 +65,8 @@ class GameInfo {
&& (it.getOwner()==player || it.neighbors.any { neighbor -> neighbor.getOwner()==player }) }
for(enemyUnitTile in enemyUnitsCloseToTerritory) {
val inOrNear = if(enemyUnitTile.getOwner()==player) "in" else "near"
player.addNotification("An enemy [${enemyUnitTile.militaryUnit!!.name}] was spotted $inOrNear our territory", enemyUnitTile.position, Color.RED)
val unitName = enemyUnitTile.militaryUnit!!.name
player.addNotification("An enemy [$unitName] was spotted $inOrNear our territory", enemyUnitTile.position, Color.RED)
}
turns++
@ -98,5 +99,4 @@ class GameInfo {
cityInfo.cityStats.update()
}
}
}

View file

@ -107,8 +107,12 @@ class MapUnit {
fun canPassThrough(tile: TileInfo):Boolean{
val tileOwner = tile.getOwner()
if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit())
return false
if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit()){
if(!civInfo.tech.isResearched("Optics"))
return false
if(tile.baseTerrain == "Ocean" && !civInfo.tech.isResearched("Astronomy"))
return false
}
if(tile.getBaseTerrain().type==TerrainType.Land && baseUnit.unitType.isWaterUnit())
return false
if(tile.baseTerrain=="Ocean" && baseUnit.uniques.contains("Cannot enter ocean tiles until Astronomy")
@ -158,6 +162,13 @@ class MapUnit {
return currentTile.baseTerrain=="Ocean"||currentTile.baseTerrain=="Coast"
}
fun getEmbarkedMovement(){
var movement=2
movement += civInfo.tech.techsResearched.map { GameBasics.Technologies[it]!! }
.count { it.baseDescription!=null && it.baseDescription!! == "Increases embarked movement" }
if(civInfo.tech.isResearched("Steam Power")) movement += 1
}
//endregion
//region state-changing functions

View file

@ -1,11 +1,17 @@
package com.unciv.logic.map
import com.badlogic.gdx.math.Vector2
import com.unciv.models.gamebasics.tile.TerrainType
class UnitMovementAlgorithms(val unit:MapUnit) {
val tileMap = unit.getTile().tileMap
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo): Float {
if(from.getBaseTerrain().type==TerrainType.Land && to.getBaseTerrain().type==TerrainType.Water
|| from.getBaseTerrain().type==TerrainType.Water && to.getBaseTerrain().type==TerrainType.Land)
return 100f // this is embarkment or disembarkment, and will take the entire turn
if (from.roadStatus === RoadStatus.Railroad && to.roadStatus === RoadStatus.Railroad)
return 1 / 10f