diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs
index 4fb10207b..9edf72dee 100644
--- a/PKHeX.Core/Editing/CommonEdits.cs
+++ b/PKHeX.Core/Editing/CommonEdits.cs
@@ -341,8 +341,9 @@ public static int GetMaximumIV(this PKM pk, int index, bool allow30 = false)
/// Force hatches a PKM by applying the current species name and a valid Met Location from the origin game.
///
/// PKM to apply hatch details to
+ /// Trainer to force hatch with if Version is not currently set.
/// Re-hatch already hatched inputs
- public static void ForceHatchPKM(this PKM pk, bool reHatch = false)
+ public static void ForceHatchPKM(this PKM pk, ITrainerInfo? tr = null, bool reHatch = false)
{
if (!pk.IsEgg && !reHatch)
return;
@@ -351,6 +352,8 @@ public static void ForceHatchPKM(this PKM pk, bool reHatch = false)
pk.CurrentFriendship = pk.PersonalInfo.BaseFriendship;
if (pk.IsTradedEgg)
pk.Egg_Location = pk.Met_Location;
+ if (pk.Version == 0)
+ pk.Version = EggStateLegality.GetEggHatchVersion(pk, (GameVersion)(tr?.Game ?? RecentTrainerCache.Game));
var loc = EncounterSuggestion.GetSuggestedEggMetLocation(pk);
if (loc >= 0)
pk.Met_Location = loc;
diff --git a/PKHeX.Core/Editing/Saves/BoxManip/BoxManipDefaults.cs b/PKHeX.Core/Editing/Saves/BoxManip/BoxManipDefaults.cs
index f03c8dfa6..2f98809c7 100644
--- a/PKHeX.Core/Editing/Saves/BoxManip/BoxManipDefaults.cs
+++ b/PKHeX.Core/Editing/Saves/BoxManip/BoxManipDefaults.cs
@@ -64,17 +64,17 @@ public static class BoxManipDefaults
///
/// Common modifying actions.
///
- public static readonly IReadOnlyList ModifyCommon = new List
+ public static readonly IReadOnlyList ModifyCommon = new List
{
- new(ModifyHatchEggs, pk => pk.ForceHatchPKM(), s => s.Generation >= 2 && s is not SAV8LA),
- new(ModifyMaxFriendship, pk => pk.MaximizeFriendship()),
- new(ModifyMaxLevel, pk => pk.MaximizeLevel()),
- new(ModifyResetMoves, pk => pk.SetMoves(pk.GetMoveSet()), s => s.Generation >= 3),
- new(ModifyRandomMoves, pk => pk.SetMoves(pk.GetMoveSet(true))),
- new(ModifyHyperTrain,pk => pk.SetSuggestedHyperTrainingData(), s => s.Generation >= 7 && s is not SAV8LA),
- new(ModifyGanbaru,pk => ((IGanbaru)pk).SetSuggestedGanbaruValues(pk), s => s is SAV8LA),
- new(ModifyRemoveNicknames, pk => pk.SetDefaultNickname()),
- new(ModifyRemoveItem, pk => pk.HeldItem = 0, s => s.Generation >= 2),
- new(ModifyHeal, pk => pk.Heal(), s => s.Generation >= 6), // HP stored in box, or official code has bugged transfer PP the user would like to rectify.
+ new BoxManipModifyComplex(ModifyHatchEggs, (pk, sav) => pk.ForceHatchPKM(sav), s => s.Generation >= 2 && s is not SAV8LA),
+ new BoxManipModify(ModifyMaxFriendship, pk => pk.MaximizeFriendship()),
+ new BoxManipModify(ModifyMaxLevel, pk => pk.MaximizeLevel()),
+ new BoxManipModify(ModifyResetMoves, pk => pk.SetMoves(pk.GetMoveSet()), s => s.Generation >= 3),
+ new BoxManipModify(ModifyRandomMoves, pk => pk.SetMoves(pk.GetMoveSet(true))),
+ new BoxManipModify(ModifyHyperTrain,pk => pk.SetSuggestedHyperTrainingData(), s => s.Generation >= 7 && s is not SAV8LA),
+ new BoxManipModify(ModifyGanbaru,pk => ((IGanbaru)pk).SetSuggestedGanbaruValues(pk), s => s is SAV8LA),
+ new BoxManipModify(ModifyRemoveNicknames, pk => pk.SetDefaultNickname()),
+ new BoxManipModify(ModifyRemoveItem, pk => pk.HeldItem = 0, s => s.Generation >= 2),
+ new BoxManipModify(ModifyHeal, pk => pk.Heal(), s => s.Generation >= 6), // HP stored in box, or official code has bugged transfer PP the user would like to rectify.
};
}
diff --git a/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs b/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs
index 344c7471a..5ce27c51b 100644
--- a/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs
+++ b/PKHeX.Core/Legality/Verifiers/Egg/EggStateLegality.cs
@@ -89,6 +89,18 @@ public static int GetMaximumEggHatchCycles(PKM pk, IEncounterTemplate enc)
_ => false,
};
+ ///
+ /// Gets a suggested Version for a hatched egg that originally lacked a Version value.
+ ///
+ /// Egg Entity
+ /// Potential version the egg was hatched in
+ /// Very roughly sanitized version the egg was hatched in.
+ public static GameVersion GetEggHatchVersion(PKM pk, GameVersion version) => pk switch
+ {
+ PK9 => version is SL or VL ? version : SL,
+ _ => version,
+ };
+
///
/// Indicates if the flag should be set for an Egg entity.
///