diff --git a/android/assets/jsons/Buildings.json b/android/assets/jsons/Buildings.json index 72dc447d07..d8020d21e6 100644 --- a/android/assets/jsons/Buildings.json +++ b/android/assets/jsons/Buildings.json @@ -715,7 +715,8 @@ culture:3, isWonder:true, uniques:["Defensive buildings in all cities are 25% more effective"], - requiredTech:"Railroad" + requiredTech:"Railroad", + quote:"'The Law is a fortress on a hill that armies cannot take or floods wash away.' –- The Prophet Muhammed" }, { name:"Neuschwanstein", diff --git a/core/src/com/unciv/logic/city/CityConstructions.kt b/core/src/com/unciv/logic/city/CityConstructions.kt index 8077797615..d37b9919ca 100644 --- a/core/src/com/unciv/logic/city/CityConstructions.kt +++ b/core/src/com/unciv/logic/city/CityConstructions.kt @@ -3,6 +3,8 @@ package com.unciv.logic.city import com.badlogic.gdx.graphics.Color import com.unciv.Constants import com.unciv.logic.automation.ConstructionAutomation +import com.unciv.logic.civilization.AlertType +import com.unciv.logic.civilization.PopupAlert import com.unciv.models.gamebasics.Building import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr @@ -192,6 +194,7 @@ class CityConstructions { inProgressConstructions.remove(currentConstruction) if (construction is Building && construction.isWonder) { + cityInfo.civInfo.popupAlerts.add(PopupAlert(AlertType.WonderBuilt, construction.name)) for (civ in cityInfo.civInfo.gameInfo.civilizations) { if (civ.exploredTiles.contains(cityInfo.location)) civ.addNotification("[$currentConstruction] has been built in [${cityInfo.name}]", cityInfo.location, Color.BROWN) diff --git a/core/src/com/unciv/logic/civilization/PopupAlert.kt b/core/src/com/unciv/logic/civilization/PopupAlert.kt index 0c6ce56b1b..fd0758f406 100644 --- a/core/src/com/unciv/logic/civilization/PopupAlert.kt +++ b/core/src/com/unciv/logic/civilization/PopupAlert.kt @@ -10,6 +10,7 @@ enum class AlertType{ CitiesSettledNearOtherCiv, DemandToStopSettlingCitiesNear, CitySettledNearOtherCivDespiteOurPromise, + WonderBuilt } class PopupAlert { diff --git a/core/src/com/unciv/logic/civilization/TechManager.kt b/core/src/com/unciv/logic/civilization/TechManager.kt index bad62edbb3..5a7819e20c 100644 --- a/core/src/com/unciv/logic/civilization/TechManager.kt +++ b/core/src/com/unciv/logic/civilization/TechManager.kt @@ -44,12 +44,14 @@ class TechManager { var techCost = GameBasics.Technologies[techName]!!.cost.toFloat() techCost *= civInfo.getDifficulty().researchCostModifier techCost *= civInfo.gameInfo.gameParameters.gameSpeed.getModifier() - techCost *= (1 + 0.02 * (civInfo.cities.size -1 )).toFloat() + techCost *= 1 + (civInfo.cities.size -1 ) * 0.02f // each city increases tech cost by 2%, as per https://civilization.fandom.com/wiki/Science_(Civ5) return techCost.toInt() } - fun currentTechnology(): Technology? = currentTechnologyName()?.let { - GameBasics.Technologies[it] + fun currentTechnology(): Technology? { + val currentTechnologyName = currentTechnologyName() + if (currentTechnologyName == null) return null + return GameBasics.Technologies[currentTechnologyName] } fun currentTechnologyName(): String? { diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 3f282ded28..b5bc734785 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -38,6 +38,7 @@ class Building : NamedStats(), IConstruction{ var xpForNewUnits=0 var replaces:String?=null var uniqueTo:String?=null + var quote:String?=null // Uniques private var providesFreeBuilding: String? = null diff --git a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt index f84623c336..954ca2c918 100644 --- a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt @@ -5,10 +5,9 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextButton import com.unciv.logic.civilization.AlertType import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.PopupAlert +import com.unciv.models.gamebasics.GameBasics import com.unciv.models.gamebasics.tr -import com.unciv.ui.utils.addSeparator -import com.unciv.ui.utils.onClick -import com.unciv.ui.utils.toLabel +import com.unciv.ui.utils.* import com.unciv.ui.worldscreen.optionstable.PopupTable class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): PopupTable(worldScreen){ @@ -95,6 +94,18 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu addGoodSizedLabel("We noticed your new city near our borders, despite your promise. This will have....implications.").row() add(getCloseButton("Very well.")) } + AlertType.WonderBuilt -> { + val wonder = GameBasics.Buildings[popupAlert.value]!! + addGoodSizedLabel(wonder.name) + addSeparator() + val centerTable = Table() + val wonderText = if(wonder.quote!=null) wonder.quote!! else "" + centerTable.add(wonderText.toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) + centerTable.add(ImageGetter.getConstructionImage(wonder.name).surroundWithCircle(100f)).pad(20f) + centerTable.add(wonder.getShortDescription().toLabel().apply { setWrap(true) }).width(worldScreen.stage.width/3) + add(centerTable).row() + add(getCloseButton("Close")) + } } open() worldScreen.alertPopupIsOpen = true