CivilizationInfo

class CivilizationInfo

Constructors

CivilizationInfo
Link copied to clipboard
fun CivilizationInfo()
CivilizationInfo
Link copied to clipboard
fun CivilizationInfo(civName: String)

Functions

addCity
Link copied to clipboard
fun addCity(location: Vector2)
addFlag
Link copied to clipboard
fun addFlag(flag: String, count: Int)
addGold
Link copied to clipboard
fun addGold(delta: Int)

Modify gold by a given amount making sure it does neither overflow nor underflow.

addNotification
Link copied to clipboard
fun addNotification(text: String, vararg notificationIcons: String)
fun addNotification(text: String, location: Vector2, vararg notificationIcons: String)
fun addNotification(text: String, action: NotificationAction?, vararg notificationIcons: String)
addProtectorCiv
Link copied to clipboard
fun addProtectorCiv(otherCiv: CivilizationInfo)
addStat
Link copied to clipboard
fun addStat(stat: Stat, amount: Int)
addUnit
Link copied to clipboard
fun addUnit(mapUnit: MapUnit, updateCivInfo: Boolean = true)
fun addUnit(unitName: String, city: CityInfo? = null): MapUnit?
asPreview
Link copied to clipboard
fun asPreview(): CivilizationInfoPreview
calculateMilitaryMight
Link copied to clipboard
private fun calculateMilitaryMight(): Int
canGiveStat
Link copied to clipboard
fun canGiveStat(statType: Stat): Boolean
canPassThroughTiles
Link copied to clipboard
fun canPassThroughTiles(otherCiv: CivilizationInfo): Boolean
canSignResearchAgreement
Link copied to clipboard
fun canSignResearchAgreement(): Boolean
canSignResearchAgreementsWith
Link copied to clipboard
fun canSignResearchAgreementsWith(otherCiv: CivilizationInfo): Boolean
changeMinorCivsAttacked
Link copied to clipboard
fun changeMinorCivsAttacked(count: Int)
clone
Link copied to clipboard
fun clone(): CivilizationInfo
destroy
Link copied to clipboard
fun destroy()
diplomaticVoteForCiv
Link copied to clipboard
fun diplomaticVoteForCiv(chosenCivName: String?)
discoverNaturalWonder
Link copied to clipboard
fun discoverNaturalWonder(naturalWonderName: String)
endTurn
Link copied to clipboard
fun endTurn()
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
getAllyCiv
Link copied to clipboard
fun getAllyCiv(): String?
getCapital
Link copied to clipboard
fun getCapital(): CityInfo
getCivGreatPeople
Link copied to clipboard
fun getCivGreatPeople(): Sequence<MapUnit>
getCivResources
Link copied to clipboard
fun getCivResources(): ResourceSupplyList
getCivResourcesByName
Link copied to clipboard
fun getCivResourcesByName(): HashMap<String, Int>

Returns a dictionary of ALL resource names, and the amount that the civ has of each

getCivResourcesWithOriginsForTrade
Link copied to clipboard
fun getCivResourcesWithOriginsForTrade(): ResourceSupplyList
getCivTerritory
Link copied to clipboard
private fun getCivTerritory(): Sequence<Vector2>
getCivUnits
Link copied to clipboard
fun getCivUnits(): Sequence<MapUnit>
getCivUnitsSize
Link copied to clipboard
fun getCivUnitsSize(): Int
getCivWideBuildingUniques
Link copied to clipboard
fun getCivWideBuildingUniques(cityItIsFor: CityInfo): Sequence<Unique>
getCompletedPolicyBranchesCount
Link copied to clipboard
fun getCompletedPolicyBranchesCount(): Int
getDifficulty
Link copied to clipboard
fun getDifficulty(): Difficulty
getDiplomacyManager
Link copied to clipboard
fun getDiplomacyManager(civInfo: CivilizationInfo): DiplomacyManager
fun getDiplomacyManager(civName: String): DiplomacyManager
getDueUnits
Link copied to clipboard
private fun getDueUnits(): Sequence<MapUnit>
getEquivalentBuilding
Link copied to clipboard
fun getEquivalentBuilding(baseBuilding: Building): Building
fun getEquivalentBuilding(buildingName: String): Building
getEquivalentUnit
Link copied to clipboard
fun getEquivalentUnit(baseUnit: BaseUnit): BaseUnit
fun getEquivalentUnit(baseUnitName: String): BaseUnit
getEra
Link copied to clipboard
fun getEra(): Era
getEraNumber
Link copied to clipboard
fun getEraNumber(): Int
getGreatPeople
Link copied to clipboard
fun getGreatPeople(): HashSet<BaseUnit>
getGreatPersonPointsForNextTurn
Link copied to clipboard
fun getGreatPersonPointsForNextTurn(): Counter<String>
getHappiness
Link copied to clipboard
fun getHappiness(): Int
getIdleUnits
Link copied to clipboard
fun getIdleUnits(): Sequence<MapUnit>
getKnownCivs
Link copied to clipboard
fun getKnownCivs(): List<CivilizationInfo>

Returns only undefeated civs, aka the ones we care about

getLeaderDisplayName
Link copied to clipboard
fun getLeaderDisplayName(): String

Returns a civilization caption suitable for greetings including player type info: Like "Milan" if the nation is a city state, "Caesar of Rome" otherwise, with an added " (AI)", " (Human - Hotseat)", or " (Human - Multiplayer)" if the game is multiplayer.

getMatchingUniques
Link copied to clipboard
fun getMatchingUniques(uniqueTemplate: String, cityToIgnore: CityInfo? = null): Sequence<Unique>
fun getMatchingUniques(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null, cityToIgnore: CityInfo? = null): Sequence<Unique>

Destined to replace getMatchingUniques, gradually, as we fill the enum

getMilitaryMight
Link copied to clipboard
private fun getMilitaryMight(): Int
getNextDueUnit
Link copied to clipboard
fun getNextDueUnit(): MapUnit?
getProtectorCivs
Link copied to clipboard
fun getProtectorCivs(): List<CivilizationInfo>
getProximity
Link copied to clipboard
fun getProximity(civInfo: CivilizationInfo): Proximity
fun getProximity(civName: String): Proximity
getRecentBullyingCountdown
Link copied to clipboard
fun getRecentBullyingCountdown(): Int?
getResearchAgreementCost
Link copied to clipboard
fun getResearchAgreementCost(): Int
getResourceModifier
Link copied to clipboard
fun getResourceModifier(resource: TileResource): Int
getStatForRanking
Link copied to clipboard
fun getStatForRanking(category: RankingType): Int
getStatReserve
Link copied to clipboard
fun getStatReserve(stat: Stat): Int
getTributeWillingness
Link copied to clipboard
fun getTributeWillingness(demandingCiv: CivilizationInfo, demandingWorker: Boolean = false): Int
getTurnsBetweenDiplomaticVotings
Link copied to clipboard
fun getTurnsBetweenDiplomaticVotings(): Int
getTurnsTillCallForBarbHelp
Link copied to clipboard
fun getTurnsTillCallForBarbHelp(): Int?
getTurnsTillNextDiplomaticVote
Link copied to clipboard
fun getTurnsTillNextDiplomaticVote(): Int?
getWorkerAutomation
Link copied to clipboard
fun getWorkerAutomation(): WorkerAutomation

Returns an instance of WorkerAutomation valid for the duration of the current turn This instance carries cached data common for all Workers of this civ

handleDiplomaticVictoryFlags
Link copied to clipboard
private fun handleDiplomaticVictoryFlags()
hasEverBeenFriendWith
Link copied to clipboard
fun hasEverBeenFriendWith(otherCiv: CivilizationInfo): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
hasMetCivTerritory
Link copied to clipboard
fun hasMetCivTerritory(otherCiv: CivilizationInfo): Boolean
hasResource
Link copied to clipboard
fun hasResource(resourceName: String): Boolean
hasTechOrPolicy
Link copied to clipboard
fun hasTechOrPolicy(techOrPolicyName: String): Boolean
hasUnique
Link copied to clipboard
fun hasUnique(unique: String): Boolean
fun hasUnique(uniqueType: UniqueType, stateForConditionals: StateForConditionals? = null): Boolean
fun initialSetCitiesConnectedToCapitalTransients()
isAlive
Link copied to clipboard
fun isAlive(): Boolean
isAtWar
Link copied to clipboard
fun isAtWar(): Boolean
isAtWarWith
Link copied to clipboard
fun isAtWarWith(otherCiv: CivilizationInfo): Boolean
isBarbarian
Link copied to clipboard
fun isBarbarian(): Boolean
isCapitalConnectedToCity
Link copied to clipboard
fun isCapitalConnectedToCity(city: CityInfo): Boolean
isCityState
Link copied to clipboard
fun isCityState(): Boolean
isCurrentPlayer
Link copied to clipboard
fun isCurrentPlayer(): Boolean
isDefeated
Link copied to clipboard
fun isDefeated(): Boolean

Determine loss conditions.

isLongCountActive
Link copied to clipboard
fun isLongCountActive(): Boolean
isLongCountDisplay
Link copied to clipboard
fun isLongCountDisplay(): Boolean
isMajorCiv
Link copied to clipboard
fun isMajorCiv(): Boolean
isMinorCivAggressor
Link copied to clipboard
fun isMinorCivAggressor(): Boolean
isMinorCivWarmonger
Link copied to clipboard
fun isMinorCivWarmonger(): Boolean
isOneCityChallenger
Link copied to clipboard
fun isOneCityChallenger(): Boolean
isPlayerCivilization
Link copied to clipboard
fun isPlayerCivilization(): Boolean
isSpectator
Link copied to clipboard
fun isSpectator(): Boolean
knows
Link copied to clipboard
fun knows(otherCiv: CivilizationInfo): Boolean
fun knows(otherCivName: String): Boolean
makeCivilizationsMeet
Link copied to clipboard
fun makeCivilizationsMeet(otherCiv: CivilizationInfo, warOnContact: Boolean = false)
mayVoteForDiplomaticVictory
Link copied to clipboard
fun mayVoteForDiplomaticVictory(): Boolean
meetCiv
Link copied to clipboard
private fun meetCiv(otherCiv: CivilizationInfo, warOnContact: Boolean = false)
otherCivCanPledgeProtection
Link copied to clipboard
fun otherCivCanPledgeProtection(otherCiv: CivilizationInfo): Boolean
otherCivCanWithdrawProtection
Link copied to clipboard
fun otherCivCanWithdrawProtection(otherCiv: CivilizationInfo): Boolean
placeUnitNearTile
Link copied to clipboard
fun placeUnitNearTile(location: Vector2, unitName: String): MapUnit?

Tries to place the a unitName unit into the TileInfo closest to the given the location

receiveGoldGift
Link copied to clipboard
fun receiveGoldGift(donorCiv: CivilizationInfo, giftAmount: Int)

Gain a random great person from the city state

removeFlag
Link copied to clipboard
fun removeFlag(flag: String): Int?
removeProtectorCiv
Link copied to clipboard
fun removeProtectorCiv(otherCiv: CivilizationInfo, forced: Boolean = false)
removeUnit
Link copied to clipboard
fun removeUnit(mapUnit: MapUnit)
setAllyCiv
Link copied to clipboard
fun setAllyCiv(newAllyName: String?)
setNationTransient
Link copied to clipboard
fun setNationTransient()

This is separate because the REGULAR setTransients updates the viewable ties, and updateVisibleTiles tries to meet civs... And if the civs don't yet know who they are then they don't know if they're barbarians =\

setTransients
Link copied to clipboard
fun setTransients()
shouldCheckForDiplomaticVictory
Link copied to clipboard
fun shouldCheckForDiplomaticVictory(): Boolean
shouldGoToDueUnit
Link copied to clipboard
fun shouldGoToDueUnit(): Boolean
shouldOpenTechPicker
Link copied to clipboard
fun shouldOpenTechPicker(): Boolean
shouldShowDiplomaticVotingResults
Link copied to clipboard
fun shouldShowDiplomaticVotingResults(): Boolean
startTurn
Link copied to clipboard
fun startTurn()
startTurnFlags
Link copied to clipboard
private fun startTurnFlags()
stats
Link copied to clipboard
fun stats(): CivInfoStats
toString
Link copied to clipboard
open override fun toString(): String
transients
Link copied to clipboard
fun transients(): CivInfoTransientUpdater
turnsForGreatPersonFromCityState
Link copied to clipboard
fun turnsForGreatPersonFromCityState(): Int
updateAllyCivForCityState
Link copied to clipboard
fun updateAllyCivForCityState()
updateDetailedCivResources
Link copied to clipboard
fun updateDetailedCivResources()
updateHasActiveGreatWall
Link copied to clipboard
fun updateHasActiveGreatWall()
updateProximity
Link copied to clipboard
fun updateProximity(otherCiv: CivilizationInfo, preCalculated: Proximity? = null): Proximity
updateSightAndResources
Link copied to clipboard
fun updateSightAndResources()
updateStatsForNextTurn
Link copied to clipboard
fun updateStatsForNextTurn()
updateViewableTiles
Link copied to clipboard
fun updateViewableTiles()
victoryType
Link copied to clipboard
fun victoryType(): VictoryType

Properties

allyCivName
Link copied to clipboard
private var allyCivName: String? = null
cachedMilitaryMight
Link copied to clipboard
private var cachedMilitaryMight: Int
cities
Link copied to clipboard
var cities: List<CityInfo>
citiesConnectedToCapitalToMediums
Link copied to clipboard

Contains mapping of cities to travel mediums from ALL civilizations connected by trade routes to the capital

citiesCreated
Link copied to clipboard
var citiesCreated: Int = 0
cityStateFunctions
Link copied to clipboard
val cityStateFunctions: CityStateFunctions
cityStatePersonality
Link copied to clipboard
var cityStatePersonality: CityStatePersonality
cityStateResource
Link copied to clipboard
var cityStateResource: String? = null
cityStateType
Link copied to clipboard
val cityStateType: CityStateType
cityStateUniqueUnit
Link copied to clipboard
var cityStateUniqueUnit: String? = null
civConstructions
Link copied to clipboard
var civConstructions: CivConstructions
civName
Link copied to clipboard
var civName: String
detailedCivResources
Link copied to clipboard
var detailedCivResources: ResourceSupplyList
diplomacy
Link copied to clipboard
var diplomacy: HashMap<String, DiplomacyManager>
exploredTiles
Link copied to clipboard
var exploredTiles: HashSet<Vector2>
flagsCountdown
Link copied to clipboard
private var flagsCountdown: HashMap<String, Int>

See DiplomacyManager.flagsCountdown for why this does not map Enums to ints

gameInfo
Link copied to clipboard
lateinit var gameInfo: GameInfo
gold
Link copied to clipboard
var gold: Int = 0

The Civ's gold reserves. Public get, private set - please use addGold method to modify.

goldenAges
Link copied to clipboard
var goldenAges: GoldenAgeManager
greatPeople
Link copied to clipboard
var greatPeople: GreatPersonManager
happinessForNextTurn
Link copied to clipboard
var happinessForNextTurn: Int = 0
hasActiveGreatWall
Link copied to clipboard
var hasActiveGreatWall: Boolean = false

This is for performance since every movement calculation depends on this, see MapUnit comment

hasEverOwnedOriginalCapital
Link copied to clipboard
var hasEverOwnedOriginalCapital: Boolean? = null
hasLongCountDisplayUnique
Link copied to clipboard
var hasLongCountDisplayUnique: Boolean = false
hasMovedAutomatedUnits
Link copied to clipboard
var hasMovedAutomatedUnits: Boolean = false
lastEraResourceUsedForBuilding
Link copied to clipboard
var lastEraResourceUsedForBuilding: HashMap<String, Int>
lastEraResourceUsedForUnit
Link copied to clipboard
val lastEraResourceUsedForUnit: HashMap<String, Int>
lastSeenImprovement
Link copied to clipboard
var lastSeenImprovement: HashMap<Vector2, String>
lastSeenImprovementSaved
Link copied to clipboard
var lastSeenImprovementSaved: HashMap<String, String>
nation
Link copied to clipboard
lateinit var nation: Nation
naturalWonders
Link copied to clipboard
var naturalWonders: ArrayList<String>
nonStandardTerrainDamage
Link copied to clipboard
var nonStandardTerrainDamage: Boolean = false
notifications
Link copied to clipboard
var notifications: ArrayList<Notification>
numMinorCivsAttacked
Link copied to clipboard
private var numMinorCivsAttacked: Int = 0
passableImpassables
Link copied to clipboard
val passableImpassables: HashSet<String>
passThroughImpassableUnlocked
Link copied to clipboard
var passThroughImpassableUnlocked: Boolean = false
playerId
Link copied to clipboard
var playerId: String

Used in online multiplayer for human players

playerType
Link copied to clipboard
var playerType: PlayerType
policies
Link copied to clipboard
var policies: PolicyManager
popupAlerts
Link copied to clipboard
val popupAlerts: ArrayList<PopupAlert>
proximity
Link copied to clipboard
var proximity: HashMap<String, Proximity>
questManager
Link copied to clipboard
var questManager: QuestManager
religionManager
Link copied to clipboard
var religionManager: ReligionManager
ruinsManager
Link copied to clipboard
var ruinsManager: RuinsManager
statsForNextTurn
Link copied to clipboard
var statsForNextTurn: Stats
tech
Link copied to clipboard
var tech: TechManager
temporaryUniques
Link copied to clipboard
val temporaryUniques: ArrayList<Pair<Unique, Int>>

Arraylist instead of HashMap as there might be doubles Pairs of Uniques and the amount of turns they are still active If the counter reaches 0 at the end of a turn, it is removed immediately

totalCultureForContests
Link copied to clipboard
var totalCultureForContests: Int = 0
totalFaithForContests
Link copied to clipboard
var totalFaithForContests: Int = 0
tradeRequests
Link copied to clipboard
val tradeRequests: ArrayList<TradeRequest>

for trades here, ourOffers is the current civ's offers, and theirOffers is what the requesting civ offers

units
Link copied to clipboard
private var units: List<MapUnit>

We never add or remove from here directly, could cause comodification problems. Instead, we create a copy list with the change, and replace this list. The other solution, casting toList() every "get", has a performance cost

victoryManager
Link copied to clipboard
var victoryManager: VictoryManager
viewableInvisibleUnitsTiles
Link copied to clipboard
var viewableInvisibleUnitsTiles: Set<TileInfo>
viewableTiles
Link copied to clipboard
var viewableTiles: Set<TileInfo>
workerAutomationCache
Link copied to clipboard
private var workerAutomationCache: WorkerAutomation? = null

Sources

jvm source
Link copied to clipboard