Added Optics and Lighthouse

This commit is contained in:
Yair Morgenstern
2018-10-16 21:13:29 +03:00
parent ae33818750
commit dea7775be5
11 changed files with 202 additions and 167 deletions

View File

@ -146,6 +146,10 @@ class MapUnit {
return range
}
fun isEmbarked(): Boolean {
return currentTile.baseTerrain=="Ocean"||currentTile.baseTerrain=="Coast"
}
//endregion
//region state-changing functions

View File

@ -111,6 +111,10 @@ open class TileInfo {
fun getTileStats(city: CityInfo?, observingCiv: CivilizationInfo): Stats {
var stats = getBaseTerrain().clone()
if((baseTerrain=="Ocean"||baseTerrain=="Coast") && city!=null
&& city.getBuildingUniques().contains("+1 food from Ocean and Coast tiles"))
stats.food += 1
if (terrainFeature != null) {
val terrainFeatureBase = getTerrainFeature()
if (terrainFeatureBase!!.overrideStats)
@ -118,6 +122,9 @@ open class TileInfo {
else
stats.add(terrainFeatureBase)
if (terrainFeature == "Jungle" && city != null
&& city.getBuildingUniques().contains("Jungles provide +2 science"))
stats.science += 2f
if(terrainFeature=="Oasis" && city!=null
&& city.getBuildingUniques().contains("+2 Gold for each source of Oil and oasis"))
stats.gold += 2
@ -156,14 +163,11 @@ open class TileInfo {
if (stats.production < 1) stats.production = 1f
}
if (stats.production < 0) stats.production = 0f
if ("Jungle" == terrainFeature && city != null
&& city.getBuildingUniques().contains("Jungles provide +2 science"))
stats.science += 2f
if (stats.gold != 0f && observingCiv.goldenAges.isGoldenAge())
stats.gold++
if (stats.production < 0) stats.production = 0f
return stats
}

View File

@ -15,6 +15,7 @@ enum class UnitType{
return this == Melee
|| this == Mounted
|| this == Scout
|| this==WaterMelee
}
fun isRanged(): Boolean {
return this == Ranged