mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Add border conflict counter for periodly popup.
This commit is contained in:
parent
06f25b5b5b
commit
ff508f22b0
@ -246,14 +246,29 @@ class NextTurnAutomation{
|
||||
// Check if city-state invaded by other civs
|
||||
if (civInfo.isCityState()) {
|
||||
for (civ in civInfo.gameInfo.civilizations) {
|
||||
if (civ == civInfo || civ.isBarbarianCivilization()) continue
|
||||
var needClearCounter = false
|
||||
if (civ == civInfo || civ.isBarbarianCivilization() || !civInfo.getKnownCivs().contains(civ)) continue
|
||||
val diplomacy = civInfo.getDiplomacyManager(civ)!!
|
||||
if (diplomacy.diplomaticStatus == DiplomaticStatus.War) continue
|
||||
if (diplomacy.diplomaticStatus == DiplomaticStatus.War) {
|
||||
needClearCounter = true
|
||||
}
|
||||
|
||||
val unitsInBorder = civ.getCivUnits().count { !it.type.isCivilian() && it.getTile().getOwner() == civInfo }
|
||||
if (unitsInBorder > 0 && diplomacy.influence < 30f) {
|
||||
diplomacy.influence -= 10f
|
||||
civ.popupAlerts.add(PopupAlert(AlertType.BorderConflict,civInfo.civName))
|
||||
if (!diplomacy.flagsCountdown.containsKey("BorderConflict")
|
||||
|| diplomacy.flagsCountdown["BorderConflict"]!! <= 0) {
|
||||
civ.popupAlerts.add(PopupAlert(AlertType.BorderConflict,civInfo.civName))
|
||||
diplomacy.flagsCountdown["BorderConflict"] = 10
|
||||
} else {
|
||||
diplomacy.flagsCountdown["BorderConflict"]!!.minus(1)
|
||||
}
|
||||
} else {
|
||||
needClearCounter = true
|
||||
}
|
||||
|
||||
if (needClearCounter && diplomacy.flagsCountdown.containsKey("BorderConflict")) {
|
||||
diplomacy.flagsCountdown.remove("BorderConflict")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ class MapUnit {
|
||||
currentMovement = getMaxMovement().toFloat()
|
||||
attacksThisTurn=0
|
||||
val tileOwner = getTile().getOwner()
|
||||
if(tileOwner!=null && !civInfo.canEnterTiles(tileOwner)) // if an enemy city expanded onto this tile while I was in it
|
||||
if(tileOwner!=null && !civInfo.canEnterTiles(tileOwner) && !tileOwner.isCityState()) // if an enemy city expanded onto this tile while I was in it
|
||||
movementAlgs().teleportToClosestMoveableTile()
|
||||
doPreTurnAction()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user