diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index 5372409f2b..8e900cb5a6 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -448,6 +448,8 @@ Clearing a [forest] has created [amount] Production for [cityName] = [civName] assigned you a new quest: [questName]. = [civName] rewarded you with [influence] influence for completing the [questName] quest. = The resistance in [cityName] has ended! = +Our [name] took [tileDamage] tile damage and was destroyed = +Our [name] took [tileDamage] tile damage = # World Screen UI diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index fb45e7050c..09e3ce833b 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -31,6 +31,8 @@ class MapUnit { // a major component of getDistanceToTilesWithinTurn, // which in turn is a component of getShortestPath and canReach @Transient var ignoresTerrainCost = false + @Transient var allTilesCosts1 = false + @Transient var canPassThroughImpassableTiles = false @Transient var roughTerrainPenalty = false @Transient var doubleMovementInCoast = false @Transient var doubleMovementInForestAndJungle = false @@ -121,6 +123,8 @@ class MapUnit { tempUniques = uniques + allTilesCosts1 = hasUnique("All tiles costs 1") + canPassThroughImpassableTiles = hasUnique("Can pass through impassable tiles") ignoresTerrainCost = hasUnique("Ignores terrain cost") roughTerrainPenalty = hasUnique("Rough terrain penalty") doubleMovementInCoast = hasUnique("Double movement in coast") @@ -439,6 +443,7 @@ class MapUnit { } getCitadelDamage() + getTerrainDamage() } fun startTurn() { @@ -657,6 +662,20 @@ class MapUnit { .sumBy { it.params[0].toInt() } } + private fun getTerrainDamage() { + // hard coded mountain damage for now + if (getTile().baseTerrain == Constants.mountain) { + val tileDamage = 50 + health -= tileDamage + + if (health <= 0) { + civInfo.addNotification("Our [$name] took [$tileDamage] tile damage and was destroyed", currentTile.position, Color.RED) + destroy() + } else civInfo.addNotification("Our [$name] took [$tileDamage] tile damage", currentTile.position, Color.RED) + } + + } + private fun getCitadelDamage() { // Check for Citadel damage val applyCitadelDamage = currentTile.neighbors diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 6769d5ab95..d517f147c5 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -8,6 +8,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) { // This function is called ALL THE TIME and should be as time-optimal as possible! fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float { + if (unit.allTilesCosts1) + return 1f if ((from.isLand != to.isLand) && !unit.civInfo.nation.embarkDisembarkCosts1 && unit.type.isLandUnit()) return 100f // this is embarkment or disembarkment, and will take the entire turn @@ -330,8 +332,9 @@ class UnitMovementAlgorithms(val unit:MapUnit) { // because optimization on this function results in massive benefits! fun canPassThrough(tile: TileInfo): Boolean { if (tile.isImpassible()){ - // special exception - ice tiles are technically impassible, but somme units can move through them anyway - if (!(tile.terrainFeature == Constants.ice && unit.canEnterIceTiles)) + // special exception - ice tiles are technically impassible, but some units can move through them anyway + // helicopters can pass through impassable tiles like mountains + if (!(tile.terrainFeature == Constants.ice && unit.canEnterIceTiles) && !unit.canPassThroughImpassableTiles) return false } if (tile.isLand