mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Possibility to liberate a traded city (#6797)
This commit is contained in:
parent
66feebae8d
commit
c4de3530f6
@ -1163,7 +1163,7 @@ Vote for World Leader = Вибір світового лідера
|
|||||||
|
|
||||||
# Capturing a city
|
# 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 = Анексувати
|
Annex = Анексувати
|
||||||
Annexed cities become part of your regular empire. = Анексовані міста стануть частиною вашої імперії.
|
Annexed cities become part of your regular empire. = Анексовані міста стануть частиною вашої імперії.
|
||||||
Their citizens generate 2x the unhappiness, unless you build a courthouse. = Їх громадяни породжують вдвійчі більше нещастя, якщо ви не побудуєте будинок суду.
|
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. = Початкові столиці та святі міста не можуть бути зруйновані.
|
Original capitals and holy cities cannot be razed. = Початкові столиці та святі міста не можуть бути зруйновані.
|
||||||
Destroy = Знищити
|
Destroy = Знищити
|
||||||
Destroying the city instantly razes the city to the ground. = Знищення міста миттєво зрівняє його з землею.
|
Destroying the city instantly razes the city to the ground. = Знищення міста миттєво зрівняє його з землею.
|
||||||
|
Keep it = Залишити собі
|
||||||
Remove your troops in our border immediately! = Негайно приберіть свої війська від нашого кордону!
|
Remove your troops in our border immediately! = Негайно приберіть свої війська від нашого кордону!
|
||||||
Sorry. = Вибачте.
|
Sorry. = Вибачте.
|
||||||
Never! = Ніколи!
|
Never! = Ніколи!
|
||||||
|
@ -1140,7 +1140,7 @@ Vote for World Leader =
|
|||||||
|
|
||||||
# Capturing a city
|
# Capturing a city
|
||||||
|
|
||||||
What would you like to do with the city? =
|
What would you like to do with the city of [cityName]? =
|
||||||
Annex =
|
Annex =
|
||||||
Annexed cities become part of your regular empire. =
|
Annexed cities become part of your regular empire. =
|
||||||
Their citizens generate 2x the unhappiness, unless you build a courthouse. =
|
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. =
|
Original capitals and holy cities cannot be razed. =
|
||||||
Destroy =
|
Destroy =
|
||||||
Destroying the city instantly razes the city to the ground. =
|
Destroying the city instantly razes the city to the ground. =
|
||||||
|
Keep it =
|
||||||
Remove your troops in our border immediately! =
|
Remove your troops in our border immediately! =
|
||||||
Sorry. =
|
Sorry. =
|
||||||
Never! =
|
Never! =
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.unciv.logic.city
|
package com.unciv.logic.city
|
||||||
|
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
import com.unciv.UncivGame
|
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
|
// 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
|
// 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.
|
// 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)
|
newCivInfo.moveCapitalTo(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ enum class AlertType {
|
|||||||
WarDeclaration,
|
WarDeclaration,
|
||||||
FirstContact,
|
FirstContact,
|
||||||
CityConquered,
|
CityConquered,
|
||||||
|
CityTraded,
|
||||||
BorderConflict,
|
BorderConflict,
|
||||||
DemandToStopSettlingCitiesNear,
|
DemandToStopSettlingCitiesNear,
|
||||||
CitySettledNearOtherCivDespiteOurPromise,
|
CitySettledNearOtherCivDespiteOurPromise,
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.unciv.logic.trade
|
package com.unciv.logic.trade
|
||||||
|
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
|
import com.unciv.logic.civilization.AlertType
|
||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
|
import com.unciv.logic.civilization.PopupAlert
|
||||||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||||
import com.unciv.models.ruleset.ModOptionsConstants
|
import com.unciv.models.ruleset.ModOptionsConstants
|
||||||
import com.unciv.models.ruleset.tile.ResourceType
|
import com.unciv.models.ruleset.tile.ResourceType
|
||||||
@ -102,6 +104,13 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
|||||||
}
|
}
|
||||||
to.updateViewableTiles()
|
to.updateViewableTiles()
|
||||||
from.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.type == TradeType.Treaty) {
|
||||||
if (offer.name == Constants.peaceTreaty) to.getDiplomacyManager(from).makePeace()
|
if (offer.name == Constants.peaceTreaty) to.getDiplomacyManager(from).makePeace()
|
||||||
|
@ -32,7 +32,8 @@ import java.util.*
|
|||||||
* @see AlertType
|
* @see AlertType
|
||||||
*/
|
*/
|
||||||
class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popup(worldScreen) {
|
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
|
// Popup.addCloseButton is close but AlertPopup needs the flexibility to add these inside a wrapper
|
||||||
val button = text.toTextButton()
|
val button = text.toTextButton()
|
||||||
val buttonAction = {
|
val buttonAction = {
|
||||||
@ -92,8 +93,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
|||||||
}
|
}
|
||||||
AlertType.CityConquered -> {
|
AlertType.CityConquered -> {
|
||||||
val city = worldScreen.gameInfo.getCities().first { it.id == popupAlert.value }
|
val city = worldScreen.gameInfo.getCities().first { it.id == popupAlert.value }
|
||||||
addGoodSizedLabel("What would you like to do with the city?", Constants.headingFontSize)
|
addQuestionAboutTheCity(city.name)
|
||||||
.padBottom(20f).row()
|
|
||||||
val conqueringCiv = worldScreen.gameInfo.currentPlayerCiv
|
val conqueringCiv = worldScreen.gameInfo.currentPlayerCiv
|
||||||
|
|
||||||
if (city.foundingCiv != ""
|
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 -> {
|
AlertType.BorderConflict -> {
|
||||||
val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
val civInfo = worldScreen.gameInfo.getCivilization(popupAlert.value)
|
||||||
addLeaderName(civInfo)
|
addLeaderName(civInfo)
|
||||||
@ -342,6 +355,11 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
|||||||
add(responseTable)
|
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) {
|
private fun addDestroyOption(destroyAction: () -> Unit) {
|
||||||
add("Destroy".toTextButton().onClick(function = destroyAction)).row()
|
add("Destroy".toTextButton().onClick(function = destroyAction)).row()
|
||||||
keyPressDispatcher['d'] = destroyAction
|
keyPressDispatcher['d'] = destroyAction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user