Fixed Great Barrier Reef spawn rules

This commit is contained in:
Yair Morgenstern 2021-03-11 22:17:59 +02:00
parent 9eaf4f4826
commit 01877fee7c
3 changed files with 4 additions and 3 deletions

View File

@ -173,7 +173,7 @@
"production": 1,
"gold": 1,
"science": 2,
"occursOn": ["Coast"],
"occursOn": ["Ocean"],
"turnsInto": "Coast",
"impassable": true,
"unbuildable": true,

View File

@ -255,7 +255,7 @@ class MapGenerator(val ruleset: Ruleset) {
private fun spawnVegetation(tileMap: TileMap) {
val vegetationSeed = randomness.RNG.nextInt().toDouble()
val candidateTerrains = Constants.vegetation.flatMap{ ruleset.terrains[it]!!.occursOn }
for (tile in tileMap.values.asSequence().filter { it.baseTerrain in candidateTerrains && it.terrainFeature == null
for (tile in tileMap.values.asSequence().filter { it.baseTerrain in candidateTerrains && it.terrainFeatures.isEmpty()
&& (!it.isHill() || Constants.hill in candidateTerrains) }) {
val vegetation = (randomness.getPerlinNoise(tile, vegetationSeed, scale = 3.0, nOctaves = 1) + 1.0) / 2.0

View File

@ -127,7 +127,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset) {
/*
Great Barrier Reef: Specifics currently unknown;
Assumption: at least 1 neighbour not water; no tundra; at least 1 neighbour coast; becomes coast
Assumption: at least 1 neighbour coast; no tundra; at least 1 neighbour coast; becomes coast
*/
private fun spawnGreatBarrierReef(tileMap: TileMap) {
val wonder = ruleset.terrains[Constants.greatBarrierReef]!!
@ -136,6 +136,7 @@ class NaturalWonderGenerator(val ruleset: Ruleset) {
&& wonder.occursOn.contains(it.getLastTerrain().name)
&& abs(it.latitude) > tileMap.maxLatitude * 0.1
&& abs(it.latitude) < tileMap.maxLatitude * 0.7
&& it.neighbors.any { it.baseTerrain == Constants.coast }
&& it.neighbors.all { neighbor -> neighbor.isWater }
&& it.neighbors.any { neighbor ->
neighbor.resource == null && neighbor.improvement == null