mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
City-states make peace with enemies when their alllies do
This commit is contained in:
parent
d56433857b
commit
478ea310b4
@ -522,9 +522,24 @@ class DiplomacyManager() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun makePeace() {
|
/** Should only be called from makePeace */
|
||||||
|
private fun makePeaceOneSide() {
|
||||||
diplomaticStatus = DiplomaticStatus.Peace
|
diplomaticStatus = DiplomaticStatus.Peace
|
||||||
otherCivDiplomacy().diplomaticStatus = DiplomaticStatus.Peace
|
val otherCiv = otherCiv()
|
||||||
|
// Get out of others' territory
|
||||||
|
for (unit in civInfo.getCivUnits().filter { it.getTile().getOwner() == otherCiv })
|
||||||
|
unit.movement.teleportToClosestMoveableTile()
|
||||||
|
|
||||||
|
// Our ally city states make peace with us
|
||||||
|
for (thirdCiv in civInfo.getKnownCivs())
|
||||||
|
if (thirdCiv.getAllyCiv() == civInfo.civName && thirdCiv.isAtWarWith(otherCiv))
|
||||||
|
thirdCiv.getDiplomacyManager(otherCiv).makePeace()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun makePeace() {
|
||||||
|
makePeaceOneSide()
|
||||||
|
otherCivDiplomacy().makePeaceOneSide()
|
||||||
|
|
||||||
for (civ in getCommonKnownCivs()) {
|
for (civ in getCommonKnownCivs()) {
|
||||||
civ.addNotification(
|
civ.addNotification(
|
||||||
@ -533,15 +548,6 @@ class DiplomacyManager() {
|
|||||||
Color.WHITE
|
Color.WHITE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val otherCiv = otherCiv()
|
|
||||||
// We get out of their territory
|
|
||||||
for (unit in civInfo.getCivUnits().filter { it.getTile().getOwner() == otherCiv })
|
|
||||||
unit.movement.teleportToClosestMoveableTile()
|
|
||||||
|
|
||||||
// And we get out of theirs
|
|
||||||
for (unit in otherCiv.getCivUnits().filter { it.getTile().getOwner() == civInfo })
|
|
||||||
unit.movement.teleportToClosestMoveableTile()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasFlag(flag:DiplomacyFlags) = flagsCountdown.containsKey(flag.name)
|
fun hasFlag(flag:DiplomacyFlags) = flagsCountdown.containsKey(flag.name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user