mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-13 11:30:31 +07:00
AI 'found religion' takes the action from the list of unit actions, so player and AI ability to act are always the same
This commit is contained in:
parent
45db7ade2e
commit
2363269814
@ -629,7 +629,11 @@ object SpecificUnitAutomation {
|
||||
return
|
||||
}
|
||||
|
||||
UnitActionsReligion.getFoundReligionAction(unit)()
|
||||
val foundReligionAction = UnitActions.getUnitActions(unit)
|
||||
.firstOrNull { it.type == UnitActionType.FoundReligion }
|
||||
?.action ?: return
|
||||
|
||||
foundReligionAction()
|
||||
}
|
||||
|
||||
fun enhanceReligion(unit: MapUnit) {
|
||||
|
@ -19,17 +19,13 @@ object UnitActionsReligion {
|
||||
if (!unit.civ.religionManager.mayFoundReligionAtAll(unit)) return
|
||||
actionList += UnitAction(
|
||||
UnitActionType.FoundReligion,
|
||||
action = getFoundReligionAction(unit).takeIf { unit.civ.religionManager.mayFoundReligionNow(unit) }
|
||||
action = {
|
||||
unit.civ.religionManager.foundReligion(unit)
|
||||
unit.consume()
|
||||
}.takeIf { unit.civ.religionManager.mayFoundReligionNow(unit) }
|
||||
)
|
||||
}
|
||||
|
||||
fun getFoundReligionAction(unit: MapUnit): () -> Unit {
|
||||
return {
|
||||
unit.civ.religionManager.foundReligion(unit)
|
||||
unit.consume()
|
||||
}
|
||||
}
|
||||
|
||||
internal fun addEnhanceReligionAction(unit: MapUnit, actionList: ArrayList<UnitAction>) {
|
||||
if (!unit.hasUnique(UniqueType.MayEnhanceReligion)) return
|
||||
if (!unit.civ.religionManager.mayEnhanceReligionAtAll(unit)) return
|
||||
|
Loading…
Reference in New Issue
Block a user