Added "Provides yield without assigned population" uniques to tile improvements

This commit is contained in:
Yair Morgenstern 2021-03-17 23:10:21 +02:00
parent 755586eecd
commit dd4778495e
3 changed files with 9 additions and 7 deletions

View File

@ -42,7 +42,8 @@ class CityStats {
private fun getStatsFromTiles(): Stats {
val stats = Stats()
for (cell in cityInfo.tilesInRange
.filter { cityInfo.location == it.position || cityInfo.isWorked(it) })
.filter { cityInfo.location == it.position || cityInfo.isWorked(it) ||
it.getTileImprovement()?.hasUnique("Provides yield without assigned population")==true && it.owningCity == cityInfo })
stats.add(cell.getTileStats(cityInfo, cityInfo.civInfo))
return stats
}

View File

@ -219,7 +219,8 @@ open class TileInfo {
}
fun isWorked(): Boolean = getWorkingCity() != null
fun providesYield() = getCity() != null && (isCityCenter() || isWorked())
fun providesYield() = getCity() != null && (isCityCenter() || isWorked()
|| getTileImprovement()?.hasUnique("Provides yield without assigned population")==true)
fun isLocked(): Boolean {
val workingCity = getWorkingCity()

View File

@ -18,8 +18,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
isTransform = false // performance helper - nothing here is rotated or scaled
addActor(yieldGroup)
if (city.location == tileInfo.position) {
icons.addPopulationIcon(ImageGetter.getImage("OtherIcons/Star")
.apply { color = Color.GOLD })
icons.addPopulationIcon(ImageGetter.getImage("OtherIcons/Star"))
}
unitLayerGroup.isVisible = false
unitImageLayerGroup.isVisible = false
@ -50,7 +49,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
icons.addPopulationIcon(ImageGetter.getImage("OtherIcons/Lock"))
}
!tileInfo.isCityCenter() -> { // workable
tileInfo.isWorked() || !tileInfo.providesYield() -> { // workable
icons.addPopulationIcon()
isWorkable = true
}
@ -85,8 +84,9 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
populationIcon.setPosition(width / 2 - populationIcon.width / 2,
height * 0.85f - populationIcon.height / 2)
if (tileInfo.providesYield()) populationIcon.color = Color.WHITE
else populationIcon.color = Color.GRAY.cpy()
if (tileInfo.isCityCenter()) populationIcon.color = Color.GOLD
else if (tileInfo.providesYield()) populationIcon.color = Color.WHITE
else populationIcon.color = Color.GRAY.cpy() // City center gets a GOLD star
populationIcon.toFront()
}