mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Resolved #455 - add great person point breakdown to city info
This commit is contained in:
parent
0cd5426440
commit
356f8b6bbd
@ -795,6 +795,10 @@
|
|||||||
Italian:"La resistenza dura per altri [numberOfTurns] turni"
|
Italian:"La resistenza dura per altri [numberOfTurns] turni"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"[greatPerson] points":{ // e.g "Great Scientist points"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Tech picker
|
// Tech picker
|
||||||
"Pick a tech":{
|
"Pick a tech":{
|
||||||
Italian:"Scegli una tecnologia"
|
Italian:"Scegli una tecnologia"
|
||||||
|
@ -134,24 +134,38 @@ class CityInfo {
|
|||||||
|
|
||||||
fun getBuildingUniques(): List<String> = cityConstructions.getBuiltBuildings().flatMap { it.uniques }
|
fun getBuildingUniques(): List<String> = cityConstructions.getBuiltBuildings().flatMap { it.uniques }
|
||||||
|
|
||||||
fun getGreatPersonPoints(): Stats {
|
fun getGreatPersonMap():HashMap<String,Stats>{
|
||||||
var greatPersonPoints = population.specialists.times(3f)
|
val stats = HashMap<String,Stats>()
|
||||||
|
if(population.specialists.toString()!="")
|
||||||
|
stats["Specialists"] = population.specialists.times(3f)
|
||||||
|
|
||||||
|
val buildingStats = Stats()
|
||||||
for (building in cityConstructions.getBuiltBuildings())
|
for (building in cityConstructions.getBuiltBuildings())
|
||||||
if (building.greatPersonPoints != null)
|
if (building.greatPersonPoints != null)
|
||||||
greatPersonPoints.add(building.greatPersonPoints!!)
|
buildingStats.add(building.greatPersonPoints!!)
|
||||||
|
if(buildingStats.toString()!="")
|
||||||
|
stats["Buildings"] = buildingStats
|
||||||
|
|
||||||
if (civInfo.getBuildingUniques().contains("+33% great person generation in all cities"))
|
for(entry in stats){
|
||||||
greatPersonPoints = greatPersonPoints.times(1.33f)
|
if(civInfo.getNation().unique=="Receive free Great Scientist when you discover Writing, Earn Great Scientists 50% faster")
|
||||||
if (civInfo.policies.isAdopted("Entrepreneurship"))
|
entry.value.science *= 1.5f
|
||||||
greatPersonPoints.gold *= 1.25f
|
if (civInfo.policies.isAdopted("Entrepreneurship"))
|
||||||
if (civInfo.policies.isAdopted("Freedom"))
|
entry.value.gold *= 1.25f
|
||||||
greatPersonPoints = greatPersonPoints.times(1.25f)
|
|
||||||
|
|
||||||
if(civInfo.getNation().unique=="Receive free Great Scientist when you discover Writing, Earn Great Scientists 50% faster")
|
if (civInfo.getBuildingUniques().contains("+33% great person generation in all cities"))
|
||||||
greatPersonPoints.science *= 1.5f
|
stats[entry.key] = stats[entry.key]!!.times(1.33f)
|
||||||
|
if (civInfo.policies.isAdopted("Freedom"))
|
||||||
|
stats[entry.key] = stats[entry.key]!!.times(1.25f)
|
||||||
|
}
|
||||||
|
|
||||||
return greatPersonPoints
|
return stats
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getGreatPersonPoints(): Stats {
|
||||||
|
val stats=Stats()
|
||||||
|
for(entry in getGreatPersonMap().values)
|
||||||
|
stats.add(entry)
|
||||||
|
return stats
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isCapital() = cityConstructions.isBuilt("Palace")
|
fun isCapital() = cityConstructions.isBuilt("Palace")
|
||||||
|
@ -122,7 +122,7 @@ class NewGameScreen: PickerScreen(){
|
|||||||
newGameOptionsTable.add("{Number of human players}:".tr())
|
newGameOptionsTable.add("{Number of human players}:".tr())
|
||||||
val humanPlayers = SelectBox<Int>(skin)
|
val humanPlayers = SelectBox<Int>(skin)
|
||||||
val humanPlayersArray = Array<Int>()
|
val humanPlayersArray = Array<Int>()
|
||||||
(1..GameBasics.Nations.size).forEach { humanPlayersArray .add(it) }
|
(1..GameBasics.Nations.size).forEach { humanPlayersArray.add(it) }
|
||||||
humanPlayers.items = humanPlayersArray
|
humanPlayers.items = humanPlayersArray
|
||||||
humanPlayers.selected = newGameParameters.numberOfHumanPlayers
|
humanPlayers.selected = newGameParameters.numberOfHumanPlayers
|
||||||
newGameOptionsTable.add(humanPlayers).pad(10f).row()
|
newGameOptionsTable.add(humanPlayers).pad(10f).row()
|
||||||
|
@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.*
|
import com.badlogic.gdx.scenes.scene2d.ui.*
|
||||||
import com.badlogic.gdx.utils.Align
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.logic.city.CityInfo
|
import com.unciv.logic.city.CityInfo
|
||||||
|
import com.unciv.logic.civilization.GreatPersonManager
|
||||||
import com.unciv.models.gamebasics.Building
|
import com.unciv.models.gamebasics.Building
|
||||||
import com.unciv.models.gamebasics.tr
|
import com.unciv.models.gamebasics.tr
|
||||||
import com.unciv.models.stats.Stat
|
import com.unciv.models.stats.Stat
|
||||||
@ -22,6 +23,32 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
|||||||
internal fun update() {
|
internal fun update() {
|
||||||
clear()
|
clear()
|
||||||
val cityInfo = cityScreen.city
|
val cityInfo = cityScreen.city
|
||||||
|
|
||||||
|
addBuildingInfo(cityInfo)
|
||||||
|
|
||||||
|
addStatInfo()
|
||||||
|
|
||||||
|
val greatPersonPoints = cityInfo.getGreatPersonMap()
|
||||||
|
val statToGreatPerson = GreatPersonManager().statToGreatPersonMapping
|
||||||
|
for(stat in Stat.values()){
|
||||||
|
if(!statToGreatPerson.containsKey(stat)) continue
|
||||||
|
val expanderName = "["+statToGreatPerson[stat]!!+"] points"
|
||||||
|
val expanderTab = ExpanderTab(expanderName.tr(),skin)
|
||||||
|
expanderTab.innerTable.defaults().pad(3f)
|
||||||
|
for(entry in greatPersonPoints){
|
||||||
|
val value = entry.value.toHashMap()[stat]!!
|
||||||
|
if(value==0f) continue
|
||||||
|
expanderTab.innerTable.add(entry.key.toLabel())
|
||||||
|
expanderTab.innerTable.add(DecimalFormat("0.#").format(value).toLabel()).row()
|
||||||
|
}
|
||||||
|
if(expanderTab.innerTable.hasChildren())
|
||||||
|
add(expanderTab).row()
|
||||||
|
}
|
||||||
|
|
||||||
|
pack()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addBuildingInfo(cityInfo: CityInfo) {
|
||||||
val wonders = mutableListOf<Building>()
|
val wonders = mutableListOf<Building>()
|
||||||
val specialistBuildings = mutableListOf<Building>()
|
val specialistBuildings = mutableListOf<Building>()
|
||||||
val otherBuildings = mutableListOf<Building>()
|
val otherBuildings = mutableListOf<Building>()
|
||||||
@ -35,7 +62,7 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!wonders.isEmpty()) {
|
if (!wonders.isEmpty()) {
|
||||||
val wondersExpander = ExpanderTab("Wonders".tr(),skin)
|
val wondersExpander = ExpanderTab("Wonders".tr(), skin)
|
||||||
for (building in wonders) {
|
for (building in wonders) {
|
||||||
wondersExpander.innerTable.add(ImageGetter.getConstructionImage(building.name).surroundWithCircle(30f))
|
wondersExpander.innerTable.add(ImageGetter.getConstructionImage(building.name).surroundWithCircle(30f))
|
||||||
wondersExpander.innerTable.add(building.name.toLabel()).pad(5f).align(Align.left).row()
|
wondersExpander.innerTable.add(building.name.toLabel()).pad(5f).align(Align.left).row()
|
||||||
@ -44,14 +71,14 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!specialistBuildings.isEmpty()) {
|
if (!specialistBuildings.isEmpty()) {
|
||||||
val specialistBuildingsExpander = ExpanderTab("Specialist Buildings".tr(),skin)
|
val specialistBuildingsExpander = ExpanderTab("Specialist Buildings".tr(), skin)
|
||||||
for (building in specialistBuildings) {
|
for (building in specialistBuildings) {
|
||||||
specialistBuildingsExpander.innerTable.add(ImageGetter.getConstructionImage(building.name).surroundWithCircle(30f))
|
specialistBuildingsExpander.innerTable.add(ImageGetter.getConstructionImage(building.name).surroundWithCircle(30f))
|
||||||
specialistBuildingsExpander.innerTable.add(building.name.toLabel()).pad(5f)
|
specialistBuildingsExpander.innerTable.add(building.name.toLabel()).pad(5f)
|
||||||
val specialistIcons = Table()
|
val specialistIcons = Table()
|
||||||
specialistIcons.row().size(20f).pad(5f)
|
specialistIcons.row().size(20f).pad(5f)
|
||||||
for(stat in building.specialistSlots!!.toHashMap())
|
for (stat in building.specialistSlots!!.toHashMap())
|
||||||
for(i in 0 until stat.value.toInt())
|
for (i in 0 until stat.value.toInt())
|
||||||
specialistIcons.add(getSpecialistIcon(stat.key)).size(20f)
|
specialistIcons.add(getSpecialistIcon(stat.key)).size(20f)
|
||||||
|
|
||||||
specialistBuildingsExpander.innerTable.add(specialistIcons).row()
|
specialistBuildingsExpander.innerTable.add(specialistIcons).row()
|
||||||
@ -63,17 +90,13 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!otherBuildings.isEmpty()) {
|
if (!otherBuildings.isEmpty()) {
|
||||||
val buildingsExpanderTab = ExpanderTab("Buildings".tr(),skin)
|
val buildingsExpanderTab = ExpanderTab("Buildings".tr(), skin)
|
||||||
for (building in otherBuildings) {
|
for (building in otherBuildings) {
|
||||||
buildingsExpanderTab.innerTable.add(ImageGetter.getConstructionImage(building.name).surroundWithCircle(30f))
|
buildingsExpanderTab.innerTable.add(ImageGetter.getConstructionImage(building.name).surroundWithCircle(30f))
|
||||||
buildingsExpanderTab.innerTable.add(building.name.toLabel()).pad(5f).row()
|
buildingsExpanderTab.innerTable.add(building.name.toLabel()).pad(5f).row()
|
||||||
}
|
}
|
||||||
add(buildingsExpanderTab).row()
|
add(buildingsExpanderTab).row()
|
||||||
}
|
}
|
||||||
|
|
||||||
addStatInfo()
|
|
||||||
|
|
||||||
pack()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addStatInfo() {
|
private fun addStatInfo() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user