How does Auto Legality Mod (ALM) work? - santacrab2/PKHeX-Plugins GitHub Wiki

Introduction

Auto-Legality Mod (ALM) automatically creates and legalizes a Pokémon based on valid Pokémon Showdown sets which can be made on Pokémon Showdown's website.

All values of the Showdown set must be legal for the mod to find a compatible encounter from a Pokémon game. Once an encounter is identified, extra data is added to the provided Showdown Set's data to create a complete, legal Pokémon.

A Pokémon's trainer details (OT and TID) can be pulled from a directory of trainer data. See the Trainer Data page for instructions.

Generating

  • Friendship is set to 0 for Frustration and otherwise 255 for Return to maximize base power of these moves.
  • Stat Markings are automatically assigned based on the IVs. This can be disabled under Tools > Auto-Legality Mod > Plugin Settings > UseCompetitiveMarkings.
  • IV's are intelligently Hyper Trained. Attack and Speed IVs originally designated as 0 IV are not Hyper Trained since it is common for competitive Pokémon to minimize Attack or Speed.
  • If ForceLevel100for50 is set to true, Pokémon sets that are level 50 will be assumed to be for ranked, which automatically down levels a Pokémon to 50. As a result, they will be generated at level 100 where they can take advantage of Hyper-Training for optimal IVs.
  • ALM acknowledges various kinds of PID/IV correlation. This may cause a Pokémon to have imperfect IVs different from the requested set.
    • Previous Generation of Pokémon (Gen 3, Gen 4, and Gen 5) automatically receive PID/IV combos that are compatible with their Nature and Hidden Power. The IVs are then Hyper-Trained automatically if appropriate. Note that if the set specifies 0 Attack or Speed IVs, the need to respect PID/IV for legality means that these values may not be as low as desired, but they will not be Hyper-Trained to be higher.
    • Generation 3 and 4 encounters with PIDIV restrictions may change the SID to make a Pokémon shiny. This is because changing anything else would require many changes due to PIDIV.
    • Generation 8 SWSH Overworld Pokémon generate using Xoroshiro RNG. This is enforced by PKHeX and cannot be disabled.
    • Generation 8 BDSP Egg Pokémon will generate using Xorshift RNG. Most eggs will be 5 IV as a result.
    • Generation 9 SV Tera Raid Pokémon will generate using Xoroshiro RNG similar to SWSH Max Raids.
  • The priority of games for which the mod searches for encounters is from newest to oldest. This can be changed under the plugin settings.

Legalize Active Pokemon

ALM will attempt to correct the values of the pokemon currently in the editor to return them to a legal state. To accomplish this goal and return a legal Pokemon ALM will strip the pokemon down to its basic Showdown Set and attempt to legalize in the same way that importing a set does. This will remove any extra cosmetic information that may potentially be causing the Pokemon to be illegal.

  • Only uses basic showdown values. No ALM specific traits e.g. Ball:
  • Will use trainer info from folder or default depending on settings. Trainer info may change from the original entity if this differs
  • Attempts to use the current active Pokemon as a template for the new one to retain encounter information. e.g. wild vs egg encounter.