mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 05:14:32 -04:00
Resolved #6136 - Destroyed units on capture provide the correct notification
This commit is contained in:
parent
43e0fa21f1
commit
680bd1a113
@ -503,23 +503,23 @@ object Battle {
|
|||||||
val defenderCiv = defender.getCivInfo()
|
val defenderCiv = defender.getCivInfo()
|
||||||
|
|
||||||
val capturedUnit = defender.unit
|
val capturedUnit = defender.unit
|
||||||
capturedUnit.civInfo.addNotification("An enemy [" + attacker.getName() + "] has captured our [" + defender.getName() + "]",
|
|
||||||
defender.getTile().position, attacker.getName(), NotificationIcon.War, defender.getName())
|
|
||||||
|
|
||||||
val capturedUnitTile = capturedUnit.getTile()
|
val capturedUnitTile = capturedUnit.getTile()
|
||||||
val originalOwner = if (capturedUnit.originalOwner != null)
|
val originalOwner = if (capturedUnit.originalOwner != null)
|
||||||
capturedUnit.civInfo.gameInfo.getCivilization(capturedUnit.originalOwner!!)
|
capturedUnit.civInfo.gameInfo.getCivilization(capturedUnit.originalOwner!!)
|
||||||
else null
|
else null
|
||||||
|
|
||||||
|
var wasDestroyedInstead = false
|
||||||
when {
|
when {
|
||||||
// Uncapturable units are destroyed
|
// Uncapturable units are destroyed
|
||||||
defender.unit.hasUnique(UniqueType.Uncapturable) -> {
|
defender.unit.hasUnique(UniqueType.Uncapturable) -> {
|
||||||
capturedUnit.destroy()
|
capturedUnit.destroy()
|
||||||
|
wasDestroyedInstead = true
|
||||||
}
|
}
|
||||||
// City states can never capture settlers at all
|
// City states can never capture settlers at all
|
||||||
capturedUnit.hasUnique(UniqueType.FoundCity) && attacker.getCivInfo().isCityState() -> {
|
capturedUnit.hasUnique(UniqueType.FoundCity) && attacker.getCivInfo().isCityState() -> {
|
||||||
capturedUnit.destroy()
|
capturedUnit.destroy()
|
||||||
|
wasDestroyedInstead = true
|
||||||
}
|
}
|
||||||
// Is it our old unit?
|
// Is it our old unit?
|
||||||
attacker.getCivInfo() == originalOwner -> {
|
attacker.getCivInfo() == originalOwner -> {
|
||||||
@ -551,6 +551,13 @@ object Battle {
|
|||||||
else -> capturedUnit.capturedBy(attacker.getCivInfo())
|
else -> capturedUnit.capturedBy(attacker.getCivInfo())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wasDestroyedInstead)
|
||||||
|
capturedUnit.civInfo.addNotification("An enemy [" + attacker.getName() + "] has captured our [" + defender.getName() + "]",
|
||||||
|
defender.getTile().position, attacker.getName(), NotificationIcon.War, defender.getName())
|
||||||
|
else
|
||||||
|
capturedUnit.civInfo.addNotification("An enemy [" + attacker.getName() + "] has destroyed our [" + defender.getName() + "]",
|
||||||
|
defender.getTile().position, attacker.getName(), NotificationIcon.War, defender.getName())
|
||||||
|
|
||||||
if (checkDefeat)
|
if (checkDefeat)
|
||||||
destroyIfDefeated(defenderCiv, attacker.getCivInfo())
|
destroyIfDefeated(defenderCiv, attacker.getCivInfo())
|
||||||
capturedUnit.updateVisibleTiles()
|
capturedUnit.updateVisibleTiles()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user