mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 23:08:35 +07:00
Standardized 'spread religion' / 'remove heresy' actions
This commit is contained in:
@ -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)
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user