mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Added popups after construction of wonder is complete
This commit is contained in:
parent
bdb049a29a
commit
1cf049f82f
@ -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",
|
||||
|
@ -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)
|
||||
|
@ -10,6 +10,7 @@ enum class AlertType{
|
||||
CitiesSettledNearOtherCiv,
|
||||
DemandToStopSettlingCitiesNear,
|
||||
CitySettledNearOtherCivDespiteOurPromise,
|
||||
WonderBuilt
|
||||
}
|
||||
|
||||
class PopupAlert {
|
||||
|
@ -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? {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user