mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
Possibility to liberate a traded city (#6797)
This commit is contained in:
@ -1163,7 +1163,7 @@ Vote for World Leader = Вибір світового лідера
|
||||
|
||||
# Capturing a city
|
||||
|
||||
What would you like to do with the city? = Що ви хочете зробити з цим містом?
|
||||
What would you like to do with the city of [cityName]? = Що ви хочете зробити з містом [cityName]?
|
||||
Annex = Анексувати
|
||||
Annexed cities become part of your regular empire. = Анексовані міста стануть частиною вашої імперії.
|
||||
Their citizens generate 2x the unhappiness, unless you build a courthouse. = Їх громадяни породжують вдвійчі більше нещастя, якщо ви не побудуєте будинок суду.
|
||||
@ -1180,6 +1180,7 @@ The population will gradually dwindle until the city is destroyed. = Насел
|
||||
Original capitals and holy cities cannot be razed. = Початкові столиці та святі міста не можуть бути зруйновані.
|
||||
Destroy = Знищити
|
||||
Destroying the city instantly razes the city to the ground. = Знищення міста миттєво зрівняє його з землею.
|
||||
Keep it = Залишити собі
|
||||
Remove your troops in our border immediately! = Негайно приберіть свої війська від нашого кордону!
|
||||
Sorry. = Вибачте.
|
||||
Never! = Ніколи!
|
||||
|
@ -1140,7 +1140,7 @@ Vote for World Leader =
|
||||
|
||||
# Capturing a city
|
||||
|
||||
What would you like to do with the city? =
|
||||
What would you like to do with the city of [cityName]? =
|
||||
Annex =
|
||||
Annexed cities become part of your regular empire. =
|
||||
Their citizens generate 2x the unhappiness, unless you build a courthouse. =
|
||||
@ -1157,6 +1157,7 @@ The population will gradually dwindle until the city is destroyed. =
|
||||
Original capitals and holy cities cannot be razed. =
|
||||
Destroy =
|
||||
Destroying the city instantly razes the city to the ground. =
|
||||
Keep it =
|
||||
Remove your troops in our border immediately! =
|
||||
Sorry. =
|
||||
Never! =
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.unciv.logic.city
|
||||
package com.unciv.logic.city
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
@ -279,7 +279,7 @@ class CityInfoConquestFunctions(val city: CityInfo){
|
||||
// Place palace for newCiv if this is the only city they have
|
||||
// This needs to happen _before_ free buildings are added, as somtimes these should
|
||||
// only be placed in the capital, and then there needs to be a capital.
|
||||
if (newCivInfo.cities.count() == 1) {
|
||||
if (newCivInfo.cities.size == 1) {
|
||||
newCivInfo.moveCapitalTo(this)
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ enum class AlertType {
|
||||
WarDeclaration,
|
||||
FirstContact,
|
||||
CityConquered,
|
||||
CityTraded,
|
||||
BorderConflict,
|
||||
DemandToStopSettlingCitiesNear,
|
||||
CitySettledNearOtherCivDespiteOurPromise,
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.unciv.logic.trade
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.civilization.AlertType
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.PopupAlert
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||
import com.unciv.models.ruleset.ModOptionsConstants
|
||||
import com.unciv.models.ruleset.tile.ResourceType
|
||||
@ -102,6 +104,13 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
||||
}
|
||||
to.updateViewableTiles()
|
||||
from.updateViewableTiles()
|
||||
|
||||
// suggest an option to liberate the city
|
||||
if (to.isPlayerCivilization()
|
||||
&& city.foundingCiv != ""
|
||||
&& from.civName != city.foundingCiv // can't liberate if the city actually belongs to those guys
|
||||
&& to.civName != city.foundingCiv) // can't liberate if it's our city
|
||||
to.popupAlerts.add(PopupAlert(AlertType.CityTraded, city.id))
|
||||
}
|
||||
if (offer.type == TradeType.Treaty) {
|
||||
if (offer.name == Constants.peaceTreaty) to.getDiplomacyManager(from).makePeace()
|
||||
|
@ -32,7 +32,8 @@ import java.util.*
|
||||
* @see AlertType
|
||||
*/
|
||||
class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popup(worldScreen) {
|
||||
fun getCloseButton(text: String, key: Char = Char.MIN_VALUE, action: (() -> Unit)? = null): TextButton {
|
||||
|
||||
private fun getCloseButton(text: String, key: Char = Char.MIN_VALUE, action: (() -> Unit)? = null): TextButton {
|
||||
// Popup.addCloseButton is close but AlertPopup needs the flexibility to add these inside a wrapper
|
||||
val button = text.toTextButton()
|
||||
val buttonAction = {
|
||||
@ -92,8 +93,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
}
|
||||
AlertType.CityConquered -> {
|
||||
val city = worldScreen.gameInfo.getCities().first { it.id == popupAlert.value }
|
||||
addGoodSizedLabel("What would you like to do with the city?", Constants.headingFontSize)
|
||||
.padBottom(20f).row()
|
||||
addQuestionAboutTheCity(city.name)
|
||||
val conqueringCiv = worldScreen.gameInfo.currentPlayerCiv
|
||||
|
||||
if (city.foundingCiv != ""
|
||||
@ -139,6 +139,19 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
}
|
||||
}
|
||||
}
|
||||
AlertType.CityTraded -> {
|
||||
val city = worldScreen.gameInfo.getCities().first { it.id == popupAlert.value }
|
||||
addQuestionAboutTheCity(city.name)
|
||||
val conqueringCiv = worldScreen.gameInfo.currentPlayerCiv
|
||||
|
||||
addLiberateOption(city.foundingCiv) {
|
||||
city.liberateCity(conqueringCiv)
|
||||
worldScreen.shouldUpdate = true
|
||||
close()
|
||||
}
|
||||
addSeparator()
|
||||
add(getCloseButton("Keep it")).row()
|
||||
}
|
||||
AlertType.BorderConflict -> {
|
||||
val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||
addLeaderName(civInfo)
|
||||
@ -342,6 +355,11 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
||||
add(responseTable)
|
||||
}
|
||||
|
||||
private fun addQuestionAboutTheCity(cityName: String) {
|
||||
addGoodSizedLabel("What would you like to do with the city of [$cityName]?",
|
||||
Constants.headingFontSize).padBottom(20f).row()
|
||||
}
|
||||
|
||||
private fun addDestroyOption(destroyAction: () -> Unit) {
|
||||
add("Destroy".toTextButton().onClick(function = destroyAction)).row()
|
||||
keyPressDispatcher['d'] = destroyAction
|
||||
|
Reference in New Issue
Block a user