Skip to content

Commit 893f41a

Browse files
authored
Add missing Natural Wonders (#5204)
* Add files via upload * Add files via upload * Add files via upload * Update Terrains.json * Update Constants.kt * Update Constants.kt * Update NaturalWonderGenerator.kt * Update Constants.kt * Update NaturalWonderGenerator.kt * Natural Wonders generation fixes.
1 parent 33ce6a7 commit 893f41a

File tree

3 files changed

+238
-18
lines changed

3 files changed

+238
-18
lines changed

android/assets/jsons/Civ V - Vanilla/Terrains.json

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,85 @@
305305
"impassable": true,
306306
"unbuildable": true,
307307
"weight": 10
308-
}
308+
},
309+
{
310+
"name": "Mount Kailash",
311+
"type": "NaturalWonder",
312+
"faith": 6,
313+
"happiness": 2,
314+
"occursOn": ["Plains","Grassland"],
315+
"turnsInto": "Mountain",
316+
"impassable": true,
317+
"unbuildable": true,
318+
"weight": 10
319+
},
320+
{
321+
"name": "Mount Sinai",
322+
"type": "NaturalWonder",
323+
"faith": 8,
324+
"occursOn": ["Desert","Plains"],
325+
"turnsInto": "Mountain",
326+
"impassable": true,
327+
"unbuildable": true,
328+
"weight": 10
329+
},
330+
{
331+
"name": "Sri Pada",
332+
"type": "NaturalWonder",
333+
"food": 2,
334+
"faith": 4,
335+
"happiness": 2,
336+
"occursOn": ["Plains","Grassland"],
337+
"turnsInto": "Mountain",
338+
"impassable": true,
339+
"unbuildable": true,
340+
"weight": 10
341+
},
342+
{
343+
"name": "Uluru",
344+
"type": "NaturalWonder",
345+
"food": 2,
346+
"faith": 6,
347+
"occursOn": ["Plains","Desert"],
348+
"turnsInto": "Mountain",
349+
"impassable": true,
350+
"unbuildable": true,
351+
"weight": 10
352+
}
309353
/*
354+
// BNW wonders
355+
{
356+
"name": "King Solomon's Mines",
357+
"type": "NaturalWonder",
358+
"production": 6,
359+
"occursOn": ["Plains","Desert"],
360+
"turnsInto": "Plains",
361+
"impassable": true,
362+
"unbuildable": true,
363+
"weight": 4
364+
},
310365
{// 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.
311366
"name": "Lake Victoria",
312367
"type": "NaturalWonder",
313368
"food": 6,
314-
"occursOn": [Plains"],
369+
"occursOn": ["Plains"],
315370
"turnsInto": "Mountain",
316371
"impassable": true,
317372
"unbuildable": true,
318373
"uniques": ["Fresh water"],
319-
"weight": 5
374+
"weight": 10
375+
},
376+
{
377+
"name": "Mount Kilimanjaro",
378+
"type": "NaturalWonder",
379+
"food": 3,
380+
"culture": 2,
381+
"occursOn": ["Plains","Grassland"],
382+
"turnsInto": "Mountain",
383+
"impassable": true,
384+
"unbuildable": true,
385+
"uniques": ["Grants Altitude Training (double movement and +10% Strength in hills) to adjacent land units for the rest of the game"], //ToDo
386+
"weight": 10
320387
}
321388
*/
322389
]

core/src/com/unciv/Constants.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ object Constants {
4545
const val cerroDePotosi = "Cerro de Potosi"
4646
const val elDorado = "El Dorado"
4747
const val fountainOfYouth = "Fountain of Youth"
48+
const val mountKailash = "Mount Kailash"
49+
const val mountSinai = "Mount Sinai"
50+
const val sriPada = "Sri Pada"
51+
const val uluru = "Uluru"
52+
/*
53+
const val kingSolomonsMines = "King Solomon's Mines" //BNW
54+
const val lakeVictoria = "Lake Victoria" //BNW
55+
const val mountKilimanjaro = "Mount Kilimanjaro" //BNW
56+
*/
4857

4958
const val barbarianEncampment = "Barbarian encampment"
5059

core/src/com/unciv/logic/map/mapgenerator/NaturalWonderGenerator.kt

Lines changed: 159 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
5555
Constants.cerroDePotosi -> spawnCerroDePotosi(tileMap)
5656
Constants.elDorado -> spawnElDorado(tileMap)
5757
Constants.fountainOfYouth -> spawnFountainOfYouth(tileMap)
58+
Constants.mountKailash -> spawnMountKailash(tileMap)
59+
Constants.mountSinai -> spawnMountSinai(tileMap)
60+
Constants.sriPada -> spawnSriPada(tileMap)
61+
Constants.uluru -> spawnUluru(tileMap)
62+
/*
63+
Constants.kingSolomonsMines -> spawnSolomonMines(tileMap)
64+
Constants.lakeVictoria -> spawnLakeVictoria(tileMap)
65+
Constants.mountKilimanjaro -> spawnMountKilimanjaro(tileMap)
66+
*/
5867
}
5968
}
6069
}
@@ -75,15 +84,16 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
7584

7685

7786
/*
78-
Must be in tundra or desert; cannot be adjacent to grassland; can be adjacent to a maximum
87+
Barringer Crater: Must be in tundra or desert; cannot be adjacent to grassland; can be adjacent to a maximum
7988
of 2 mountains and a maximum of 4 hills and mountains; avoids oceans; becomes mountain
8089
*/
8190
private fun spawnBarringerCrater(tileMap: TileMap) {
8291
val wonder = ruleset.terrains[Constants.barringerCrater]!!
8392
val suitableLocations = tileMap.values.filter {
84-
it.resource == null && it.improvement == null
93+
it.resource == null
8594
&& wonder.occursOn.contains(it.getLastTerrain().name)
8695
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland }
96+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
8797
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2
8898
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain || neighbor.isHill() } <= 4
8999
}
@@ -92,16 +102,18 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
92102
}
93103

94104
/*
95-
Mt. Fuji: Must be in grass or plains; cannot be adjacent to tundra, desert, marsh, or mountains;
96-
can be adjacent to a maximum of 2 hills; becomes mountain
105+
Mt. Fuji: Must be in grass or plains; avoids oceans and the biggest landmass; cannot be adjacent to tundra,
106+
desert, marsh, or mountains;can be adjacent to a maximum of 2 hills; becomes mountain
107+
// ToDo: avoids the biggest landmass
97108
*/
98109
private fun spawnMountFuji(tileMap: TileMap) {
99110
val wonder = ruleset.terrains[Constants.mountFuji]!!
100111
val suitableLocations = tileMap.values.filter {
101-
it.resource == null && it.improvement == null
112+
it.resource == null
102113
&& wonder.occursOn.contains(it.getLastTerrain().name)
103114
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra }
104115
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.desert }
116+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
105117
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain }
106118
&& it.neighbors.none { neighbor -> neighbor.getLastTerrain().name == Constants.marsh }
107119
&& it.neighbors.count { neighbor -> neighbor.isHill() } <= 2
@@ -117,9 +129,10 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
117129
private fun spawnGrandMesa(tileMap: TileMap) {
118130
val wonder = ruleset.terrains[Constants.grandMesa]!!
119131
val suitableLocations = tileMap.values.filter {
120-
it.resource == null && it.improvement == null
132+
it.resource == null
121133
&& wonder.occursOn.contains(it.getLastTerrain().name)
122134
&& it.neighbors.count { neighbor -> neighbor.isHill() } >= 2
135+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
123136
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland }
124137
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2
125138
}
@@ -134,7 +147,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
134147
private fun spawnGreatBarrierReef(tileMap: TileMap) {
135148
val wonder = ruleset.terrains[Constants.greatBarrierReef]!!
136149
val suitableLocations = tileMap.values.filter {
137-
it.resource == null && it.improvement == null
150+
it.resource == null
138151
&& wonder.occursOn.contains(it.getLastTerrain().name)
139152
&& abs(it.latitude) > tileMap.maxLatitude * 0.1
140153
&& abs(it.latitude) < tileMap.maxLatitude * 0.7
@@ -151,7 +164,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
151164
if (location != null) {
152165
val possibleLocations = location.neighbors
153166
.filter {
154-
it.resource == null && it.improvement == null
167+
it.resource == null
155168
&& wonder.occursOn.contains(it.getLastTerrain().name)
156169
&& it.neighbors.all { it.isWater }
157170
}.toList()
@@ -166,7 +179,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
166179
private fun spawnKrakatoa(tileMap: TileMap) {
167180
val wonder = ruleset.terrains[Constants.krakatoa]!!
168181
val suitableLocations = tileMap.values.filter {
169-
it.resource == null && it.improvement == null
182+
it.resource == null
170183
&& wonder.occursOn.contains(it.getLastTerrain().name)
171184
&& it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
172185
&& it.neighbors.none { neighbor -> neighbor.getLastTerrain().name == Constants.ice }
@@ -190,7 +203,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
190203
private fun spawnRockOfGibraltar(tileMap: TileMap) {
191204
val wonder = ruleset.terrains[Constants.rockOfGibraltar]!!
192205
val suitableLocations = tileMap.values.filter {
193-
it.resource == null && it.improvement == null
206+
it.resource == null
194207
&& wonder.occursOn.contains(it.getLastTerrain().name)
195208
&& it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
196209
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } == 1
@@ -223,8 +236,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
223236
private fun spawnOldFaithful(tileMap: TileMap) {
224237
val wonder = ruleset.terrains[Constants.oldFaithful]!!
225238
val suitableLocations = tileMap.values.filter {
226-
it.resource == null && it.improvement == null
239+
it.resource == null
227240
&& wonder.occursOn.contains(it.getLastTerrain().name)
241+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
228242
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 4
229243
&& it.neighbors.count { neighbor ->
230244
neighbor.getBaseTerrain().name == Constants.mountain ||
@@ -243,8 +257,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
243257
private fun spawnCerroDePotosi(tileMap: TileMap) {
244258
val wonder = ruleset.terrains[Constants.cerroDePotosi]!!
245259
val suitableLocations = tileMap.values.filter {
246-
it.resource == null && it.improvement == null
260+
it.resource == null
247261
&& wonder.occursOn.contains(it.getLastTerrain().name)
262+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
248263
&& it.neighbors.any { neighbor -> neighbor.isHill() }
249264
}
250265

@@ -257,8 +272,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
257272
private fun spawnElDorado(tileMap: TileMap) {
258273
val wonder = ruleset.terrains[Constants.elDorado]!!
259274
val suitableLocations = tileMap.values.filter {
260-
it.resource == null && it.improvement == null
275+
it.resource == null
261276
&& wonder.occursOn.contains(it.getLastTerrain().name)
277+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
262278
&& it.neighbors.any { neighbor -> neighbor.getLastTerrain().name == Constants.jungle }
263279
}
264280

@@ -271,17 +287,145 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
271287
private fun spawnFountainOfYouth(tileMap: TileMap) {
272288
val wonder = ruleset.terrains[Constants.fountainOfYouth]!!
273289
val suitableLocations = tileMap.values.filter {
274-
it.resource == null && it.improvement == null
290+
it.resource == null
275291
&& wonder.occursOn.contains(it.getLastTerrain().name)
292+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
276293
}
277294

278295
trySpawnOnSuitableLocation(suitableLocations, wonder)
279296
}
280297

298+
// G&K Natural Wonders
299+
300+
/*
301+
Mount Kailash: Must be in plains or grassland, and must be adjacent to at least 4 hills and/or mountains;
302+
cannot be adjacent to marshes; can be adjacent to a maximum of 1 desert tile; avoids oceans; becomes mountain
303+
*/
304+
private fun spawnMountKailash(tileMap: TileMap) {
305+
val wonder = ruleset.terrains[Constants.mountKailash]!!
306+
val suitableLocations = tileMap.values.filter {
307+
it.resource == null
308+
&& wonder.occursOn.contains(it.getLastTerrain().name)
309+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh }
310+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
311+
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain || neighbor.isHill() } >= 4
312+
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.desert} <= 1
313+
}
314+
315+
trySpawnOnSuitableLocation(suitableLocations, wonder)
316+
}
317+
318+
/*
319+
Mount Sinai: Must be in plains or desert, and must be adjacent to a minimum of 3 desert tiles;
320+
cannot be adjacent to tundra, marshes, or grassland; avoids oceans; becomes mountain
321+
*/
322+
private fun spawnMountSinai(tileMap: TileMap) {
323+
val wonder = ruleset.terrains[Constants.mountSinai]!!
324+
val suitableLocations = tileMap.values.filter {
325+
it.resource == null
326+
&& wonder.occursOn.contains(it.getLastTerrain().name)
327+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh }
328+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra }
329+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland }
330+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
331+
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.desert } >= 3
332+
}
333+
334+
trySpawnOnSuitableLocation(suitableLocations, wonder)
335+
}
336+
337+
/*
338+
Sri Pada: Must be in a grass or plains; cannot be adjacent to desert, tundra, or marshes;
339+
avoids the biggest landmass ; becomes mountain
340+
// ToDo: avoids the biggest landmass
341+
*/
342+
private fun spawnSriPada(tileMap: TileMap) {
343+
val wonder = ruleset.terrains[Constants.sriPada]!!
344+
val suitableLocations = tileMap.values.filter {
345+
it.resource == null
346+
&& wonder.occursOn.contains(it.getLastTerrain().name)
347+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.desert }
348+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra }
349+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh }
350+
}
351+
352+
trySpawnOnSuitableLocation(suitableLocations, wonder)
353+
}
354+
355+
/*
356+
Uluru: Must be in plains or desert, and must be adjacent to a minimum of 3 plains tiles;
357+
cannot be adjacent to grassland, tundra, or marshes; avoids oceans; becomes mountain
358+
*/
359+
private fun spawnUluru(tileMap: TileMap) {
360+
val wonder = ruleset.terrains[Constants.uluru]!!
361+
val suitableLocations = tileMap.values.filter {
362+
it.resource == null
363+
&& wonder.occursOn.contains(it.getLastTerrain().name)
364+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.grassland }
365+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
366+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.marsh }
367+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.tundra }
368+
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.plains } >= 3
369+
}
370+
371+
trySpawnOnSuitableLocation(suitableLocations, wonder)
372+
}
373+
374+
//BNW Natural Wonders
375+
/*
376+
377+
/*
378+
King Solomon's Mines: Cannot be adjacent to more than 2 mountains; avoids oceans; becomes flatland plains
379+
*/
380+
private fun spawnSolomonMines(tileMap: TileMap) {
381+
val wonder = ruleset.terrains[Constants.kingSolomonsMines]!!
382+
val suitableLocations = tileMap.values.filter {
383+
it.resource == null
384+
&& wonder.occursOn.contains(it.getLastTerrain().name)
385+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
386+
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2
387+
}
388+
389+
trySpawnOnSuitableLocation(suitableLocations, wonder)
390+
}
391+
392+
/*
393+
Lake Victoria: Avoids oceans; becomes flatland plains
394+
*/
395+
private fun spawnLakeVictoria(tileMap: TileMap) {
396+
val wonder = ruleset.terrains[Constants.lakeVictoria]!!
397+
val suitableLocations = tileMap.values.filter {
398+
it.resource == null
399+
&& wonder.occursOn.contains(it.getLastTerrain().name)
400+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
401+
}
402+
403+
trySpawnOnSuitableLocation(suitableLocations, wonder)
404+
}
405+
406+
/*
407+
Mount Kilimanjaro: Must be in plains or grassland, and must be adjacent to at least 2 hills;
408+
cannot be adjacent to more than 2 mountains; avoids oceans; becomes mountain
409+
*/
410+
private fun spawnMountKilimanjaro(tileMap: TileMap) {
411+
val wonder = ruleset.terrains[Constants.mountKilimanjaro]!!
412+
val suitableLocations = tileMap.values.filter {
413+
it.resource == null
414+
&& wonder.occursOn.contains(it.getLastTerrain().name)
415+
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants.coast }
416+
&& it.neighbors.count { neighbor -> neighbor.isHill() } >= 2
417+
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants.mountain } <= 2
418+
}
419+
420+
trySpawnOnSuitableLocation(suitableLocations, wonder)
421+
}
422+
423+
*/
424+
281425
private fun clearTile(tile: TileInfo){
282426
tile.terrainFeatures.clear()
283427
tile.resource = null
284428
tile.improvement = null
285429
tile.setTerrainTransients()
286430
}
287-
}
431+
}

0 commit comments

Comments
 (0)