diff --git a/PKHeX.Core/Legality/Verifiers/FormArgumentVerifier.cs b/PKHeX.Core/Legality/Verifiers/FormArgumentVerifier.cs
index 3e2b13c1c..fa3b468ae 100644
--- a/PKHeX.Core/Legality/Verifiers/FormArgumentVerifier.cs
+++ b/PKHeX.Core/Legality/Verifiers/FormArgumentVerifier.cs
@@ -56,6 +56,8 @@ private CheckResult VerifyFormArgument(LegalityAnalysis data, IFormArgument f)
> 9_999 => GetInvalid(FormArgumentLEQ_0, 9999),
_ => GetValid(FormArgumentValid),
},
+ Farfetchd when pk.Form is 1 => CheckFarfetchd(data, pk, arg), // Galar
+ Sirfetchd => CheckSirfetchd(data, arg, enc),
Qwilfish when pk.Form is 1 => CheckQwilfish(data, pk, arg),
Overqwil => CheckOverqwil(data, pk, arg, enc),
Stantler => arg switch
@@ -120,6 +122,41 @@ private CheckResult VerifyFormArgument(LegalityAnalysis data, IFormArgument f)
};
}
+ private CheckResult CheckFarfetchd(LegalityAnalysis data, PKM pk, uint arg)
+ {
+ if (arg == 0)
+ return GetValid(FormArgumentValid);
+ if (arg > 9_999)
+ return GetInvalid(FormArgumentLEQ_0, 9999);
+ if (pk.IsEgg)
+ return GetInvalid(FormArgumentNotAllowed);
+
+ var history = data.Info.EvoChainsAllGens;
+ if (history.HasVisitedZA) // Can increase.
+ return GetValid(FormArgumentValid);
+ return GetInvalid(FormArgumentLEQ_0, 0); // Can't increase from 0.
+ }
+
+ private CheckResult CheckSirfetchd(LegalityAnalysis data, uint arg, IEncounterTemplate enc)
+ {
+ var history = data.Info.EvoChainsAllGens;
+ if (arg is 0)
+ {
+ if (enc.Species is (ushort)Sirfetchd)
+ return GetValid(FormArgumentValid);
+ if (history.HasVisitedGen9 || history.HasVisitedSWSH)
+ return GetValid(FormArgumentValid);
+ }
+ else if (arg > 9999)
+ {
+ return GetInvalid(FormArgumentLEQ_0, 9999);
+ }
+
+ if (history.HasVisitedZA && arg >= 3) // Can increase.
+ return GetValid(FormArgumentValid);
+ return GetInvalid(FormArgumentLEQ_0, 0); // Can't increase from 0.
+ }
+
private CheckResult CheckQwilfish(LegalityAnalysis data, PKM pk, uint arg)
{
if (arg == 0)
diff --git a/PKHeX.Core/PKM/Interfaces/IFormArgument.cs b/PKHeX.Core/PKM/Interfaces/IFormArgument.cs
index e2ac1fb63..d853579ac 100644
--- a/PKHeX.Core/PKM/Interfaces/IFormArgument.cs
+++ b/PKHeX.Core/PKM/Interfaces/IFormArgument.cs
@@ -53,18 +53,39 @@ public static class FormArgumentUtil
///
/// Sets the suggested Form Argument to the .
///
- public static void SetSuggestedFormArgument(this PKM pk, ushort originalSpecies = 0)
+ public static void SetSuggestedFormArgument(this PKM pk, EvolutionHistory history, ushort originalSpecies = 0)
{
if (pk is not IFormArgument)
return;
- uint value = IsFormArgumentTypeDatePair(pk.Species, pk.Form)
- ? GetFormArgumentMax(pk.Species, pk.Form, pk.Context)
- : GetFormArgumentMinEvolution(pk.Species, originalSpecies);
- if (pk.Species is (int)Hoopa && pk.Format >= 8)
- value = 0; // S/V does not set the argument for Hoopa
+
+ var (species, form) = (pk.Species, pk.Form);
+
+ uint value = IsFormArgumentTypeDatePair(species, form)
+ ? GetFormArgumentMax(species, form, pk.Context)
+ : GetFormArgumentMinEvolution(species, originalSpecies);
+ if (IsFormArgumentAbleToStay0(species, form, history))
+ value = 0;
pk.ChangeFormArgument(value);
}
+ ///
+ /// Checks if the Form Argument can stay zero due to different games having different uses/behaviors of the value.
+ ///
+ public static bool IsFormArgumentAbleToStay0(ushort species, byte form, EvolutionHistory history) => species switch
+ {
+ // S/V does not set the argument for Hoopa
+ (int)Hoopa => history.HasVisitedGen9 || history.HasVisitedZA,
+
+ // S/V does not set the argument for Farfetch'd (Galar)
+ (int)Farfetchd when form == 1 => history.HasVisitedGen9,
+ (int)Sirfetchd => history.HasVisitedGen9,
+
+ // Z-A does not set the argument for Gimmighoul/Gholdengo
+ (int)Gimmighoul or (int)Gholdengo => history.HasVisitedZA,
+
+ _ => false,
+ };
+
///
/// Modifies the values for the provided to the requested .
///
@@ -128,9 +149,11 @@ public static uint GetFormArgumentMax(ushort species, byte form, EntityContext c
(int)Basculegion => 9999, // 294
(int)Primeape or (int)Annihilape when gen >= 8 => 9999,
(int)Bisharp or (int)Kingambit when gen >= 8 => 9999,
- (int)Gimmighoul when context is EntityContext.Gen9 => 998,
- (int)Gholdengo when context is EntityContext.Gen9 => 999,
+ (int)Gimmighoul => 998,
+ (int)Gholdengo => 999,
(int)Koraidon or (int)Miraidon => 1,
+ (int)Farfetchd when form == 1 && gen >= 8 => 9999,
+ (int)Sirfetchd when gen >= 8 => 9999,
_ => 0,
};
}