Added conditional for 'first civilization to research a tech' (#6120)

* Techs with these kinds of conditional bonuses exist in Civ IV and VI

* Phrasing can now include long-term benefits :)

* Capitalization

* Triggered uniques now subject to conditionals

* Removed extraneous parameter

* Conditional placement

* Updated uniques.md to better phrasing
This commit is contained in:
Yair Morgenstern 2022-02-09 12:21:20 +02:00 committed by GitHub
parent 03f7af4360
commit 90d459a9f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -176,6 +176,12 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
UniqueType.ConditionalInRegionOfType -> state.region?.type == condition.params[0]
UniqueType.ConditionalInRegionExceptOfType -> state.region?.type != condition.params[0]
UniqueType.ConditionalFirstCivToResearch -> sourceObjectType == UniqueTarget.Tech
&& state.civInfo != null
&& state.civInfo.gameInfo.civilizations.none {
it != state.civInfo && it.isMajorCiv() && it.hasTechOrPolicy(sourceObjectName!!)
}
else -> false
}
}

View File

@ -29,6 +29,8 @@ object UniqueTriggerActivation {
if (tile != null) Random(tile.position.toString().hashCode())
else Random(-550) // Very random indeed
if (!unique.conditionalsApply(StateForConditionals(civInfo, cityInfo))) return false
@Suppress("NON_EXHAUSTIVE_WHEN") // Yes we're not treating all types here
when (unique.type) {
OneTimeFreeUnit -> {

View File

@ -552,7 +552,8 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
ConditionalDuringEra("during the [era]", UniqueTarget.Conditional),
ConditionalBeforeEra("before the [era]", UniqueTarget.Conditional),
ConditionalStartingFromEra("starting from the [era]", UniqueTarget.Conditional),
ConditionalFirstCivToResearch("if no other Civilization has researched this", UniqueTarget.Conditional),
ConditionalTech("after discovering [tech]", UniqueTarget.Conditional),
ConditionalNoTech("before discovering [tech]", UniqueTarget.Conditional),
ConditionalPolicy("after adopting [policy]", UniqueTarget.Conditional),

View File

@ -1328,6 +1328,9 @@ Example: "<starting from the [Ancient era]>"
Applicable to: Conditional
#### <if no other Civilization has researched this>
Applicable to: Conditional
#### <after discovering [tech]>
Example: "<after discovering [Agriculture]>"