mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 14:57:58 +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:
@ -629,7 +629,11 @@ object SpecificUnitAutomation {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitActionsReligion.getFoundReligionAction(unit)()
|
val foundReligionAction = UnitActions.getUnitActions(unit)
|
||||||
|
.firstOrNull { it.type == UnitActionType.FoundReligion }
|
||||||
|
?.action ?: return
|
||||||
|
|
||||||
|
foundReligionAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun enhanceReligion(unit: MapUnit) {
|
fun enhanceReligion(unit: MapUnit) {
|
||||||
|
@ -19,17 +19,13 @@ object UnitActionsReligion {
|
|||||||
if (!unit.civ.religionManager.mayFoundReligionAtAll(unit)) return
|
if (!unit.civ.religionManager.mayFoundReligionAtAll(unit)) return
|
||||||
actionList += UnitAction(
|
actionList += UnitAction(
|
||||||
UnitActionType.FoundReligion,
|
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>) {
|
internal fun addEnhanceReligionAction(unit: MapUnit, actionList: ArrayList<UnitAction>) {
|
||||||
if (!unit.hasUnique(UniqueType.MayEnhanceReligion)) return
|
if (!unit.hasUnique(UniqueType.MayEnhanceReligion)) return
|
||||||
if (!unit.civ.religionManager.mayEnhanceReligionAtAll(unit)) return
|
if (!unit.civ.religionManager.mayEnhanceReligionAtAll(unit)) return
|
||||||
|
Reference in New Issue
Block a user