mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 10:54:19 -04:00
Replace unit action for timed golden ages with a generic triggered unique
Triggered uniques display side effects
This commit is contained in:
parent
a1453a8b37
commit
c3a4a18bba
@ -1599,7 +1599,8 @@
|
|||||||
{
|
{
|
||||||
"name": "Great Artist",
|
"name": "Great Artist",
|
||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniques": ["Can start an [8]-turn golden age",
|
"uniques": [
|
||||||
|
"Empire enters a [8]-turn Golden Age <by consuming this unit>",
|
||||||
"Can instantly construct a [Landmark] improvement <by consuming this unit>",
|
"Can instantly construct a [Landmark] improvement <by consuming this unit>",
|
||||||
"Great Person - [Culture]", "Unbuildable", "Uncapturable"],
|
"Great Person - [Culture]", "Unbuildable", "Uncapturable"],
|
||||||
"movement": 2
|
"movement": 2
|
||||||
@ -1607,7 +1608,8 @@
|
|||||||
{
|
{
|
||||||
"name": "Great Scientist",
|
"name": "Great Scientist",
|
||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniques": ["Can hurry technology research",
|
"uniques": [
|
||||||
|
"Can hurry technology research",
|
||||||
"Can instantly construct a [Academy] improvement <by consuming this unit>",
|
"Can instantly construct a [Academy] improvement <by consuming this unit>",
|
||||||
"Great Person - [Science]", "Unbuildable", "Uncapturable"],
|
"Great Person - [Science]", "Unbuildable", "Uncapturable"],
|
||||||
"movement": 2
|
"movement": 2
|
||||||
@ -1646,7 +1648,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Great General",
|
"name": "Great General",
|
||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniques": ["Can start an [8]-turn golden age", "[+15]% Strength bonus for [Military] units within [2] tiles",
|
"uniques": [
|
||||||
|
"Empire enters a [8]-turn Golden Age <by consuming this unit>",
|
||||||
|
"[+15]% Strength bonus for [Military] units within [2] tiles",
|
||||||
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
||||||
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
||||||
"movement": 2
|
"movement": 2
|
||||||
@ -1656,7 +1660,9 @@
|
|||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniqueTo": "Mongolia",
|
"uniqueTo": "Mongolia",
|
||||||
"replaces": "Great General",
|
"replaces": "Great General",
|
||||||
"uniques": ["Can start an [8]-turn golden age","[+15]% Strength bonus for [Military] units within [2] tiles",
|
"uniques": [
|
||||||
|
"Empire enters a [8]-turn Golden Age <by consuming this unit>",
|
||||||
|
"[+15]% Strength bonus for [Military] units within [2] tiles",
|
||||||
"All adjacent units heal [+15] HP when healing", "[+15] HP when healing",
|
"All adjacent units heal [+15] HP when healing", "[+15] HP when healing",
|
||||||
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
||||||
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
||||||
|
@ -1258,7 +1258,8 @@
|
|||||||
{
|
{
|
||||||
"name": "Great Artist",
|
"name": "Great Artist",
|
||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniques": ["Can start an [8]-turn golden age",
|
"uniques": [
|
||||||
|
"Empire enters a [8]-turn Golden Age <by consuming this unit>",
|
||||||
"Can instantly construct a [Landmark] improvement <by consuming this unit>",
|
"Can instantly construct a [Landmark] improvement <by consuming this unit>",
|
||||||
"Great Person - [Culture]", "Unbuildable", "Uncapturable"],
|
"Great Person - [Culture]", "Unbuildable", "Uncapturable"],
|
||||||
"movement": 2
|
"movement": 2
|
||||||
@ -1305,7 +1306,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Great General",
|
"name": "Great General",
|
||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniques": ["Can start an [8]-turn golden age", "[+15]% Strength bonus for [Military] units within [2] tiles",
|
"uniques": [
|
||||||
|
"Empire enters a [8]-turn Golden Age <by consuming this unit>",
|
||||||
|
"[+15]% Strength bonus for [Military] units within [2] tiles",
|
||||||
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
||||||
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
||||||
"movement": 2
|
"movement": 2
|
||||||
@ -1315,7 +1318,9 @@
|
|||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniqueTo": "Mongolia",
|
"uniqueTo": "Mongolia",
|
||||||
"replaces": "Great General",
|
"replaces": "Great General",
|
||||||
"uniques": ["Can start an [8]-turn golden age", "[+15]% Strength bonus for [Military] units within [2] tiles",
|
"uniques": [
|
||||||
|
"Empire enters a [8]-turn Golden Age <by consuming this unit>",
|
||||||
|
"[+15]% Strength bonus for [Military] units within [2] tiles",
|
||||||
"All adjacent units heal [+15] HP when healing", "[+15] HP when healing",
|
"All adjacent units heal [+15] HP when healing", "[+15] HP when healing",
|
||||||
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
"Can instantly construct a [Citadel] improvement <by consuming this unit>",
|
||||||
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
||||||
|
@ -164,8 +164,9 @@ object UniqueTriggerActivation {
|
|||||||
civInfo.addNotification(notificationText, NotificationCategory.General, NotificationIcon.Culture)
|
civInfo.addNotification(notificationText, NotificationCategory.General, NotificationIcon.Culture)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
UniqueType.OneTimeEnterGoldenAge -> {
|
UniqueType.OneTimeEnterGoldenAge, UniqueType.OneTimeEnterGoldenAgeTurns -> {
|
||||||
civInfo.goldenAges.enterGoldenAge()
|
if (unique.type == UniqueType.OneTimeEnterGoldenAgeTurns) civInfo.goldenAges.enterGoldenAge(unique.params[0].toInt())
|
||||||
|
else civInfo.goldenAges.enterGoldenAge()
|
||||||
|
|
||||||
val notificationText = getNotificationText(notification, triggerNotificationText,
|
val notificationText = getNotificationText(notification, triggerNotificationText,
|
||||||
"You enter a Golden Age")
|
"You enter a Golden Age")
|
||||||
|
@ -360,6 +360,9 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
MayFoundReligion("May found a religion", UniqueTarget.Unit),
|
MayFoundReligion("May found a religion", UniqueTarget.Unit),
|
||||||
MayEnhanceReligion("May enhance a religion", UniqueTarget.Unit),
|
MayEnhanceReligion("May enhance a religion", UniqueTarget.Unit),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Deprecated("as of 4.5.3", ReplaceWith("Empire enters a [amount]-turn Golden Age <by consuming this unit>"))
|
||||||
StartGoldenAge("Can start an [amount]-turn golden age", UniqueTarget.Unit),
|
StartGoldenAge("Can start an [amount]-turn golden age", UniqueTarget.Unit),
|
||||||
AddInCapital("Can be added to [comment] in the Capital", UniqueTarget.Unit),
|
AddInCapital("Can be added to [comment] in the Capital", UniqueTarget.Unit),
|
||||||
PreventSpreadingReligion("Prevents spreading of religion to the city it is next to", UniqueTarget.Unit),
|
PreventSpreadingReligion("Prevents spreading of religion to the city it is next to", UniqueTarget.Unit),
|
||||||
@ -701,6 +704,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
OneTimeFreePolicy("Free Social Policy", UniqueTarget.Triggerable), // used in Buildings
|
OneTimeFreePolicy("Free Social Policy", UniqueTarget.Triggerable), // used in Buildings
|
||||||
OneTimeAmountFreePolicies("[amount] Free Social Policies", UniqueTarget.Triggerable), // Not used in Vanilla
|
OneTimeAmountFreePolicies("[amount] Free Social Policies", UniqueTarget.Triggerable), // Not used in Vanilla
|
||||||
OneTimeEnterGoldenAge("Empire enters golden age", UniqueTarget.Triggerable), // used in Policies, Buildings
|
OneTimeEnterGoldenAge("Empire enters golden age", UniqueTarget.Triggerable), // used in Policies, Buildings
|
||||||
|
OneTimeEnterGoldenAgeTurns("Empire enters a [amount]-turn Golden Age", UniqueTarget.Triggerable),
|
||||||
OneTimeFreeGreatPerson("Free Great Person", UniqueTarget.Triggerable), // used in Policies, Buildings
|
OneTimeFreeGreatPerson("Free Great Person", UniqueTarget.Triggerable), // used in Policies, Buildings
|
||||||
OneTimeGainPopulation("[amount] population [cityFilter]", UniqueTarget.Triggerable), // used in CN tower
|
OneTimeGainPopulation("[amount] population [cityFilter]", UniqueTarget.Triggerable), // used in CN tower
|
||||||
OneTimeGainPopulationRandomCity("[amount] population in a random city", UniqueTarget.Triggerable),
|
OneTimeGainPopulationRandomCity("[amount] population in a random city", UniqueTarget.Triggerable),
|
||||||
|
@ -202,8 +202,7 @@ object UnitActions {
|
|||||||
|
|
||||||
return UnitAction(
|
return UnitAction(
|
||||||
type = UnitActionType.FoundCity,
|
type = UnitActionType.FoundCity,
|
||||||
title = if (!hasActionModifiers) UnitActionType.FoundCity.value
|
title = actionTextWithSideEffects(UnitActionType.FoundCity.value, unique),
|
||||||
else "${UnitActionType.FoundCity.value} ${getSideEffectString(unique)}",
|
|
||||||
uncivSound = UncivSound.Chimes,
|
uncivSound = UncivSound.Chimes,
|
||||||
action = {
|
action = {
|
||||||
// check if we would be breaking a promise
|
// check if we would be breaking a promise
|
||||||
@ -474,12 +473,8 @@ object UnitActions {
|
|||||||
(civResources[unique.params[1]] ?: 0) < unique.params[0].toInt()
|
(civResources[unique.params[1]] ?: 0) < unique.params[0].toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
val sideEffectsString = getSideEffectString(unique)
|
|
||||||
val title = if (sideEffectsString.isEmpty()) "Create [$improvementName]"
|
|
||||||
else "{Create [$improvementName]} {$sideEffectsString}"
|
|
||||||
|
|
||||||
finalActions += UnitAction(UnitActionType.Create,
|
finalActions += UnitAction(UnitActionType.Create,
|
||||||
title = title,
|
title = actionTextWithSideEffects("Create [$improvementName]", unique),
|
||||||
action = {
|
action = {
|
||||||
val unitTile = unit.getTile()
|
val unitTile = unit.getTile()
|
||||||
unitTile.improvementFunctions.removeCreatesOneImprovementMarker()
|
unitTile.improvementFunctions.removeCreatesOneImprovementMarker()
|
||||||
@ -658,7 +653,9 @@ object UnitActions {
|
|||||||
if (unique.conditionals.none { it.type?.targetTypes?.contains(UniqueTarget.UnitActionModifier) == true }) continue
|
if (unique.conditionals.none { it.type?.targetTypes?.contains(UniqueTarget.UnitActionModifier) == true }) continue
|
||||||
if (unique.type?.targetTypes?.any { it in triggerableTypes }!=true) continue
|
if (unique.type?.targetTypes?.any { it in triggerableTypes }!=true) continue
|
||||||
|
|
||||||
val unitAction = UnitAction(type = UnitActionType.TriggerUnique, unique.text.removeConditionals()){
|
val unitAction = UnitAction(type = UnitActionType.TriggerUnique,
|
||||||
|
title = actionTextWithSideEffects(unique.text.removeConditionals(), unique)
|
||||||
|
){
|
||||||
UniqueTriggerActivation.triggerUnitwideUnique(unique, unit)
|
UniqueTriggerActivation.triggerUnitwideUnique(unique, unit)
|
||||||
activateSideEffects(unit, unique)
|
activateSideEffects(unit, unique)
|
||||||
}
|
}
|
||||||
@ -707,6 +704,12 @@ object UnitActions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun actionTextWithSideEffects(originalText:String, actionUnique: Unique): String {
|
||||||
|
val sideEffectString = getSideEffectString(actionUnique)
|
||||||
|
if (sideEffectString == "") return originalText
|
||||||
|
else return "$originalText $sideEffectString"
|
||||||
|
}
|
||||||
|
|
||||||
fun getSideEffectString(actionUnique: Unique): String {
|
fun getSideEffectString(actionUnique: Unique): String {
|
||||||
val effects = ArrayList<String>()
|
val effects = ArrayList<String>()
|
||||||
if (actionUnique.conditionals.any { it.type == UniqueType.UnitActionConsumeUnit }) effects += Fonts.death.toString()
|
if (actionUnique.conditionals.any { it.type == UniqueType.UnitActionConsumeUnit }) effects += Fonts.death.toString()
|
||||||
|
@ -22,6 +22,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
|||||||
??? example "Empire enters golden age"
|
??? example "Empire enters golden age"
|
||||||
Applicable to: Triggerable
|
Applicable to: Triggerable
|
||||||
|
|
||||||
|
??? example "Empire enters a [amount]-turn Golden Age"
|
||||||
|
Example: "Empire enters a [3]-turn Golden Age"
|
||||||
|
|
||||||
|
Applicable to: Triggerable
|
||||||
|
|
||||||
??? example "Free Great Person"
|
??? example "Free Great Person"
|
||||||
Applicable to: Triggerable
|
Applicable to: Triggerable
|
||||||
|
|
||||||
@ -1058,11 +1063,6 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
|||||||
??? example "May enhance a religion"
|
??? example "May enhance a religion"
|
||||||
Applicable to: Unit
|
Applicable to: Unit
|
||||||
|
|
||||||
??? example "Can start an [amount]-turn golden age"
|
|
||||||
Example: "Can start an [3]-turn golden age"
|
|
||||||
|
|
||||||
Applicable to: Unit
|
|
||||||
|
|
||||||
??? example "Can be added to [comment] in the Capital"
|
??? example "Can be added to [comment] in the Capital"
|
||||||
Example: "Can be added to [comment] in the Capital"
|
Example: "Can be added to [comment] in the Capital"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user