diff --git a/android/assets/jsons/Civ V - Vanilla/Terrains.json b/android/assets/jsons/Civ V - Vanilla/Terrains.json index a97a5d0266..0439ffc1dd 100644 --- a/android/assets/jsons/Civ V - Vanilla/Terrains.json +++ b/android/assets/jsons/Civ V - Vanilla/Terrains.json @@ -305,18 +305,85 @@ "impassable": true, "unbuildable": true, "weight": 10 - } + }, + { + "name": "Mount Kailash", + "type": "NaturalWonder", + "faith": 6, + "happiness": 2, + "occursOn": ["Plains","Grassland"], + "turnsInto": "Mountain", + "impassable": true, + "unbuildable": true, + "weight": 10 + }, + { + "name": "Mount Sinai", + "type": "NaturalWonder", + "faith": 8, + "occursOn": ["Desert","Plains"], + "turnsInto": "Mountain", + "impassable": true, + "unbuildable": true, + "weight": 10 + }, + { + "name": "Sri Pada", + "type": "NaturalWonder", + "food": 2, + "faith": 4, + "happiness": 2, + "occursOn": ["Plains","Grassland"], + "turnsInto": "Mountain", + "impassable": true, + "unbuildable": true, + "weight": 10 + }, + { + "name": "Uluru", + "type": "NaturalWonder", + "food": 2, + "faith": 6, + "occursOn": ["Plains","Desert"], + "turnsInto": "Mountain", + "impassable": true, + "unbuildable": true, + "weight": 10 + } /* + // BNW wonders + { + "name": "King Solomon's Mines", + "type": "NaturalWonder", + "production": 6, + "occursOn": ["Plains","Desert"], + "turnsInto": "Plains", + "impassable": true, + "unbuildable": true, + "weight": 4 + }, {// Will be introduced in Brave New World. Despite being a lake, it cannot be sailed on and it blocks line of sight like a mountain. "name": "Lake Victoria", "type": "NaturalWonder", "food": 6, - "occursOn": [Plains"], + "occursOn": ["Plains"], "turnsInto": "Mountain", "impassable": true, "unbuildable": true, "uniques": ["Fresh water"], - "weight": 5 + "weight": 10 + }, + { + "name": "Mount Kilimanjaro", + "type": "NaturalWonder", + "food": 3, + "culture": 2, + "occursOn": ["Plains","Grassland"], + "turnsInto": "Mountain", + "impassable": true, + "unbuildable": true, + "uniques": ["Grants Altitude Training (double movement and +10% Strength in hills) to adjacent land units for the rest of the game"], //ToDo + "weight": 10 } */ ] diff --git a/core/src/com/unciv/Constants.kt b/core/src/com/unciv/Constants.kt index 725c289851..5d413e32c6 100644 --- a/core/src/com/unciv/Constants.kt +++ b/core/src/com/unciv/Constants.kt @@ -45,6 +45,15 @@ object Constants { const val cerroDePotosi = "Cerro de Potosi" const val elDorado = "El Dorado" const val fountainOfYouth = "Fountain of Youth" + const val mountKailash = "Mount Kailash" + const val mountSinai = "Mount Sinai" + const val sriPada = "Sri Pada" + const val uluru = "Uluru" + /* + const val kingSolomonsMines = "King Solomon's Mines" //BNW + const val lakeVictoria = "Lake Victoria" //BNW + const val mountKilimanjaro = "Mount Kilimanjaro" //BNW + */ const val barbarianEncampment = "Barbarian encampment" diff --git a/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt b/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt index e427fddff5..6a5a171a9c 100644 --- a/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt +++ b/core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt @@ -55,6 +55,15 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration Constants.cerroDePotosi -> spawnCerroDePotosi(tileMap) Constants.elDorado -> spawnElDorado(tileMap) Constants.fountainOfYouth -> spawnFountainOfYouth(tileMap) + Constants.mountKailash -> spawnMountKailash(tileMap) + Constants.mountSinai -> spawnMountSinai(tileMap) + Constants.sriPada -> spawnSriPada(tileMap) + Constants.uluru -> spawnUluru(tileMap) + /* + Constants.kingSolomonsMines -> spawnSolomonMines(tileMap) + Constants.lakeVictoria -> spawnLakeVictoria(tileMap) + Constants.mountKilimanjaro -> spawnMountKilimanjaro(tileMap) + */ } } } @@ -75,15 +84,16 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration /* - Must be in tundra or desert; cannot be adjacent to grassland; can be adjacent to a maximum + Barringer Crater: Must be in tundra or desert; cannot be adjacent to grassland; can be adjacent to a maximum of 2 mountains and a maximum of 4 hills and mountains; avoids oceans; becomes mountain */ private fun spawnBarringerCrater(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.barringerCrater]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2 && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain || neighbor.isHill() } <= 4 } @@ -92,16 +102,18 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration } /* - Mt. Fuji: Must be in grass or plains; cannot be adjacent to tundra, desert, marsh, or mountains; - can be adjacent to a maximum of 2 hills; becomes mountain + Mt. Fuji: Must be in grass or plains; avoids oceans and the biggest landmass; cannot be adjacent to tundra, + desert, marsh, or mountains;can be adjacent to a maximum of 2 hills; becomes mountain + // ToDo: avoids the biggest landmass */ private fun spawnMountFuji(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.mountFuji]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra } && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.desert } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } && it.neighbors.none { neighbor -> neighbor.getLastTerrain().name == Constants.marsh } && it.neighbors.count { neighbor -> neighbor.isHill() } <= 2 @@ -117,9 +129,10 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnGrandMesa(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.grandMesa]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) && it.neighbors.count { neighbor -> neighbor.isHill() } >= 2 + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland } && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2 } @@ -134,7 +147,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnGreatBarrierReef(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.greatBarrierReef]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) && abs(it.latitude) > tileMap.maxLatitude * 0.1 && abs(it.latitude) < tileMap.maxLatitude * 0.7 @@ -151,7 +164,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration if (location != null) { val possibleLocations = location.neighbors .filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) && it.neighbors.all { it.isWater } }.toList() @@ -166,7 +179,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnKrakatoa(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.krakatoa]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) && it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.none { neighbor -> neighbor.getLastTerrain().name == Constants.ice } @@ -190,7 +203,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnRockOfGibraltar(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.rockOfGibraltar]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) && it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } == 1 @@ -223,8 +236,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnOldFaithful(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.oldFaithful]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 4 && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain || @@ -243,8 +257,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnCerroDePotosi(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.cerroDePotosi]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.any { neighbor -> neighbor.isHill() } } @@ -257,8 +272,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnElDorado(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.elDorado]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } && it.neighbors.any { neighbor -> neighbor.getLastTerrain().name == Constants.jungle } } @@ -271,17 +287,145 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration private fun spawnFountainOfYouth(tileMap: TileMap) { val wonder = ruleset.terrains[Constants.fountainOfYouth]!! val suitableLocations = tileMap.values.filter { - it.resource == null && it.improvement == null + it.resource == null && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } } trySpawnOnSuitableLocation(suitableLocations, wonder) } + // G&K Natural Wonders + + /* + Mount Kailash: Must be in plains or grassland, and must be adjacent to at least 4 hills and/or mountains; + cannot be adjacent to marshes; can be adjacent to a maximum of 1 desert tile; avoids oceans; becomes mountain + */ + private fun spawnMountKailash(tileMap: TileMap) { + val wonder = ruleset.terrains[Constants.mountKailash]!! + val suitableLocations = tileMap.values.filter { + it.resource == null + && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } + && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain || neighbor.isHill() } >= 4 + && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.desert} <= 1 + } + + trySpawnOnSuitableLocation(suitableLocations, wonder) + } + + /* + Mount Sinai: Must be in plains or desert, and must be adjacent to a minimum of 3 desert tiles; + cannot be adjacent to tundra, marshes, or grassland; avoids oceans; becomes mountain + */ + private fun spawnMountSinai(tileMap: TileMap) { + val wonder = ruleset.terrains[Constants.mountSinai]!! + val suitableLocations = tileMap.values.filter { + it.resource == null + && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } + && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.desert } >= 3 + } + + trySpawnOnSuitableLocation(suitableLocations, wonder) + } + + /* + Sri Pada: Must be in a grass or plains; cannot be adjacent to desert, tundra, or marshes; + avoids the biggest landmass ; becomes mountain + // ToDo: avoids the biggest landmass + */ + private fun spawnSriPada(tileMap: TileMap) { + val wonder = ruleset.terrains[Constants.sriPada]!! + val suitableLocations = tileMap.values.filter { + it.resource == null + && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.desert } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh } + } + + trySpawnOnSuitableLocation(suitableLocations, wonder) + } + + /* + Uluru: Must be in plains or desert, and must be adjacent to a minimum of 3 plains tiles; + cannot be adjacent to grassland, tundra, or marshes; avoids oceans; becomes mountain + */ + private fun spawnUluru(tileMap: TileMap) { + val wonder = ruleset.terrains[Constants.uluru]!! + val suitableLocations = tileMap.values.filter { + it.resource == null + && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh } + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra } + && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.plains } >= 3 + } + + trySpawnOnSuitableLocation(suitableLocations, wonder) + } + + //BNW Natural Wonders + /* + + /* + King Solomon's Mines: Cannot be adjacent to more than 2 mountains; avoids oceans; becomes flatland plains + */ + private fun spawnSolomonMines(tileMap: TileMap) { + val wonder = ruleset.terrains[Constants.kingSolomonsMines]!! + val suitableLocations = tileMap.values.filter { + it.resource == null + && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } + && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2 + } + + trySpawnOnSuitableLocation(suitableLocations, wonder) + } + + /* + Lake Victoria: Avoids oceans; becomes flatland plains + */ + private fun spawnLakeVictoria(tileMap: TileMap) { + val wonder = ruleset.terrains[Constants.lakeVictoria]!! + val suitableLocations = tileMap.values.filter { + it.resource == null + && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } + } + + trySpawnOnSuitableLocation(suitableLocations, wonder) + } + + /* + Mount Kilimanjaro: Must be in plains or grassland, and must be adjacent to at least 2 hills; + cannot be adjacent to more than 2 mountains; avoids oceans; becomes mountain + */ + private fun spawnMountKilimanjaro(tileMap: TileMap) { + val wonder = ruleset.terrains[Constants.mountKilimanjaro]!! + val suitableLocations = tileMap.values.filter { + it.resource == null + && wonder.occursOn.contains(it.getLastTerrain().name) + && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast } + && it.neighbors.count { neighbor -> neighbor.isHill() } >= 2 + && it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2 + } + + trySpawnOnSuitableLocation(suitableLocations, wonder) + } + + */ + private fun clearTile(tile: TileInfo){ tile.terrainFeatures.clear() tile.resource = null tile.improvement = null tile.setTerrainTransients() } -} \ No newline at end of file +}