mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 03:18:18 +07:00
Height of terrains is now defined by a unique
This commit is contained in:
parent
59a419c1c9
commit
e8d4767b6d
@ -64,7 +64,8 @@
|
||||
"name": "Mountain",
|
||||
"type": "Land",
|
||||
"impassable": true,
|
||||
"RGB": [120, 120, 120]
|
||||
"RGB": [120, 120, 120],
|
||||
"uniques":["Has an elevation of [4] for visibility calculations"]
|
||||
},
|
||||
{
|
||||
"name": "Snow",
|
||||
@ -85,7 +86,8 @@
|
||||
"defenceBonus": 0.25,
|
||||
"RGB": [105,125,72],
|
||||
"occursOn": ["Tundra","Plains","Grassland","Desert","Snow"],
|
||||
"uniques": ["Rough terrain", "[+5] Strength for cities built on this terrain", "[+1] Sight for [Land] units"]
|
||||
"uniques": ["Rough terrain", "[+5] Strength for cities built on this terrain",
|
||||
"[+1] Sight for [Land] units", "Has an elevation of [2] for visibility calculations"]
|
||||
},
|
||||
{
|
||||
"name": "Forest",
|
||||
@ -97,7 +99,8 @@
|
||||
"unbuildable": true,
|
||||
"defenceBonus": 0.25,
|
||||
"occursOn": ["Tundra","Plains","Grassland","Hill"],
|
||||
"uniques": ["Provides a one-time Production bonus to the closest city when cut down", "Rough terrain"]
|
||||
"uniques": ["Provides a one-time Production bonus to the closest city when cut down", "Rough terrain",
|
||||
"Has an elevation of [1] for visibility calculations"]
|
||||
},
|
||||
{
|
||||
"name": "Jungle",
|
||||
@ -108,7 +111,7 @@
|
||||
"unbuildable": true,
|
||||
"defenceBonus": 0.25,
|
||||
"occursOn": ["Plains","Grassland"],
|
||||
"uniques": ["Rough terrain"]
|
||||
"uniques": ["Rough terrain", "Has an elevation of [1] for visibility calculations"]
|
||||
},
|
||||
{
|
||||
"name": "Marsh",
|
||||
|
@ -163,6 +163,13 @@ open class TileInfo {
|
||||
// and the toSequence so that aggregations (like neighbors.flatMap{it.units} don't take up their own space
|
||||
|
||||
fun getHeight(): Int {
|
||||
if (ruleset.terrains.values.asSequence().flatMap { it.uniqueObjects }
|
||||
.any { it.placeholderText == "Has an elevation of [] for visibility calculations" })
|
||||
return getAllTerrains().flatMap { it.uniqueObjects }
|
||||
.filter { it.placeholderText == "Has an elevation of [] for visibility calculations" }
|
||||
.map { it.params[0].toInt() }.sum()
|
||||
|
||||
// Old method - deprecated 3.14.7
|
||||
if (baseTerrain == Constants.mountain) return 4
|
||||
if (isHill()) return 2
|
||||
if (terrainFeatures.contains(Constants.forest) || terrainFeatures.contains(Constants.jungle)) return 1
|
||||
@ -382,12 +389,12 @@ open class TileInfo {
|
||||
|| filter == "River" && isAdjacentToRiver()
|
||||
|| terrainFeatures.contains(filter)
|
||||
|| baseTerrainObject.uniques.contains(filter)
|
||||
|| terrainFeatures.isNotEmpty() && getTerrainFeatures().last().uniques.contains(filter)
|
||||
|| improvement == filter
|
||||
|| civInfo != null && hasViewableResource(civInfo) && resource == filter
|
||||
|| filter == "Water" && isWater
|
||||
|| filter == "Land" && isLand
|
||||
|| filter == naturalWonder
|
||||
|| terrainFeatures.isNotEmpty() && getTerrainFeatures().last().uniques.contains(filter)
|
||||
|| civInfo != null && hasViewableResource(civInfo) && resource == filter
|
||||
|| filter == "Foreign Land" && civInfo!=null && !isFriendlyTerritory(civInfo)
|
||||
|| filter == "Friendly Land" && civInfo!=null && isFriendlyTerritory(civInfo)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user