Techs display short info on buildings and units
This commit is contained in:
parent
398b612d8c
commit
1de4c2c9f2
8 changed files with 52 additions and 76 deletions
|
@ -19,8 +19,7 @@
|
|||
maintenance:1
|
||||
},
|
||||
{
|
||||
name:"Granary",
|
||||
baseDescription: "",
|
||||
name:"Granary",
|
||||
food:2,
|
||||
resourceBonusStats:{food:1},
|
||||
maintenance:1,
|
||||
|
@ -28,8 +27,7 @@
|
|||
requiredTech:"Pottery"
|
||||
},
|
||||
{
|
||||
name:"Stone Works",
|
||||
baseDescription: "",
|
||||
name:"Stone Works",
|
||||
happiness:1,
|
||||
production:1
|
||||
requiredNearbyImprovedResources:["Marble","Stone"]
|
||||
|
@ -40,7 +38,6 @@
|
|||
},
|
||||
{
|
||||
name:"Stonehenge",
|
||||
baseDescription: "",
|
||||
culture:6,
|
||||
isWonder:true,
|
||||
greatPersonPoints:{production:1},
|
||||
|
@ -62,12 +59,11 @@
|
|||
baseDescription: "Adds 1 science for each 2 population in the city.",
|
||||
hurryCostModifier:25,
|
||||
maintenance:1,
|
||||
unique:"Science Per 2 Population",
|
||||
unique:"+1 Science Per 2 Population",
|
||||
requiredTech:"Writing"
|
||||
},
|
||||
{
|
||||
name:"Circus",
|
||||
baseDescription: "",
|
||||
name:"Circus",
|
||||
requiredNearbyImprovedResources:["Ivory","Horses"]
|
||||
happiness:2,
|
||||
hurryCostModifier:25,
|
||||
|
@ -84,7 +80,6 @@
|
|||
},
|
||||
{
|
||||
name:"Temple",
|
||||
baseDescription: "",
|
||||
culture:3,
|
||||
specialistSlots:{culture:1},
|
||||
requiredBuilding:"Monument",
|
||||
|
@ -103,7 +98,6 @@
|
|||
},
|
||||
{
|
||||
name:"National College",
|
||||
baseDescription: "",
|
||||
science:3,
|
||||
culture:1,
|
||||
isWonder:true,
|
||||
|
@ -121,8 +115,7 @@
|
|||
requiredTech:"Civil Service"
|
||||
},
|
||||
{
|
||||
name:"Stable",
|
||||
baseDescription: "",
|
||||
name:"Stable",
|
||||
maintenance:1,
|
||||
requiredNearbyImprovedResources:["Horses","Sheep","Cattle"]
|
||||
resourceBonusStats:{production:1},
|
||||
|
@ -131,7 +124,6 @@
|
|||
},
|
||||
{
|
||||
name:"Circus Maximus",
|
||||
baseDescription: "",
|
||||
happiness:5,
|
||||
culture:1,
|
||||
isWonder:true,
|
||||
|
@ -140,7 +132,6 @@
|
|||
},
|
||||
{
|
||||
name:"Hanging Gardens",
|
||||
baseDescription: "",
|
||||
greatPersonPoints:{culture:1},
|
||||
food:10,
|
||||
culture:1,
|
||||
|
@ -148,8 +139,7 @@
|
|||
requiredTech:"Mathematics"
|
||||
},
|
||||
{
|
||||
name:"Colloseum",
|
||||
baseDescription: "",
|
||||
name:"Colloseum",
|
||||
maintenance:1,
|
||||
happiness:2,
|
||||
hurryCostModifier:25,
|
||||
|
@ -157,7 +147,6 @@
|
|||
},
|
||||
{
|
||||
name:"Market",
|
||||
baseDescription: "",
|
||||
gold:2,
|
||||
specialistSlots:{gold:1},
|
||||
hurryCostModifier:25,
|
||||
|
@ -166,7 +155,6 @@
|
|||
},
|
||||
{
|
||||
name:"Monastery",
|
||||
baseDescription: "",
|
||||
maintenance:0,
|
||||
requiredNearbyImprovedResources:["Wine","Incense"],
|
||||
resourceBonusStats:{culture:2},
|
||||
|
@ -175,7 +163,6 @@
|
|||
},
|
||||
{
|
||||
name:"Notre Dame",
|
||||
baseDescription: "",
|
||||
culture:1,
|
||||
happiness:10,
|
||||
greatPersonPoints:{gold:1},
|
||||
|
@ -193,7 +180,6 @@
|
|||
},
|
||||
{
|
||||
name:"Mint",
|
||||
baseDescription: "",
|
||||
maintenance:0,
|
||||
requiredNearbyImprovedResources:["Gold","Silver"],
|
||||
resourceBonusStats:{gold:2},
|
||||
|
@ -219,8 +205,7 @@
|
|||
requiredTech:"Engineering"
|
||||
},
|
||||
{
|
||||
name:"Workshop",
|
||||
baseDescription: "",
|
||||
name:"Workshop",
|
||||
maintenance:2,
|
||||
production:2,
|
||||
specialistSlots:{production:1},
|
||||
|
@ -230,7 +215,6 @@
|
|||
},
|
||||
{
|
||||
name:"Forge",
|
||||
baseDescription: "",
|
||||
maintenance:1,
|
||||
hurryCostModifier:25,
|
||||
requiredNearbyImprovedResources:["Iron"],
|
||||
|
@ -279,7 +263,6 @@
|
|||
},
|
||||
{
|
||||
name:"Ironworks",
|
||||
baseDescription: "",
|
||||
production:8,
|
||||
culture:1,
|
||||
isWonder:true,
|
||||
|
@ -297,7 +280,6 @@
|
|||
},
|
||||
{
|
||||
name:"Opera House",
|
||||
baseDescription: "",
|
||||
culture:4,
|
||||
specialistSlots:{culture:1},
|
||||
hurryCostModifier:10,
|
||||
|
@ -315,7 +297,6 @@
|
|||
},
|
||||
{
|
||||
name:"Bank",
|
||||
baseDescription: "",
|
||||
gold:2,
|
||||
specialistSlots:{gold:1},
|
||||
hurryCostModifier:15,
|
||||
|
@ -333,7 +314,6 @@
|
|||
},
|
||||
{
|
||||
name:"Theatre",
|
||||
baseDescription: "",
|
||||
happiness:3,
|
||||
hurryCostModifier:10,
|
||||
maintenance:2,
|
||||
|
@ -351,7 +331,6 @@
|
|||
},
|
||||
{
|
||||
name:"Windmill",
|
||||
baseDescription: "",
|
||||
production:2,
|
||||
specialistSlots:{production:1},
|
||||
hurryCostModifier:25,
|
||||
|
@ -361,7 +340,6 @@
|
|||
},
|
||||
{
|
||||
name:"Museum",
|
||||
baseDescription: "",
|
||||
culture:5,
|
||||
specialistSlots:{culture:1},
|
||||
requiredBuilding:"Opera House",
|
||||
|
@ -371,7 +349,6 @@
|
|||
},
|
||||
{
|
||||
name:"Hermitage",
|
||||
baseDescription: "",
|
||||
percentStatBonus:{culture:50},
|
||||
culture:5,
|
||||
isWonder:true,
|
||||
|
@ -395,12 +372,11 @@
|
|||
requiredBuilding:"University",
|
||||
maintenance:3,
|
||||
hurryCostModifier:0,
|
||||
unique:"Science Per 2 Population",
|
||||
unique:"+1 Science Per 2 Population",
|
||||
requiredTech:"Scientific Theory"
|
||||
},
|
||||
{
|
||||
name:"Hospital",
|
||||
baseDescription: "",
|
||||
food:5,
|
||||
requiredBuilding:"Aqueduct",
|
||||
maintenance:2,
|
||||
|
@ -409,7 +385,6 @@
|
|||
},
|
||||
{
|
||||
name:"Factory",
|
||||
baseDescription: "",
|
||||
production:4,
|
||||
percentStatBonus:{production:10},
|
||||
specialistSlots:{production:1},
|
||||
|
@ -421,7 +396,6 @@
|
|||
},
|
||||
{
|
||||
name:"Stock Exchange",
|
||||
baseDescription: "",
|
||||
gold:3,
|
||||
percentStatBonus:{gold:25},
|
||||
specialistSlots:{gold:2},
|
||||
|
@ -439,7 +413,6 @@
|
|||
},
|
||||
{
|
||||
name:"Broadcast Tower",
|
||||
baseDescription: "",
|
||||
culture:3,
|
||||
percentStatBonus:{culture:33},
|
||||
requiredBuilding:"Museum",
|
||||
|
@ -464,7 +437,6 @@
|
|||
},
|
||||
{
|
||||
name:"Research Lab",
|
||||
baseDescription: "",
|
||||
science:4,
|
||||
percentStatBonus:{science:50},
|
||||
specialistSlots:{science:1},
|
||||
|
@ -481,7 +453,6 @@
|
|||
},
|
||||
{
|
||||
name:"Stadium",
|
||||
baseDescription: "",
|
||||
happiness:4,
|
||||
requiredBuilding:"Theatre",
|
||||
maintenance:2,
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
},
|
||||
{
|
||||
name:"Scout",
|
||||
baseDescription: "",
|
||||
cost:25,
|
||||
unitType:"Melee",
|
||||
strength:5,
|
||||
|
@ -28,7 +27,6 @@
|
|||
},
|
||||
{
|
||||
name:"Warrior",
|
||||
baseDescription: "A basic fighting unit",
|
||||
unitType:"Melee",
|
||||
movement:2,
|
||||
strength:8,
|
||||
|
@ -38,7 +36,6 @@
|
|||
},
|
||||
{
|
||||
name:"Archer",
|
||||
baseDescription: "A basic fighting unit",
|
||||
unitType:"Archery",
|
||||
movement:2,
|
||||
strength:5,
|
||||
|
@ -48,7 +45,6 @@
|
|||
},
|
||||
{
|
||||
name:"Chariot Archer",
|
||||
baseDescription: "",
|
||||
unitType:"Archery",
|
||||
movement:4,
|
||||
strength:6,
|
||||
|
@ -61,7 +57,6 @@
|
|||
},
|
||||
{
|
||||
name:"Spearman",
|
||||
baseDescription: "",
|
||||
unitType:"Melee",
|
||||
movement:2,
|
||||
strength:11,
|
||||
|
@ -75,7 +70,6 @@
|
|||
/* Classical Era */
|
||||
{
|
||||
name:"Catapult",
|
||||
baseDescription: "",
|
||||
unitType:"Siege",
|
||||
movement:2,
|
||||
strength:7,
|
||||
|
@ -87,7 +81,6 @@
|
|||
},
|
||||
{
|
||||
name:"Swordsman",
|
||||
baseDescription: "",
|
||||
unitType:"Melee",
|
||||
movement:2,
|
||||
strength:14,
|
||||
|
@ -98,7 +91,6 @@
|
|||
},
|
||||
{
|
||||
name:"Horseman",
|
||||
baseDescription:"",
|
||||
unitType:"Mounted",
|
||||
movement:4,
|
||||
strength:12,
|
||||
|
@ -112,7 +104,6 @@
|
|||
// Medieval Era
|
||||
{
|
||||
name:"Crossbowman",
|
||||
baseDescription: "",
|
||||
unitType:"Archery",
|
||||
movement:2,
|
||||
strength:13,
|
||||
|
@ -123,7 +114,6 @@
|
|||
},
|
||||
{
|
||||
name:"Trebuchet",
|
||||
baseDescription: "",
|
||||
unitType:"Siege",
|
||||
movement:2,
|
||||
strength:12,
|
||||
|
@ -135,7 +125,6 @@
|
|||
},
|
||||
{
|
||||
name:"Longswordsman",
|
||||
baseDescription: "",
|
||||
unitType:"Melee",
|
||||
movement:2,
|
||||
strength:21,
|
||||
|
@ -146,7 +135,6 @@
|
|||
},
|
||||
{
|
||||
name:"Pikeman",
|
||||
baseDescription: "",
|
||||
unitType:"Melee",
|
||||
movement:2,
|
||||
strength:16,
|
||||
|
|
|
@ -27,7 +27,7 @@ class CityConstructions {
|
|||
val stats = Stats()
|
||||
for (building in getBuiltBuildings())
|
||||
stats.add(building.getStats(cityInfo.civInfo.policies.adoptedPolicies))
|
||||
stats.science += (cityInfo.buildingUniques.count({ it == "Science Per 2 Population" }) * cityInfo.population.population / 2).toFloat()
|
||||
stats.science += (cityInfo.buildingUniques.count({ it == "+1 Science Per 2 Population" }) * cityInfo.population.population / 2).toFloat()
|
||||
return stats
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.unciv.ui.VictoryScreen
|
|||
import com.unciv.ui.pickerscreens.PolicyPickerScreen
|
||||
|
||||
class Building : NamedStats(), IConstruction{
|
||||
private lateinit var baseDescription: String
|
||||
private var baseDescription: String? = null
|
||||
override val description: String
|
||||
get() = getDescription(false, hashSetOf())
|
||||
|
||||
|
@ -45,9 +45,16 @@ class Building : NamedStats(), IConstruction{
|
|||
fun getRequiredTech(): Technology = GameBasics.Technologies[requiredTech]!!
|
||||
|
||||
fun getShortDescription(): String { // should fit in one line
|
||||
var str = getStats(hashSetOf()).toString()
|
||||
if(unique!=null) str += ", "+ unique!!
|
||||
return str
|
||||
val infoList= mutableListOf<String>()
|
||||
val str = getStats(hashSetOf()).toString()
|
||||
if(str.isNotEmpty()) infoList += str
|
||||
val improvedResources = GameBasics.TileResources.values.filter { it.building==name }
|
||||
if(improvedResources.isNotEmpty()){
|
||||
// buildings that improve resources
|
||||
infoList += resourceBonusStats.toString() +" from "+improvedResources.joinToString()
|
||||
}
|
||||
if(unique!=null) infoList += unique!!
|
||||
return infoList.joinToString()
|
||||
}
|
||||
|
||||
fun getStats(adoptedPolicies: HashSet<String>): Stats {
|
||||
|
@ -97,7 +104,7 @@ class Building : NamedStats(), IConstruction{
|
|||
stringBuilder.appendln("Requires a $requiredBuildingInAllCities to be built in all cities")
|
||||
if (providesFreeBuilding != null)
|
||||
stringBuilder.appendln("Provides a free $providesFreeBuilding in this city")
|
||||
stringBuilder.appendln(baseDescription)
|
||||
if(baseDescription!=null) stringBuilder.appendln(baseDescription)
|
||||
if (stats.toString() != "")
|
||||
stringBuilder.appendln(stats)
|
||||
if (this.percentStatBonus != null) {
|
||||
|
@ -120,7 +127,7 @@ class Building : NamedStats(), IConstruction{
|
|||
}
|
||||
if (maintenance != 0)
|
||||
stringBuilder.appendln("Maintenance cost: $maintenance gold")
|
||||
return stringBuilder.toString()
|
||||
return stringBuilder.toString().trim()
|
||||
}
|
||||
|
||||
override fun getProductionCost(adoptedPolicies: HashSet<String>): Int {
|
||||
|
|
|
@ -8,21 +8,6 @@ class Technology : ICivilopedia {
|
|||
val SB=StringBuilder()
|
||||
if(baseDescription!=null) SB.appendln(baseDescription)
|
||||
|
||||
val enabledUnits = GameBasics.Units.values.filter { it.requiredTech==name }
|
||||
if(enabledUnits.isNotEmpty()) SB.appendln("Units enabled: "+enabledUnits.map { it.name }.joinToString())
|
||||
|
||||
val enabledBuildings = GameBasics.Buildings.values.filter { it.requiredTech==name }
|
||||
val regularBuildings = enabledBuildings.filter { !it.isWonder }
|
||||
if(regularBuildings.isNotEmpty())
|
||||
SB.appendln("Buildings enabled: "+regularBuildings.map { it.name + " ("+it.getShortDescription()+")" }.joinToString())
|
||||
val wonders = enabledBuildings.filter { it.isWonder }
|
||||
if(wonders.isNotEmpty()) SB.appendln("Wonders enabled: "+wonders.map { it.name }.joinToString())
|
||||
|
||||
val revealedResource = GameBasics.TileResources.values.filter { it.revealedBy==name }.firstOrNull() // can only be one
|
||||
if(revealedResource!=null) SB.appendln("Reveals $revealedResource on map")
|
||||
|
||||
val tileImprovements = GameBasics.TileImprovements.values.filter { it.techRequired==name }
|
||||
if(tileImprovements.isNotEmpty()) SB.appendln("Tile improvements enabled: "+tileImprovements.map { it.name }.joinToString())
|
||||
|
||||
val improvedImprovements = GameBasics.TileImprovements.values.filter { it.improvingTech==name }.groupBy { it.improvingTechStats.toString()!! }
|
||||
improvedImprovements.forEach{
|
||||
|
@ -30,6 +15,22 @@ class Technology : ICivilopedia {
|
|||
SB.appendln(impimpString)
|
||||
}
|
||||
|
||||
val enabledUnits = GameBasics.Units.values.filter { it.requiredTech==name }
|
||||
if(enabledUnits.isNotEmpty()) SB.appendln("Units enabled: "+enabledUnits.map { it.name + " ("+it.getShortDescription()+")" }.joinToString())
|
||||
|
||||
val enabledBuildings = GameBasics.Buildings.values.filter { it.requiredTech==name }
|
||||
val regularBuildings = enabledBuildings.filter { !it.isWonder }
|
||||
if(regularBuildings.isNotEmpty())
|
||||
SB.appendln("Buildings enabled: "+regularBuildings.map { "\n * "+it.name + " ("+it.getShortDescription()+")" }.joinToString())
|
||||
val wonders = enabledBuildings.filter { it.isWonder }
|
||||
if(wonders.isNotEmpty()) SB.appendln("Wonders enabled: "+wonders.map { "\n * "+it.name+ " ("+it.getShortDescription()+")" }.joinToString())
|
||||
|
||||
val revealedResource = GameBasics.TileResources.values.filter { it.revealedBy==name }.firstOrNull() // can only be one
|
||||
if(revealedResource!=null) SB.appendln("Reveals $revealedResource on map")
|
||||
|
||||
val tileImprovements = GameBasics.TileImprovements.values.filter { it.techRequired==name }
|
||||
if(tileImprovements.isNotEmpty()) SB.appendln("Tile improvements enabled: "+tileImprovements.map { it.name }.joinToString())
|
||||
|
||||
return SB.toString().trim()
|
||||
}
|
||||
lateinit var name: String
|
||||
|
|
|
@ -12,9 +12,18 @@ class Unit : INamed, IConstruction, ICivilopedia {
|
|||
return getDescription(false)
|
||||
}
|
||||
|
||||
fun getShortDescription(): String {
|
||||
val infoList= mutableListOf<String>()
|
||||
if(baseDescription!=null) infoList+=baseDescription!!
|
||||
if(strength!=0) infoList += "strength: $strength"
|
||||
if(rangedStrength!=0) infoList += "ranged strength: $rangedStrength"
|
||||
if(movement!=2) infoList+="movement: $movement"
|
||||
return infoList.joinToString()
|
||||
}
|
||||
|
||||
fun getDescription(forPickerScreen:Boolean): String {
|
||||
val sb = StringBuilder()
|
||||
if(baseDescription!="") sb.appendln(baseDescription)
|
||||
if(baseDescription!=null) sb.appendln(baseDescription)
|
||||
if(!forPickerScreen) {
|
||||
if (unbuildable) sb.appendln("Unbuildable")
|
||||
else sb.appendln("Cost: $cost")
|
||||
|
|
|
@ -30,8 +30,8 @@ open class PickerScreen : CameraStageBaseScreen() {
|
|||
descriptionLabel = Label("", CameraStageBaseScreen.skin)
|
||||
descriptionLabel.setWrap(true)
|
||||
descriptionLabel.setFontScale(game.settings.labelScale)
|
||||
descriptionLabel.width = stage.width / 2
|
||||
bottomTable.add(descriptionLabel).pad(5f).width(stage.width / 2)
|
||||
val labelScroll = ScrollPane(descriptionLabel)
|
||||
bottomTable.add(labelScroll).pad(5f).width(stage.width / 2)
|
||||
|
||||
rightSideButton = TextButton("", CameraStageBaseScreen.skin)
|
||||
rightSideButton.disable()
|
||||
|
|
|
@ -83,8 +83,8 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
|||
if (defenderModifiers.size > i) add(defenderModifiers[i]) else add()
|
||||
row().pad(5f)
|
||||
}
|
||||
add(battle.getAttackingStrength(attacker,defender).toString())
|
||||
add(battle.getDefendingStrength(attacker,defender).toString())
|
||||
add("%.2f".format(battle.getAttackingStrength(attacker,defender)))
|
||||
add("%.2f".format(battle.getDefendingStrength(attacker,defender)))
|
||||
row().pad(5f)
|
||||
|
||||
var damageToDefender = battle.calculateDamageToDefender(attacker,defender)
|
||||
|
|
Loading…
Reference in a new issue