diff --git a/PKHeX.Core/Editing/Saves/BoxManipParam.cs b/PKHeX.Core/Editing/Saves/BoxManipParam.cs index eedb87381..0630d3c03 100644 --- a/PKHeX.Core/Editing/Saves/BoxManipParam.cs +++ b/PKHeX.Core/Editing/Saves/BoxManipParam.cs @@ -5,5 +5,10 @@ public struct BoxManipParam public int Start { get; set; } public int Stop { get; set; } public bool Reverse { get; set; } + + public override bool Equals(object obj) => obj is BoxManipParam p && p.Start == Start && p.Stop == Stop && p.Reverse == Reverse; + public override int GetHashCode() => -1; + public static bool operator ==(BoxManipParam left, BoxManipParam right) => left.Equals(right); + public static bool operator !=(BoxManipParam left, BoxManipParam right) => !(left == right); } } \ No newline at end of file diff --git a/PKHeX.Core/Legality/Memories.cs b/PKHeX.Core/Legality/Memories.cs index 771af242a..f6919f015 100644 --- a/PKHeX.Core/Legality/Memories.cs +++ b/PKHeX.Core/Legality/Memories.cs @@ -229,5 +229,16 @@ public static MemoryVariableSet Read(PKM pkm, int handler) _ => new MemoryVariableSet(LegalityCheckStrings.L_XOT, 0, 0, 0, 0) }; } + + public override bool Equals(object obj) => obj is MemoryVariableSet v + && v.Handler == Handler + && v.MemoryID == MemoryID + && v.Variable == Variable + && v.Intensity == Intensity + && v.Feeling == Feeling; + + public override int GetHashCode() => -1; + public static bool operator ==(MemoryVariableSet left, MemoryVariableSet right) => left.Equals(right); + public static bool operator !=(MemoryVariableSet left, MemoryVariableSet right) => !(left == right); } } diff --git a/PKHeX.Core/Legality/Moves/LearnInfo.cs b/PKHeX.Core/Legality/Moves/LearnInfo.cs index ff6026967..4fb04d2da 100644 --- a/PKHeX.Core/Legality/Moves/LearnInfo.cs +++ b/PKHeX.Core/Legality/Moves/LearnInfo.cs @@ -22,7 +22,7 @@ public LearnInfo(PKM pkm, MoveParseSource source) } } - public struct LearnVersion + public readonly struct LearnVersion { public readonly GameVersion Game; public readonly int Level; @@ -34,5 +34,10 @@ public LearnVersion(int lv, GameVersion game = GameVersion.Any) } public bool IsLevelUp => Level >= 0; + + public override bool Equals(object obj) => obj is LearnVersion v && v.Game == Game && v.Level == Level; + public override int GetHashCode() => -1; + public static bool operator ==(LearnVersion left, LearnVersion right) => left.Equals(right); + public static bool operator !=(LearnVersion left, LearnVersion right) => !(left == right); } } diff --git a/PKHeX.Core/Legality/RNG/Frame/SeedInfo.cs b/PKHeX.Core/Legality/RNG/Frame/SeedInfo.cs index 0878acb2f..d53841ff9 100644 --- a/PKHeX.Core/Legality/RNG/Frame/SeedInfo.cs +++ b/PKHeX.Core/Legality/RNG/Frame/SeedInfo.cs @@ -2,10 +2,21 @@ namespace PKHeX.Core { - public struct SeedInfo + public readonly struct SeedInfo { - public uint Seed; - public bool Charm3; + public readonly uint Seed; + public readonly bool Charm3; + + private SeedInfo(uint seed, bool charm3 = false) + { + Seed = seed; + Charm3 = charm3; + } + + public override bool Equals(object obj) => obj is SeedInfo s && s.Charm3 == Charm3 && s.Seed == Seed; + public override int GetHashCode() => -1; + public static bool operator ==(SeedInfo left, SeedInfo right) => left.Equals(right); + public static bool operator !=(SeedInfo left, SeedInfo right) => !(left == right); /// /// Yields an enumerable list of seeds until another valid PID breaks the chain. @@ -18,7 +29,7 @@ public static IEnumerable GetSeedsUntilNature(PIDIV pidiv, FrameGenera bool charm3 = false; var seed = pidiv.OriginSeed; - yield return new SeedInfo { Seed = seed }; + yield return new SeedInfo(seed); var s1 = seed; var s2 = RNG.LCRNG.Prev(s1); @@ -42,7 +53,7 @@ public static IEnumerable GetSeedsUntilNature(PIDIV pidiv, FrameGenera s1 = RNG.LCRNG.Prev(s2); s2 = RNG.LCRNG.Prev(s1); - yield return new SeedInfo { Seed = s1, Charm3 = charm3 }; + yield return new SeedInfo(s1, charm3); } } @@ -56,7 +67,7 @@ public static IEnumerable GetSeedsUntilNature(PIDIV pidiv, FrameGenera public static IEnumerable GetSeedsUntilUnownForm(PIDIV pidiv, FrameGenerator info, int form) { var seed = pidiv.OriginSeed; - yield return new SeedInfo { Seed = seed }; + yield return new SeedInfo(seed); var s1 = seed; var s2 = RNG.LCRNG.Prev(s1); @@ -80,7 +91,7 @@ public static IEnumerable GetSeedsUntilUnownForm(PIDIV pidiv, FrameGen s1 = RNG.LCRNG.Prev(s2); s2 = RNG.LCRNG.Prev(s1); - yield return new SeedInfo { Seed = s1 }; + yield return new SeedInfo(s1); } }