@@ -55,6 +55,15 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
55
55
Constants .cerroDePotosi -> spawnCerroDePotosi(tileMap)
56
56
Constants .elDorado -> spawnElDorado(tileMap)
57
57
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
+ */
58
67
}
59
68
}
60
69
}
@@ -75,15 +84,16 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
75
84
76
85
77
86
/*
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
79
88
of 2 mountains and a maximum of 4 hills and mountains; avoids oceans; becomes mountain
80
89
*/
81
90
private fun spawnBarringerCrater (tileMap : TileMap ) {
82
91
val wonder = ruleset.terrains[Constants .barringerCrater]!!
83
92
val suitableLocations = tileMap.values.filter {
84
- it.resource == null && it.improvement == null
93
+ it.resource == null
85
94
&& wonder.occursOn.contains(it.getLastTerrain().name)
86
95
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .grassland }
96
+ && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
87
97
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants .mountain } <= 2
88
98
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants .mountain || neighbor.isHill() } <= 4
89
99
}
@@ -92,16 +102,18 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
92
102
}
93
103
94
104
/*
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
97
108
*/
98
109
private fun spawnMountFuji (tileMap : TileMap ) {
99
110
val wonder = ruleset.terrains[Constants .mountFuji]!!
100
111
val suitableLocations = tileMap.values.filter {
101
- it.resource == null && it.improvement == null
112
+ it.resource == null
102
113
&& wonder.occursOn.contains(it.getLastTerrain().name)
103
114
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .tundra }
104
115
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .desert }
116
+ && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
105
117
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .mountain }
106
118
&& it.neighbors.none { neighbor -> neighbor.getLastTerrain().name == Constants .marsh }
107
119
&& it.neighbors.count { neighbor -> neighbor.isHill() } <= 2
@@ -117,9 +129,10 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
117
129
private fun spawnGrandMesa (tileMap : TileMap ) {
118
130
val wonder = ruleset.terrains[Constants .grandMesa]!!
119
131
val suitableLocations = tileMap.values.filter {
120
- it.resource == null && it.improvement == null
132
+ it.resource == null
121
133
&& wonder.occursOn.contains(it.getLastTerrain().name)
122
134
&& it.neighbors.count { neighbor -> neighbor.isHill() } >= 2
135
+ && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
123
136
&& it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .grassland }
124
137
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants .mountain } <= 2
125
138
}
@@ -134,7 +147,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
134
147
private fun spawnGreatBarrierReef (tileMap : TileMap ) {
135
148
val wonder = ruleset.terrains[Constants .greatBarrierReef]!!
136
149
val suitableLocations = tileMap.values.filter {
137
- it.resource == null && it.improvement == null
150
+ it.resource == null
138
151
&& wonder.occursOn.contains(it.getLastTerrain().name)
139
152
&& abs(it.latitude) > tileMap.maxLatitude * 0.1
140
153
&& abs(it.latitude) < tileMap.maxLatitude * 0.7
@@ -151,7 +164,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
151
164
if (location != null ) {
152
165
val possibleLocations = location.neighbors
153
166
.filter {
154
- it.resource == null && it.improvement == null
167
+ it.resource == null
155
168
&& wonder.occursOn.contains(it.getLastTerrain().name)
156
169
&& it.neighbors.all { it.isWater }
157
170
}.toList()
@@ -166,7 +179,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
166
179
private fun spawnKrakatoa (tileMap : TileMap ) {
167
180
val wonder = ruleset.terrains[Constants .krakatoa]!!
168
181
val suitableLocations = tileMap.values.filter {
169
- it.resource == null && it.improvement == null
182
+ it.resource == null
170
183
&& wonder.occursOn.contains(it.getLastTerrain().name)
171
184
&& it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
172
185
&& it.neighbors.none { neighbor -> neighbor.getLastTerrain().name == Constants .ice }
@@ -190,7 +203,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
190
203
private fun spawnRockOfGibraltar (tileMap : TileMap ) {
191
204
val wonder = ruleset.terrains[Constants .rockOfGibraltar]!!
192
205
val suitableLocations = tileMap.values.filter {
193
- it.resource == null && it.improvement == null
206
+ it.resource == null
194
207
&& wonder.occursOn.contains(it.getLastTerrain().name)
195
208
&& it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
196
209
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants .mountain } == 1
@@ -223,8 +236,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
223
236
private fun spawnOldFaithful (tileMap : TileMap ) {
224
237
val wonder = ruleset.terrains[Constants .oldFaithful]!!
225
238
val suitableLocations = tileMap.values.filter {
226
- it.resource == null && it.improvement == null
239
+ it.resource == null
227
240
&& wonder.occursOn.contains(it.getLastTerrain().name)
241
+ && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
228
242
&& it.neighbors.count { neighbor -> neighbor.getBaseTerrain().name == Constants .mountain } <= 4
229
243
&& it.neighbors.count { neighbor ->
230
244
neighbor.getBaseTerrain().name == Constants .mountain ||
@@ -243,8 +257,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
243
257
private fun spawnCerroDePotosi (tileMap : TileMap ) {
244
258
val wonder = ruleset.terrains[Constants .cerroDePotosi]!!
245
259
val suitableLocations = tileMap.values.filter {
246
- it.resource == null && it.improvement == null
260
+ it.resource == null
247
261
&& wonder.occursOn.contains(it.getLastTerrain().name)
262
+ && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
248
263
&& it.neighbors.any { neighbor -> neighbor.isHill() }
249
264
}
250
265
@@ -257,8 +272,9 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
257
272
private fun spawnElDorado (tileMap : TileMap ) {
258
273
val wonder = ruleset.terrains[Constants .elDorado]!!
259
274
val suitableLocations = tileMap.values.filter {
260
- it.resource == null && it.improvement == null
275
+ it.resource == null
261
276
&& wonder.occursOn.contains(it.getLastTerrain().name)
277
+ && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
262
278
&& it.neighbors.any { neighbor -> neighbor.getLastTerrain().name == Constants .jungle }
263
279
}
264
280
@@ -271,17 +287,145 @@ class NaturalWonderGenerator(val ruleset: Ruleset, val randomness: MapGeneration
271
287
private fun spawnFountainOfYouth (tileMap : TileMap ) {
272
288
val wonder = ruleset.terrains[Constants .fountainOfYouth]!!
273
289
val suitableLocations = tileMap.values.filter {
274
- it.resource == null && it.improvement == null
290
+ it.resource == null
275
291
&& wonder.occursOn.contains(it.getLastTerrain().name)
292
+ && it.neighbors.none { neighbor -> neighbor.getBaseTerrain().name == Constants .coast }
276
293
}
277
294
278
295
trySpawnOnSuitableLocation(suitableLocations, wonder)
279
296
}
280
297
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
+
281
425
private fun clearTile (tile : TileInfo ){
282
426
tile.terrainFeatures.clear()
283
427
tile.resource = null
284
428
tile.improvement = null
285
429
tile.setTerrainTransients()
286
430
}
287
- }
431
+ }
0 commit comments