mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-10 02:47:24 +07:00
Land units can embark!
This commit is contained in:
parent
7537f59bda
commit
2c5f4e1529
@ -21,7 +21,7 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 148
|
versionCode 149
|
||||||
versionName "2.9.2"
|
versionName "2.9.2"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -65,7 +65,8 @@ class GameInfo {
|
|||||||
&& (it.getOwner()==player || it.neighbors.any { neighbor -> neighbor.getOwner()==player }) }
|
&& (it.getOwner()==player || it.neighbors.any { neighbor -> neighbor.getOwner()==player }) }
|
||||||
for(enemyUnitTile in enemyUnitsCloseToTerritory) {
|
for(enemyUnitTile in enemyUnitsCloseToTerritory) {
|
||||||
val inOrNear = if(enemyUnitTile.getOwner()==player) "in" else "near"
|
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++
|
turns++
|
||||||
@ -98,5 +99,4 @@ class GameInfo {
|
|||||||
cityInfo.cityStats.update()
|
cityInfo.cityStats.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -107,8 +107,12 @@ class MapUnit {
|
|||||||
|
|
||||||
fun canPassThrough(tile: TileInfo):Boolean{
|
fun canPassThrough(tile: TileInfo):Boolean{
|
||||||
val tileOwner = tile.getOwner()
|
val tileOwner = tile.getOwner()
|
||||||
if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit())
|
if(tile.getBaseTerrain().type==TerrainType.Water && baseUnit.unitType.isLandUnit()){
|
||||||
return false
|
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())
|
if(tile.getBaseTerrain().type==TerrainType.Land && baseUnit.unitType.isWaterUnit())
|
||||||
return false
|
return false
|
||||||
if(tile.baseTerrain=="Ocean" && baseUnit.uniques.contains("Cannot enter ocean tiles until Astronomy")
|
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"
|
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
|
//endregion
|
||||||
|
|
||||||
//region state-changing functions
|
//region state-changing functions
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
package com.unciv.logic.map
|
package com.unciv.logic.map
|
||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
|
import com.unciv.models.gamebasics.tile.TerrainType
|
||||||
|
|
||||||
class UnitMovementAlgorithms(val unit:MapUnit) {
|
class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||||
val tileMap = unit.getTile().tileMap
|
val tileMap = unit.getTile().tileMap
|
||||||
|
|
||||||
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo): Float {
|
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)
|
if (from.roadStatus === RoadStatus.Railroad && to.roadStatus === RoadStatus.Railroad)
|
||||||
return 1 / 10f
|
return 1 / 10f
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user