Building

class Building : RulesetStatsObject, INonPerpetualConstruction

Functions

add
Link copied to clipboard
fun add(other: Stats)

Adds each value of another Stats instance to this one in place

fun add(stat: Stat, value: Float): Stats

Adds the value parameter to the instance value specified by stat in place

assembleCivilopediaText
Link copied to clipboard
open fun assembleCivilopediaText(ruleset: Ruleset): ICivilopediaText

Assemble json-supplied lines with automatically generated ones.

asSequence
Link copied to clipboard
fun asSequence(): Sequence<Stats.StatValuePair>

Enables iteration over the non-zero Stat/value pairs. Explicit use unnecessary - Stats is iterable directly.

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
clear
Link copied to clipboard
fun clear()

Reset all values to zero (in place)

clone
Link copied to clipboard
fun clone(): Stats
cloneStats
Link copied to clipboard
fun cloneStats(): Stats
div
Link copied to clipboard
operator fun div(number: Float): Stats
equals
Link copied to clipboard
fun equals(otherStats: Stats): Boolean

Compares two instances. Not callable via ==.

open operator fun equals(other: Any?): Boolean
forEach
Link copied to clipboard
open fun forEach(p0: Consumer<in Stats.StatValuePair>)
get
Link copied to clipboard
operator fun get(stat: Stat): Float

Indexed read of a value for a given Stat, e.g. this.gold == this[Stat.Gold]

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(cityInfo: CityInfo?, ruleset: Ruleset): String

used in CityScreen (CityInfoTable and ConstructionInfoTable)

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.

getImprovement
Link copied to clipboard
fun getImprovement(ruleset: Ruleset): TileImprovement?
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
getResourceRequirements
Link copied to clipboard
open override fun getResourceRequirements(): HashMap<String, Int>
getShortDescription
Link copied to clipboard
fun getShortDescription(ruleset: Ruleset): String

Used for AlertType.WonderBuilt, and as sub-text in Nation and Tech descriptions

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?
getStatPercentageBonuses
Link copied to clipboard
fun getStatPercentageBonuses(cityInfo: CityInfo?): Stats
getStats
Link copied to clipboard
fun getStats(city: CityInfo?): Stats
getUniquesStrings
Link copied to clipboard
private fun getUniquesStrings(filterUniques: (Unique) -> Boolean? = null): Sequence<String>
getUniquesStringsWithoutDisablers
Link copied to clipboard
private fun getUniquesStringsWithoutDisablers(filterUniques: (Unique) -> Boolean? = null): Sequence<String>
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
isAnyWonder
Link copied to clipboard
fun isAnyWonder(): Boolean
isBuildable
Link copied to clipboard
open override fun isBuildable(cityConstructions: CityConstructions): Boolean
isEmpty
Link copied to clipboard
fun isEmpty(): 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

isSellable
Link copied to clipboard
fun isSellable(): Boolean
isStatRelated
Link copied to clipboard
fun isStatRelated(stat: Stat): Boolean
iterator
Link copied to clipboard
open operator override fun iterator(): Iterator<Stats.StatValuePair>

Returns an iterator over the elements of this object, wrapped as StatValuePairs

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
newSpecialists
Link copied to clipboard
fun newSpecialists(): Counter<String>
plus
Link copied to clipboard
operator fun plus(stats: Stats): Stats
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
set
Link copied to clipboard
operator fun set(stat: Stat, value: Float)

Indexed write of a value for a given Stat, e.g. this.gold += 1f is equivalent to this[Stat.Gold] += 1f

shouldBeDisplayed
Link copied to clipboard
open override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean
spliterator
Link copied to clipboard
open fun spliterator(): Spliterator<Stats.StatValuePair>
times
Link copied to clipboard
operator fun times(number: Float): Stats
operator fun times(number: Int): Stats
timesInPlace
Link copied to clipboard
fun timesInPlace(number: Float)

Multiplies each value of this instance by number in place

toString
Link copied to clipboard
open override fun toString(): String

Not only a debug helper. It returns a string representing the content, already translated.

toStringWithDecimals
Link copied to clipboard
fun toStringWithDecimals(): String

Properties

cityHealth
Link copied to clipboard
var cityHealth: Int = 0
cityStrength
Link copied to clipboard
var cityStrength: Int = 0
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
culture
Link copied to clipboard
var culture: Float = 0f
faith
Link copied to clipboard
var faith: Float = 0f
food
Link copied to clipboard
var food: Float = 0f
gold
Link copied to clipboard
var gold: Float = 0f
greatPersonPoints
Link copied to clipboard
var greatPersonPoints: Counter<String>
happiness
Link copied to clipboard
var happiness: Float = 0f
hurryCostModifier
Link copied to clipboard
open override var hurryCostModifier: Int = 0

Extra cost percentage when purchasing

isNationalWonder
Link copied to clipboard
var isNationalWonder: Boolean = false
isWonder
Link copied to clipboard
var isWonder: Boolean = false
maintenance
Link copied to clipboard
var maintenance: Int = 0
mapView
Link copied to clipboard
private val mapView: Map<Stat, KMutableProperty0<Float>>
name
Link copied to clipboard
open lateinit override var name: String
percentStatBonus
Link copied to clipboard
private var percentStatBonus: Stats? = null
production
Link copied to clipboard
var production: Float = 0f
quote
Link copied to clipboard
var quote: String
replacementTextForUniques
Link copied to clipboard
private var replacementTextForUniques: String
replaces
Link copied to clipboard
var replaces: String? = null
requiredBuilding
Link copied to clipboard
var requiredBuilding: String? = null
requiredBuildingInAllCities
Link copied to clipboard
var requiredBuildingInAllCities: String? = null
requiredNearbyImprovedResources
Link copied to clipboard
var requiredNearbyImprovedResources: List<String>? = null

City can only be built if one of these resources is nearby - it must be improved!

requiredResource
Link copied to clipboard
private var requiredResource: String? = null

A strategic resource that will be consumed by this building

requiredTech
Link copied to clipboard
var requiredTech: String? = null
science
Link copied to clipboard
var science: Float = 0f
specialistSlots
Link copied to clipboard
private var specialistSlots: Counter<String>? = null
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
values
Link copied to clipboard
val values: Sequence<Float>

Enables aggregates over the values, never empty

Sources

jvm source
Link copied to clipboard