mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -04:00
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:
parent
03f7af4360
commit
90d459a9f4
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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 -> {
|
||||
|
@ -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),
|
||||
|
@ -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]>"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user