diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index e6a8f816d2..bfedc3b1e5 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -770,6 +770,7 @@ Auto-build roads = Automated workers replace improvements = Automated units move on turn start = Automated units can upgrade = +Automated units choose promotions = Order trade offers by amount = Ask for confirmation when pressing next turn = Notifications log max turns = diff --git a/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt b/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt index 4900ec0e8d..08e7e41a78 100644 --- a/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt +++ b/core/src/com/unciv/logic/automation/unit/UnitAutomation.kt @@ -18,7 +18,6 @@ import com.unciv.logic.civilization.managers.ReligionState import com.unciv.logic.map.mapunit.MapUnit import com.unciv.logic.map.tile.Tile import com.unciv.models.UnitActionType -import com.unciv.models.metadata.GameSettings import com.unciv.models.ruleset.unique.UniqueType import com.unciv.ui.screens.worldscreen.unit.actions.UnitActions import com.unciv.ui.screens.worldscreen.unit.actions.UnitActionsPillage @@ -160,7 +159,9 @@ object UnitAutomation { return } - if (unit.promotions.canBePromoted()) { + if (unit.promotions.canBePromoted() && + // Restrict Human automated units from promotions via setting + (UncivGame.Current.settings.automatedUnitsChoosePromotions || unit.civ.isAI())) { val availablePromotions = unit.promotions.getAvailablePromotions() .filterNot { it.hasUnique(UniqueType.SkipPromotion) } if (availablePromotions.any()) @@ -383,7 +384,7 @@ object UnitAutomation { unit.movement.headTowards(encampmentToHeadTowards) return true } - + private fun tryHealUnit(unit: MapUnit): Boolean { if (unit.baseUnit.isRanged() && unit.hasUnique(UniqueType.HealsEvenAfterAction)) return false // will heal anyway, and attacks don't hurt diff --git a/core/src/com/unciv/models/metadata/GameSettings.kt b/core/src/com/unciv/models/metadata/GameSettings.kt index 28008f3299..033d3d0d30 100644 --- a/core/src/com/unciv/models/metadata/GameSettings.kt +++ b/core/src/com/unciv/models/metadata/GameSettings.kt @@ -71,7 +71,8 @@ class GameSettings { var autoBuildingRoads: Boolean = true var automatedWorkersReplaceImprovements = true var automatedUnitsMoveOnTurnStart: Boolean = false - var automatedUnitsCanUpgrade: Boolean = true + var automatedUnitsCanUpgrade: Boolean = false + var automatedUnitsChoosePromotions: Boolean = false var showMinimap: Boolean = true var minimapSize: Int = 6 // default corresponds to 15% screen space diff --git a/core/src/com/unciv/ui/popups/options/GameplayTab.kt b/core/src/com/unciv/ui/popups/options/GameplayTab.kt index 6c24c53212..19af51f669 100644 --- a/core/src/com/unciv/ui/popups/options/GameplayTab.kt +++ b/core/src/com/unciv/ui/popups/options/GameplayTab.kt @@ -2,12 +2,11 @@ package com.unciv.ui.popups.options import com.badlogic.gdx.scenes.scene2d.ui.Table import com.unciv.GUI -import com.unciv.UncivGame import com.unciv.logic.civilization.PlayerType import com.unciv.models.metadata.GameSettings -import com.unciv.ui.screens.basescreen.BaseScreen import com.unciv.ui.components.UncivSlider import com.unciv.ui.components.extensions.toLabel +import com.unciv.ui.screens.basescreen.BaseScreen fun gameplayTab( optionsPopup: OptionsPopup @@ -45,8 +44,13 @@ fun gameplayTab( optionsPopup.addCheckbox( this, "Automated units can upgrade", - settings.automatedUnitsCanUpgrade, true + settings.automatedUnitsCanUpgrade, false ) { settings.automatedUnitsCanUpgrade = it } + optionsPopup.addCheckbox( + this, + "Automated units choose promotions", + settings.automatedUnitsChoosePromotions, false + ) { settings.automatedUnitsChoosePromotions = it } optionsPopup.addCheckbox(this, "Order trade offers by amount", settings.orderTradeOffersByAmount) { settings.orderTradeOffersByAmount = it } optionsPopup.addCheckbox(this, "Ask for confirmation when pressing next turn", settings.confirmNextTurn) { settings.confirmNextTurn = it }