mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
Add overload for Totem check, simplify some flow
This commit is contained in:
parent
5635e8f345
commit
f35a3ce03c
4 changed files with 15 additions and 7 deletions
|
@ -12,6 +12,8 @@ namespace PKHeX.Core
|
|||
public override int Generation => 7;
|
||||
public IReadOnlyList<int> Relearn { get; init; } = Array.Empty<int>();
|
||||
|
||||
public bool IsTotem => FormInfo.IsTotemForm(Species, Form);
|
||||
|
||||
public EncounterStatic7(GameVersion game) : base(game) { }
|
||||
|
||||
protected override bool IsMatchLocation(PKM pkm)
|
||||
|
@ -26,7 +28,7 @@ namespace PKHeX.Core
|
|||
if (SkipFormCheck)
|
||||
return true;
|
||||
|
||||
if (FormInfo.IsTotemForm(Species, Form, 7))
|
||||
if (IsTotem)
|
||||
{
|
||||
var expectForm = pkm.Format == 7 ? Form : FormInfo.GetTotemBaseForm(Species, Form);
|
||||
return expectForm == evo.Form;
|
||||
|
|
|
@ -201,15 +201,21 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chhecks if the <see cref="form"/> for the <see cref="species"/> is a Totem form.
|
||||
/// Checks if the <see cref="form"/> for the <see cref="species"/> is a Totem form.
|
||||
/// </summary>
|
||||
/// <param name="species">Entity species</param>
|
||||
/// <param name="form">Entity form</param>
|
||||
/// <param name="format">Current generation format</param>
|
||||
public static bool IsTotemForm(int species, int form, int format)
|
||||
public static bool IsTotemForm(int species, int form, int format) => format == 7 && IsTotemForm(species, form);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the <see cref="form"/> for the <see cref="species"/> is a Totem form.
|
||||
/// </summary>
|
||||
/// <remarks>Use <see cref="IsTotemForm(int,int,int)"/> if you aren't 100% sure the format is 7.</remarks>
|
||||
/// <param name="species">Entity species</param>
|
||||
/// <param name="form">Entity form</param>
|
||||
public static bool IsTotemForm(int species, int form)
|
||||
{
|
||||
if (format != 7)
|
||||
return false;
|
||||
if (form == 0)
|
||||
return false;
|
||||
if (!Legal.Totem_USUM.Contains(species))
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
else if (enc.Generation < 8 && pkm.Format >= 8)
|
||||
{
|
||||
if (enc is EncounterStatic7 s && FormInfo.IsTotemForm(s.Species, s.Form, 7))
|
||||
if (enc is EncounterStatic7 {IsTotem: true} s)
|
||||
{
|
||||
if (Legal.Totem_NoTransfer.Contains(s.Species))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
|
|
|
@ -644,7 +644,7 @@ namespace PKHeX.Core
|
|||
};
|
||||
|
||||
// Wipe Totem Forms
|
||||
if (FormInfo.IsTotemForm(Species, Form, 7))
|
||||
if (FormInfo.IsTotemForm(Species, Form))
|
||||
pk8.Form = FormInfo.GetTotemBaseForm(Species, Form);
|
||||
|
||||
// Fix PP and Stats
|
||||
|
|
Loading…
Reference in a new issue