diff --git a/app/src/main/java/com/kamron/pogoiv/scanlogic/PokeInfoCalculator.java b/app/src/main/java/com/kamron/pogoiv/scanlogic/PokeInfoCalculator.java index 6feded1e2..797e7d7dc 100644 --- a/app/src/main/java/com/kamron/pogoiv/scanlogic/PokeInfoCalculator.java +++ b/app/src/main/java/com/kamron/pogoiv/scanlogic/PokeInfoCalculator.java @@ -27,6 +27,12 @@ public class PokeInfoCalculator { private List formVariantPokemons; private String[] pokeNamesWithForm = {}; + public static final int MELTAN_INDEX_OFFSET = 5; + public static final int MELMETAL_INDEX_OFFSET = 4; + public static final int OBSTAGOON_INDEX_OFFSET = 3; + public static final int PERRSERKER_INDEX_OFFSET = 2; + public static final int SIRFETCHD_INDEX_OFFSET = 1; + /** * Pokemons who's name appears as a type of candy. * For most, this is the basePokemon (ie: Pidgey candies) @@ -177,13 +183,18 @@ private void populatePokemon(@NonNull GoIVSettings settings, @NonNull Resources int pokeListSize = names.length; ArrayList formVariantPokemons = new ArrayList<>(); - // quick hardcoded patch for Meltan and Melmetal - // Tentatively use pokedex list size until supporting discontinuous pokedex numbers, - // like as #493 Arceus, #808 Meltan, #809 Melmetal. - candyNamesArray[pokeListSize - 2] = pokeListSize - 2; - candyNamesArray[pokeListSize - 1] = pokeListSize - 2; - devolution[pokeListSize - 1] = pokeListSize - 2; - // END patch for Meltan and Melmetal + // quick hardcoded patch for supporting discontinuous pokedex number pokemons followings + // #808 Meltan + // #809 Melmetal + // #862 Obstagoon, + // #863 Perrserker, + // #865 Sirfetch'd + // currently GoIV logic expects that pokedex numbers are continuous and less than pokeListSize. + // so this patch shifts these to dummy indexes, with pokeListSize offset. + candyNamesArray[pokeListSize - MELTAN_INDEX_OFFSET] = pokeListSize - MELTAN_INDEX_OFFSET; + candyNamesArray[pokeListSize - MELMETAL_INDEX_OFFSET] = pokeListSize - MELTAN_INDEX_OFFSET; + devolution[pokeListSize - MELMETAL_INDEX_OFFSET] = pokeListSize - MELTAN_INDEX_OFFSET; + // END patch for supporting discontinuous pokedex number pokemons for (int i = 0; i < pokeListSize; i++) { PokemonBase p = new PokemonBase(names[i], displayNames[i], i, devolution[i], evolutionCandyCost[i]); diff --git a/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonBase.java b/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonBase.java index afb61f42d..bb6da7e12 100644 --- a/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonBase.java +++ b/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonBase.java @@ -70,6 +70,99 @@ public Pokemon getForm(@NonNull Pokemon otherForm) { // In that case return the first one, which can be done in any case if this base has multiple forms (because // then we know that the other form is the single one). But if the other form has multiple forms it also needs // to verify that the other form is actually the first one. + + final int pokeListSize = PokeInfoCalculator.getInstance().getPokedex().size(); + + if (number == 51) { // #52 Meowth + // check #863 Perrserker with its index number in pokemons.xml + if (otherForm.number == pokeListSize - PokeInfoCalculator.PERRSERKER_INDEX_OFFSET) { + // return Galarian forms + return forms.get(2); + } else { + return getForm(otherForm.formName); + } + } + if (number == 52) { // #53 Persian + return getForm(otherForm.formName); + } + if (number == 82) { // #83 Farfetch'd + // check #865 Sirfetch'd with its index number in pokemons.xml + if (otherForm.number == pokeListSize - PokeInfoCalculator.SIRFETCHD_INDEX_OFFSET) { + // return Galarian forms + return forms.get(1); + } else { + return getForm(otherForm.formName); + } + } + if (number == 262 || number == 263) { // #263 ZIGZAGOON or #264 LINOONE + // check #862 OBSTAGOON with its index number in pokemons.xml + if (otherForm.number == pokeListSize - PokeInfoCalculator.OBSTAGOON_INDEX_OFFSET) { + // return Galarian forms + return forms.get(1); + } else { + return getForm(otherForm.formName); + } + } + if (number == 553) { // #554 Darumaka + // check #555 Darmanitan + if (otherForm.number == 554 && otherForm.base.forms.get(0) == otherForm) { + // return Normal Form + return forms.get(0); + } + // check #555 Darmanitan Galarian + if (otherForm.number == 554 && otherForm.base.forms.get(2) == otherForm) { + // return Galarian Form + return forms.get(1); + } else { + return getForm(otherForm.formName); + } + } + if (number == 554) { // #555 Darmanitan + // check #554 Darumaka Normal + if (otherForm.number == 553 && otherForm.base.forms.get(0) == otherForm) { + // return Standard Form + return forms.get(0); + } + // check #554 Darumaka Galarian + if (otherForm.number == 553 && otherForm.base.forms.get(1) == otherForm) { + // return Galarian Standard Form + return forms.get(2); + } else { + return getForm(otherForm.formName); + } + } + if (number == pokeListSize + - PokeInfoCalculator.OBSTAGOON_INDEX_OFFSET) { // #862 OBSTAGOON index number in pokemons.xml + // check #263 ZIGZAGOON Galarian + if (otherForm.number == 262 && otherForm.base.forms.get(1) == otherForm) { + return forms.get(0); + } + // check #264 LINOONE Galarian + if (otherForm.number == 263 && otherForm.base.forms.get(1) == otherForm) { + return forms.get(0); + } else { + return getForm(otherForm.formName); + } + } + if (number == pokeListSize + - PokeInfoCalculator.PERRSERKER_INDEX_OFFSET) { // #863 Perrserker index number in pokemons.xml + // check #52 Meowth Galarian + if (otherForm.number == 51 && otherForm.base.forms.get(2) == otherForm) { + return forms.get(0); + } else { + return getForm(otherForm.formName); + } + } + if (number == pokeListSize + - PokeInfoCalculator.SIRFETCHD_INDEX_OFFSET) { // #865 Sirfetch'd index number in pokemons.xml + // check #83 Farfetch'd Galarian + if (otherForm.number == 82 && otherForm.base.forms.get(1) == otherForm) { + return forms.get(0); + } else { + return getForm(otherForm.formName); + } + } + if ((otherForm.base.forms.size() == 1 && forms.size() > 1) || (forms.size() == 1 && otherForm.base.forms.size() > 1 && otherForm.base.forms.get(0) == otherForm)) { return forms.get(0); diff --git a/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonNameCorrector.java b/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonNameCorrector.java index 73f231c3b..b16d429a1 100644 --- a/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonNameCorrector.java +++ b/app/src/main/java/com/kamron/pogoiv/scanlogic/PokemonNameCorrector.java @@ -181,11 +181,11 @@ public PokeDist getPossiblePokemon(@NonNull ScanData scanData) { } - //6. Check if the found pokemon should be alolan variant or not. + //6. Check if the found pokemon should be its variant(e.g. Alolan, Galarian, or its specific form) or not. if (scanData != null && scanData.getPokemonType() != null) { - PokeDist alolanGuess = checkAlolanVariant(guess, scanData); - if (alolanGuess != null) { - guess = alolanGuess; + PokeDist variantGuess = checkVariant(guess, scanData); + if (variantGuess != null) { + guess = variantGuess; } } @@ -289,7 +289,7 @@ private PokeDist createFormPokeDistances(PokeDist guess, ScanData scanData, Type return null; } - private PokeDist checkAlolanVariant(PokeDist guess, ScanData scanData) { + private PokeDist checkVariant(PokeDist guess, ScanData scanData) { try { switch (guess.pokemon.number) { case (102): // Exeggutor (dex 103) @@ -323,8 +323,7 @@ private PokeDist checkAlolanVariant(PokeDist guess, ScanData scanData) { // check types including steel return createFormPokeDist(guess, scanData, Type.STEEL, 1); case (51): // Meowth - // check types including dark - return createFormPokeDist(guess, scanData, Type.DARK, 1); + return createFormPokeDistances(guess, scanData, Type.NORMAL, Type.DARK, Type.STEEL); case (52): // Persian // check types including dark return createFormPokeDist(guess, scanData, Type.DARK, 1); @@ -337,6 +336,8 @@ private PokeDist checkAlolanVariant(PokeDist guess, ScanData scanData) { case (75): // Golem // check types including electric return createFormPokeDist(guess, scanData, Type.ELECTRIC, 1); + case (82): // Farfetch'd + return createFormPokeDist(guess, scanData, Type.FIGHTING, 1); case (87): // Grimer // check types including dark return createFormPokeDist(guess, scanData, Type.DARK, 1); @@ -346,6 +347,12 @@ private PokeDist checkAlolanVariant(PokeDist guess, ScanData scanData) { case (104): // Marowak // check types including fire return createFormPokeDist(guess, scanData, Type.FIRE, 1); + case (109): // Weezing + return createFormPokeDist(guess, scanData, Type.FAIRY, 1); + case (262): // Zigzagoon + return createFormPokeDist(guess, scanData, Type.DARK, 1); + case (263): // Linoone + return createFormPokeDist(guess, scanData, Type.DARK, 1); case (412): // Wormadam return createFormPokeDistances(guess, scanData, Type.DARK, Type.GROUND, Type.STEEL); case (478): // Rotom @@ -357,10 +364,33 @@ private PokeDist checkAlolanVariant(PokeDist guess, ScanData scanData) { dist = new PokeDist(guess.pokemon.base.forms.get(0), 0); } return dist; - case (492): // Rotom + case (492): // Arceus return createFormPokeDistances(guess, scanData, Type.NORMAL, Type.FIGHTING, Type.FLYING, Type.POISON, Type.GROUND, Type.ROCK, Type.BUG, Type.GHOST, Type.STEEL, Type.FIRE, Type.WATER, Type.GRASS, Type.ELECTRIC, Type.PSYCHIC, Type.ICE, Type.DRAGON, Type.DARK, Type.FAIRY); + case (553): // Darumaka + return createFormPokeDist(guess, scanData, Type.ICE, 1); + case (554): // Darmanitan + dist = createFormPokeDist(guess, scanData, Type.PSYCHIC, 1); + // check Zen Form + if (dist == null) { + // check Standard Form + if (createFormPokeDist(guess, scanData, Type.ICE, 1) == null) { + dist = createFormPokeDist(guess, scanData, Type.FIRE, 0); + } + // check Galarian Standard Form + else if (createFormPokeDist(guess, scanData, Type.FIRE, 1) == null) { + dist = createFormPokeDist(guess, scanData, Type.ICE, 2); + } + // Galarian Zen Form + else { + dist = createFormPokeDist(guess, scanData, Type.ICE, 3); + } + } + return dist; + case (617): // Stunfisk + return createFormPokeDist(guess, scanData, Type.STEEL, 1); + default: // do nothing diff --git a/app/src/main/res/values-de/pokemons.xml b/app/src/main/res/values-de/pokemons.xml index 999a5d63c..7a5750e60 100644 --- a/app/src/main/res/values-de/pokemons.xml +++ b/app/src/main/res/values-de/pokemons.xml @@ -656,6 +656,9 @@ Genesect Meltan Melmetal + Barrikadax + Mauzinger + Lauchzelot diff --git a/app/src/main/res/values-fr/pokemons.xml b/app/src/main/res/values-fr/pokemons.xml index 20c3808f5..e579e8402 100644 --- a/app/src/main/res/values-fr/pokemons.xml +++ b/app/src/main/res/values-fr/pokemons.xml @@ -656,6 +656,9 @@ Genesect Meltan Melmetal + Ixon + Berserkatt + Palarticho diff --git a/app/src/main/res/values-zh-rTW/pokemons.xml b/app/src/main/res/values-zh-rTW/pokemons.xml index ae85b629f..8706db79c 100644 --- a/app/src/main/res/values-zh-rTW/pokemons.xml +++ b/app/src/main/res/values-zh-rTW/pokemons.xml @@ -654,5 +654,8 @@ 蓋諾賽克特 美錄坦 美錄梅塔 + 堵攔熊 + 喵頭目 + 蔥遊兵 \ No newline at end of file diff --git a/app/src/main/res/values/forms.xml b/app/src/main/res/values/forms.xml index 8b323985a..4f81f5030 100644 --- a/app/src/main/res/values/forms.xml +++ b/app/src/main/res/values/forms.xml @@ -10,18 +10,22 @@ 2 2 2 - 2 + 3 2 2 2 2 + 2 2 2 2 2 + 2 2 28 - 9 + 2 + 2 + 20 4 4 3 @@ -34,9 +38,13 @@ 2 18 2 - 2 + 2 + 4 4 4 + 2 + 2 + 2 2 2 2 @@ -44,7 +52,7 @@ 2 2 5 - + Normal Form @@ -76,6 +84,7 @@ Normal Form Alola Form + Galarian Form Normal Form Alola Form @@ -88,6 +97,9 @@ Normal Form Alola Form + + Normal Form + Galarian Form Normal Form Alola Form @@ -100,6 +112,9 @@ Normal Form Alola Form + + Normal Form + Galarian Form Normal Form Armored Form @@ -132,6 +147,12 @@ Z Form Exclamation Point Form Question Mark Form + + Normal Form + Galarian Form + + Normal Form + Galarian Form 00 Form 01 Form @@ -142,6 +163,17 @@ 06 Form 07 Form 08 Form + 09 Form + 10 Form + 11 Form + 12 Form + 13 Form + 14 Form + 15 Form + 16 Form + 17 Form + 18 Form + 19 Form Normal Form Sunny Form @@ -201,47 +233,61 @@ Dragon Form Dark Form Fairy Form - + Red Striped Form Blue Striped Form - + + Normal Form + Galarian Form + Standard Form Zen Form - + Galarian Standard Form + Galarian Zen Form + Spring Form Summer Form Autumn Form Winter Form - + Spring Form Summer Form Autumn Form Winter Form - + + Normal Form + Female Form + + Normal Form + Female Form + + Normal Form + Galarian Form + Incarnate Form Therian Form - + Incarnate Form Therian Form - + Incarnate Form Therian Form - + Normal Form - Black Form White Form - + Black Form + Ordinary Form Resolute Form - + Aria Form Pirouette Form - + Normal Form + Douse Form Shock Form Burn Form Chill Form - Douse Form @@ -274,6 +320,7 @@ 92 99 + 115 150 158 @@ -286,6 +333,9 @@ 211 211 + + 124 + 174 135 135 @@ -298,6 +348,9 @@ 144 144 + + 174 + 174 300 182 @@ -330,6 +383,12 @@ 136 136 136 + + 58 + 58 + + 142 + 142 116 116 @@ -340,6 +399,17 @@ 116 116 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 139 139 @@ -399,48 +469,62 @@ 238 238 238 - + 189 189 - + + 153 + 153 + 263 243 - + 263 + 323 + 115 115 115 115 - + 198 198 198 198 - + + 115 + 115 + + 159 + 159 + + 144 + 144 + 266 238 - + 266 295 - + 261 289 - + 246 - 310 310 - + 310 + 260 260 - + 250 269 - + 252 + 252 252 252 252 - 252 - + 70 @@ -472,6 +556,7 @@ 78 78 + 92 136 136 @@ -484,6 +569,9 @@ 198 198 + + 115 + 114 90 90 @@ -496,6 +584,9 @@ 186 186 + + 197 + 197 182 278 @@ -528,6 +619,12 @@ 91 91 91 + + 80 + 80 + + 128 + 128 116 116 @@ -538,6 +635,17 @@ 116 116 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 + 116 139 139 @@ -597,47 +705,61 @@ 238 238 238 - + 129 129 - + + 86 + 86 + 114 202 - + 114 + 123 + 100 100 100 100 - + 146 146 146 146 - + + 134 + 134 + + 178 + 178 + + 171 + 171 + 164 189 - + 164 161 - + 182 179 - + 170 - 183 183 - + 183 + 192 192 - + 225 188 - + 199 + 199 199 199 199 - 199 @@ -670,6 +792,7 @@ 120 120 + 137 163 163 @@ -682,6 +805,9 @@ 190 190 + + 141 + 141 190 190 @@ -694,6 +820,9 @@ 155 155 + + 163 + 163 214 214 @@ -726,6 +855,12 @@ 134 134 134 + + 116 + 116 + + 186 + 186 155 155 @@ -736,6 +871,17 @@ 155 155 155 + 155 + 155 + 155 + 155 + 155 + 155 + 155 + 155 + 155 + 155 + 155 172 172 @@ -795,46 +941,60 @@ 237 237 237 - + 172 172 - + + 172 + 172 + 233 233 - + 233 + 233 + 155 155 155 155 - + 190 190 190 190 - + + 146 + 146 + + 225 + 225 + + 240 + 240 + 188 188 - + 188 188 - + 205 205 - + 245 - 245 245 - + 245 + 209 209 - + 225 225 - + 174 + 174 174 174 174 - 174 diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml index 17f268655..d5212f5b6 100644 --- a/app/src/main/res/values/integers.xml +++ b/app/src/main/res/values/integers.xml @@ -652,7 +652,10 @@ 252 118 226 - + 180 + 195 + 248 + 111 143 @@ -1305,7 +1308,10 @@ 199 99 190 - + 194 + 162 + 176 + 128 155 @@ -1958,7 +1964,10 @@ 174 130 264 - + 212 + 172 + 158 + -1 0 @@ -2545,7 +2554,7 @@ 581 582 -1 - 585 + 584 -1 -1 587 @@ -2611,7 +2620,10 @@ -1 -1 807 - + 262 + 51 + 82 + 25 100 @@ -3136,16 +3148,16 @@ -1 50 -1 - 25 - 100 + 50 + 200 -1 50 -1 50 -1 -1 - 25 - 100 + 50 + 200 -1 25 100 @@ -3167,7 +3179,7 @@ 50 -1 50 - 50 + -1 -1 50 -1 @@ -3197,10 +3209,10 @@ 25 100 -1 - 50 + -1 -1 -1 - 50 + 200 -1 50 -1 @@ -3228,7 +3240,7 @@ 50 -1 -1 - 50 + 200 -1 -1 50 @@ -3264,7 +3276,10 @@ -1 400 -1 - + -1 + -1 + -1 + 0 0 @@ -3917,6 +3932,9 @@ 648 807 807 + 262 + 51 + 82 -1 @@ -4001,13 +4019,13 @@ -1 -1 -1 - -1 + 14 -1 -1 -1 -1 - 14 - 15 + 15 + 16 -1 -1 -1 @@ -4021,14 +4039,14 @@ -1 -1 -1 - 16 + 17 -1 - 17 + 18 -1 -1 -1 -1 - -1 + 19 -1 -1 -1 @@ -4068,7 +4086,7 @@ -1 -1 -1 - 18 + 20 -1 -1 -1 @@ -4119,7 +4137,7 @@ -1 -1 -1 - 19 + 21 -1 -1 -1 @@ -4181,8 +4199,8 @@ -1 -1 -1 - -1 - -1 + 22 + 23 -1 -1 -1 @@ -4245,7 +4263,7 @@ -1 -1 -1 - 20 + 24 -1 -1 -1 @@ -4269,7 +4287,7 @@ -1 -1 -1 - 21 + 25 -1 -1 -1 @@ -4304,7 +4322,7 @@ -1 -1 -1 - 22 + 26 -1 -1 -1 @@ -4330,8 +4348,8 @@ -1 -1 -1 - 23 - 24 + 27 + 28 -1 -1 -1 @@ -4339,9 +4357,9 @@ -1 -1 -1 - 25 - 26 - 27 + 29 + 30 + 31 -1 -1 -1 @@ -4397,7 +4415,7 @@ -1 -1 -1 - 28 + 32 -1 -1 -1 @@ -4405,13 +4423,13 @@ -1 -1 -1 - 29 + 33 -1 -1 -1 -1 - 30 - 31 + 34 + 35 -1 -1 -1 @@ -4468,12 +4486,12 @@ -1 -1 -1 - 32 + 36 -1 -1 -1 - -1 - 33 + 37 + 38 -1 -1 -1 @@ -4503,15 +4521,15 @@ -1 -1 -1 - 34 - 35 + 39 + 40 -1 -1 -1 -1 -1 - -1 - -1 + 41 + 42 -1 -1 -1 @@ -4536,7 +4554,7 @@ -1 -1 -1 - -1 + 43 -1 -1 -1 @@ -4559,16 +4577,19 @@ -1 -1 -1 - 36 - 37 + 44 + 45 -1 -1 - 38 - 39 - 40 - 41 - 42 + 46 + 47 + 48 + 49 + 50 -1 -1 - + -1 + -1 + -1 + diff --git a/app/src/main/res/values/pokemons.xml b/app/src/main/res/values/pokemons.xml index 05d7dc427..1c7bf4c55 100644 --- a/app/src/main/res/values/pokemons.xml +++ b/app/src/main/res/values/pokemons.xml @@ -655,6 +655,9 @@ Genesect Meltan Melmetal + Obstagoon + Perrserker + Sirfetch\'d NORMAL