TileImprovement

class TileImprovement : RulesetStatsObject

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.

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]

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.

getDescription
Link copied to clipboard
fun getDescription(ruleset: Ruleset): String
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.

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>
getSortGroup
Link copied to clipboard
open fun getSortGroup(ruleset: Ruleset): Int

Overrides alphabetical sorting in Civilopedia

getTurnsToBuild
Link copied to clipboard
fun getTurnsToBuild(civInfo: CivilizationInfo): Int
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
isAllowedOnFeature
Link copied to clipboard
fun isAllowedOnFeature(name: String): Boolean

Check: Is this improvement allowed on a given terrain feature?

isAncientRuinsEquivalent
Link copied to clipboard
fun isAncientRuinsEquivalent(): Boolean
isEmpty
Link copied to clipboard
fun isEmpty(): Boolean
isGreatImprovement
Link copied to clipboard
fun isGreatImprovement(): Boolean
isRoad
Link copied to clipboard
fun isRoad(): 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
plus
Link copied to clipboard
operator fun plus(stats: Stats): Stats
renderCivilopediaText
Link copied to clipboard
open fun renderCivilopediaText(labelWidth: Float, linkAction: (id: String) -> Unit? = null): Table

Build a Gdx Table showing our formattedcontent.

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

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

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.

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
happiness
Link copied to clipboard
var happiness: Float = 0f
mapView
Link copied to clipboard
private val mapView: Map<Stat, KMutableProperty0<Float>>
name
Link copied to clipboard
open lateinit override var name: String
production
Link copied to clipboard
var production: Float = 0f
science
Link copied to clipboard
var science: Float = 0f
shortcutKey
Link copied to clipboard
val shortcutKey: Char? = null
techRequired
Link copied to clipboard
var techRequired: String? = null
terrainsCanBeBuiltOn
Link copied to clipboard
var terrainsCanBeBuiltOn: Collection<String>
turnsToBuild
Link copied to clipboard
val turnsToBuild: 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
values
Link copied to clipboard
val values: Sequence<Float>

Enables aggregates over the values, never empty

Sources

jvm source
Link copied to clipboard