mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-20 19:56:51 +01:00
can now raze non-original capitals at capture (#4903)
* can now raze non-original capitals at capture * clearer code, equal for AI, get gold and reduce pop when liberating * fix conflict?? * fix conflict???? * restore whitespace * restore whitespace Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
parent
f6a3808fe0
commit
33cba2eea9
|
|
@ -429,7 +429,7 @@ object Battle {
|
|||
UncivGame.Current.settings.addCompletedTutorialTask("Conquer a city")
|
||||
} else {
|
||||
city.puppetCity(attackerCiv)
|
||||
if (city.population.population < 4 && city.canBeDestroyed()) {
|
||||
if (city.population.population < 4 && city.canBeDestroyed(justCaptured = true)) {
|
||||
city.annexCity()
|
||||
city.isBeingRazed = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -663,8 +663,8 @@ class CityInfo {
|
|||
return religion.religionThisIsTheHolyCityOf != null
|
||||
}
|
||||
|
||||
fun canBeDestroyed(): Boolean {
|
||||
return !isOriginalCapital && !isCapital() && !isHolyCity()
|
||||
fun canBeDestroyed(justCaptured: Boolean = false): Boolean {
|
||||
return !isOriginalCapital && !isHolyCity() && (!isCapital() || justCaptured)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ class CityInfoConquestFunctions(val city: CityInfo){
|
|||
}
|
||||
|
||||
fun liberateCity(conqueringCiv: CivilizationInfo) {
|
||||
val goldPlundered = getGoldForCapturingCity(conqueringCiv)
|
||||
city.apply {
|
||||
if (foundingCiv == "") { // this should never happen but just in case...
|
||||
puppetCity(conqueringCiv)
|
||||
|
|
@ -107,6 +108,9 @@ class CityInfoConquestFunctions(val city: CityInfo){
|
|||
return
|
||||
}
|
||||
|
||||
conqueringCiv.addGold(goldPlundered)
|
||||
conqueringCiv.addNotification("Received [$goldPlundered] Gold for capturing [$name]", getCenterTile().position, NotificationIcon.Gold)
|
||||
|
||||
val oldCiv = civInfo
|
||||
|
||||
val foundingCiv = civInfo.gameInfo.civilizations.first { it.civName == foundingCiv }
|
||||
|
|
@ -120,6 +124,7 @@ class CityInfoConquestFunctions(val city: CityInfo){
|
|||
Battle.destroyIfDefeated(oldCiv, conqueringCiv)
|
||||
|
||||
health = getMaxHealth() / 2 // I think that cities recover to half health when conquered?
|
||||
if (population.population > 1) population.addPopulation(-1 - population.population / 4) // so from 2-4 population, remove 1, from 5-8, remove 2, etc.
|
||||
reassignPopulation()
|
||||
|
||||
if (foundingCiv.cities.size == 1) cityConstructions.addBuilding(capitalCityIndicator()) // Resurrection!
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
|
|||
close()
|
||||
}
|
||||
add("Raze".toTextButton().apply {
|
||||
if (!city.canBeDestroyed()) disable()
|
||||
if (!city.canBeDestroyed(justCaptured = true)) disable()
|
||||
else {
|
||||
onClick(function = razeAction)
|
||||
keyPressDispatcher['r'] = razeAction
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user