diff --git a/PKHeX.Core/PersonalInfo/PersonalInfo.cs b/PKHeX.Core/PersonalInfo/PersonalInfo.cs index e2141695e..4ce324889 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfo.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfo.cs @@ -5,15 +5,50 @@ /// public abstract class PersonalInfo { + /// + /// Raw Data + /// protected byte[] Data; + + /// + /// Writes entry to raw bytes. + /// + /// public abstract byte[] Write(); + + /// + /// Base HP + /// public abstract int HP { get; set; } + + /// + /// Base Attack + /// public abstract int ATK { get; set; } + + /// + /// Base Defense + /// public abstract int DEF { get; set; } + + /// + /// Base Speed + /// public abstract int SPE { get; set; } + + /// + /// Base Special Attack + /// public abstract int SPA { get; set; } + + /// + /// Base Special Defense + /// public abstract int SPD { get; set; } + /// + /// Base Stat values + /// public int[] Stats { get => new[] { HP, ATK, DEF, SPE, SPA, SPD }; @@ -28,34 +63,139 @@ public int[] Stats } } + /// + /// Amount of HP Effort Values to yield when defeating this entry. + /// public abstract int EV_HP { get; set; } + + /// + /// Amount of Attack Effort Values to yield when defeating this entry. + /// public abstract int EV_ATK { get; set; } + + /// + /// Amount of Defense Effort Values to yield when defeating this entry. + /// public abstract int EV_DEF { get; set; } + + /// + /// Amount of Speed Effort Values to yield when defeating this entry. + /// public abstract int EV_SPE { get; set; } + + /// + /// Amount of Special Attack Effort Values to yield when defeating this entry. + /// public abstract int EV_SPA { get; set; } + + /// + /// Amount of Special Defense Effort Values to yield when defeating this entry. + /// public abstract int EV_SPD { get; set; } + + /// + /// Primary Type + /// public abstract int Type1 { get; set; } + + /// + /// Secondary Type + /// public abstract int Type2 { get; set; } + + /// + /// First Egg Group + /// public abstract int EggGroup1 { get; set; } + + /// + /// Second Egg Group + /// public abstract int EggGroup2 { get; set; } + + /// + /// Catch Rate + /// public abstract int CatchRate { get; set; } + + /// + /// Evolution Stage value (or equivalent for unevolved). + /// public virtual int EvoStage { get; set; } + + /// + /// Held Items the entry can be randomly encountered with. + /// public abstract int[] Items { get; set; } + + /// + /// Gender Ratio value determining if the entry is a fixed gender or bigendered. + /// public abstract int Gender { get; set; } + + /// + /// Amount of Hatching Step Cycles required to hatch if in an egg. + /// public abstract int HatchCycles { get; set; } + + /// + /// Initial Friendship when captured or received. + /// public abstract int BaseFriendship { get; set; } + + /// + /// Experience-Level Growth Rate type + /// public abstract int EXPGrowth { get; set; } + + /// + /// Full list of values the entry can have. + /// public abstract int [] Abilities { get; set; } + + /// + /// Escape factor used for fleeing the Safari Zone or calling for help in SOS Battles. + /// public abstract int EscapeRate { get; set; } + + /// + /// Count of values the entry can have. + /// public virtual int FormeCount { get; set; } = 1; + + /// + /// Pointer to the first index + /// protected internal virtual int FormStatsIndex { get; set; } + + /// + /// Pointer to the sprite index. + /// public virtual int FormeSprite { get; set; } + + /// + /// Base Experience Yield factor + /// public abstract int BaseEXP { get; set; } + + /// + /// Main color ID of the entry. The majority of the pkm's color is of this color, usually. + /// public abstract int Color { get; set; } + /// + /// Height of the entry in meters (m). + /// public virtual int Height { get; set; } = 0; + + /// + /// Mass of the entry in kilograms (kg). + /// public virtual int Weight { get; set; } = 0; + /// + /// Dual Type IDs used for same-type attack bonuses, weakness, etc. + /// public int[] Types { get => new[] { Type1, Type2 }; @@ -66,6 +206,10 @@ public int[] Types Type2 = value[1]; } } + + /// + /// Dual Egg Group IDs used to determine if an egg should be created as a result of both parents sharing at least one group ID. + /// public int[] EggGroups { get => new[] { EggGroup1, EggGroup2 }; @@ -81,10 +225,12 @@ public int[] EggGroups /// TM/HM learn compatibility flags for individual moves. /// public bool[] TMHM { get; protected set; } + /// /// Grass-Fire-Water-Etc typed learn compatibility flags for individual moves. /// public bool[] TypeTutors { get; protected set; } + /// /// Special tutor learn compatibility flags for individual moves. /// @@ -114,6 +260,7 @@ protected static byte[] SetBits(bool[] bits) /// Starting offset to read at /// Amount of bytes to decompose into bits internal void AddTMHM(byte[] data, int start = 0, int length = -1) => TMHM = GetBits(data, start, length); + /// /// Injects supplementary Type Tutor compatibility which is not present in the generation specific format. /// @@ -139,6 +286,10 @@ public int FormeIndex(int species, int forme) return FormStatsIndex + forme - 1; } + + /// + /// Gets a random valid gender for the entry. + /// public int RandomGender { get @@ -153,21 +304,72 @@ public int RandomGender } } + /// + /// Indicates that the entry is exclusively Genderless. + /// public bool Genderless => Gender == 255; + + /// + /// Indicates that the entry is exclusively Female gendered. + /// public bool OnlyFemale => Gender == 254; + /// + /// Indicates that the entry is exclusively Male gendered. + /// public bool OnlyMale => Gender == 0; + + /// + /// Indicates if the entry has Formes or not. + /// public bool HasFormes => FormeCount > 1; + + /// + /// Base Stat Total sum of all stats. + /// public int BST => HP + ATK + DEF + SPE + SPA + SPD; + /// + /// Checks to see if the is valid within the + /// + /// + /// public bool IsFormeWithinRange(int forme) { if (forme == 0) return true; return forme < FormeCount; } + + /// + /// Checks to see if the provided Types match the entry's types. + /// + /// Input order matters! If input order does not matter, use . + /// First type + /// Second type + /// Typing is an exact match public bool IsValidTypeCombination(int type1, int type2) => Type1 == type1 && Type2 == type2; + + /// + /// Checks if the entry has either type equal to the input type. + /// + /// Type + /// Typing is present in entry public bool IsType(int type1) => Type1 == type1 || Type2 == type1; + + /// + /// Checks if the entry has either type equal to both input types. + /// + /// Input order does not matter. + /// Type 1 + /// Type 2 + /// Typing is present in entry public bool IsType(int type1, int type2) => (Type1 == type1 || Type2 == type1) && (Type1 == type2 || Type2 == type2); + + /// + /// Checks if the entry has either egg group equal to the input type. + /// + /// Egg group + /// Egg is present in entry public bool IsEggGroup(int group) => EggGroup1 == group || EggGroup2 == group; } }