From d65e3369c997b21ae2e8fb2f8c63abe80a06abfd Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 16 Nov 2019 11:01:00 -0800 Subject: [PATCH] Add toxtricity evo check refer to sub_71007805B0 for algo --- PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs | 11 +++++++++++ PKHeX.Core/Legality/Evolutions/EvolutionType.cs | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs b/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs index dafef0cde..44aee3b60 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionMethod.cs @@ -58,6 +58,10 @@ public bool Valid(PKM pkm, int lvl, bool skipChecks) case TradeSpecies: return !pkm.IsUntraded || skipChecks; + case LevelUpNatureAmped when GetAmpLowKeyResult(pkm.Nature) != pkm.AltForm && !skipChecks: + case LevelUpNatureLowKey when GetAmpLowKeyResult(pkm.Nature) != pkm.AltForm && !skipChecks: + return false; + // Special Level Up Cases -- return false if invalid case LevelUpBeauty when !(pkm is IContestStats s) || s.CNT_Beauty < Argument: return skipChecks; @@ -135,5 +139,12 @@ public EvolutionMethod Copy(int species) Level = Level }; } + + private static int GetAmpLowKeyResult(int n) + { + if ((uint)(n - 1) > 22) + return 0; + return (0x5BCA51 >> (n - 1)) & 1; + } } } \ No newline at end of file diff --git a/PKHeX.Core/Legality/Evolutions/EvolutionType.cs b/PKHeX.Core/Legality/Evolutions/EvolutionType.cs index f57ad67ff..73602dbea 100644 --- a/PKHeX.Core/Legality/Evolutions/EvolutionType.cs +++ b/PKHeX.Core/Legality/Evolutions/EvolutionType.cs @@ -47,6 +47,11 @@ public enum EvolutionType : byte LevelUpDusk = 40, LevelUpWormhole = 41, UseItemWormhole = 42, + Crit3, // Sirfetch'd + HPDownBy49, // Runerigus + SpinType, // Alcremie + LevelUpNatureAmped, // Toxtricity + LevelUpNatureLowKey, // Toxtricity } public static class EvolutionTypeExtensions