More memory legality additions

probably worthwhile to move the checks into the context, and return an enum -> switch to generate checkresult
This commit is contained in:
Kurt 2021-08-29 15:56:09 -07:00
parent 348fa4c9fa
commit adb7466a22
3 changed files with 22 additions and 0 deletions

View file

@ -128,6 +128,18 @@ namespace PKHeX.Core
case (int)BehemothBash when pkm.Species == (int)Zamazenta:
return true;
}
if (gen == 8 && Legal.IsDynamaxMove(move))
return true;
if (pkm.Species == (int)Ditto)
{
if (move == (int)Struggle)
return false;
return gen switch
{
8 => move <= Legal.MaxMoveID_8_R2 && !Legal.DummiedMoves_SWSH.Contains(move),
_ => move <= Legal.MaxMoveID_6_AO,
};
}
}
return false;

View file

@ -104,6 +104,8 @@ namespace PKHeX.Core
(int)ClangorousSoulblaze,
};
public static bool IsDynamaxMove(int move) => move is >= (int)MaxFlare and <= (int)MaxSteelspike;
/// <summary>
/// Moves that can not be obtained by using Sketch with Smeargle in any game.
/// </summary>

View file

@ -80,6 +80,14 @@ namespace PKHeX.Core
case 82 or 83 or 87 when !((PersonalInfoSWSH)PersonalTable.SWSH[memory.Variable]).IsPresentInGame:
return GetInvalid(string.Format(LMemoryArgBadSpecies, memory.Handler));
// {0} fought hard until it had to use Struggle when it battled at {1}s side against {2}. {4} that {3}.
case 60 when gen == 8 && !((PersonalInfoSWSH)PersonalTable.SWSH[memory.Variable]).IsPresentInGame:
return GetInvalid(string.Format(LMemoryArgBadSpecies, memory.Handler));
// {0} had a very hard training session with {1}. {4} that {3}.
case 53 when gen == 8 && pkm is IHyperTrain t && !t.IsHyperTrained():
return GetInvalid(string.Format(LMemoryArgBadID, memory.Handler));
// Item
// {0} went to a Pokémon Center with {1} to buy {2}. {4} that {3}.
case 5 when !CanBuyItem(gen, memory.Variable, handler == 0 ? (GameVersion)pkm.Version : GameVersion.Any):