Skip to content

Commit

Permalink
added new pokemon archetype
Browse files Browse the repository at this point in the history
  • Loading branch information
lexa-diky committed Mar 11, 2023
1 parent 703fa36 commit 2dd4325
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string name="domain_pokemon_asset_archetype_sp_attacker">Sp.Attacker</string>
<string name="domain_pokemon_asset_archetype_ph_attacker">Ph.Attacker</string>
<string name="domain_pokemon_asset_archetype_speedster">Speedster</string>
<string name="domain_pokemon_asset_archetype_balanced">Perfectly Balanced</string>
<string name="domain_pokemon_asset_archetype_unknown">Unknown</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ enum class PokemonArchetype {
SpecialAttacker,
PhysicalAttacker,
Speedster,
PerfectlyBalanced,
Unknown,
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ class GetPokemonSpeciesDetailsUseCase(
}

private fun makeArchetype(stats: Map<PokemonStat, Int>): 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
Expand Down

0 comments on commit 2dd4325

Please sign in to comment.