mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-15 10:18:26 +07:00
Added "Provides yield without assigned population" uniques to tile improvements
This commit is contained in:
@ -42,7 +42,8 @@ class CityStats {
|
|||||||
private fun getStatsFromTiles(): Stats {
|
private fun getStatsFromTiles(): Stats {
|
||||||
val stats = Stats()
|
val stats = Stats()
|
||||||
for (cell in cityInfo.tilesInRange
|
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))
|
stats.add(cell.getTileStats(cityInfo, cityInfo.civInfo))
|
||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,8 @@ open class TileInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isWorked(): Boolean = getWorkingCity() != null
|
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 {
|
fun isLocked(): Boolean {
|
||||||
val workingCity = getWorkingCity()
|
val workingCity = getWorkingCity()
|
||||||
|
@ -18,8 +18,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
|||||||
isTransform = false // performance helper - nothing here is rotated or scaled
|
isTransform = false // performance helper - nothing here is rotated or scaled
|
||||||
addActor(yieldGroup)
|
addActor(yieldGroup)
|
||||||
if (city.location == tileInfo.position) {
|
if (city.location == tileInfo.position) {
|
||||||
icons.addPopulationIcon(ImageGetter.getImage("OtherIcons/Star")
|
icons.addPopulationIcon(ImageGetter.getImage("OtherIcons/Star"))
|
||||||
.apply { color = Color.GOLD })
|
|
||||||
}
|
}
|
||||||
unitLayerGroup.isVisible = false
|
unitLayerGroup.isVisible = false
|
||||||
unitImageLayerGroup.isVisible = false
|
unitImageLayerGroup.isVisible = false
|
||||||
@ -50,7 +49,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
|||||||
icons.addPopulationIcon(ImageGetter.getImage("OtherIcons/Lock"))
|
icons.addPopulationIcon(ImageGetter.getImage("OtherIcons/Lock"))
|
||||||
}
|
}
|
||||||
|
|
||||||
!tileInfo.isCityCenter() -> { // workable
|
tileInfo.isWorked() || !tileInfo.providesYield() -> { // workable
|
||||||
icons.addPopulationIcon()
|
icons.addPopulationIcon()
|
||||||
isWorkable = true
|
isWorkable = true
|
||||||
}
|
}
|
||||||
@ -85,8 +84,9 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
|||||||
populationIcon.setPosition(width / 2 - populationIcon.width / 2,
|
populationIcon.setPosition(width / 2 - populationIcon.width / 2,
|
||||||
height * 0.85f - populationIcon.height / 2)
|
height * 0.85f - populationIcon.height / 2)
|
||||||
|
|
||||||
if (tileInfo.providesYield()) populationIcon.color = Color.WHITE
|
if (tileInfo.isCityCenter()) populationIcon.color = Color.GOLD
|
||||||
else populationIcon.color = Color.GRAY.cpy()
|
else if (tileInfo.providesYield()) populationIcon.color = Color.WHITE
|
||||||
|
else populationIcon.color = Color.GRAY.cpy() // City center gets a GOLD star
|
||||||
|
|
||||||
populationIcon.toFront()
|
populationIcon.toFront()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user