diff --git a/PKHeX.Core/Game/ComboItem.cs b/PKHeX.Core/Game/ComboItem.cs index 04f6db77f..de744e91b 100644 --- a/PKHeX.Core/Game/ComboItem.cs +++ b/PKHeX.Core/Game/ComboItem.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Key Value pair for a displayed and underlying value. + /// public struct ComboItem { public string Text { get; set; } diff --git a/PKHeX.Core/Game/GameUtil.cs b/PKHeX.Core/Game/GameUtil.cs index 537bd9346..3e048d946 100644 --- a/PKHeX.Core/Game/GameUtil.cs +++ b/PKHeX.Core/Game/GameUtil.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Utility class for logic. + /// public static class GameUtil { /// Determines the Version Grouping of an input Version ID diff --git a/PKHeX.Core/Game/GameVersion.cs b/PKHeX.Core/Game/GameVersion.cs index 4427c7805..110e44510 100644 --- a/PKHeX.Core/Game/GameVersion.cs +++ b/PKHeX.Core/Game/GameVersion.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Game Version ID enum shared between actual Version IDs and lumped version groupings. + /// public enum GameVersion { // Indicators diff --git a/PKHeX.Core/Legality/Analysis.cs b/PKHeX.Core/Legality/Analysis.cs index fb2134986..60d994f4f 100644 --- a/PKHeX.Core/Legality/Analysis.cs +++ b/PKHeX.Core/Legality/Analysis.cs @@ -8,6 +8,9 @@ namespace PKHeX.Core { + /// + /// Legality Check object containing the data and overview values from the parse. + /// public partial class LegalityAnalysis { private PKM pkm; @@ -53,6 +56,10 @@ private IEnumerable AllSuggestedRelearnMoves private int[] _allSuggestedMoves, _allSuggestedRelearnMoves; public int[] AllSuggestedMovesAndRelearn => AllSuggestedMoves.Concat(AllSuggestedRelearnMoves).ToArray(); + /// + /// Checks the input data for legality. + /// + /// Input data to check public LegalityAnalysis(PKM pk) { #if SUPPRESS diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs index 74ac36437..8059e06c4 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs @@ -4,6 +4,9 @@ namespace PKHeX.Core { + /// + /// Generation 1 Encounters + /// internal static class Encounters1 { internal static readonly EncounterArea[] SlotsRBY; diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs index a89e97ef4..0d2d598ab 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Generation 2 Encounters + /// internal static class Encounters2 { internal static readonly EncounterArea[] SlotsGSC, SlotsGS, SlotsC; diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs index d333f6eec..b548af4f5 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters3.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Generation 3 Encounters + /// internal static class Encounters3 { internal static readonly EncounterArea[] SlotsR, SlotsS, SlotsE; diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs index 00b46b707..8c6d20b3b 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters4.cs @@ -5,6 +5,9 @@ namespace PKHeX.Core { + /// + /// Generation 4 Encounters + /// internal static class Encounters4 { internal static readonly EncounterArea[] SlotsD, SlotsP, SlotsPt, SlotsHG, SlotsSS; diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs index 8059dcf18..f99278b24 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters5.cs @@ -4,6 +4,9 @@ namespace PKHeX.Core { + /// + /// Generation 5 Encounters + /// internal static class Encounters5 { internal static readonly EncounterArea[] SlotsB, SlotsW, SlotsB2, SlotsW2; diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs index 7c4042f82..72e0db6c3 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters6.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// Generation 6 Encounters + /// internal static class Encounters6 { internal static readonly EncounterArea[] SlotsX, SlotsY, SlotsA, SlotsO; diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs index 2a94afa13..c69907b4f 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters7.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Generation 7 Encounters + /// internal static class Encounters7 { internal static readonly EncounterArea[] SlotsSN, SlotsMN, SlotsUS, SlotsUM; diff --git a/PKHeX.Core/Legality/Encounters/Data/EncountersWC3.cs b/PKHeX.Core/Legality/Encounters/Data/EncountersWC3.cs index a1c22de86..7b8bfdad5 100644 --- a/PKHeX.Core/Legality/Encounters/Data/EncountersWC3.cs +++ b/PKHeX.Core/Legality/Encounters/Data/EncountersWC3.cs @@ -2,6 +2,13 @@ namespace PKHeX.Core { + /// + /// Generation 3 Gifts + /// + /// + /// Generation 3 has a wide range of PIDIV types and other restrictions, and was never consistently stored in raw bytes. + /// Normally we'd just load the data from a binary, but without raw data... hard-code everything by hand. + /// internal static class EncountersWC3 { internal static readonly MysteryGift[] Encounter_Event3 = diff --git a/PKHeX.Core/Legality/Encounters/EncounterEgg.cs b/PKHeX.Core/Legality/Encounters/EncounterEgg.cs index 755bfc174..a2f53bb53 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterEgg.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterEgg.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Egg Encounter Data + /// public class EncounterEgg : IEncounterable { public int Species { get; set; } diff --git a/PKHeX.Core/Legality/Encounters/EncounterInvalid.cs b/PKHeX.Core/Legality/Encounters/EncounterInvalid.cs index 841397fc8..4ca7466aa 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterInvalid.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterInvalid.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Invalid Encounter Data + /// public class EncounterInvalid : IEncounterable { public int Species { get; } diff --git a/PKHeX.Core/Legality/Encounters/EncounterRejected.cs b/PKHeX.Core/Legality/Encounters/EncounterRejected.cs index 4bfebf328..c39bb2777 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterRejected.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterRejected.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Rejected Encounter Data containing a reason why the encounter was rejected (not compatible). + /// public class EncounterRejected : IEncounterable { public readonly IEncounterable Encounter; diff --git a/PKHeX.Core/Legality/Encounters/EncounterSuggestion.cs b/PKHeX.Core/Legality/Encounters/EncounterSuggestion.cs index c1cb99223..5bf801187 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSuggestion.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSuggestion.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// Logic for providing suggested property values with respect to the input data. + /// internal static class EncounterSuggestion { public static EncounterStatic GetSuggestedMetInfo(PKM pkm) diff --git a/PKHeX.Core/Legality/Encounters/LegalInfo.cs b/PKHeX.Core/Legality/Encounters/LegalInfo.cs index 72cbddbc1..2e80afb54 100644 --- a/PKHeX.Core/Legality/Encounters/LegalInfo.cs +++ b/PKHeX.Core/Legality/Encounters/LegalInfo.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Calculated Information storage with properties useful for parsing the legality of the input . + /// public class LegalInfo { /// The object used for comparisons. diff --git a/PKHeX.Core/Legality/Encounters/PeekEnumerator.cs b/PKHeX.Core/Legality/Encounters/PeekEnumerator.cs index a82318b91..da06736bc 100644 --- a/PKHeX.Core/Legality/Encounters/PeekEnumerator.cs +++ b/PKHeX.Core/Legality/Encounters/PeekEnumerator.cs @@ -4,6 +4,10 @@ namespace PKHeX.Core { + /// + /// Iterates a generic collection with the ability to peek into the collection to see if the next element exists. + /// + /// Generic Collection Element Type public class PeekEnumerator : IEnumerator { private readonly IEnumerator Enumerator; @@ -12,6 +16,10 @@ public class PeekEnumerator : IEnumerator #region IEnumerator Implementation + /// + /// Advances the enumerator to the next element in the collection. + /// + /// Indication if there are more elements in the collection. public bool MoveNext() { if (!didPeek) @@ -19,6 +27,9 @@ public bool MoveNext() didPeek = false; return true; } + /// + /// Sets the enumerator to its initial position, which is before the first element in the collection. + /// public void Reset() { Enumerator.Reset(); diff --git a/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs b/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs index 354231a91..5c645751e 100644 --- a/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs +++ b/PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs @@ -6,6 +6,9 @@ namespace PKHeX.Core { + /// + /// Logic to verify the current . + /// public static class VerifyCurrentMoves { public static CheckMoveResult[] VerifyMoves(PKM pkm, LegalInfo info, GameVersion game = GameVersion.Any) diff --git a/PKHeX.Core/Legality/Encounters/VerifyRelearnMoves.cs b/PKHeX.Core/Legality/Encounters/VerifyRelearnMoves.cs index 8c0d186c6..af5a2be6d 100644 --- a/PKHeX.Core/Legality/Encounters/VerifyRelearnMoves.cs +++ b/PKHeX.Core/Legality/Encounters/VerifyRelearnMoves.cs @@ -6,6 +6,9 @@ namespace PKHeX.Core { + /// + /// Logic to verify the current . + /// public static class VerifyRelearnMoves { public static CheckResult[] VerifyRelearn(PKM pkm, LegalInfo info) diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs index cac381bd3..f767ce5c2 100644 --- a/PKHeX.Core/Legality/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Legality Check Message Strings to indicate why certain values are flagged. + /// public static class LegalityCheckStrings { diff --git a/PKHeX.Core/Legality/Structures/CheckMoveResult.cs b/PKHeX.Core/Legality/Structures/CheckMoveResult.cs index e3ce6ca86..7ef93d69b 100644 --- a/PKHeX.Core/Legality/Structures/CheckMoveResult.cs +++ b/PKHeX.Core/Legality/Structures/CheckMoveResult.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Source the Move was learned from + /// public enum MoveSource { Unknown, @@ -17,6 +20,9 @@ public enum MoveSource Sketch, } + /// + /// Move specific to contain in which Generation it was learned & source. + /// public class CheckMoveResult : CheckResult { public readonly MoveSource Source; diff --git a/PKHeX.Core/Legality/Structures/CheckResult.cs b/PKHeX.Core/Legality/Structures/CheckResult.cs index e84ea823a..36bd07cc1 100644 --- a/PKHeX.Core/Legality/Structures/CheckResult.cs +++ b/PKHeX.Core/Legality/Structures/CheckResult.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Result of a Legality Check + /// public class CheckResult { internal readonly Severity Judgement = Severity.Valid; diff --git a/PKHeX.Core/Legality/Structures/EncounterArea.cs b/PKHeX.Core/Legality/Structures/EncounterArea.cs index 6acdd7c53..3423045b1 100644 --- a/PKHeX.Core/Legality/Structures/EncounterArea.cs +++ b/PKHeX.Core/Legality/Structures/EncounterArea.cs @@ -4,12 +4,26 @@ namespace PKHeX.Core { + /// + /// Represents an Area where can be encountered, which contains a Location ID and data. + /// public class EncounterArea { public int Location; public EncounterSlot[] Slots; + + /// + /// Creates an empty encounter area ready for initialization. + /// public EncounterArea() { } + /// + /// Creates an array of encounter data with a specified location ID. + /// + /// Encounter data + /// + /// Encounter Data is stored in the following format: (u16 Location, n*[u16 Species/Form, u8 Min, u8 Max]) + /// private EncounterArea(byte[] data) { Location = BitConverter.ToUInt16(data, 0); @@ -49,10 +63,10 @@ public EncounterArea[] Clone(int[] locations) return Areas; } - private static EncounterSlot1[] GetSlots1_GW(byte[] data, ref int ofs, SlotType t) + private static IEnumerable GetSlots1_GW(byte[] data, ref int ofs, SlotType t) { int rate = data[ofs++]; - return rate == 0 ? new EncounterSlot1[0] : ReadSlots(data, ref ofs, 10, t, rate); + return rate == 0 ? Enumerable.Empty() : ReadSlots(data, ref ofs, 10, t, rate); } private static EncounterSlot1[] GetSlots1_F(byte[] data, ref int ofs) { @@ -85,7 +99,7 @@ private static EncounterSlot1[] GetSlots2_GW(byte[] data, ref int ofs, SlotType return slots; } - private static EncounterSlot1[] GetSlots2_F(byte[] data, ref int ofs, SlotType t) + private static List GetSlots2_F(byte[] data, ref int ofs, SlotType t) { // slot set ends in 0xFF 0x** 0x** var slots = new List(); @@ -109,7 +123,7 @@ private static EncounterSlot1[] GetSlots2_F(byte[] data, ref int ofs, SlotType t if (rate == 0xFF) break; } - return slots.ToArray(); + return slots; } private static EncounterSlot1[] GetSlots2_H(byte[] data, ref int ofs, SlotType t) { @@ -916,6 +930,11 @@ public static EncounterArea[] GetSimpleEncounterArea(IEnumerable species, i return new[] { new EncounterArea { Location = location, Slots = l.ToArray() } }; } + /// + /// Gets an array of areas from an array of raw area data + /// + /// Simplified raw format of an Area + /// Array of areas public static EncounterArea[] GetArray(byte[][] entries) { if (entries == null) diff --git a/PKHeX.Core/Legality/Structures/EncounterLink.cs b/PKHeX.Core/Legality/Structures/EncounterLink.cs index 90beb3b56..20482a790 100644 --- a/PKHeX.Core/Legality/Structures/EncounterLink.cs +++ b/PKHeX.Core/Legality/Structures/EncounterLink.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Pokémon Link Encounter Data + /// public class EncounterLink : IEncounterable, IRibbonSetEvent4, IMoveset { public int Species { get; set; } diff --git a/PKHeX.Core/Legality/Structures/EncounterLock.cs b/PKHeX.Core/Legality/Structures/EncounterLock.cs index 815cdf383..eff652907 100644 --- a/PKHeX.Core/Legality/Structures/EncounterLock.cs +++ b/PKHeX.Core/Legality/Structures/EncounterLock.cs @@ -1,6 +1,9 @@ namespace PKHeX.Core { - // Gender Locking + /// + /// Encounter lock values restricting certain properties to a fixed value. + /// + /// Used in Colosseum/XD to ensure that non-shadow are of a certain Nature/etc. public class EncounterLock { public int Species { get; set; } diff --git a/PKHeX.Core/Legality/Structures/EncounterSlot.cs b/PKHeX.Core/Legality/Structures/EncounterSlot.cs index 4f2c733f6..cca8a1216 100644 --- a/PKHeX.Core/Legality/Structures/EncounterSlot.cs +++ b/PKHeX.Core/Legality/Structures/EncounterSlot.cs @@ -14,6 +14,9 @@ public class EncounterSlotPermissions public bool IsNormalLead => !(WhiteFlute || BlackFlute || DexNav); public bool IsDexNav => AllowDexNav && DexNav; } + /// + /// Wild Encounter Slot data + /// public class EncounterSlot : IEncounterable, IGeneration { public int Location { get; set; } = -1; @@ -53,10 +56,18 @@ public string Name } } } + + /// + /// Generation 1 Wild Encounter Slot data + /// + /// + /// Contains Time data which is present in origin data. + /// Contains identification, as this Version value is not stored in or formats. + /// public class EncounterSlot1 : EncounterSlot { public int Rate; - public EncounterTime Time = EncounterTime.Any; + internal EncounterTime Time = EncounterTime.Any; public GameVersion Version = GameVersion.Any; public override EncounterSlot Clone() { diff --git a/PKHeX.Core/Legality/Structures/EncounterStatic.cs b/PKHeX.Core/Legality/Structures/EncounterStatic.cs index 5cc14b8ab..cfcae608c 100644 --- a/PKHeX.Core/Legality/Structures/EncounterStatic.cs +++ b/PKHeX.Core/Legality/Structures/EncounterStatic.cs @@ -1,5 +1,11 @@ namespace PKHeX.Core { + /// + /// Static Encounter Data + /// + /// + /// Static Encounters are fixed position encounters with properties that are not subject to Wild Encounter conditions. + /// public class EncounterStatic : IEncounterable, IMoveset, IGeneration { public int Species { get; set; } diff --git a/PKHeX.Core/Legality/Structures/EncounterTime.cs b/PKHeX.Core/Legality/Structures/EncounterTime.cs index 050bf7b6f..45a56219f 100644 --- a/PKHeX.Core/Legality/Structures/EncounterTime.cs +++ b/PKHeX.Core/Legality/Structures/EncounterTime.cs @@ -1,6 +1,9 @@ namespace PKHeX.Core { - public enum EncounterTime + /// + /// Generation 2 Time of Encounter enum + /// + internal enum EncounterTime { Any = -1, MorningDay = -2, @@ -9,9 +12,9 @@ public enum EncounterTime Night = 3 } - public static class EncounterTimeExtension + internal static class EncounterTimeExtension { - public static bool Contains(this EncounterTime t1, int t2) => t1.Contains((EncounterTime)t2); + internal static bool Contains(this EncounterTime t1, int t2) => t1.Contains((EncounterTime)t2); private static bool Contains(this EncounterTime t1, EncounterTime t2) { if (t1 == t2 || t1 == EncounterTime.Any || t2 == EncounterTime.Any) diff --git a/PKHeX.Core/Legality/Structures/EncounterTrade.cs b/PKHeX.Core/Legality/Structures/EncounterTrade.cs index 48f4e4ccf..4c3d8a910 100644 --- a/PKHeX.Core/Legality/Structures/EncounterTrade.cs +++ b/PKHeX.Core/Legality/Structures/EncounterTrade.cs @@ -1,5 +1,11 @@ namespace PKHeX.Core { + /// + /// Trade Encounter data + /// + /// + /// Trade data is fixed level in all cases except for the first few generations of games. + /// public class EncounterTrade : IEncounterable, IMoveset, IGeneration { public int Species { get; set; } @@ -36,11 +42,20 @@ public class EncounterTrade : IEncounterable, IMoveset, IGeneration }; } + /// + /// Trade Encounter data with a fixed PID. + /// public class EncounterTradePID : EncounterTrade { public uint PID; } + /// + /// Trade Encounter data with a fixed Catch Rate + /// + /// + /// Generation 1 specific value used in detecting unmodified/untraded Generation 1 Trade Encounter data. + /// public class EncounterTradeCatchRate : EncounterTrade { public uint Catch_Rate; diff --git a/PKHeX.Core/Legality/Structures/EncounterType.cs b/PKHeX.Core/Legality/Structures/EncounterType.cs index a2c329cb2..1235970fa 100644 --- a/PKHeX.Core/Legality/Structures/EncounterType.cs +++ b/PKHeX.Core/Legality/Structures/EncounterType.cs @@ -1,5 +1,13 @@ namespace PKHeX.Core { + /// + /// Tile type the was encountered from. + /// + /// + /// Used in Generation 4 games, this value is set depending on what type of overworld tile the player is standing on when the is obtained. + /// Some locations have multiple tile types, requiring multiple values possible. + /// May be worthwhile to convert this and associated to bitflags for supporting 3+ tile types (or the ability to not be specific for combinations permitted). + /// public enum EncounterType { Headbutt_Grass = -1, // None or TallGrass diff --git a/PKHeX.Core/Legality/Structures/EvolutionTree.cs b/PKHeX.Core/Legality/Structures/EvolutionTree.cs index 659d74e0f..38c2d84e1 100644 --- a/PKHeX.Core/Legality/Structures/EvolutionTree.cs +++ b/PKHeX.Core/Legality/Structures/EvolutionTree.cs @@ -4,6 +4,12 @@ namespace PKHeX.Core { + /// + /// Generation specific Evolution Tree data. + /// + /// + /// Used to determine if a can evolve from prior steps in its evolution branch. + /// public class EvolutionTree { private static readonly EvolutionTree Evolves1; @@ -207,10 +213,16 @@ public IEnumerable GetValidPreEvolutions(PKM pkm, int maxLevel, int ma } } + /// + /// Table of Evolution Branch Entries + /// public abstract class EvolutionSet { public EvolutionMethod[] PossibleEvolutions; } + /// + /// Generation 1 Evolution Branch Entries + /// public class EvolutionSet1 : EvolutionSet { private static EvolutionMethod GetMethod(byte[] data, ref int offset) @@ -263,6 +275,9 @@ public static List GetArray(byte[] data, int maxSpecies) return evos; } } + /// + /// Generation 2 Evolution Branch Entries + /// public class EvolutionSet2 : EvolutionSet { private static EvolutionMethod GetMethod(byte[] data, ref int offset) @@ -299,6 +314,9 @@ public static List GetArray(byte[] data, int maxSpecies) return evos; } } + /// + /// Generation 3 Evolution Branch Entries + /// public class EvolutionSet3 : EvolutionSet { private static EvolutionMethod GetMethod(byte[] data, int offset) @@ -358,6 +376,9 @@ public static List GetArray(byte[] data) return evos.ToList(); } } + /// + /// Generation 4 Evolution Branch Entries + /// public class EvolutionSet4 : EvolutionSet { private static EvolutionMethod GetMethod(byte[] data, int offset) @@ -410,6 +431,9 @@ public static List GetArray(byte[] data) return evos; } } + /// + /// Generation 5 Evolution Branch Entries + /// public class EvolutionSet5 : EvolutionSet { private static EvolutionMethod GetMethod(byte[] data, int offset) @@ -457,6 +481,9 @@ public static List GetArray(byte[] data) return evos; } } + /// + /// Generation 6 Evolution Branch Entries + /// public class EvolutionSet6 : EvolutionSet { private static readonly HashSet argEvos = new HashSet {6, 8, 16, 17, 18, 19, 20, 21, 22, 29, 30, 32, 33, 34}; @@ -484,6 +511,9 @@ public EvolutionSet6(byte[] data) } } } + /// + /// Generation 7 Evolution Branch Entries + /// public class EvolutionSet7 : EvolutionSet { private const int SIZE = 8; @@ -503,6 +533,10 @@ public EvolutionSet7(byte[] data) } } } + + /// + /// Criteria for evolving to this branch in the + /// public class EvolutionMethod { public int Method; @@ -624,7 +658,9 @@ public EvolutionMethod Copy(int species = -1) } } - // Informatics + /// + /// Informatics pertaining to a 's evolution lineage. + /// public class EvolutionLineage { public readonly List Chain = new List(); @@ -720,6 +756,9 @@ private static void UpdateMinValues(IReadOnlyCollection dl, EvolutionM last.RequiresLvlUp = evo.RequiresLevelUp; } } + /// + /// Evolution Stage Entries + /// public struct EvolutionStage { public List StageEntryMethods; diff --git a/PKHeX.Core/Legality/Structures/GBEncounterData.cs b/PKHeX.Core/Legality/Structures/GBEncounterData.cs index 7adb07b15..29ae9cfb7 100644 --- a/PKHeX.Core/Legality/Structures/GBEncounterData.cs +++ b/PKHeX.Core/Legality/Structures/GBEncounterData.cs @@ -2,7 +2,10 @@ namespace PKHeX.Core { - public enum GBEncounterType + /// + /// Generation 1/2 Encounter Data type, which serves as a 'best match' priority rating when returning from a list. + /// + internal enum GBEncounterType { EggEncounter, WildEncounter, @@ -12,12 +15,15 @@ public enum GBEncounterType TradeEncounterG2, } + /// + /// Generation 1/2 Encounter Data wrapper for storing supplemental information about the encounter. + /// public class GBEncounterData : IEncounterable { - public readonly int Level; + private readonly int Level; public readonly GameVersion Game; public readonly int Generation; - public readonly GBEncounterType Type; + internal readonly GBEncounterType Type; public readonly IEncounterable Encounter; public int Species => Encounter.Species; diff --git a/PKHeX.Core/Legality/Structures/IEncounterable.cs b/PKHeX.Core/Legality/Structures/IEncounterable.cs index 42cf68b51..2156bb3f2 100644 --- a/PKHeX.Core/Legality/Structures/IEncounterable.cs +++ b/PKHeX.Core/Legality/Structures/IEncounterable.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Common Encounter Properties base interface. + /// public interface IEncounterable { int Species { get; } @@ -17,15 +20,13 @@ private static bool IsWithinRange(this IEncounterable encounter, int lvl) } public static bool IsWithinRange(this IEncounterable encounter, PKM pkm) { - if (pkm.HasOriginalMetLocation) - { - if (encounter.EggEncounter) - return pkm.CurrentLevel == Legal.GetEggHatchLevel(pkm); - if (encounter is MysteryGift g) - return pkm.CurrentLevel == g.Level; - return pkm.CurrentLevel == pkm.Met_Level; - } - return encounter.IsWithinRange(pkm.CurrentLevel); + if (!pkm.HasOriginalMetLocation) + return encounter.IsWithinRange(pkm.CurrentLevel); + if (encounter.EggEncounter) + return pkm.CurrentLevel == Legal.GetEggHatchLevel(pkm); + if (encounter is MysteryGift g) + return pkm.CurrentLevel == g.Level; + return pkm.CurrentLevel == pkm.Met_Level; } internal static string GetEncounterTypeName(this IEncounterable Encounter) => Encounter?.Name ?? "Unknown"; } diff --git a/PKHeX.Core/Legality/Structures/IGeneration.cs b/PKHeX.Core/Legality/Structures/IGeneration.cs index e49264c0a..911c982d1 100644 --- a/PKHeX.Core/Legality/Structures/IGeneration.cs +++ b/PKHeX.Core/Legality/Structures/IGeneration.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Interface that exposes a Generation value for the object. + /// internal interface IGeneration { int Generation { get; } diff --git a/PKHeX.Core/Legality/Structures/IMoveset.cs b/PKHeX.Core/Legality/Structures/IMoveset.cs index 423cd4d37..63f53badc 100644 --- a/PKHeX.Core/Legality/Structures/IMoveset.cs +++ b/PKHeX.Core/Legality/Structures/IMoveset.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Interface that exposes a Moveset for the object. + /// internal interface IMoveset { int[] Moves { get; set; } diff --git a/PKHeX.Core/Legality/Structures/Nature.cs b/PKHeX.Core/Legality/Structures/Nature.cs index c737b4806..73ce7038e 100644 --- a/PKHeX.Core/Legality/Structures/Nature.cs +++ b/PKHeX.Core/Legality/Structures/Nature.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Nature ID values for the corresponding English nature name. + /// public enum Nature { Random = -1, diff --git a/PKHeX.Core/Legality/Structures/SlotType.cs b/PKHeX.Core/Legality/Structures/SlotType.cs index 7e6741735..d82226df7 100644 --- a/PKHeX.Core/Legality/Structures/SlotType.cs +++ b/PKHeX.Core/Legality/Structures/SlotType.cs @@ -1,5 +1,10 @@ namespace PKHeX.Core { + /// + /// Wild Encounter data Type + /// + /// + /// Different from , this corresponds to the method that the may be encountered. public enum SlotType { Any, diff --git a/PKHeX.Core/Legality/Structures/TradebackType.cs b/PKHeX.Core/Legality/Structures/TradebackType.cs index 02d28c12f..83bc9eb92 100644 --- a/PKHeX.Core/Legality/Structures/TradebackType.cs +++ b/PKHeX.Core/Legality/Structures/TradebackType.cs @@ -1,5 +1,9 @@ namespace PKHeX.Core { + /// + /// Indicates if the is required to be traded between Generation 1/2 saves. + /// + /// Used for only Generation 1/2 data. public enum TradebackType { Any, diff --git a/PKHeX.Core/Legality/Structures/ValidEncounterMoves.cs b/PKHeX.Core/Legality/Structures/ValidEncounterMoves.cs index 99082e965..154c0414e 100644 --- a/PKHeX.Core/Legality/Structures/ValidEncounterMoves.cs +++ b/PKHeX.Core/Legality/Structures/ValidEncounterMoves.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Object which stores information useful for analyzing a moveset relative to the encounter data. + /// public class ValidEncounterMoves { public int EncounterSpecies { get; } diff --git a/PKHeX.Core/Legality/VivillonTables.cs b/PKHeX.Core/Legality/VivillonTables.cs index e13cbb844..db3a5022f 100644 --- a/PKHeX.Core/Legality/VivillonTables.cs +++ b/PKHeX.Core/Legality/VivillonTables.cs @@ -242,18 +242,26 @@ private struct FormSubregionTable }, }; - public static bool CheckVivillonPattern(int form, int pkmcountry, int pkmregion) + /// + /// Compares the Vivillon pattern against its country and region to determine if the pattern is able to be obtained legally. + /// + /// Alternate Forme Pattern + /// Country ID + /// Console Region ID + /// + public static bool CheckVivillonPattern(int form, int country, int region) { - if (!VivillonCountryTable[form].Contains(pkmcountry)) + if (!VivillonCountryTable[form].Contains(country)) return false; // Country mismatch - if (RegionFormTable.All(c => c.countryID != pkmcountry)) + + CountryTable ct = RegionFormTable.Where(t => t.countryID == country).FirstOrDefault(); + if (ct.otherforms == null) // empty struct = no forms referenced return true; // No subregion table - CountryTable ct = RegionFormTable.Where(t => t.countryID == pkmcountry).ToArray()[0]; if (ct.mainform == form) - return !ct.otherforms.SelectMany(e => e.region).Contains(pkmregion); //true if Mainform not in other specific region + return !ct.otherforms.Any(e => e.region.Contains(region)); //true if Mainform not in other specific region - return ct.otherforms.Any(e => e.form == form && e.region.Contains(pkmregion)); + return ct.otherforms.Any(e => e.form == form && e.region.Contains(region)); } } } \ No newline at end of file diff --git a/PKHeX.Core/Legality/WordFilter.cs b/PKHeX.Core/Legality/WordFilter.cs index 116dee3b1..5710c8f46 100644 --- a/PKHeX.Core/Legality/WordFilter.cs +++ b/PKHeX.Core/Legality/WordFilter.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Bad-word Filter class containing logic to check against unsavory regular expressions. + /// public static class WordFilter { /// diff --git a/PKHeX.Core/MysteryGifts/PL6.cs b/PKHeX.Core/MysteryGifts/PL6.cs index 64aedeff1..7890a6041 100644 --- a/PKHeX.Core/MysteryGifts/PL6.cs +++ b/PKHeX.Core/MysteryGifts/PL6.cs @@ -4,7 +4,14 @@ namespace PKHeX.Core { - public class PL6 //: PokemonLink + /// + /// Pokemon Link Data Storage + /// + /// + /// This Template object is very similar to the structure in that it stores more data than just the gift. + /// This template object is only present in Generation 6 save files. + /// + public class PL6 { public const int Size = 0xA47; public const string Filter = "Pokémon Link Data|*.pl6|All Files (*.*)|*.*"; @@ -14,13 +21,17 @@ public PL6(byte[] data = null) { Data = (byte[])(data?.Clone() ?? new byte[Size]); } - // Pokémon Link Flag + /// + /// Pokémon Link Flag + /// public byte PL_Flag { get => Data[0x00]; set => Data[0x00] = value; } public bool PL_enabled { get => PL_Flag != 0; set => PL_Flag = (byte)(value ? 1 << 7 : 0); } - - //Name of data source + + /// + /// Name of data source + /// public string Origin_app { get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x01, 0x6E)); set => Encoding.Unicode.GetBytes(value.PadRight(54 + 1, '\0')).CopyTo(Data, 0x01); @@ -171,9 +182,15 @@ public int[] Quantities set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4A3); } } - public class PL6_PKM : IEncounterable + /// + /// Pokemon Link Gift Template + /// + /// + /// This Template object is very similar to the structure and similar objects, in that the structure offsets are ordered the same. + /// This template object is only present in Generation 6 save files. + /// + public class PL6_PKM : IEncounterable, IRibbonSetEvent3, IRibbonSetEvent4 { - internal const int Size = 0xA0; public readonly byte[] Data; @@ -289,22 +306,22 @@ public PL6_PKM(byte[] data = null) public int OT_Feeling { get => Data[0x7C]; set => Data[0x7C] = (byte)value; } private byte RIB0 { get => Data[0x0C]; set => Data[0x0C] = value; } - public bool RIB0_0 { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Battle Champ Ribbon - public bool RIB0_1 { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Regional Champ Ribbon - public bool RIB0_2 { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // National Champ Ribbon - public bool RIB0_3 { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Country Ribbon - public bool RIB0_4 { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // National Ribbon - public bool RIB0_5 { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Earth Ribbon - public bool RIB0_6 { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // World Ribbon - public bool RIB0_7 { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Event Ribbon + public bool RibbonChampionBattle { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Battle Champ Ribbon + public bool RibbonChampionRegional { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Regional Champ Ribbon + public bool RibbonChampionNational { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // National Champ Ribbon + public bool RibbonCountry { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Country Ribbon + public bool RibbonNational { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // National Ribbon + public bool RibbonEarth { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Earth Ribbon + public bool RibbonWorld { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // World Ribbon + public bool RibbonEvent { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Event Ribbon private byte RIB1 { get => Data[0x0D]; set => Data[0x0D] = value; } - public bool RIB1_0 { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // World Champ Ribbon - public bool RIB1_1 { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Birthday Ribbon - public bool RIB1_2 { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Special Ribbon - public bool RIB1_3 { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Souvenir Ribbon - public bool RIB1_4 { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Wishing Ribbon - public bool RIB1_5 { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Classic Ribbon - public bool RIB1_6 { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Premier Ribbon + public bool RibbonChampionWorld { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // World Champ Ribbon + public bool RibbonBirthday { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Birthday Ribbon + public bool RibbonSpecial { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Special Ribbon + public bool RibbonSouvenir { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Souvenir Ribbon + public bool RibbonWishing { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Wishing Ribbon + public bool RibbonClassic { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Classic Ribbon + public bool RibbonPremier { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Premier Ribbon public bool RIB1_7 { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Empty public int[] Moves diff --git a/PKHeX.Core/MysteryGifts/WC3.cs b/PKHeX.Core/MysteryGifts/WC3.cs index 2577ec763..2bce68aef 100644 --- a/PKHeX.Core/MysteryGifts/WC3.cs +++ b/PKHeX.Core/MysteryGifts/WC3.cs @@ -2,6 +2,13 @@ namespace PKHeX.Core { + /// + /// Generation 3 Mystery Gift Template File + /// + /// + /// This is fabricated data built to emulate the future generation Mystery Gift objects. + /// Data here is not stored in any save file and cannot be naturally exported. + /// public class WC3 : MysteryGift, IRibbonSetEvent3 { // Template Properties diff --git a/PKHeX.Core/PKM/BK4.cs b/PKHeX.Core/PKM/BK4.cs index c8cabda3b..c53a32769 100644 --- a/PKHeX.Core/PKM/BK4.cs +++ b/PKHeX.Core/PKM/BK4.cs @@ -3,7 +3,9 @@ namespace PKHeX.Core { - public class BK4 : PKM // Big Endian 4th Generation PKM File + /// Generation 4 format, exclusively for Pokémon Battle Revolution. + /// Values are stored in Big Endian format rather than Little Endian. Beware. + public class BK4 : PKM { public static readonly byte[] ExtraBytes = { diff --git a/PKHeX.Core/PKM/CK3.cs b/PKHeX.Core/PKM/CK3.cs index edf60997f..64f60a706 100644 --- a/PKHeX.Core/PKM/CK3.cs +++ b/PKHeX.Core/PKM/CK3.cs @@ -2,6 +2,7 @@ namespace PKHeX.Core { + /// Generation 3 format, exclusively for Pokémon Colosseum. public class CK3 : PKM, IRibbonSetEvent3, IRibbonSetCommon3, IRibbonSetUnique3, IRibbonSetOnly3, IShadowPKM { public static readonly byte[] ExtraBytes = diff --git a/PKHeX.Core/PKM/IShadowPKM.cs b/PKHeX.Core/PKM/IShadowPKM.cs index fdc0290ce..9b926f2a3 100644 --- a/PKHeX.Core/PKM/IShadowPKM.cs +++ b/PKHeX.Core/PKM/IShadowPKM.cs @@ -1,5 +1,9 @@ namespace PKHeX.Core { + /// + /// Interface that exposes Shadow details for the object. + /// + /// Used only for Colosseum/XD that were shadow encounters. public interface IShadowPKM { int ShadowID { get; set; } diff --git a/PKHeX.Core/PKM/ItemConverter.cs b/PKHeX.Core/PKM/ItemConverter.cs index 0c56d30ba..e9c1b7fae 100644 --- a/PKHeX.Core/PKM/ItemConverter.cs +++ b/PKHeX.Core/PKM/ItemConverter.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Logic for converting Item IDs between the generation specific value sets. + /// internal static class ItemConverter { /// Unused item ID, placeholder for item/sprite finding diff --git a/PKHeX.Core/PKM/PK1.cs b/PKHeX.Core/PKM/PK1.cs index 170302f5f..c1e12d30a 100644 --- a/PKHeX.Core/PKM/PK1.cs +++ b/PKHeX.Core/PKM/PK1.cs @@ -5,6 +5,7 @@ namespace PKHeX.Core { + /// Generation 1 format. public class PK1 : PKM { // Internal use only diff --git a/PKHeX.Core/PKM/PK2.cs b/PKHeX.Core/PKM/PK2.cs index 772565e31..2507a72f3 100644 --- a/PKHeX.Core/PKM/PK2.cs +++ b/PKHeX.Core/PKM/PK2.cs @@ -5,6 +5,7 @@ namespace PKHeX.Core { + /// Generation 2 format. public class PK2 : PKM { // Internal use only diff --git a/PKHeX.Core/PKM/PK3.cs b/PKHeX.Core/PKM/PK3.cs index b828090b7..1d36c522e 100644 --- a/PKHeX.Core/PKM/PK3.cs +++ b/PKHeX.Core/PKM/PK3.cs @@ -2,6 +2,7 @@ namespace PKHeX.Core { + /// Generation 3 format. public class PK3 : PKM, IRibbonSetEvent3, IRibbonSetCommon3, IRibbonSetUnique3, IRibbonSetOnly3 { public static readonly byte[] ExtraBytes = diff --git a/PKHeX.Core/PKM/PK4.cs b/PKHeX.Core/PKM/PK4.cs index 6f81d86ac..a2056d7eb 100644 --- a/PKHeX.Core/PKM/PK4.cs +++ b/PKHeX.Core/PKM/PK4.cs @@ -3,6 +3,7 @@ namespace PKHeX.Core { + /// Generation 4 format. public class PK4 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetUnique3, IRibbonSetUnique4, IRibbonSetCommon3, IRibbonSetCommon4 { public static readonly byte[] ExtraBytes = diff --git a/PKHeX.Core/PKM/PK5.cs b/PKHeX.Core/PKM/PK5.cs index 49b99ef77..9e8d9766a 100644 --- a/PKHeX.Core/PKM/PK5.cs +++ b/PKHeX.Core/PKM/PK5.cs @@ -3,6 +3,7 @@ namespace PKHeX.Core { + /// Generation 5 format. public class PK5 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetUnique3, IRibbonSetUnique4, IRibbonSetCommon3, IRibbonSetCommon4 { public static readonly byte[] ExtraBytes = diff --git a/PKHeX.Core/PKM/PK6.cs b/PKHeX.Core/PKM/PK6.cs index 949cdc666..e03f7c4e3 100644 --- a/PKHeX.Core/PKM/PK6.cs +++ b/PKHeX.Core/PKM/PK6.cs @@ -3,6 +3,7 @@ namespace PKHeX.Core { + /// Generation 6 format. public class PK6 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetCommon6 { public static readonly byte[] ExtraBytes = diff --git a/PKHeX.Core/PKM/PK7.cs b/PKHeX.Core/PKM/PK7.cs index 1591ad939..fc8be2deb 100644 --- a/PKHeX.Core/PKM/PK7.cs +++ b/PKHeX.Core/PKM/PK7.cs @@ -3,6 +3,7 @@ namespace PKHeX.Core { + /// Generation 7 format. public class PK7 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, IRibbonSetCommon4, IRibbonSetCommon6, IRibbonSetCommon7 { public static readonly byte[] ExtraBytes = diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 406e4cd5f..866c3bd94 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Object representing a 's data and derived properties. + /// public abstract class PKM { public static readonly string[] Extensions = PKX.GetPKMExtensions(); diff --git a/PKHeX.Core/PKM/PKMConverter.cs b/PKHeX.Core/PKM/PKMConverter.cs index 73431ac4e..630c8f7c7 100644 --- a/PKHeX.Core/PKM/PKMConverter.cs +++ b/PKHeX.Core/PKM/PKMConverter.cs @@ -5,6 +5,9 @@ namespace PKHeX.Core { + /// + /// Logic for converting a from one generation specific format to another. + /// public static class PKMConverter { public static int Country { get; private set; } = 49; diff --git a/PKHeX.Core/PKM/ShowdownSet.cs b/PKHeX.Core/PKM/ShowdownSet.cs index e2f58100b..45fbea2a4 100644 --- a/PKHeX.Core/PKM/ShowdownSet.cs +++ b/PKHeX.Core/PKM/ShowdownSet.cs @@ -4,6 +4,9 @@ namespace PKHeX.Core { + /// + /// Logic for exporting and importing data in Pokémon Showdown's text format. + /// public class ShowdownSet { // String to Values @@ -285,7 +288,7 @@ private void ParseSpeciesNickname(ref string line) { n1 = line.Substring(0, index - 1); n2 = line.Substring(index).Trim(); - ReplaceAll(ref n2, "", "[", "]", "(", ")"); // Trim out excess data + n2 = ReplaceAll(n2, string.Empty, "[", "]", "(", ")"); // Trim out excess data } else // nickname first (manually created set, incorrect) { @@ -308,7 +311,7 @@ private string ParseLineMove(string line) if (moveString.Length > 13) { string type = moveString.Remove(0, 13); - ReplaceAll(ref type, "", "[", "]", "(", ")"); // Trim out excess data + type = ReplaceAll(type, string.Empty, "[", "]", "(", ")"); // Trim out excess data int hpVal = Array.IndexOf(hptypes, type); // Get HP Type if (hpVal >= 0) IVs = PKX.SetHPIVs(hpVal, IVs); // Get IVs @@ -418,9 +421,9 @@ private static string[] SplitLineStats(string line) .Replace("SDef", "SpD").Replace("Sp Def", "SpD") .Replace("Spd", "Spe").Replace("Speed", "Spe").Split(new[] { " / ", " " }, StringSplitOptions.None); } - private static void ReplaceAll(ref string rv, string o, params string[] i) + private static string ReplaceAll(string original, string to, params string[] toBeReplaced) { - rv = i.Aggregate(rv, (current, v) => current.Replace(v, o)); + return toBeReplaced.Aggregate(original, (current, v) => current.Replace(v, to)); } } } diff --git a/PKHeX.Core/PKM/SpeciesConverter.cs b/PKHeX.Core/PKM/SpeciesConverter.cs index 2b0415763..c146d56a0 100644 --- a/PKHeX.Core/PKM/SpeciesConverter.cs +++ b/PKHeX.Core/PKM/SpeciesConverter.cs @@ -3,6 +3,10 @@ namespace PKHeX.Core { + /// + /// Logic for converting a National Pokédex Species ID to/from generation specific values. + /// + /// Generation 4+ always use the national dex ID. Prior generations do not. internal static class SpeciesConverter { /// diff --git a/PKHeX.Core/PKM/StringConverter.cs b/PKHeX.Core/PKM/StringConverter.cs index 85c8bf314..699e82b1a 100644 --- a/PKHeX.Core/PKM/StringConverter.cs +++ b/PKHeX.Core/PKM/StringConverter.cs @@ -5,6 +5,9 @@ namespace PKHeX.Core { + /// + /// Logic for converting a between the various generation specific encoding formats. + /// public static class StringConverter { /// diff --git a/PKHeX.Core/PKM/XK3.cs b/PKHeX.Core/PKM/XK3.cs index d76aa3939..67e352870 100644 --- a/PKHeX.Core/PKM/XK3.cs +++ b/PKHeX.Core/PKM/XK3.cs @@ -2,6 +2,7 @@ namespace PKHeX.Core { + /// Generation 3 format, exclusively for Pokémon XD. public class XK3 : PKM, IRibbonSetEvent3, IRibbonSetCommon3, IRibbonSetUnique3, IRibbonSetOnly3, IShadowPKM { public static readonly byte[] ExtraBytes = diff --git a/PKHeX.Core/PersonalInfo/PersonalInfo.cs b/PKHeX.Core/PersonalInfo/PersonalInfo.cs index a9a09753b..b0a3c949b 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfo.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfo.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Stat/misc data for individual species or their associated alternate forme data. + /// public abstract class PersonalInfo { protected byte[] Data; @@ -59,8 +62,15 @@ protected static byte[] SetBits(bool[] bits) return data; } - public void AddTMHM(byte[] data) => TMHM = GetBits(data); - public void AddTypeTutors(byte[] data) => TypeTutors = GetBits(data); + /// + /// Injects supplementary TM/HM compatibility which is not present in the generation specific PersonalInfo format. + /// + /// + internal void AddTMHM(byte[] data) => TMHM = GetBits(data); + /// + /// Injects supplementary Type Tutor compatibility which is not present in the generation specific PersonalInfo format. + /// + internal void AddTypeTutors(byte[] data) => TypeTutors = GetBits(data); // Data Manipulation public int FormeIndex(int species, int forme) @@ -87,7 +97,7 @@ public int RandomGender case 0: // Male return 0; default: - return (int)(Util.Rand32() % 2); + return (int)(Util.Rand32() & 1); } } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoB2W2.cs b/PKHeX.Core/PersonalInfo/PersonalInfoB2W2.cs index 8ada11418..804c988d6 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoB2W2.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoB2W2.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// class with values from the Black 2 & White 2 games. + /// public class PersonalInfoB2W2 : PersonalInfoBW { public new const int SIZE = 0x4C; diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs b/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs index edc3b879d..97bfce025 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// class with values from the Black & White games. + /// public class PersonalInfoBW : PersonalInfo { protected PersonalInfoBW() { } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs index 3b45e3eea..181f04de8 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// class with values from Generation 1 games. + /// public class PersonalInfoG1 : PersonalInfo { protected PersonalInfoG1() { } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs index 46f2077e0..7225771f0 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// class with values from Generation 2 games. + /// public class PersonalInfoG2 : PersonalInfo { protected PersonalInfoG2() { } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs index f0236e345..660fcaab6 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// class with values from Generation 3 games. + /// public class PersonalInfoG3 : PersonalInfo { protected PersonalInfoG3() { } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs index 3765e6310..46c8c81e1 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// class with values from Generation 4 games. + /// public class PersonalInfoG4 : PersonalInfoG3 { public new const int SIZE = 0x2C; diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoORAS.cs b/PKHeX.Core/PersonalInfo/PersonalInfoORAS.cs index 020805e93..91d237e1d 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoORAS.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoORAS.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// class with values from the OR & AS games. + /// public class PersonalInfoORAS : PersonalInfoXY { public new const int SIZE = 0x50; diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs b/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs index fbe952584..d7fd2b148 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// class with values from the Sun/Moon games. + /// public class PersonalInfoSM : PersonalInfoXY { public new const int SIZE = 0x54; diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoXY.cs b/PKHeX.Core/PersonalInfo/PersonalInfoXY.cs index 04203c75d..200dc50b0 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoXY.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoXY.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// class with values from the X & Y games. + /// public class PersonalInfoXY : PersonalInfoBW { protected PersonalInfoXY() { } // For ORAS diff --git a/PKHeX.Core/PersonalInfo/PersonalTable.cs b/PKHeX.Core/PersonalInfo/PersonalTable.cs index 1dd0fa5ff..681a7eb5c 100644 --- a/PKHeX.Core/PersonalInfo/PersonalTable.cs +++ b/PKHeX.Core/PersonalInfo/PersonalTable.cs @@ -4,6 +4,12 @@ namespace PKHeX.Core { + /// + /// table (array). + /// + /// + /// Serves as the main object that is accessed for stat data in a particular generation/game format. + /// public class PersonalTable { public static readonly PersonalTable USUM = GetTable("sm", GameVersion.USUM); @@ -151,14 +157,12 @@ private PersonalTable(byte[] data, GameVersion format) public int[] GetAbilities(int species, int forme) { - if (species >= Table.Length) - { species = 0; Debug.WriteLine("Requested out of bounds SpeciesID"); } - return this[GetFormeIndex(species, forme)].Abilities; + return GetFormeEntry(species, forme).Abilities; } public int GetFormeIndex(int species, int forme) { if (species >= Table.Length) - { species = 0; Debug.WriteLine("Requested out of bounds SpeciesID"); } + { species = 0; Debug.WriteLine($"Requested out of bounds {nameof(species)}: {species} (max={Table.Length-1}"); } return this[species].FormeIndex(species, forme); } public PersonalInfo GetFormeEntry(int species, int forme) diff --git a/PKHeX.Core/Saves/SAV1.cs b/PKHeX.Core/Saves/SAV1.cs index 0636c7331..13764e349 100644 --- a/PKHeX.Core/Saves/SAV1.cs +++ b/PKHeX.Core/Saves/SAV1.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Generation 1 object. + /// public sealed class SAV1 : SaveFile { public override string BAKName => $"{FileName} [{OT} ({Version}) - {PlayTimeString}].bak"; diff --git a/PKHeX.Core/Saves/SAV2.cs b/PKHeX.Core/Saves/SAV2.cs index fabe51306..e88074f5b 100644 --- a/PKHeX.Core/Saves/SAV2.cs +++ b/PKHeX.Core/Saves/SAV2.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Generation 2 object. + /// public sealed class SAV2 : SaveFile { public override string BAKName => $"{FileName} [{OT} ({Version}) - {PlayTimeString}].bak"; diff --git a/PKHeX.Core/Saves/SAV3.cs b/PKHeX.Core/Saves/SAV3.cs index 58ac3022b..219e2ebbe 100644 --- a/PKHeX.Core/Saves/SAV3.cs +++ b/PKHeX.Core/Saves/SAV3.cs @@ -4,6 +4,9 @@ namespace PKHeX.Core { + /// + /// Generation 3 object. + /// public sealed class SAV3 : SaveFile { public override string BAKName => $"{FileName} [{OT} ({Version}) - {PlayTimeString}].bak"; diff --git a/PKHeX.Core/Saves/SAV3Colosseum.cs b/PKHeX.Core/Saves/SAV3Colosseum.cs index 2c6557cd1..9c4ba2bf3 100644 --- a/PKHeX.Core/Saves/SAV3Colosseum.cs +++ b/PKHeX.Core/Saves/SAV3Colosseum.cs @@ -4,6 +4,9 @@ namespace PKHeX.Core { + /// + /// Generation 3 object for Pokémon Colosseum saves. + /// public sealed class SAV3Colosseum : SaveFile, IDisposable { public override string BAKName => $"{FileName} [{OT} ({Version}) - {PlayTimeString}].bak"; diff --git a/PKHeX.Core/Saves/SAV3GCMemoryCard.cs b/PKHeX.Core/Saves/SAV3GCMemoryCard.cs index ea1a8b31e..e2c3c284e 100644 --- a/PKHeX.Core/Saves/SAV3GCMemoryCard.cs +++ b/PKHeX.Core/Saves/SAV3GCMemoryCard.cs @@ -8,6 +8,9 @@ namespace PKHeX.Core * https://github.com/dolphin-emu/dolphin/ */ + /// + /// Flags for indicating what data is present in the Memory Card + /// public enum GCMemoryCardState { Invalid, @@ -21,6 +24,9 @@ public enum GCMemoryCardState DuplicateRSBOX, } + /// + /// GameCube save container which may or may not contain Generation 3 objects. + /// public sealed class SAV3GCMemoryCard { private const int BLOCK_SIZE = 0x2000; diff --git a/PKHeX.Core/Saves/SAV3RSBox.cs b/PKHeX.Core/Saves/SAV3RSBox.cs index 0ce42cc85..0eb77b727 100644 --- a/PKHeX.Core/Saves/SAV3RSBox.cs +++ b/PKHeX.Core/Saves/SAV3RSBox.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Generation 3 object for Pokémon Ruby Sapphire Box saves. + /// public sealed class SAV3RSBox : SaveFile { public override string BAKName => $"{FileName} [{Version} #{SaveCount:0000}].bak"; diff --git a/PKHeX.Core/Saves/SAV3XD.cs b/PKHeX.Core/Saves/SAV3XD.cs index daa173e0b..a3217ee44 100644 --- a/PKHeX.Core/Saves/SAV3XD.cs +++ b/PKHeX.Core/Saves/SAV3XD.cs @@ -3,6 +3,9 @@ namespace PKHeX.Core { + /// + /// Generation 3 object for Pokémon XD saves. + /// public sealed class SAV3XD : SaveFile { public override string BAKName => $"{FileName} [{OT} ({Version}) #{SaveCount:0000}].bak"; diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index 81da4543e..3824e8dc7 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -4,6 +4,9 @@ namespace PKHeX.Core { + /// + /// Generation 4 object. + /// public sealed class SAV4 : SaveFile { public override string BAKName => $"{FileName} [{OT} ({Version}) - {PlayTimeString}].bak"; diff --git a/PKHeX.Core/Saves/SAV4BR.cs b/PKHeX.Core/Saves/SAV4BR.cs index cb2f46e4a..f329b330b 100644 --- a/PKHeX.Core/Saves/SAV4BR.cs +++ b/PKHeX.Core/Saves/SAV4BR.cs @@ -5,6 +5,9 @@ namespace PKHeX.Core { + /// + /// Generation 4 object for Pokémon Battle Revolution saves. + /// public sealed class SAV4BR : SaveFile { public override string BAKName => $"{FileName} [{Version} #{SaveCount:0000}].bak"; diff --git a/PKHeX.Core/Saves/SAV5.cs b/PKHeX.Core/Saves/SAV5.cs index 954eab793..901582bcb 100644 --- a/PKHeX.Core/Saves/SAV5.cs +++ b/PKHeX.Core/Saves/SAV5.cs @@ -6,6 +6,9 @@ namespace PKHeX.Core { + /// + /// Generation 5 object. + /// public sealed class SAV5 : SaveFile { // Save Data Attributes diff --git a/PKHeX.Core/Saves/SAV6.cs b/PKHeX.Core/Saves/SAV6.cs index c4f234275..61d4b9129 100644 --- a/PKHeX.Core/Saves/SAV6.cs +++ b/PKHeX.Core/Saves/SAV6.cs @@ -6,6 +6,9 @@ namespace PKHeX.Core { + /// + /// Generation 6 object. + /// public sealed class SAV6 : SaveFile { // Save Data Attributes diff --git a/PKHeX.Core/Saves/SAV7.cs b/PKHeX.Core/Saves/SAV7.cs index 0e9b1d436..22a615b46 100644 --- a/PKHeX.Core/Saves/SAV7.cs +++ b/PKHeX.Core/Saves/SAV7.cs @@ -5,6 +5,9 @@ namespace PKHeX.Core { + /// + /// Generation 7 object. + /// public sealed class SAV7 : SaveFile { // Save Data Attributes diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 8c384414c..27b8dd772 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -5,7 +5,9 @@ namespace PKHeX.Core { - // Base Class for Save Files + /// + /// Base Class for Save Files + /// public abstract class SaveFile { public static bool SetUpdateDex { protected get; set; } = true; @@ -198,9 +200,8 @@ public IList PartyData if (value[0].Species == 0) Debug.WriteLine($"Empty first slot, received {value.Count}."); - PKM[] newParty = value.Where(pk => pk.Species != 0).ToArray(); - - Array.Resize(ref newParty, 6); + PKM[] newParty = new PKM[6]; + value.Where(pk => pk.Species != 0).CopyTo(newParty); for (int i = PartyCount; i < newParty.Length; i++) newParty[i] = BlankPKM; diff --git a/PKHeX.Core/Saves/SaveUtil.cs b/PKHeX.Core/Saves/SaveUtil.cs index a45c0dd91..06cf8be1c 100644 --- a/PKHeX.Core/Saves/SaveUtil.cs +++ b/PKHeX.Core/Saves/SaveUtil.cs @@ -6,6 +6,9 @@ namespace PKHeX.Core { + /// + /// Logic for data loading and manipulation. + /// public static class SaveUtil { public const int BEEF = 0x42454546; diff --git a/PKHeX.Core/Saves/Substructures/SaveObjects.cs b/PKHeX.Core/Saves/Substructures/SaveObjects.cs index 5e8a8b983..e74092043 100644 --- a/PKHeX.Core/Saves/Substructures/SaveObjects.cs +++ b/PKHeX.Core/Saves/Substructures/SaveObjects.cs @@ -13,6 +13,9 @@ public struct Daycare public ulong Seed; } + /// + /// Structure containing Mystery Gift Block Data + /// public struct MysteryGiftAlbum { public MysteryGift[] Gifts; diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 626ad950a..d79a750c5 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -586,14 +586,14 @@ private bool TryLoadPKM(byte[] input, string path, string ext, SaveFile SAV) if (pk == null) { WinFormsUtil.Alert("Conversion failed.", c); - return false; + return true; } - if (SAV.Generation < 3 && ((pk as PK1)?.Japanese ?? ((PK2)pk).Japanese) != SAV.Japanese) + if (SAV.Generation < 3 && pk.Japanese != SAV.Japanese) { var strs = new[] { "International", "Japanese" }; var val = SAV.Japanese ? 0 : 1; WinFormsUtil.Alert($"Cannot load {strs[val]} {pk.GetType().Name}s to {strs[val ^ 1]} saves."); - return false; + return true; } PKME_Tabs.PopulateFields(pk); @@ -607,7 +607,7 @@ private bool TryLoadPCBoxBin(byte[] input) if (!C_SAV.OpenPCBoxBin(input, out string c)) { WinFormsUtil.Alert("Binary is not compatible with save file.", c); - return false; + return true; } WinFormsUtil.Alert(c);