AI focuses city bombardment on siege units
This commit is contained in:
parent
e59ad4ff94
commit
519ad2a7ad
3 changed files with 9 additions and 4 deletions
|
@ -10,6 +10,7 @@ import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
|
|||
import com.unciv.logic.map.MapUnit
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.models.gamebasics.unit.UnitType
|
||||
import com.unciv.ui.worldscreen.unit.UnitAction
|
||||
import com.unciv.ui.worldscreen.unit.UnitActions
|
||||
|
||||
|
@ -373,8 +374,11 @@ class UnitAutomation{
|
|||
}
|
||||
|
||||
private fun chooseBombardTarget(city: CityInfo) : TileInfo? {
|
||||
val targets = getBombardTargets(city)
|
||||
var targets = getBombardTargets(city)
|
||||
if (targets.isEmpty()) return null
|
||||
val siegeUnits = targets
|
||||
.filter { Battle(city.civInfo.gameInfo).getMapCombatantOfTile(it)!!.getUnitType()==UnitType.Siege }
|
||||
if(siegeUnits.any()) targets = siegeUnits
|
||||
return targets.minBy { Battle(city.civInfo.gameInfo).getMapCombatantOfTile(it)!!.getHealth() }
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,9 @@ class DiplomacyScreen:CameraStageBaseScreen() {
|
|||
private fun updateLeftSideTable() {
|
||||
leftSideTable.clear()
|
||||
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
for (civ in currentPlayerCiv.getKnownCivs()
|
||||
.filterNot { it.isDefeated() || it.isBarbarianCivilization() }) {
|
||||
for (civ in UnCivGame.Current.gameInfo.civilizations
|
||||
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }) {
|
||||
if (!currentPlayerCiv.knows(civ)) continue
|
||||
|
||||
val civIndicator = ImageGetter.getNationIndicator(civ.getNation(),100f)
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||
private fun updateDiplomacyButton(civInfo: CivilizationInfo) {
|
||||
diplomacyButtonWrapper.clear()
|
||||
if(civInfo.getKnownCivs()
|
||||
.filterNot { it.isDefeated() || it.isBarbarianCivilization() }
|
||||
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }
|
||||
.any()) {
|
||||
displayTutorials("OtherCivEncountered")
|
||||
val btn = TextButton("Diplomacy".tr(), skin)
|
||||
|
|
Loading…
Reference in a new issue