Closed jmynes closed 1 year ago
hmm, interestingly enough, I don't sort the order of the imported moves at all :o (they're processed in the order as-is in the PokéPaste!)
but a feature exists in the Calcdex that will always show the Pokémon's revealed moves, regardless of the set. the order in which those revealed moves are processed is also handled as-is, which is up to each player. (there's a specific ordering of the revealed moves when you hover over a Pokémon in a battle, which isn't necessarily in the same order as what your opponent sees when they go to choose one.)
revealed moves aren't replaced in a linear order either, i.e., first revealed move replaces the first move slot, second move in the second slot, etc. rather, they replace existing moves based on their properties (e.g., category, STAB, etc.) in a very particular order (see mergeRevealedMoves()
for the exact algorithm).
all this to say, not entirely sure what's going on your end o_O ... I tried reproducing this on my end, but without any revealed moves, so the moves appeared in the same order as my PokéPaste import.
did the Slowking have any revealed moves when you took that screenshot? do you happen to have a replay of that game or a similar one by any chance? (no worries if not!)
thanks! c:
Here's an example:
Swagger + Psych Up
set to my clipboard:
Regirock @ Leftovers
Ability: Clear Body
EVs: 252 HP / 252 Atk / 4 SpD
Adamant Nature
- Swagger
- Psych Up
- Superpower
- Rock Slide
Showdown Usage
set to Import
- Psych Up
- Rock Slide
- Superpower
- Swagger
Replay: https://replay.pokemonshowdown.com/gen3ou-1928416802
Thanks for the detailed write-up! I see the problem now on my end, so I'll take a look & keep you posted c:
dude I figured it out holy fuck LOL.
In importPokePaste()
, there's a little line right before the return
:
preset.calcdexId = calcPresetCalcdexId(preset);
Seemed innocent enough & in my initial 100 searches, never bothered to look at it. There's nothing possibly in calcPresetCalcdexId()
that could sort the array or anything right...?
moves: preset?.moves?.sort().join(','), // sort moves in ABC order
Whoops, don't think I thought it through when I wrote that a year ago LOL.
But anyway, I fixed it & will be bundling it alongside the upcoming v1.1.7 release! (I'll also close this issue when I merge the v1.1.7 PR.)
This has been one wild ride, thanks!
Currently, when importing from clipboard, a Pokemon with a moveset that doesn't already match the imported one will be sorted alphabetically once updated:
(If the moveset is the same, but the order is not, no change is made currently)
Could there be a setting to import as-is, without sorting moves alphabetically?: