From 9bbd3b416e3626380961e7e7c539c3260ac35151 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 3 Jun 2023 22:42:36 +0300 Subject: [PATCH] Resolved #9501 - badly configured era conditional no longer causes crashes --- core/src/com/unciv/models/ruleset/unique/Unique.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/unique/Unique.kt b/core/src/com/unciv/models/ruleset/unique/Unique.kt index 1d1a435e48..4b230b4b99 100644 --- a/core/src/com/unciv/models/ruleset/unique/Unique.kt +++ b/core/src/com/unciv/models/ruleset/unique/Unique.kt @@ -176,11 +176,14 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s UniqueType.ConditionalWLTKD -> state.city != null && state.city.isWeLoveTheKingDayActive() UniqueType.ConditionalBeforeEra -> - state.civInfo != null && state.civInfo.getEraNumber() < ruleset().eras[condition.params[0]]!!.eraNumber + state.civInfo != null && ruleset().eras.containsKey(condition.params[0]) + && state.civInfo.getEraNumber() < ruleset().eras[condition.params[0]]!!.eraNumber UniqueType.ConditionalStartingFromEra -> - state.civInfo != null && state.civInfo.getEraNumber() >= ruleset().eras[condition.params[0]]!!.eraNumber + state.civInfo != null && ruleset().eras.containsKey(condition.params[0]) + && state.civInfo.getEraNumber() >= ruleset().eras[condition.params[0]]!!.eraNumber UniqueType.ConditionalDuringEra -> - state.civInfo != null && state.civInfo.getEraNumber() == ruleset().eras[condition.params[0]]!!.eraNumber + state.civInfo != null && ruleset().eras.containsKey(condition.params[0]) + && state.civInfo.getEraNumber() == ruleset().eras[condition.params[0]]!!.eraNumber UniqueType.ConditionalIfStartingInEra -> state.civInfo != null && state.civInfo.gameInfo.gameParameters.startingEra == condition.params[0] UniqueType.ConditionalTech ->