diff --git a/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs b/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs index 73aeac1b0..7b77602b3 100644 --- a/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs +++ b/PKHeX.Core/Editing/Applicators/RibbonApplicator.cs @@ -42,7 +42,7 @@ public static class RibbonApplicator /// /// Parses the Entity for all ribbons, then fixes any ribbon that was invalid. /// - public static void FixInvalidRibbons(RibbonVerifierArguments args) + public static void FixInvalidRibbons(in RibbonVerifierArguments args) { Span result = stackalloc RibbonResult[RibbonVerifier.MaxRibbonCount]; var count = RibbonVerifier.GetRibbonResults(args, result); @@ -50,7 +50,7 @@ public static class RibbonApplicator ribbon.Fix(args); } - private static void SetAllRibbonState(RibbonVerifierArguments args, bool desiredState) + private static void SetAllRibbonState(in RibbonVerifierArguments args, bool desiredState) { for (RibbonIndex3 r = 0; r < RibbonIndex3.MAX_COUNT; r++) r.Fix(args, desiredState); diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 5773e1da2..09151431e 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -246,7 +246,7 @@ public static class Legal /// /// Checks if the input has IVs that match the template . /// - public static bool GetIsFixedIVSequenceValidSkipRand(IndividualValueSet IVs, PKM pk, int max = 31) + public static bool GetIsFixedIVSequenceValidSkipRand(in IndividualValueSet IVs, PKM pk, int max = 31) { // Template IVs not in the [0,max] range are random. Only check for IVs within the "specified" range. if ((uint)IVs.HP <= max && IVs.HP != pk.IV_HP ) return false; @@ -261,7 +261,7 @@ public static class Legal /// /// Checks if the input has IVs that match the template . /// - public static bool GetIsFixedIVSequenceValidNoRand(IndividualValueSet IVs, PKM pk) + public static bool GetIsFixedIVSequenceValidNoRand(in IndividualValueSet IVs, PKM pk) { if (IVs.HP != pk.IV_HP ) return false; if (IVs.ATK != pk.IV_ATK) return false; diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs index dcf78d6fd..a3025a948 100644 --- a/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs +++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterCriteria.cs @@ -275,7 +275,7 @@ public sealed record EncounterCriteria : IFixedNature, IFixedGender, IFixedAbili /// /// Entity to mutate. /// Template to populate from - public void SetRandomIVs(PKM pk, IndividualValueSet template) + public void SetRandomIVs(PKM pk, in IndividualValueSet template) { if (!template.IsSpecified) { diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterUtil1.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterUtil1.cs index aa4a47e15..d6694ea73 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterUtil1.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterUtil1.cs @@ -37,7 +37,7 @@ public static class EncounterUtil1 _ => tr.Language == 1 ? "GF" : tr.OT, }; - public static ushort GetDV16(IndividualValueSet actual) + public static ushort GetDV16(in IndividualValueSet actual) { ushort result = 0; result |= (ushort)(actual.SPA << 0); diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonResult.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonResult.cs index e8fd9610a..804f62f9e 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonResult.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonResult.cs @@ -41,7 +41,7 @@ public readonly record struct RibbonResult /// /// Updates the ribbon state depending on the and state. /// - public void Fix(RibbonVerifierArguments args) + public void Fix(in RibbonVerifierArguments args) { switch (Type) { diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs index f45e2626d..337368d61 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifier.cs @@ -48,7 +48,7 @@ public sealed class RibbonVerifier : Verifier /// Ribbon Index to check for /// Inputs to analyze /// True if not present in the flagged result span. - public static bool IsValidExtra(RibbonIndex index, RibbonVerifierArguments args) + public static bool IsValidExtra(RibbonIndex index, in RibbonVerifierArguments args) { Span result = stackalloc RibbonResult[MaxRibbonCount]; int count = GetRibbonResults(args, result); @@ -70,13 +70,13 @@ public sealed class RibbonVerifier : Verifier /// Inputs to analyze /// Result storage /// Count of elements filled in the span. - public static int GetRibbonResults(RibbonVerifierArguments args, Span result) + public static int GetRibbonResults(in RibbonVerifierArguments args, Span result) { var list = new RibbonResultList(result); return GetRibbonResults(args, ref list); } - private static int GetRibbonResults(RibbonVerifierArguments args, ref RibbonResultList list) + private static int GetRibbonResults(in RibbonVerifierArguments args, ref RibbonResultList list) { if (!args.Entity.IsEgg) Parse(args, ref list); @@ -131,7 +131,7 @@ public sealed class RibbonVerifier : Verifier } } - private static void Parse(RibbonVerifierArguments args, ref RibbonResultList list) + private static void Parse(in RibbonVerifierArguments args, ref RibbonResultList list) { var pk = args.Entity; if (pk is IRibbonSetOnly3 o3) @@ -160,7 +160,7 @@ public sealed class RibbonVerifier : Verifier m9.Parse(args, ref list); } - private static void ParseEgg(RibbonVerifierArguments args, ref RibbonResultList list) + private static void ParseEgg(in RibbonVerifierArguments args, ref RibbonResultList list) { var pk = args.Entity; if (pk is IRibbonSetOnly3 o3) diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon3.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon3.cs index f21c24a01..197654a8e 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon3.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon3.cs @@ -7,10 +7,9 @@ namespace PKHeX.Core; /// public static class RibbonVerifierCommon3 { - public static void Parse(this IRibbonSetCommon3 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetCommon3 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var evos = args.History; - var pk = args.Entity; if (r.RibbonChampionG3 && !evos.HasVisitedGen3) list.Add(ChampionG3); if (r.RibbonArtist && !evos.HasVisitedGen3) diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon4.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon4.cs index f1722b9c8..97219cfbb 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon4.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon4.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierCommon4 { - public static void Parse(this IRibbonSetCommon4 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetCommon4 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var pk = args.Entity; var evos = args.History; diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon6.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon6.cs index 3ba13de1a..90c5cd299 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon6.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon6.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierCommon6 { - public static void Parse(this IRibbonSetCommon6 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetCommon6 r, in RibbonVerifierArguments args, ref RibbonResultList list) { if (r is IRibbonSetMemory6 m) GetInvalidRibbons6Memory(m, args, ref list); @@ -89,7 +89,7 @@ public static class RibbonVerifierCommon6 FlagContest(r, ref list); } - private static void GetInvalidRibbons6Memory(IRibbonSetMemory6 r, RibbonVerifierArguments args, ref RibbonResultList list) + private static void GetInvalidRibbons6Memory(IRibbonSetMemory6 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var format = args.Entity.Format; (byte contest, byte battle) = RibbonRules.GetMaxMemoryCounts(args.History, args.Entity, args.Encounter); @@ -138,7 +138,7 @@ public static class RibbonVerifierCommon6 list.Add(MasterToughness); } - private static void CheckChampionMemory(RibbonVerifierArguments args, ref RibbonResultList list) + private static void CheckChampionMemory(in RibbonVerifierArguments args, ref RibbonResultList list) { var pk = args.Entity; var enc = args.Encounter; @@ -150,7 +150,7 @@ public static class RibbonVerifierCommon6 list.Add(ribbon, true); } - private static void CheckMaisonRibbons(IRibbonSetCommon6 r, RibbonVerifierArguments args, ref RibbonResultList list) + private static void CheckMaisonRibbons(IRibbonSetCommon6 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var pk = args.Entity; if (!RibbonRules.IsAllowedBattleFrontier(pk.Species)) diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon7.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon7.cs index 80f3e7ab2..102058c90 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon7.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon7.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierCommon7 { - public static void Parse(this IRibbonSetCommon7 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetCommon7 r, in RibbonVerifierArguments args, ref RibbonResultList list) { bool inhabited7 = args.History.HasVisitedGen7; bool alolaValid = RibbonRules.IsRibbonValidAlolaChamp(r, args.Encounter, inhabited7); diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon8.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon8.cs index 7bf3df3c0..2f16c964e 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon8.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon8.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierCommon8 { - public static void Parse(this IRibbonSetCommon8 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetCommon8 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var evos = args.History; if (r.RibbonTowerMaster && !RibbonRules.IsRibbonValidTowerMaster(evos)) diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon9.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon9.cs index 54b644a91..4302d80c8 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon9.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierCommon9.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierCommon9 { - public static void Parse(this IRibbonSetCommon9 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetCommon9 r, in RibbonVerifierArguments args, ref RibbonResultList list) { if (r.RibbonChampionPaldea && !args.History.HasVisitedGen9) list.Add(ChampionPaldea); diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent3.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent3.cs index 520a837f9..cea710c97 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent3.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent3.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierEvent3 { - public static void Parse(this IRibbonSetEvent3 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetEvent3 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var enc = args.Encounter; if (enc is IRibbonSetEvent3 e) diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent4.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent4.cs index 929b7d434..bf5abc949 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent4.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierEvent4.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierEvent4 { - public static void Parse(this IRibbonSetEvent4 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetEvent4 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var enc = args.Encounter; if (enc is IRibbonSetEvent4 e) @@ -84,7 +84,7 @@ public static class RibbonVerifierEvent4 list.Add(Souvenir); } - public static void ParseEgg(this IRibbonSetEvent4 r, ref RibbonResultList list, RibbonVerifierArguments args) + public static void ParseEgg(this IRibbonSetEvent4 r, ref RibbonResultList list, in RibbonVerifierArguments args) { var enc = args.Encounter; if (enc is IRibbonSetEvent4 e) diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierMark9.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierMark9.cs index c17b0a866..0c4fe1e82 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierMark9.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierMark9.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierMark9 { - public static void Parse(this IRibbonSetMark9 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetMark9 r, in RibbonVerifierArguments args, ref RibbonResultList list) { if (!MarkRules.IsMarkValidAlpha(args.Encounter, args.Entity)) list.Add(MarkAlpha, !r.RibbonMarkAlpha); diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierOnly3.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierOnly3.cs index 72f93fc5a..8cc840dd1 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierOnly3.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierOnly3.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierOnly3 { - public static void Parse(this IRibbonSetOnly3 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetOnly3 r, in RibbonVerifierArguments args, ref RibbonResultList list) { if (r.RibbonWorld) list.Add(RibbonIndex.World); diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique3.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique3.cs index 150010fd0..fb00f4297 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique3.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique3.cs @@ -7,7 +7,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierUnique3 { - public static void Parse(this IRibbonSetUnique3 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetUnique3 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var evos = args.History; if (evos.HasVisitedGen3) diff --git a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique4.cs b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique4.cs index 5885e8c0b..2bb427c99 100644 --- a/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique4.cs +++ b/PKHeX.Core/Legality/Verifiers/Ribbons/RibbonVerifierUnique4.cs @@ -5,7 +5,7 @@ namespace PKHeX.Core; /// public static class RibbonVerifierUnique4 { - public static void Parse(this IRibbonSetUnique4 r, RibbonVerifierArguments args, ref RibbonResultList list) + public static void Parse(this IRibbonSetUnique4 r, in RibbonVerifierArguments args, ref RibbonResultList list) { var evos = args.History; if (!RibbonRules.IsAllowedBattleFrontier4(evos)) diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 61cd10f05..9c0a2359a 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -916,10 +916,10 @@ public abstract class PKM : ISpeciesForm, ITrainerID32, IGeneration, IShiny, ILa public void SetRandomIVs(int minFlawless = 0) => SetRandomIVs(stackalloc int[6], minFlawless); /// - public void SetRandomIVs(IndividualValueSet template) => SetRandomIVs(stackalloc int[6], template); + public void SetRandomIVs(in IndividualValueSet template) => SetRandomIVs(stackalloc int[6], template); /// - public void SetRandomIVs(Span ivs, IndividualValueSet template) + public void SetRandomIVs(Span ivs, in IndividualValueSet template) { var rnd = Util.Rand; for (int i = 0; i < ivs.Length; i++) diff --git a/PKHeX.Core/Ribbons/Past/RibbonIndex3.cs b/PKHeX.Core/Ribbons/Past/RibbonIndex3.cs index d9323179c..5b5592ebe 100644 --- a/PKHeX.Core/Ribbons/Past/RibbonIndex3.cs +++ b/PKHeX.Core/Ribbons/Past/RibbonIndex3.cs @@ -39,7 +39,7 @@ public enum RibbonIndex3 : byte public static class RibbonIndex3Extensions { - public static void Fix(this RibbonIndex3 r, RibbonVerifierArguments args, bool state) + public static void Fix(this RibbonIndex3 r, in RibbonVerifierArguments args, bool state) { var pk = args.Entity; if (r is Victory or Winning) diff --git a/PKHeX.Core/Ribbons/Past/RibbonIndex4.cs b/PKHeX.Core/Ribbons/Past/RibbonIndex4.cs index 6823549d8..9190aedec 100644 --- a/PKHeX.Core/Ribbons/Past/RibbonIndex4.cs +++ b/PKHeX.Core/Ribbons/Past/RibbonIndex4.cs @@ -43,7 +43,7 @@ public enum RibbonIndex4 : byte public static class RibbonIndex4Extensions { - public static void Fix(this RibbonIndex4 r, RibbonVerifierArguments args, bool state) + public static void Fix(this RibbonIndex4 r, in RibbonVerifierArguments args, bool state) { var pk = args.Entity; if (pk is not IRibbonSetUnique4 u4) diff --git a/PKHeX.Core/Ribbons/RibbonIndex.cs b/PKHeX.Core/Ribbons/RibbonIndex.cs index 0a5cfe4c2..280166946 100644 --- a/PKHeX.Core/Ribbons/RibbonIndex.cs +++ b/PKHeX.Core/Ribbons/RibbonIndex.cs @@ -265,7 +265,7 @@ public static class RibbonIndexExtensions }; } - public static void Fix(this RibbonIndex r, RibbonVerifierArguments args, bool state) + public static void Fix(this RibbonIndex r, in RibbonVerifierArguments args, bool state) { var pk = args.Entity; var group = r.GetGroup();