Barbarians no longer spawn on mountains and lakes (a bit silly)

This commit is contained in:
Yair Morgenstern
2019-04-15 22:08:44 +03:00
parent 66370400b5
commit cbf0c52d2c
2 changed files with 4 additions and 2 deletions

View File

@ -218,7 +218,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
* [Christ the redeemer](https://thenounproject.com/term/christ-the-redeemer/56112/) By Stefan Spieler for Cristo Redentor * [Christ the redeemer](https://thenounproject.com/term/christ-the-redeemer/56112/) By Stefan Spieler for Cristo Redentor
* [St. Petersburg](https://thenounproject.com/search/?q=kremlin&i=1569704) By Carpe Diem for Kremlin * [St. Petersburg](https://thenounproject.com/search/?q=kremlin&i=1569704) By Carpe Diem for Kremlin
* [Neuschwanstein](https://thenounproject.com/search/?q=Neuschwanstein&i=2107683) By Vectors Market * [Neuschwanstein](https://thenounproject.com/search/?q=Neuschwanstein&i=2107683) By Vectors Market
* [BugBen](https://thenounproject.com/search/?q=Big%20Ben&i=443690) By Ben Davis, RO * [Big Ben](https://thenounproject.com/search/?q=Big%20Ben&i=443690) By Ben Davis, RO
### Information Era ### Information Era

View File

@ -86,7 +86,9 @@ class GameInfo {
// Barbarians will only spawn in places that no one can see // Barbarians will only spawn in places that no one can see
val allViewableTiles = civilizations.filterNot { it.isBarbarianCivilization() } val allViewableTiles = civilizations.filterNot { it.isBarbarianCivilization() }
.flatMap { it.viewableTiles }.toHashSet() .flatMap { it.viewableTiles }.toHashSet()
val viableTiles = tileMap.values.filterNot { allViewableTiles.contains(it) || it.militaryUnit != null || it.civilianUnit != null } val viableTiles = tileMap.values.filter { it.militaryUnit == null
&& it.civilianUnit == null && !it.getBaseTerrain().impassable && it.baseTerrain!="Lakes"
&& !allViewableTiles.contains(it)}
if (viableTiles.isEmpty()) return // no place for more barbs =( if (viableTiles.isEmpty()) return // no place for more barbs =(
tile = viableTiles.random() tile = viableTiles.random()
} }