From ca5a439394e8b7550522cd0d44d872f4af1f2b65 Mon Sep 17 00:00:00 2001 From: Radu Voinea Date: Fri, 29 Sep 2023 04:56:16 +0300 Subject: [PATCH] Update Pokemon.kt --- .../kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt index 12bfd51239..91195fa7d1 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt @@ -866,7 +866,15 @@ open class Pokemon : ShowdownIdentifiable { if (json.has(DataKeys.TETHERING_ID)) { tetheringId = UUID.fromString(json.get(DataKeys.TETHERING_ID).asString) } - this.teraType = ElementalTypes.get(json.get(DataKeys.POKEMON_TERA_TYPE).asString) ?: this.primaryType + + val jsonObjectTeraType = json.get(DataKeys.POKEMON_TERA_TYPE) + + if (jsonObjectTeraType == null) { + this.teraType = this.primaryType; + } else { + this.teraType = ElementalTypes.get(json.get(DataKeys.POKEMON_TERA_TYPE).asString) ?: this.primaryType + } + this.dmaxLevel = json.get(DataKeys.POKEMON_DMAX_LEVEL).asInt this.gmaxFactor = json.get(DataKeys.POKEMON_GMAX_FACTOR).asBoolean return this