mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-06 08:21:36 +07:00
Added triggered uniques to grant specific tech / policy
This commit is contained in:
@ -910,6 +910,7 @@ Gained [amount] [unitName] unit(s) =
|
||||
Gained [stats] =
|
||||
You may choose a free Policy =
|
||||
You may choose [amount] free Policies =
|
||||
You gain the [policy] Policy =
|
||||
You enter a Golden Age =
|
||||
|
||||
## Trigger causes
|
||||
|
@ -131,13 +131,11 @@ object UniqueTriggerActivation {
|
||||
if (civInfo.isSpectator()) return false
|
||||
civInfo.policies.freePolicies++
|
||||
|
||||
|
||||
val notificationText = getNotificationText(notification, triggerNotificationText,
|
||||
"You may choose a free Policy")
|
||||
?: return true
|
||||
|
||||
civInfo.addNotification(notificationText, NotificationCategory.General, NotificationIcon.Culture)
|
||||
|
||||
return true
|
||||
}
|
||||
UniqueType.OneTimeAmountFreePolicies -> {
|
||||
@ -150,7 +148,20 @@ object UniqueTriggerActivation {
|
||||
?: return true
|
||||
|
||||
civInfo.addNotification(notificationText, NotificationCategory.General, NotificationIcon.Culture)
|
||||
return true
|
||||
}
|
||||
UniqueType.OneTimeAdoptPolicy -> {
|
||||
val policyName = unique.params[0]
|
||||
if (civInfo.policies.isAdopted(policyName)) return false
|
||||
val policy = civInfo.gameInfo.ruleset.policies[policyName] ?: return false
|
||||
civInfo.policies.freePolicies++
|
||||
civInfo.policies.adopt(policy)
|
||||
|
||||
val notificationText = getNotificationText(notification, triggerNotificationText,
|
||||
"You gain the [$policyName] Policy")
|
||||
?: return true
|
||||
|
||||
civInfo.addNotification(notificationText, NotificationCategory.General, NotificationIcon.Culture)
|
||||
return true
|
||||
}
|
||||
UniqueType.OneTimeEnterGoldenAge -> {
|
||||
@ -161,7 +172,6 @@ object UniqueTriggerActivation {
|
||||
?: return true
|
||||
|
||||
civInfo.addNotification(notificationText, NotificationCategory.General, NotificationIcon.Happiness)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -280,6 +290,18 @@ object UniqueTriggerActivation {
|
||||
|
||||
return true
|
||||
}
|
||||
UniqueType.OneTimeDiscoverTech -> {
|
||||
val techName = unique.params[0]
|
||||
if (civInfo.tech.isResearched(techName)) return false
|
||||
civInfo.tech.addTechnology(techName)
|
||||
|
||||
val notificationText = getNotificationText(notification, triggerNotificationText,
|
||||
"You have discovered the secrets of [$techName]")
|
||||
?: return true
|
||||
|
||||
civInfo.addNotification(notificationText, NotificationCategory.General, NotificationIcon.Science)
|
||||
return true
|
||||
}
|
||||
|
||||
UniqueType.StrategicResourcesIncrease -> {
|
||||
civInfo.cache.updateCivResources()
|
||||
|
@ -71,6 +71,9 @@ enum class UniqueFlag {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// I didn't put this is a companion object because APPARENTLY doing that means you can't use it in the init function.
|
||||
val numberRegex = Regex("\\d+$") // Any number of trailing digits
|
||||
enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags: List<UniqueFlag> = emptyList()) {
|
||||
|
||||
//////////////////////////////////////// region GLOBAL UNIQUES ////////////////////////////////////////
|
||||
@ -674,6 +677,8 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
OneTimeFreeGreatPerson("Free Great Person", UniqueTarget.Triggerable), // used in Policies, Buildings
|
||||
OneTimeGainPopulation("[amount] population [cityFilter]", UniqueTarget.Triggerable), // used in CN tower
|
||||
OneTimeGainPopulationRandomCity("[amount] population in a random city", UniqueTarget.Triggerable),
|
||||
OneTimeDiscoverTech("Discover [tech]", UniqueTarget.Triggerable),
|
||||
OneTimeAdoptPolicy("Adopt [policy]", UniqueTarget.Triggerable),
|
||||
OneTimeFreeTech("Free Technology", UniqueTarget.Triggerable), // used in Buildings
|
||||
OneTimeAmountFreeTechs("[amount] Free Technologies", UniqueTarget.Triggerable), // used in Policy
|
||||
OneTimeFreeTechRuins("[amount] free random researchable Tech(s) from the [era]", UniqueTarget.Triggerable),
|
||||
@ -745,7 +750,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
|
||||
HiddenAfterGreatProphet("Hidden after generating a Great Prophet", UniqueTarget.Ruins),
|
||||
HiddenWithoutVictoryType("Hidden when [victoryType] Victory is disabled", UniqueTarget.Building, UniqueTarget.Unit, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
HiddenFromCivilopedia("Will not be displayed in Civilopedia", UniqueTarget.Building, UniqueTarget.Unit, UniqueTarget.Improvement,
|
||||
HiddenFromCivilopedia("Will not be displayed in Civilopedia", UniqueTarget.Building, UniqueTarget.Unit, UniqueTarget.UnitType, UniqueTarget.Improvement,
|
||||
UniqueTarget.Tech, UniqueTarget.Terrain, UniqueTarget.Resource, UniqueTarget.Policy, UniqueTarget.Promotion,
|
||||
UniqueTarget.Nation, UniqueTarget.Ruins, flags = UniqueFlag.setOfHiddenToUsers),
|
||||
|
||||
@ -1161,6 +1166,3 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
.getAnnotation(Deprecated::class.java)
|
||||
|
||||
}
|
||||
|
||||
// I didn't put this is a companion object because APPARENTLY doing that means you can't use it in the init function.
|
||||
val numberRegex = Regex("\\d+$") // Any number of trailing digits
|
||||
|
@ -35,6 +35,16 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Discover [tech]"
|
||||
Example: "Discover [Agriculture]"
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Adopt [policy]"
|
||||
Example: "Adopt [Oligarchy]"
|
||||
|
||||
Applicable to: Triggerable
|
||||
|
||||
??? example "Free Technology"
|
||||
Applicable to: Triggerable
|
||||
|
||||
@ -839,7 +849,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
Applicable to: Nation
|
||||
|
||||
??? example "Will not be displayed in Civilopedia"
|
||||
Applicable to: Nation, Tech, Policy, Building, Unit, Promotion, Terrain, Improvement, Resource, Ruins
|
||||
Applicable to: Nation, Tech, Policy, Building, Unit, UnitType, Promotion, Terrain, Improvement, Resource, Ruins
|
||||
|
||||
## Era uniques
|
||||
??? example "Starting in this era disables religion"
|
||||
|
Reference in New Issue
Block a user