mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-12 16:59:11 +07:00
Game can now handle modded unique buildings that don't replace anything existing
This commit is contained in:
@ -29,7 +29,7 @@ data class TradeOffer(var name:String, var type: TradeType, var amount:Int=1, va
|
|||||||
var offerText = when(type){
|
var offerText = when(type){
|
||||||
TradeType.WarDeclaration -> "Declare war on [$name]"
|
TradeType.WarDeclaration -> "Declare war on [$name]"
|
||||||
TradeType.Introduction -> "Introduction to [$name]"
|
TradeType.Introduction -> "Introduction to [$name]"
|
||||||
TradeType.City -> UncivGame.Current.gameInfo.getCities().first{ it.id == name }.name
|
TradeType.City -> UncivGame.Current.gameInfo.getCities().firstOrNull{ it.id == name }?.name ?: "Non-existent city"
|
||||||
else -> name
|
else -> name
|
||||||
}.tr()
|
}.tr()
|
||||||
if (type !in tradesToNotHaveNumbers || name=="Research Agreement") offerText += " ($amount)"
|
if (type !in tradesToNotHaveNumbers || name=="Research Agreement") offerText += " ($amount)"
|
||||||
|
@ -100,9 +100,11 @@ class Nation : INamed {
|
|||||||
private fun addUniqueBuildingsText(textList: ArrayList<String>, ruleset: Ruleset) {
|
private fun addUniqueBuildingsText(textList: ArrayList<String>, ruleset: Ruleset) {
|
||||||
for (building in ruleset.buildings.values
|
for (building in ruleset.buildings.values
|
||||||
.filter { it.uniqueTo == name }) {
|
.filter { it.uniqueTo == name }) {
|
||||||
|
if (building.replaces == null) textList += building.getShortDescription(ruleset)
|
||||||
|
else {
|
||||||
val originalBuilding = ruleset.buildings[building.replaces!!]!!
|
val originalBuilding = ruleset.buildings[building.replaces!!]!!
|
||||||
|
|
||||||
textList += building.name.tr() + " - "+"Replaces [${originalBuilding.name}]".tr()
|
textList += building.name.tr() + " - " + "Replaces [${originalBuilding.name}]".tr()
|
||||||
val originalBuildingStatMap = originalBuilding.toHashMap()
|
val originalBuildingStatMap = originalBuilding.toHashMap()
|
||||||
for (stat in building.toHashMap())
|
for (stat in building.toHashMap())
|
||||||
if (stat.value != originalBuildingStatMap[stat.key])
|
if (stat.value != originalBuildingStatMap[stat.key])
|
||||||
@ -121,6 +123,7 @@ class Nation : INamed {
|
|||||||
textList += ""
|
textList += ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun addUniqueUnitsText(textList: ArrayList<String>, ruleset: Ruleset) {
|
private fun addUniqueUnitsText(textList: ArrayList<String>, ruleset: Ruleset) {
|
||||||
for (unit in ruleset.units.values
|
for (unit in ruleset.units.values
|
||||||
|
Reference in New Issue
Block a user