mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Example for automating golden age triggers (#12406)
This commit is contained in:
parent
b68c4d3edc
commit
6e75245d25
@ -104,8 +104,8 @@ object CivilianUnitAutomation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Great engineer -> Try to speed up wonder construction
|
// Great engineer -> Try to speed up wonder construction
|
||||||
if ((unit.hasUnique(UniqueType.CanSpeedupConstruction)
|
if (unit.hasUnique(UniqueType.CanSpeedupConstruction)
|
||||||
|| unit.hasUnique(UniqueType.CanSpeedupWonderConstruction))) {
|
|| unit.hasUnique(UniqueType.CanSpeedupWonderConstruction)) {
|
||||||
val wonderCanBeSpedUpEventually = SpecificUnitAutomation.speedupWonderConstruction(unit)
|
val wonderCanBeSpedUpEventually = SpecificUnitAutomation.speedupWonderConstruction(unit)
|
||||||
if (wonderCanBeSpedUpEventually)
|
if (wonderCanBeSpedUpEventually)
|
||||||
return
|
return
|
||||||
@ -140,6 +140,14 @@ object CivilianUnitAutomation {
|
|||||||
|
|
||||||
if (SpecificUnitAutomation.automateImprovementPlacer(unit)) return
|
if (SpecificUnitAutomation.automateImprovementPlacer(unit)) return
|
||||||
|
|
||||||
|
val goldenAgeAction = UnitActions.getUnitActions(unit, UnitActionType.TriggerUnique)
|
||||||
|
.filter { it.action != null && it.associatedUnique?.type in listOf(UniqueType.OneTimeEnterGoldenAge,
|
||||||
|
UniqueType.OneTimeEnterGoldenAgeTurns) }.firstOrNull()
|
||||||
|
if (goldenAgeAction != null) {
|
||||||
|
goldenAgeAction.action?.invoke()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
return // The AI doesn't know how to handle unknown civilian units
|
return // The AI doesn't know how to handle unknown civilian units
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user