QuestManager

class QuestManager

Types

Companion
Link copied to clipboard
object Companion

Functions

assignNewQuest
Link copied to clipboard
private fun assignNewQuest(quest: Quest, assignees: Iterable<CivilizationInfo>)
barbarianCampCleared
Link copied to clipboard
fun barbarianCampCleared(civInfo: CivilizationInfo, location: Vector2)

Gets notified a barbarian camp in location has been cleared by civInfo. Since QuestName.ClearBarbarianCamp is a global quest, it could have been assigned to multiple civilizations, so after this notification all matching quests are removed.

canAssignAQuestTo
Link copied to clipboard
private fun canAssignAQuestTo(challenger: CivilizationInfo): Boolean

Returns true if civInfo can assign a quest to challenger

cityStateBullied
Link copied to clipboard
fun cityStateBullied(cityState: CivilizationInfo, bully: CivilizationInfo)

Gets notified the city state cityState was just bullied by bully.

cityStateConquered
Link copied to clipboard
fun cityStateConquered(cityState: CivilizationInfo, attacker: CivilizationInfo)

Gets notified the city state cityState was just conquered by attacker.

clone
Link copied to clipboard
fun clone(): QuestManager
decrementQuestCountdowns
Link copied to clipboard
private fun decrementQuestCountdowns()
endTurn
Link copied to clipboard
fun endTurn()
endWarWithMajorQuest
Link copied to clipboard
private fun endWarWithMajorQuest(attacker: CivilizationInfo)
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
getBarbarianEncampmentForQuest
Link copied to clipboard
private fun getBarbarianEncampmentForQuest(): TileInfo?

Returns a random TileInfo containing a Barbarian encampment within 8 tiles of civInfo to be destroyed

getCityStateTarget
Link copied to clipboard
private fun getCityStateTarget(challenger: CivilizationInfo): CivilizationInfo?

Returns a city-state CivilizationInfo that civInfo wants to target for hostile quests

getCivilizationToFindForQuest
Link copied to clipboard
private fun getCivilizationToFindForQuest(challenger: CivilizationInfo): CivilizationInfo?

Returns a random CivilizationInfo (major) that challenger has met, but whose territory he cannot see; if none exists, it returns null.

getGreatPersonForQuest
Link copied to clipboard
private fun getGreatPersonForQuest(challenger: CivilizationInfo): BaseUnit?

Returns a Great Person BaseUnit that is not owned by both the challenger and the civInfo

getInvestmentMultiplier
Link copied to clipboard
fun getInvestmentMultiplier(donor: String): Float

Returns the influence multiplier for donor from a Investment quest that civInfo might have (assumes only one)

getLeaderStringForQuest
Link copied to clipboard
fun getLeaderStringForQuest(questName: String): String

Returns a string with the leading civ and their score for questName

getMostRecentBully
Link copied to clipboard
private fun getMostRecentBully(): String?

Returns a CivilizationInfo of the civ that most recently bullied civInfo. Note: forgets after 20 turns has passed!

getNaturalWonderToFindForQuest
Link copied to clipboard
private fun getNaturalWonderToFindForQuest(challenger: CivilizationInfo): String?

Returns a random Natural Wonder not yet discovered by challenger.

getQuestWeight
Link copied to clipboard
private fun getQuestWeight(questName: String): Float

Returns the weight of the questName, depends on city state trait and personality

getResourceForQuest
Link copied to clipboard
private fun getResourceForQuest(challenger: CivilizationInfo): TileResource?

Returns a random resource to be connected to the challenger's trade route as a quest. The resource must be a ResourceType.Luxury or ResourceType.Strategic, must not be owned by the civInfo and the challenger, and must be viewable by the challenger; if none exists, it returns null.

getScoreForQuest
Link copied to clipboard
private fun getScoreForQuest(assignedQuest: AssignedQuest): Int

Returns the score for the assignedQuest

getWonderToBuildForQuest
Link copied to clipboard
private fun getWonderToBuildForQuest(challenger: CivilizationInfo): Building?
giveReward
Link copied to clipboard
private fun giveReward(assignedQuest: AssignedQuest)

Increments assignedQuest.assignee influence on civInfo and adds a Notification

handleGlobalQuest
Link copied to clipboard
private fun handleGlobalQuest(questName: String)
handleGlobalQuests
Link copied to clipboard
private fun handleGlobalQuests()
handleIndividualQuest
Link copied to clipboard
private fun handleIndividualQuest(assignedQuest: AssignedQuest): Boolean

If quest is complete, it gives the influence reward to the player. Returns true if the quest can be removed (is either complete, obsolete or expired)

handleIndividualQuests
Link copied to clipboard
private fun handleIndividualQuests()
hashCode
Link copied to clipboard
open fun hashCode(): Int
haveQuestsFor
Link copied to clipboard
fun haveQuestsFor(challenger: CivilizationInfo): Boolean

Returns true if civInfo have active quests for challenger

isComplete
Link copied to clipboard
private fun isComplete(assignedQuest: AssignedQuest): Boolean

Returns true if the assignedQuest is successfully completed

isObsolete
Link copied to clipboard
private fun isObsolete(assignedQuest: AssignedQuest): Boolean

Returns true if the assignedQuest request cannot be fulfilled anymore

isQuestValid
Link copied to clipboard
private fun isQuestValid(quest: Quest, challenger: CivilizationInfo): Boolean

Returns true if the quest can be assigned to challenger

justMet
Link copied to clipboard
fun justMet(otherCiv: CivilizationInfo)

Called when a major civ meets the city-state for the first time. Mainly for war with major pseudo-quest.

militaryUnitKilledBy
Link copied to clipboard
fun militaryUnitKilledBy(killer: CivilizationInfo, killed: CivilizationInfo)

Gets notified when killed's military unit was killed by killer, for war with major pseudo-quest

notifyExpired
Link copied to clipboard
private fun notifyExpired(assignedQuest: AssignedQuest, winners: List<AssignedQuest> = emptyList())

Notifies the assignee of assignedQuest that the quest is now obsolete or expired. Optionally displays the winners of global quests.

receivedGoldGift
Link copied to clipboard
fun receivedGoldGift(donorCiv: CivilizationInfo)

Gets notified when given gold by donorCiv.

seedGlobalQuestCountdown
Link copied to clipboard
private fun seedGlobalQuestCountdown()
seedIndividualQuestsCountdown
Link copied to clipboard
private fun seedIndividualQuestsCountdown()
private fun seedIndividualQuestsCountdown(challenger: CivilizationInfo)
setTransients
Link copied to clipboard
fun setTransients()
toString
Link copied to clipboard
open fun toString(): String
tryBarbarianInvasion
Link copied to clipboard
private fun tryBarbarianInvasion()
tryEndWarWithMajorQuests
Link copied to clipboard
private fun tryEndWarWithMajorQuests()

Ends War with Major pseudo-quests that aren't relevant any longer

tryStartNewGlobalQuest
Link copied to clipboard
private fun tryStartNewGlobalQuest()
tryStartNewIndividualQuests
Link copied to clipboard
private fun tryStartNewIndividualQuests()
unitsKilledSoFar
Link copied to clipboard
fun unitsKilledSoFar(target: CivilizationInfo, viewingCiv: CivilizationInfo): Int
unitsToKill
Link copied to clipboard
fun unitsToKill(target: CivilizationInfo): Int
wantsDead
Link copied to clipboard
fun wantsDead(target: String): Boolean

Returns true if civInfo has asked anyone to conquer target

warWithMajorActive
Link copied to clipboard
fun warWithMajorActive(target: CivilizationInfo): Boolean
wasAttackedBy
Link copied to clipboard
fun wasAttackedBy(attacker: CivilizationInfo)

Gets notified when we are attacked, for war with major pseudo-quest

Properties

assignedQuests
Link copied to clipboard
var assignedQuests: ArrayList<AssignedQuest>

List of active quests, both global and individual ones

civInfo
Link copied to clipboard
lateinit var civInfo: CivilizationInfo

Civilization object holding and dispatching quests

globalQuestCountdown
Link copied to clipboard
private var globalQuestCountdown: Int

Number of turns left before starting new global quest

individualQuestCountdown
Link copied to clipboard
private var individualQuestCountdown: HashMap<String, Int>

Number of turns left before this city state can start a new individual quest

unitsKilledFromCiv
Link copied to clipboard
private var unitsKilledFromCiv: HashMap<String, HashMap<String, Int>>

For this attacker, number of units killed by each civ

unitsToKillForCiv
Link copied to clipboard
private var unitsToKillForCiv: HashMap<String, Int>

Target number of units to kill for this war, for war with major pseudo-quest

Sources

jvm source
Link copied to clipboard