UnitAutomation

object UnitAutomation

Functions

automatedExplore
Link copied to clipboard
fun automatedExplore(unit: MapUnit)

This is what a unit with the 'explore' action does. It also explores, but also has other functions, like healing if necessary.

automateUnitMoves
Link copied to clipboard
fun automateUnitMoves(unit: MapUnit)
chooseBombardTarget
Link copied to clipboard
private fun chooseBombardTarget(city: CityInfo): ICombatant?
containsEnemyMilitaryUnit
Link copied to clipboard
private fun containsEnemyMilitaryUnit(unit: MapUnit, tileInfo: TileInfo): Boolean
countDistanceToClosestEnemy
Link copied to clipboard
private fun countDistanceToClosestEnemy(unit: MapUnit, tile: TileInfo): Int
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
getBombardTargets
Link copied to clipboard
fun getBombardTargets(city: CityInfo): Sequence<TileInfo>
hashCode
Link copied to clipboard
open fun hashCode(): Int
headTowardsEnemyCity
Link copied to clipboard
private fun headTowardsEnemyCity(unit: MapUnit, closestReachableEnemyCity: TileInfo): Boolean
isGoodTileForFogBusting
Link copied to clipboard
private fun isGoodTileForFogBusting(unit: MapUnit, tile: TileInfo): Boolean
isGoodTileToExplore
Link copied to clipboard
private fun isGoodTileToExplore(unit: MapUnit, tile: TileInfo): Boolean
runAway
Link copied to clipboard
fun runAway(unit: MapUnit)
toString
Link copied to clipboard
open fun toString(): String
tryAccompanySettlerOrGreatPerson
Link copied to clipboard
private fun tryAccompanySettlerOrGreatPerson(unit: MapUnit): Boolean
tryAdvanceTowardsCloseEnemy
Link copied to clipboard
private fun tryAdvanceTowardsCloseEnemy(unit: MapUnit): Boolean

Move towards the closest attackable enemy of the unit.

tryBombardEnemy
Link copied to clipboard
fun tryBombardEnemy(city: CityInfo): Boolean
tryEnterOwnClosestCity
Link copied to clipboard
fun tryEnterOwnClosestCity(unit: MapUnit): Boolean
tryExplore
Link copied to clipboard
internal fun tryExplore(unit: MapUnit): Boolean
tryFogBust
Link copied to clipboard
private fun tryFogBust(unit: MapUnit): Boolean
tryGarrisoningUnit
Link copied to clipboard
private fun tryGarrisoningUnit(unit: MapUnit): Boolean
tryGoToRuinAndEncampment
Link copied to clipboard
private fun tryGoToRuinAndEncampment(unit: MapUnit): Boolean
tryHeadTowardsEncampment
Link copied to clipboard
private fun tryHeadTowardsEncampment(unit: MapUnit): Boolean
tryHeadTowardsEnemyCity
Link copied to clipboard
private fun tryHeadTowardsEnemyCity(unit: MapUnit): Boolean
tryHeadTowardsSiegedCity
Link copied to clipboard
private fun tryHeadTowardsSiegedCity(unit: MapUnit): Boolean
tryHealUnit
Link copied to clipboard
private fun tryHealUnit(unit: MapUnit): Boolean
tryPillageImprovement
Link copied to clipboard
fun tryPillageImprovement(unit: MapUnit): Boolean
tryRunAwayIfNeccessary
Link copied to clipboard
fun tryRunAwayIfNeccessary(unit: MapUnit): Boolean

Returns whether the civilian spends its turn hiding and not moving

tryTakeBackCapturedCity
Link copied to clipboard
private fun tryTakeBackCapturedCity(unit: MapUnit): Boolean
tryUpgradeUnit
Link copied to clipboard
internal fun tryUpgradeUnit(unit: MapUnit): Boolean
wander
Link copied to clipboard
fun wander(unit: MapUnit, stayInTerritory: Boolean = false)

Properties

CLOSE_ENEMY_TILES_AWAY_LIMIT
Link copied to clipboard
private const val CLOSE_ENEMY_TILES_AWAY_LIMIT: Int = 5
CLOSE_ENEMY_TURNS_AWAY_LIMIT
Link copied to clipboard
private const val CLOSE_ENEMY_TURNS_AWAY_LIMIT: Float = 3f

Sources

jvm source
Link copied to clipboard