mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 01:39:40 +07:00
chore: Deprecated old event fields
This commit is contained in:
@ -41,19 +41,8 @@ class EventChoice : ICivilopediaText, RulesetObject() {
|
||||
/** Keyboard support - not user-rebindable, mod control only. Will be [parsed][KeyCharAndCode.parse], so Gdx key names will work. */
|
||||
val keyShortcut = ""
|
||||
|
||||
@Deprecated("as of 4.13.4", ReplaceWith("uniques"))
|
||||
var triggeredUniques = ArrayList<String>()
|
||||
@Deprecated("as of 4.13.4", ReplaceWith("uniqueObjects"))
|
||||
val triggeredUniqueObjects by lazy { triggeredUniques.map { Unique(it) } }
|
||||
|
||||
@Deprecated("as of 4.13.4", ReplaceWith("uniques"))
|
||||
var conditions = ArrayList<String>()
|
||||
@Deprecated("as of 4.13.4", ReplaceWith("uniqueObjects"))
|
||||
val conditionObjects by lazy { conditions.map { Unique(it) } }
|
||||
|
||||
fun matchesConditions(stateForConditionals: StateForConditionals): Boolean {
|
||||
if (conditionObjects.any { !Conditionals.conditionalApplies(null, it, stateForConditionals) })
|
||||
return false
|
||||
if (hasUnique(UniqueType.Unavailable, stateForConditionals)) return false
|
||||
if (getMatchingUniques(UniqueType.OnlyAvailable, StateForConditionals.IgnoreConditionals)
|
||||
.any { !it.conditionalsApply(stateForConditionals) })
|
||||
@ -64,7 +53,7 @@ class EventChoice : ICivilopediaText, RulesetObject() {
|
||||
fun triggerChoice(civ: Civilization, unit: MapUnit? = null): Boolean {
|
||||
var success = false
|
||||
val stateForConditionals = StateForConditionals(civ, unit = unit)
|
||||
val triggerUniques = uniqueObjects.filter { it.isTriggerable } + triggeredUniqueObjects
|
||||
val triggerUniques = uniqueObjects.filter { it.isTriggerable }
|
||||
for (unique in triggerUniques.flatMap { it.getMultiplied(stateForConditionals) })
|
||||
if (UniqueTriggerActivation.triggerUnique(unique, civ, unit = unit)) success = true
|
||||
return success
|
||||
|
@ -239,20 +239,6 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
// An Event is not a IHasUniques, so not suitable as sourceObject
|
||||
for (event in ruleset.events.values) {
|
||||
for (choice in event.choices) {
|
||||
|
||||
for (unique in choice.conditionObjects + choice.triggeredUniqueObjects)
|
||||
lines += uniqueValidator.checkUnique(unique, tryFixUnknownUniques, null, true)
|
||||
|
||||
if (choice.conditions.isNotEmpty())
|
||||
lines.add("Event choice 'conditions' field is deprecated, " +
|
||||
"please replace with 'Only available' or 'Not availble' uniques in 'uniques' field",
|
||||
errorSeverityToReport = RulesetErrorSeverity.WarningOptionsOnly, choice)
|
||||
|
||||
if (choice.triggeredUniques.isNotEmpty())
|
||||
lines.add("Event choice 'triggered uniques' field is deprecated, " +
|
||||
"please place the triggers in the 'uniques' field",
|
||||
errorSeverityToReport = RulesetErrorSeverity.WarningOptionsOnly, choice)
|
||||
|
||||
uniqueValidator.checkUniques(choice, lines, true, tryFixUnknownUniques)
|
||||
}
|
||||
uniqueValidator.checkUniques(event, lines, true, tryFixUnknownUniques)
|
||||
|
@ -69,9 +69,6 @@ class RenderEvent(
|
||||
|
||||
val lines = (
|
||||
choice.civilopediaText.asSequence()
|
||||
+ choice.triggeredUniqueObjects.asSequence()
|
||||
.filterNot { it.isHiddenToUsers() }
|
||||
.map { FormattedLine(it) }
|
||||
+ choice.uniqueObjects.filter { it.isTriggerable }
|
||||
.filterNot { it.isHiddenToUsers() }
|
||||
.map { FormattedLine(it) }
|
||||
|
Reference in New Issue
Block a user