Fix natural wonders (#1550)

* Natural Wonders Uniques

* Fix Natural Wonders in Map Editor

* Translation files

* Terrain uniques test

* GBR spawn update Fix #1552
This commit is contained in:
r3versi 2019-12-28 22:11:37 +01:00 committed by Yair Morgenstern
parent a55e01f004
commit aa034d73c2
27 changed files with 240 additions and 36 deletions

View File

@ -149,6 +149,7 @@
gold: 1,
science: 2,
occursOn: ["Coast"],
turnsInto: "Coast",
impassable: true,
unbuildable: true,
weight: 10
@ -159,6 +160,7 @@
science: 2,
happiness: 3,
occursOn: ["Grassland","Plains","Tundra","Mountain"],
turnsInto: "Mountain",
impassable: true,
unbuildable: true,
weight: 10
@ -168,8 +170,10 @@
type: "NaturalWonder",
culture: 5,
occursOn: ["Plains"],
turnsInto: "Plains",
impassable: true,
unbuildable: true,
uniques: ["Grants 500 Gold to the first civilization to discover it"],
weight: 2
},
{
@ -177,8 +181,10 @@
type: "NaturalWonder",
happiness: 10,
occursOn: ["Plains"],
turnsInto: "Plains",
impassable: true,
unbuildable: true,
uniques: ["Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game"],
weight: 1
},
{
@ -187,6 +193,7 @@
production: 2,
gold: 3,
occursOn: ["Plains","Desert","Tundra"],
turnsInto: "Mountain",
impassable: true,
unbuildable: true,
weight: 10
@ -197,6 +204,7 @@
gold: 1,
culture: 5,
occursOn: ["Grassland","Plains"],
turnsInto: "Mountain",
impassable: true,
unbuildable: true,
weight: 10
@ -207,6 +215,7 @@
type: "NaturalWonder",
science: 5,
occursOn: ["Ocean"],
turnsInto: "Mountain",
impassable: true,
unbuildable: true,
weight: 10
@ -217,6 +226,7 @@
food: 2,
gold: 5,
occursOn: ["Grassland"],
turnsInto: "Mountain",
impassable: true,
unbuildable: true,
weight: 10
@ -226,6 +236,7 @@
type: "NaturalWonder",
gold: 10,
occursOn: ["Plains","Mountain"],
turnsInto: "Mountain",
impassable: true,
unbuildable: true,
weight: 5
@ -236,6 +247,7 @@
gold: 2,
science: 3,
occursOn: ["Desert","Tundra"],
turnsInto: "Mountain",
impassable: true,
unbuildable: true,
weight: 10

View File

@ -923,6 +923,8 @@ May contain [listOfResources] = Může obsahovat [listOfResources]
Upgrades to [upgradedUnit] = Vylepšení na [upgradedUnit]
Obsolete with [obsoleteTech] = Zastará (přestane půspbit) s [obsoleteTech]
Occurs on [listOfTerrains] = Nalézá se v/na [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Může se objevit v/na
Improved by [improvement] = Vylešen(a/o) díky [improvement]
Bonus stats for improvement: = Bonusové statistiky pro vylepšení:
@ -1328,6 +1330,12 @@ Cerro de Potosi =
El Dorado =
Fountain of Youth = Fontána mládí
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Dobytek

View File

@ -1517,6 +1517,8 @@ Obsolete with [obsoleteTech] =
# Requires translation!
Occurs on [listOfTerrains] =
# Requires translation!
Placed on [terrainType] =
# Requires translation!
Can be found on =
# Requires translation!
Improved by [improvement] =
@ -2159,6 +2161,12 @@ El Dorado =
# Requires translation!
Fountain of Youth =
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Rundvee

View File

@ -1672,6 +1672,8 @@ Obsolete with [obsoleteTech] =
# Requires translation!
Occurs on [listOfTerrains] =
# Requires translation!
Placed on [terrainType] =
# Requires translation!
Can be found on =
# Requires translation!
Improved by [improvement] =
@ -2405,6 +2407,12 @@ El Dorado =
# Requires translation!
Fountain of Youth =
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
# Requires translation!

View File

@ -912,6 +912,8 @@ May contain [listOfResources] = Peut contenir [listOfResources]
Upgrades to [upgradedUnit] = Améliorer en [upgradedUnit]
Obsolete with [obsoleteTech] = Obsolète avec [obsoleteTech]
Occurs on [listOfTerrains] = Doit possèder [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Peut être trouver sur
Improved by [improvement] = Amélioré par [improvement]
Bonus stats for improvement: = Bonus de case améliorée:
@ -1295,6 +1297,12 @@ Cerro de Potosi = Cerro de Potosi
El Dorado = El Dorado
Fountain of Youth = Fontaine de Jouvence
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Bétail

View File

@ -926,6 +926,8 @@ May contain [listOfResources] = kann [listOfResources] enthalten
Upgrades to [upgradedUnit] = Verbessert sich zu [upgradedUnit]
Obsolete with [obsoleteTech] = Überflüssig mit [obsoleteTech]
Occurs on [listOfTerrains] = Kommt vor in [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Kann gefunden werden in
Improved by [improvement] = Wird verbessert durch [improvement]
Bonus stats for improvement: = Boni für Verbesserung:
@ -1336,6 +1338,12 @@ Cerro de Potosi = Cerro de Potosí
El Dorado = El Dorado
Fountain of Youth = Jungbrunnen
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Rinder

View File

@ -1369,6 +1369,8 @@ Obsolete with [obsoleteTech] =
# Requires translation!
Occurs on [listOfTerrains] =
# Requires translation!
Placed on [terrainType] =
# Requires translation!
Can be found on =
# Requires translation!
Improved by [improvement] =
@ -2102,6 +2104,12 @@ El Dorado =
# Requires translation!
Fountain of Youth =
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
# Requires translation!

View File

@ -910,7 +910,8 @@ Cost = Costo
May contain [listOfResources] = Può contenere [listOfResources]
Upgrades to [upgradedUnit] = Aggiorna a [upgradedUnit]
Obsolete with [obsoleteTech] = Diventa obsoleta con [obsoleteTech]
Occurs on [listOfTerrains] = Può avvenire/avviene su [listOfTerrains]
Occurs on [listOfTerrains] = Si può trovare su [listOfTerrains]
Placed on [terrainType] = Si trova su [terrainType]
Can be found on = Può trovarsi su
Improved by [improvement] = Può essere migliorato/a da [improvement]
Bonus stats for improvement: = Bonus per miglioramento:
@ -1294,6 +1295,11 @@ Cerro de Potosi = Cerro Rico de Potosí
El Dorado = El Dorado
Fountain of Youth = Fonte della giovinezza
# Natural Wonders Uniques
Grants 500 Gold to the first civilization to discover it = Fornisce 500 Oro per la prima civiltà a scoprirla
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game = Fornisce Ringiovanimento (tutti gli effetti di cura raddoppiati) alle unità militari terrestri adiacenti per il resto della partita
# Resources
Cattle = Bestiame

View File

@ -947,6 +947,8 @@ May contain [listOfResources] = [listOfResources] 자원을 포함할 수 있음
Upgrades to [upgradedUnit] = [upgradedUnit](으)로 업그레이드 가능
Obsolete with [obsoleteTech] = [obsoleteTech] 연구 후 생산 불가
Occurs on [listOfTerrains] = [listOfTerrains]에서 생길 수 있음
# Requires translation!
Placed on [terrainType] =
Can be found on = 발견 가능한 지형 :
Improved by [improvement] = [improvement]로 개발 가능
Bonus stats for improvement: = 개발할 경우 추가로
@ -1360,6 +1362,12 @@ El Dorado =
# Requires translation!
Fountain of Youth =
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle =

View File

@ -1561,6 +1561,8 @@ Obsolete with [obsoleteTech] =
# Requires translation!
Occurs on [listOfTerrains] =
# Requires translation!
Placed on [terrainType] =
# Requires translation!
Can be found on =
# Requires translation!
Improved by [improvement] =
@ -2212,6 +2214,12 @@ El Dorado =
# Requires translation!
Fountain of Youth =
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
# Requires translation!

View File

@ -911,6 +911,8 @@ May contain [listOfResources] = Może zawierać [listOfResources]
Upgrades to [upgradedUnit] = Ulepsz do [upgradedUnit]
Obsolete with [obsoleteTech] = Przestarzałe z [obsoleteTech]
Occurs on [listOfTerrains] = Występuje na [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Znajduje się na
Improved by [improvement] = Ulepszone przez [improvement]
Bonus stats for improvement: = Bonusowe statystyki dla ulepszeń
@ -1294,6 +1296,12 @@ Cerro de Potosi = Cerro de Potosi
El Dorado = El Dorado
Fountain of Youth = Źródło młodości
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Bydło

View File

@ -1011,6 +1011,8 @@ May contain [listOfResources] = Pode conter [listOfResources]
Upgrades to [upgradedUnit] = Melhorar para [upgradedUnit]
Obsolete with [obsoleteTech] = Obsoleta(0) com [obsoleteTech]
Occurs on [listOfTerrains] = Ocorre em [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Pode ser encontrado em
Improved by [improvement] = Melhorado por [improvement]
Bonus stats for improvement: = Bonus de estatisticas por melhoria:
@ -1511,6 +1513,12 @@ El Dorado =
# Requires translation!
Fountain of Youth =
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Gado

View File

@ -1348,6 +1348,8 @@ Obsolete with [obsoleteTech] =
# Requires translation!
Occurs on [listOfTerrains] =
# Requires translation!
Placed on [terrainType] =
# Requires translation!
Can be found on =
# Requires translation!
Improved by [improvement] =
@ -1866,6 +1868,12 @@ El Dorado =
# Requires translation!
Fountain of Youth =
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Vite

View File

@ -912,6 +912,8 @@ May contain [listOfResources] = Может содержать [listOfResources]
Upgrades to [upgradedUnit] = Улучшается до [upgradedUnit]
Obsolete with [obsoleteTech] = Устаревает после [obsoleteTech]
Occurs on [listOfTerrains] = Появляется на [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Может быть найден в
Improved by [improvement] = Улучшен [improvement]
Bonus stats for improvement: = Бонусы за улучшение:
@ -1295,6 +1297,12 @@ Cerro de Potosi = гора Серро-де-Потоси
El Dorado = Эльдорадо
Fountain of Youth = Фонтан вечной молодости
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Скот

View File

@ -924,6 +924,8 @@ May contain [listOfResources] = 可能拥有下列资源:[listOfResources]
Upgrades to [upgradedUnit] = 可升级为[upgradedUnit]
Obsolete with [obsoleteTech] = 研发下列科技后过时:[obsoleteTech]
Occurs on [listOfTerrains] = 可能出现在以下地形:[listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = 可能发现该资源的地形地貌:
Improved by [improvement] = 开发该资源所需设施:[improvement]
Bonus stats for improvement: = 开发该资源后设施所获奖励效果:
@ -1326,6 +1328,12 @@ Cerro de Potosi = 富饶山
El Dorado = 黄金国
Fountain of Youth = 青春之泉
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = 牛群

View File

@ -911,6 +911,8 @@ May contain [listOfResources] = Puede contener [listOfResources]
Upgrades to [upgradedUnit] = Mejora a [upgradedUnit]
Obsolete with [obsoleteTech] = Se hace obsoleto con [obsoleteTech]
Occurs on [listOfTerrains] = Ocurre en [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Se puede encontrar en
Improved by [improvement] = Mejorado por [improvement]
Bonus stats for improvement: = Bonus de atributos por mejora:
@ -1294,6 +1296,12 @@ Cerro de Potosi = Cerro de Potosí
El Dorado = El Dorado
Fountain of Youth = Fuente de la juventud
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Ganado

View File

@ -924,6 +924,8 @@ May contain [listOfResources] = 可能擁有以下資源:[listOfResources]
Upgrades to [upgradedUnit] = 可升級為[upgradedUnit]
Obsolete with [obsoleteTech] = 研發下列科技後過時:[obsoleteTech]
Occurs on [listOfTerrains] = 可能出現在以下地形:[listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = 可能發現該資源的地形地貌:
Improved by [improvement] = 開發該資源所需設施:[improvement]
Bonus stats for improvement: = 開發該資源後設施所獲獎勵效果:
@ -1326,6 +1328,12 @@ Cerro de Potosi = 富饒山
El Dorado = 黃金國
Fountain of Youth = 青春之泉
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = 牛群

View File

@ -912,6 +912,8 @@ May contain [listOfResources] = Може містити [listOfResources]
Upgrades to [upgradedUnit] = Удосконалюється до [upgradedUnit]
Obsolete with [obsoleteTech] = Застарілий після [obsoleteTech]
Occurs on [listOfTerrains] = З’являється на [listOfTerrains]
# Requires translation!
Placed on [terrainType] =
Can be found on = Може бути знайдений в
Improved by [improvement] = Удосконалив [improvement]
Bonus stats for improvement: = Бонусні характеристики за удосконалення:
@ -1302,6 +1304,12 @@ Cerro de Potosi = Серро-Ріко
El Dorado = Ельдорадо
Fountain of Youth = Джерело вічної молодості
# Natural Wonders Uniques
# Requires translation!
Grants 500 Gold to the first civilization to discover it =
# Requires translation!
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle = Худоба

View File

@ -2,8 +2,9 @@ Traditional_Chinese = 97
Italian = 100
Polish = 99
Russian = 99
Polish = 99
Romanian = 49
Korean = 95
Korean = 94
Simplified_Chinese = 97
German = 96
English = 0

View File

@ -911,6 +911,7 @@ May contain [listOfResources] =
Upgrades to [upgradedUnit] =
Obsolete with [obsoleteTech] =
Occurs on [listOfTerrains] =
Placed on [terrainType] =
Can be found on =
Improved by [improvement] =
Bonus stats for improvement: =
@ -1294,6 +1295,11 @@ Cerro de Potosi =
El Dorado =
Fountain of Youth =
# Natural Wonders Uniques
Grants 500 Gold to the first civilization to discover it =
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle =

View File

@ -93,7 +93,8 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo){
var goldGained = 0
val discoveredNaturalWonders = civInfo.gameInfo.civilizations.filter { it != civInfo }
.flatMap { it.naturalWonders }
if (tile.naturalWonder == "El Dorado" && !discoveredNaturalWonders.contains(tile.naturalWonder!!)) {
if (tile.containsUnique("Grants 500 Gold to the first civilization to discover it")
&& !discoveredNaturalWonders.contains(tile.naturalWonder!!)) {
goldGained += 500
}

View File

@ -253,7 +253,7 @@ class MapGenerator {
Constants.barringerCrater -> spawnBarringerCrater(mapToReturn, ruleset)
Constants.mountFuji -> spawnMountFuji(mapToReturn, ruleset)
Constants.grandMesa -> spawnGrandMesa(mapToReturn, ruleset)
Constants.greatBarrierReef -> spawnGreatBarrierReef(mapToReturn, ruleset)
Constants.greatBarrierReef -> spawnGreatBarrierReef(mapToReturn, ruleset, mapRadius)
Constants.krakatoa -> spawnKrakatoa(mapToReturn, ruleset)
Constants.rockOfGibraltar -> spawnRockOfGibraltar(mapToReturn, ruleset)
Constants.oldFaithful -> spawnOldFaithful(mapToReturn, ruleset)
@ -280,7 +280,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.mountain
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
}
else {
@ -306,7 +306,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.mountain
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
}
else {
@ -330,7 +330,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.mountain
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
}
else {
@ -343,29 +343,34 @@ class MapGenerator {
Assumption: at least 1 neighbour not water; no tundra; at least 1 neighbour coast; becomes coast
TODO: investigate Great Barrier Reef placement requirements
*/
private fun spawnGreatBarrierReef(mapToReturn: TileMap, ruleset: Ruleset) {
private fun spawnGreatBarrierReef(mapToReturn: TileMap, ruleset: Ruleset, mapRadius: Int) {
val wonder = ruleset.terrains[Constants.greatBarrierReef]!!
val maxLatitude = abs(getLatitude(Vector2(mapRadius.toFloat(), mapRadius.toFloat())))
val suitableLocations = mapToReturn.values.filter { it.resource == null && it.improvement == null
&& wonder.occursOn!!.contains(it.getLastTerrain().name)
&& it.neighbors.none{ neighbor -> neighbor.getBaseTerrain().name == Constants.tundra }
&& it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name != Constants.ocean
&& neighbor.getBaseTerrain().name != Constants.coast }
&& it.neighbors.any { neighbor -> neighbor.getBaseTerrain().name == Constants.coast
&& neighbor.resource == null && neighbor.improvement == null}
&& abs(getLatitude(it.position)) > maxLatitude * 0.1
&& abs(getLatitude(it.position)) < maxLatitude * 0.7
&& it.neighbors.all {neighbor -> neighbor.isWater}
&& it.neighbors.any {neighbor ->
neighbor.resource == null && neighbor.improvement == null
&& wonder.occursOn!!.contains(neighbor.getLastTerrain().name)
&& neighbor.neighbors.all{ it.isWater } }
}
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.coast
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
val location2 = location.neighbors
.filter { it.getBaseTerrain().name == Constants.coast && it.resource == null && it.improvement == null }
.filter { it.resource == null && it.improvement == null
&& wonder.occursOn!!.contains(it.getLastTerrain().name)
&& it.neighbors.all{ it.isWater } }
.random()
location2.naturalWonder = wonder.name
location2.baseTerrain = Constants.coast
location2.baseTerrain = wonder.turnsInto!!
location2.terrainFeature = null
}
else {
@ -388,7 +393,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.mountain
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
for (tile in location.neighbors) {
@ -421,7 +426,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.mountain
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
for (tile in location.neighbors) {
@ -458,7 +463,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.mountain
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
}
else {
@ -479,7 +484,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.mountain
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
}
else {
@ -500,7 +505,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.plains
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
}
else {
@ -519,7 +524,7 @@ class MapGenerator {
if (suitableLocations.isNotEmpty()) {
val location = suitableLocations.random()
location.naturalWonder = wonder.name
location.baseTerrain = Constants.plains
location.baseTerrain = wonder.turnsInto!!
location.terrainFeature = null
}
else {

View File

@ -429,7 +429,7 @@ class MapUnit {
if(!hasUnique("All healing effects doubled") && type.isLandUnit() && type.isMilitary())
{
val gainDoubleHealPromotion = tile.neighbors.filter{it.naturalWonder == "Fountain of Youth"}.any()
val gainDoubleHealPromotion = tile.neighbors.any{it.containsUnique("Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game")}
if (gainDoubleHealPromotion)
promotions.addPromotion("Rejuvenation", true)
}

View File

@ -68,6 +68,9 @@ open class TileInfo {
return false
}
fun containsUnique(unique: String): Boolean {
return isNaturalWonder() && getNaturalWonder().uniques.contains(unique)
}
//region pure functions
/** Returns military, civilian and air units in tile */

View File

@ -10,19 +10,26 @@ class Terrain : NamedStats() {
fun getDescription(ruleset: Ruleset): String {
val sb = StringBuilder()
sb.appendln(this.clone().toString())
if (occursOn != null) {
if (occursOn != null)
sb.appendln("Occurs on [${occursOn.joinToString(", ")}]".tr())
}
val resourcesFound = ruleset.tileResources.values.filter { it.terrainsCanBeFoundOn.contains(name) }
if (resourcesFound.isNotEmpty()) {
sb.appendln("May contain [${resourcesFound.joinToString(", ") { it.name.tr() }}]".tr())
}
sb.appendln("{Movement cost}: $movementCost".tr())
if (defenceBonus != 0f) {
sb.appendln("{Defence bonus}: ".tr() + (defenceBonus * 100).toInt() + "%")
}
if (rough) sb.appendln("Rough Terrain".tr())
if (turnsInto != null)
sb.appendln("Placed on [${turnsInto.tr()}]".tr())
val resourcesFound = ruleset.tileResources.values.filter { it.terrainsCanBeFoundOn.contains(name) }
if (resourcesFound.isNotEmpty())
sb.appendln("May contain [${resourcesFound.joinToString(", ") { it.name.tr() }}]".tr())
if(uniques.isNotEmpty())
sb.appendln(uniques.joinToString { it.tr() })
sb.appendln("{Movement cost}: $movementCost".tr())
if (defenceBonus != 0f)
sb.appendln("{Defence bonus}: ".tr() + (defenceBonus * 100).toInt() + "%")
if (rough)
sb.appendln("Rough Terrain".tr())
return sb.toString()
}
@ -47,6 +54,16 @@ class Terrain : NamedStats() {
*/
val occursOn: Collection<String>? = null
/***
* Used by Natural Wonders: it is the baseTerrain on top of which the Natural Wonder is placed
*/
val turnsInto: String? = null
/**
* Uniques (currently used only for Natural Wonders)
*/
val uniques = ArrayList<String>()
/*
* Natural Wonder weight: probability to be picked
*/

View File

@ -293,13 +293,19 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
fun updateTileWhenClicked(tileInfo: TileInfo) {
when {
clearTerrainFeature -> tileInfo.terrainFeature = null
clearTerrainFeature -> {
tileInfo.terrainFeature = null
tileInfo.naturalWonder = null
}
clearResource -> tileInfo.resource = null
selectedResource != null -> tileInfo.resource = selectedResource!!.name
selectedTerrain != null -> {
if (selectedTerrain!!.type == TerrainType.TerrainFeature)
tileInfo.terrainFeature = selectedTerrain!!.name
else tileInfo.baseTerrain = selectedTerrain!!.name
else if (selectedTerrain!!.type == TerrainType.NaturalWonder)
tileInfo.naturalWonder = selectedTerrain!!.name
else
tileInfo.baseTerrain = selectedTerrain!!.name
}
clearImprovement -> {
tileInfo.improvement = null
@ -330,6 +336,15 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
}
fun normalizeTile(tileInfo: TileInfo){
/*Natural Wonder superpowers! */
if (tileInfo.naturalWonder != null) {
val naturalWonder = tileInfo.getNaturalWonder()
tileInfo.baseTerrain = naturalWonder.turnsInto!!
tileInfo.terrainFeature = null
tileInfo.resource = null
tileInfo.improvement = null
}
if(tileInfo.terrainFeature!=null){
val terrainFeature = tileInfo.getTerrainFeature()!!
if(terrainFeature.occursOn!=null && !terrainFeature.occursOn.contains(tileInfo.baseTerrain))

View File

@ -82,6 +82,16 @@ class TranslationTests {
allStringsHaveTranslation)
}
@Test
fun allTerrainUniquesHaveTranslation() {
val strings: MutableSet<String> = HashSet()
for (terrain in ruleSet.terrains.values) {
strings.addAll(terrain.uniques)
}
val allStringsHaveTranslation = allStringAreTranslated(strings)
Assert.assertTrue("This test will only pass when there is a translation for all terrain uniques", allStringsHaveTranslation)
}
@Test
fun allImprovementsHaveTranslation() {
val strings: Set<String> = ruleSet.tileImprovements.keys