From 2dd4325804ac1b0d8e50d7a2f5d6bf4e6378ee2b Mon Sep 17 00:00:00 2001 From: Aleksey Date: Sat, 11 Mar 2023 15:20:12 +0700 Subject: [PATCH] added new pokemon archetype --- .../pdx/domain/pokemon/asset/PokemonArchetypeAssets.kt | 2 ++ sources/domain/pokemon-asset/src/main/res/values/strings.xml | 1 + .../lexadiky/pdx/domain/pokemon/entity/PokemonArchetype.kt | 1 + .../domain/pokemon/usecase/GetPokemonSpeciesDetailsUseCase.kt | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/sources/domain/pokemon-asset/src/main/java/io/github/lexadiky/pdx/domain/pokemon/asset/PokemonArchetypeAssets.kt b/sources/domain/pokemon-asset/src/main/java/io/github/lexadiky/pdx/domain/pokemon/asset/PokemonArchetypeAssets.kt index 84e98735..ecbf0aa6 100644 --- a/sources/domain/pokemon-asset/src/main/java/io/github/lexadiky/pdx/domain/pokemon/asset/PokemonArchetypeAssets.kt +++ b/sources/domain/pokemon-asset/src/main/java/io/github/lexadiky/pdx/domain/pokemon/asset/PokemonArchetypeAssets.kt @@ -10,6 +10,7 @@ enum class PokemonArchetypeAssets( SpecialAttacker(R.string.domain_pokemon_asset_archetype_sp_attacker), PhysicalAttacker(R.string.domain_pokemon_asset_archetype_ph_attacker), Speedster(R.string.domain_pokemon_asset_archetype_speedster), + PerfectlyBalanced(R.string.domain_pokemon_asset_archetype_balanced), Unknown(R.string.domain_pokemon_asset_archetype_unknown); val title get() = StringResource.from(titleResource) @@ -20,5 +21,6 @@ val PokemonArchetype.assets: PokemonArchetypeAssets PokemonArchetype.SpecialAttacker -> PokemonArchetypeAssets.SpecialAttacker PokemonArchetype.PhysicalAttacker -> PokemonArchetypeAssets.PhysicalAttacker PokemonArchetype.Speedster -> PokemonArchetypeAssets.Speedster + PokemonArchetype.PerfectlyBalanced -> PokemonArchetypeAssets.PerfectlyBalanced PokemonArchetype.Unknown -> PokemonArchetypeAssets.Unknown } \ No newline at end of file diff --git a/sources/domain/pokemon-asset/src/main/res/values/strings.xml b/sources/domain/pokemon-asset/src/main/res/values/strings.xml index eaa7f453..c2a5b7f9 100644 --- a/sources/domain/pokemon-asset/src/main/res/values/strings.xml +++ b/sources/domain/pokemon-asset/src/main/res/values/strings.xml @@ -30,6 +30,7 @@ Sp.Attacker Ph.Attacker Speedster + Perfectly Balanced Unknown \ No newline at end of file diff --git a/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/entity/PokemonArchetype.kt b/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/entity/PokemonArchetype.kt index d91e112b..90b83c78 100644 --- a/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/entity/PokemonArchetype.kt +++ b/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/entity/PokemonArchetype.kt @@ -4,5 +4,6 @@ enum class PokemonArchetype { SpecialAttacker, PhysicalAttacker, Speedster, + PerfectlyBalanced, Unknown, } \ No newline at end of file diff --git a/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/usecase/GetPokemonSpeciesDetailsUseCase.kt b/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/usecase/GetPokemonSpeciesDetailsUseCase.kt index 388c4eff..e15ff883 100644 --- a/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/usecase/GetPokemonSpeciesDetailsUseCase.kt +++ b/sources/domain/pokemon/src/main/java/io/github/lexadiky/pdx/domain/pokemon/usecase/GetPokemonSpeciesDetailsUseCase.kt @@ -81,6 +81,10 @@ class GetPokemonSpeciesDetailsUseCase( } private fun makeArchetype(stats: Map): PokemonArchetype { + if (stats.values.distinct().size == 1) { + return PokemonArchetype.PerfectlyBalanced + } + return when (stats.maxByOrNull { it.value }?.key) { PokemonStat.SpAttack -> PokemonArchetype.SpecialAttacker PokemonStat.Attack -> PokemonArchetype.PhysicalAttacker