mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 05:09:25 +07:00
All trades are now cancelled when a civ is defeated
This commit is contained in:
@ -196,9 +196,7 @@ class Battle(val gameInfo:GameInfo) {
|
||||
if(city.cityConstructions.isBuilt("Palace")){
|
||||
city.cityConstructions.removeBuilding("Palace")
|
||||
if(enemyCiv.isDefeated()) {
|
||||
for(civ in gameInfo.civilizations)
|
||||
civ.addNotification("The civilization of [${enemyCiv.civName}] has been destroyed!", null, Color.RED)
|
||||
enemyCiv.getCivUnits().forEach { it.destroy() }
|
||||
enemyCiv.destroy()
|
||||
attacker.getCivInfo().popupAlerts.add(PopupAlert(AlertType.Defeated,enemyCiv.civName))
|
||||
}
|
||||
else if(enemyCiv.cities.isNotEmpty()){
|
||||
|
@ -508,5 +508,18 @@ class CivilizationInfo {
|
||||
}
|
||||
}
|
||||
|
||||
fun destroy(){
|
||||
for(civ in gameInfo.civilizations)
|
||||
civ.addNotification("The civilization of [$civName] has been destroyed!", null, Color.RED)
|
||||
getCivUnits().forEach { it.destroy() }
|
||||
tradeRequests.clear() // if we don't do this then there could be resources taken by "pending" trades forever
|
||||
for(diplomacyManager in diplomacy.values){
|
||||
diplomacyManager.trades.clear()
|
||||
diplomacyManager.otherCiv().getDiplomacyManager(this).trades.clear()
|
||||
for(tradeRequest in diplomacyManager.otherCiv().tradeRequests.filter { it.requestingCiv==civName })
|
||||
diplomacyManager.otherCiv().tradeRequests.remove(tradeRequest) // it would be really weird to get a trade request from a dead civ
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
Reference in New Issue
Block a user