mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Simplified rough terrain check
This commit is contained in:
parent
4cb5a8c912
commit
7686b1ee4a
@ -74,7 +74,7 @@ open class TileInfo {
|
||||
var roadStatus = RoadStatus.None
|
||||
var turnsToImprovement: Int = 0
|
||||
|
||||
fun isHill() = terrainFeatures.contains(Constants.hill)
|
||||
fun isHill() = baseTerrain == Constants.hill || terrainFeatures.contains(Constants.hill)
|
||||
|
||||
var hasBottomRightRiver = false
|
||||
var hasBottomRiver = false
|
||||
@ -191,6 +191,8 @@ open class TileInfo {
|
||||
}
|
||||
|
||||
fun getTerrainFeatures(): List<Terrain> = terrainFeatures.mapNotNull { ruleset.terrains[it] }
|
||||
fun getAllTerrains(): Sequence<Terrain> = sequenceOf(baseTerrainObject) +
|
||||
terrainFeatures.asSequence().mapNotNull { ruleset.terrains[it] }
|
||||
|
||||
fun getWorkingCity(): CityInfo? {
|
||||
val civInfo = getOwner()
|
||||
@ -437,9 +439,6 @@ open class TileInfo {
|
||||
return min(distance, wrappedDistance).toInt()
|
||||
}
|
||||
|
||||
fun isRoughTerrain() = getBaseTerrain().rough || getTerrainFeatures().any { it.rough }
|
||||
|| getBaseTerrain().uniques.contains("Rough") || getTerrainFeatures().any { it.uniques.contains("Rough") }
|
||||
|
||||
override fun toString(): String { // for debugging, it helps to see what you're doing
|
||||
return toString(null)
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
if (civInfo.nation.ignoreHillMovementCost && to.isHill())
|
||||
return 1f + extraCost // usually hills take 2 movements, so here it is 1
|
||||
|
||||
if (unit.roughTerrainPenalty && to.isRoughTerrain())
|
||||
if (unit.roughTerrainPenalty && to.getAllTerrains().any { it.rough || it.uniques.contains("Rough terrain") })
|
||||
return 4f + extraCost
|
||||
|
||||
if (unit.doubleMovementInCoast && to.baseTerrain == Constants.coast)
|
||||
|
Loading…
Reference in New Issue
Block a user