Standardized 'spread religion' / 'remove heresy' actions

This commit is contained in:
Yair Morgenstern
2023-12-07 19:56:34 +02:00
parent c4310fb0f9
commit 612545eec5
2 changed files with 5 additions and 6 deletions

View File

@ -205,13 +205,12 @@ object UnitActionsFromUniques {
fun getImprovementCreationActions(unit: MapUnit, tile: Tile) = sequence {
val waterImprovementAction = getWaterImprovementAction(unit)
val waterImprovementAction = getWaterImprovementAction(unit, tile)
if (waterImprovementAction != null) yield(waterImprovementAction)
yieldAll(getImprovementConstructionActionsFromGeneralUnique(unit, tile))
}.asIterable()
fun getWaterImprovementAction(unit: MapUnit): UnitAction? {
val tile = unit.currentTile
fun getWaterImprovementAction(unit: MapUnit, tile: Tile): UnitAction? {
if (!tile.isWater || !unit.hasUnique(UniqueType.CreateWaterImprovements) || tile.resource == null) return null
val improvementName = tile.tileResource.getImprovingImprovement(tile, unit.civ) ?: return null
@ -372,7 +371,7 @@ object UnitActionsFromUniques {
}
return listOf(UnitAction(UnitActionType.ConstructImprovement,
isCurrentAction = unit.currentTile.hasImprovementInProgress(),
isCurrentAction = tile.hasImprovementInProgress(),
action = {
GUI.pushScreen(ImprovementPickerScreen(tile, unit) {
if (GUI.getSettings().autoUnitCycle)

View File

@ -87,7 +87,7 @@ object UnitActionsReligion {
fun addSpreadReligionActions(unit: MapUnit, tile: Tile): List<UnitAction> {
if (!unit.civ.religionManager.maySpreadReligionAtAll(unit)) return listOf()
val city = unit.currentTile.getCity() ?: return listOf()
val city = tile.getCity() ?: return listOf()
val newStyleUnique = UnitActionModifiers.getUsableUnitActionUniques(unit, UniqueType.CanSpreadReligion).firstOrNull()
@ -121,7 +121,7 @@ object UnitActionsReligion {
val religion = unit.civ.gameInfo.religions[unit.religion] ?: return listOf()
if (religion.isPantheon()) return listOf()
val city = unit.currentTile.getCity() ?: return listOf()
val city = tile.getCity() ?: return listOf()
if (city.civ != unit.civ) return listOf()
// Only allow the action if the city actually has any foreign religion
// This will almost be always due to pressure from cities close-by