BaseUnit

class BaseUnit : RulesetObject, INonPerpetualConstruction

This is the basic info of the units, as specified in Units.json, in contrast to MapUnit, which is a specific unit of a certain type that appears on the map

Constructors

BaseUnit
Link copied to clipboard
fun BaseUnit()

Functions

addConstructionBonuses
Link copied to clipboard
fun addConstructionBonuses(unit: MapUnit, cityConstructions: CityConstructions)
assembleCivilopediaText
Link copied to clipboard
open fun assembleCivilopediaText(ruleset: Ruleset): ICivilopediaText

Assemble json-supplied lines with automatically generated ones.

canBePurchasedWithAnyStat
Link copied to clipboard
open fun canBePurchasedWithAnyStat(cityInfo: CityInfo): Boolean
canBePurchasedWithStat
Link copied to clipboard
open override fun canBePurchasedWithStat(cityInfo: CityInfo?, stat: Stat): Boolean
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
evaluateForce
Link copied to clipboard
private fun evaluateForce()
getBaseBuyCost
Link copied to clipboard
open override fun getBaseBuyCost(cityInfo: CityInfo, stat: Stat): Int?
getBaseGoldCost
Link copied to clipboard
open fun getBaseGoldCost(civInfo: CivilizationInfo): Double
getCivilopediaTextHeader
Link copied to clipboard
open fun getCivilopediaTextHeader(): FormattedLine?

Generate header line from object metadata. Default implementation will take INamed.name and render it in 150% normal font size with an icon from makeLink.

getCivilopediaTextLines
Link copied to clipboard
open override fun getCivilopediaTextLines(ruleset: Ruleset): List<FormattedLine>

Generate automatic lines from object metadata.

open fun getCostForConstructionsIncreasingInPrice(baseCost: Int, increaseCost: Int, previouslyBought: Int): Int
getDescription
Link copied to clipboard
fun getDescription(): String

Generate description as multi-line string for Nation description addUniqueUnitsText and CityScreen addSelectedConstructionTable

getDirectUpgradeUnit
Link copied to clipboard
fun getDirectUpgradeUnit(civInfo: CivilizationInfo): BaseUnit
getDisbandGold
Link copied to clipboard
fun getDisbandGold(civInfo: CivilizationInfo): Int
getForceEvaluation
Link copied to clipboard
fun getForceEvaluation(): Int
getIconName
Link copied to clipboard
open fun getIconName(): String

Overrides Icon used for Civilopedia entry list (where you select the instance) This will still be passed to the category-specific image getter.

getMapUnit
Link copied to clipboard
fun getMapUnit(civInfo: CivilizationInfo): MapUnit
getMatchingUniques
Link copied to clipboard
open fun getMatchingUniques(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Sequence<Unique>
open fun getMatchingUniques(uniqueTemplate: String, stateForConditionals: StateForConditionals? = null): Sequence<Unique>
getProductionCost
Link copied to clipboard
open override fun getProductionCost(civInfo: CivilizationInfo): Int
getRejectionReasons
Link copied to clipboard
open override fun getRejectionReasons(cityConstructions: CityConstructions): RejectionReasons
fun getRejectionReasons(civInfo: CivilizationInfo): RejectionReasons
getReplacedUnit
Link copied to clipboard
fun getReplacedUnit(ruleset: Ruleset): BaseUnit
getResourceRequirements
Link copied to clipboard
open override fun getResourceRequirements(): HashMap<String, Int>
getShortDescription
Link copied to clipboard
fun getShortDescription(): String
getSortGroup
Link copied to clipboard
open fun getSortGroup(ruleset: Ruleset): Int

Overrides alphabetical sorting in Civilopedia

getStatBuyCost
Link copied to clipboard
open override fun getStatBuyCost(cityInfo: CityInfo, stat: Stat): Int?
getType
Link copied to clipboard
fun getType(): UnitType
getUniqueTarget
Link copied to clipboard
open override fun getUniqueTarget(): UniqueTarget

Technically not currently needed, since the unique target can be retrieved from every unique in the uniqueObjects, But making this a function is relevant for future "unify Unciv object" plans ;)

hashCode
Link copied to clipboard
open fun hashCode(): Int
hasUnique
Link copied to clipboard
open fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Boolean
open fun hasUnique(uniqueTemplate: String, stateForConditionals: StateForConditionals? = null): Boolean
isAirUnit
Link copied to clipboard
fun isAirUnit(): Boolean
isBuildable
Link copied to clipboard
open override fun isBuildable(cityConstructions: CityConstructions): Boolean
fun isBuildable(civInfo: CivilizationInfo): Boolean
isBuildableIgnoringTechs
Link copied to clipboard
fun isBuildableIgnoringTechs(civInfo: CivilizationInfo): Boolean
isCivilian
Link copied to clipboard
fun isCivilian(): Boolean
isGreatPerson
Link copied to clipboard
fun isGreatPerson(): Boolean
isLandUnit
Link copied to clipboard
fun isLandUnit(): Boolean
isMelee
Link copied to clipboard
fun isMelee(): Boolean
isMilitary
Link copied to clipboard
fun isMilitary(): Boolean
isNuclearWeapon
Link copied to clipboard
fun isNuclearWeapon(): Boolean
isProbablySiegeUnit
Link copied to clipboard
fun isProbablySiegeUnit(): Boolean
isPurchasable
Link copied to clipboard
open fun isPurchasable(cityConstructions: CityConstructions): Boolean

Checks if the construction should be purchasable, not whether it can be bought with a stat at all

isRanged
Link copied to clipboard
fun isRanged(): Boolean
isWaterUnit
Link copied to clipboard
fun isWaterUnit(): Boolean
makeLink
Link copied to clipboard
open override fun makeLink(): String

Create the correct string for a Civilopedia link

matchesFilter
Link copied to clipboard
fun matchesFilter(filter: String): Boolean
movesLikeAirUnits
Link copied to clipboard
fun movesLikeAirUnits(): Boolean
postBuildEvent
Link copied to clipboard
open override fun postBuildEvent(cityConstructions: CityConstructions, boughtWith: Stat?): Boolean
renderCivilopediaText
Link copied to clipboard
open fun renderCivilopediaText(labelWidth: Float, linkAction: (id: String) -> Unit? = null): Table

Build a Gdx Table showing our formattedcontent.

requiresResource
Link copied to clipboard
open override fun requiresResource(resource: String): Boolean
shouldBeDisplayed
Link copied to clipboard
open override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean
toString
Link copied to clipboard
open override fun toString(): String

Properties

attackSound
Link copied to clipboard
var attackSound: String? = null
cachedForceEvaluation
Link copied to clipboard
var cachedForceEvaluation: Int
civilopediaText
Link copied to clipboard
open override var civilopediaText: List<FormattedLine>

List of strings supporting simple formatting rules that CivilopediaScreen can render. May later be merged with automatic lines generated by the deriving class through overridden getCivilopediaTextHeader and/or getCivilopediaTextLines methods.

cost
Link copied to clipboard
var cost: Int = 0
hurryCostModifier
Link copied to clipboard
open override var hurryCostModifier: Int = 0
interceptRange
Link copied to clipboard
var interceptRange: Int = 0
movement
Link copied to clipboard
var movement: Int = 0
name
Link copied to clipboard
open lateinit override var name: String
obsoleteTech
Link copied to clipboard
var obsoleteTech: String? = null
promotions
Link copied to clipboard
var promotions: HashSet<String>
range
Link copied to clipboard
var range: Int = 2
rangedStrength
Link copied to clipboard
var rangedStrength: Int = 0
religiousStrength
Link copied to clipboard
var religiousStrength: Int = 0
replacementTextForUniques
Link copied to clipboard
private var replacementTextForUniques: String
replaces
Link copied to clipboard
var replaces: String? = null
requiredResource
Link copied to clipboard
private var requiredResource: String? = null
requiredTech
Link copied to clipboard
var requiredTech: String? = null
ruleset
Link copied to clipboard
lateinit var ruleset: Ruleset
specialUpgradesTo
Link copied to clipboard
val specialUpgradesTo: String?
strength
Link copied to clipboard
var strength: Int = 0
uniqueObjects
Link copied to clipboard
open override val uniqueObjects: List<Unique>
uniques
Link copied to clipboard
open override var uniques: ArrayList<String>
uniqueTo
Link copied to clipboard
var uniqueTo: String? = null
unitType
Link copied to clipboard
lateinit var unitType: String
upgradesTo
Link copied to clipboard
var upgradesTo: String? = null

Sources

jvm source
Link copied to clipboard