mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Fixed a bug where one city challengers could capture enemy cities (#4431)
* Fixed a bug where one city challengres could capture enemy cities * Actually, this is a cleaner implementation
This commit is contained in:
@ -369,11 +369,6 @@ object Battle {
|
||||
}
|
||||
city.hasJustBeenConquered = true
|
||||
|
||||
if (attackerCiv.isBarbarian()) {
|
||||
city.destroyCity()
|
||||
return
|
||||
}
|
||||
|
||||
for (unique in attackerCiv.getMatchingUniques("Upon capturing a city, receive [] times its [] production as [] immediately")) {
|
||||
attackerCiv.addStat(
|
||||
Stat.valueOf(unique.params[2]),
|
||||
@ -381,6 +376,11 @@ object Battle {
|
||||
)
|
||||
}
|
||||
|
||||
if (attackerCiv.isBarbarian() || attackerCiv.isOneCityChallenger()) {
|
||||
city.destroyCity(true)
|
||||
return
|
||||
}
|
||||
|
||||
if (attackerCiv.isPlayerCivilization()) {
|
||||
attackerCiv.popupAlerts.add(PopupAlert(AlertType.CityConquered, city.id))
|
||||
UncivGame.Current.settings.addCompletedTutorialTask("Conquer a city")
|
||||
|
@ -440,9 +440,11 @@ class CityInfo {
|
||||
}
|
||||
}
|
||||
|
||||
fun destroyCity() {
|
||||
// Original capitals can't be destroyed
|
||||
if (isOriginalCapital) return
|
||||
fun destroyCity(overrideSafeties: Boolean = false) {
|
||||
// Original capitals can't be destroyed.
|
||||
// Unless they are captured by a one-city-challenger for some reason.
|
||||
// This was tested in the original.
|
||||
if (isOriginalCapital && !overrideSafeties) return
|
||||
|
||||
for (airUnit in getCenterTile().airUnits.toList()) airUnit.destroy() //Destroy planes stationed in city
|
||||
|
||||
|
Reference in New Issue
Block a user