mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
add more xml docs
This commit is contained in:
parent
6df1f97f95
commit
9ef4152736
4 changed files with 136 additions and 4 deletions
|
@ -1,5 +1,8 @@
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Small general purpose value passing object with misc data pertaining to an encountered Species.
|
||||
/// </summary>
|
||||
public class DexLevel
|
||||
{
|
||||
public int Species { get; set; }
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
public abstract class MysteryGift : IEncounterable, IMoveset
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether or not the given length of bytes is valid for a mystery gift.
|
||||
/// </summary>
|
||||
|
@ -84,12 +83,22 @@ namespace PKHeX.Core
|
|||
public abstract PKM ConvertToPKM(SaveFile SAV);
|
||||
public abstract int Format { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a deep copy of the <see cref="MysteryGift"/> object data.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public MysteryGift Clone()
|
||||
{
|
||||
byte[] data = (byte[])Data.Clone();
|
||||
return GetMysteryGift(data);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a friendly name for the underlying <see cref="MysteryGift"/> type.
|
||||
/// </summary>
|
||||
public string Type => GetType().Name;
|
||||
/// <summary>
|
||||
/// Gets a friendly name for the underlying <see cref="MysteryGift"/> type for the <see cref="IEncounterable"/> interface.
|
||||
/// </summary>
|
||||
public string Name => $"Event Gift ({Type})";
|
||||
|
||||
// Properties
|
||||
|
|
|
@ -43,8 +43,17 @@
|
|||
public virtual int Height { get; set; } = 0;
|
||||
public virtual int Weight { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// TM/HM learn compatibility flags for individual moves.
|
||||
/// </summary>
|
||||
public bool[] TMHM { get; protected set; }
|
||||
/// <summary>
|
||||
/// Grass-Fire-Water-Etc typed learn compatibility flags for individual moves.
|
||||
/// </summary>
|
||||
public bool[] TypeTutors { get; protected set; }
|
||||
/// <summary>
|
||||
/// Special tutor learn compatibility flags for individual moves.
|
||||
/// </summary>
|
||||
public bool[][] SpecialTutors { get; protected set; } = new bool[0][];
|
||||
|
||||
protected static bool[] GetBits(byte[] data)
|
||||
|
@ -63,16 +72,21 @@
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Injects supplementary TM/HM compatibility which is not present in the generation specific PersonalInfo format.
|
||||
/// Injects supplementary TM/HM compatibility which is not present in the generation specific <see cref="PersonalInfo"/> format.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
internal void AddTMHM(byte[] data) => TMHM = GetBits(data);
|
||||
/// <summary>
|
||||
/// Injects supplementary Type Tutor compatibility which is not present in the generation specific PersonalInfo format.
|
||||
/// Injects supplementary Type Tutor compatibility which is not present in the generation specific <see cref="PersonalInfo"/> format.
|
||||
/// </summary>
|
||||
internal void AddTypeTutors(byte[] data) => TypeTutors = GetBits(data);
|
||||
|
||||
// Data Manipulation
|
||||
/// <summary>
|
||||
/// Gets the <see cref="PersonalTable"/> <see cref="PKM.AltForm"/> entry index for the input criteria, with fallback for the original species entry.
|
||||
/// </summary>
|
||||
/// <param name="species"><see cref="PKM.Species"/> to retrieve for</param>
|
||||
/// <param name="forme"><see cref="PKM.AltForm"/> to retrieve for</param>
|
||||
/// <returns>Index the <see cref="PKM.AltForm"/> exists as in the <see cref="PersonalTable"/>.</returns>
|
||||
public int FormeIndex(int species, int forme)
|
||||
{
|
||||
if (forme <= 0) // no forme requested
|
||||
|
|
|
@ -12,22 +12,73 @@ namespace PKHeX.Core
|
|||
/// </remarks>
|
||||
public class PersonalTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.USUM"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable USUM = GetTable("sm", GameVersion.USUM);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.SM"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable SM = GetTable("sm", GameVersion.SM);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.ORAS"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable AO = GetTable("ao", GameVersion.ORAS);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.XY"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable XY = GetTable("xy", GameVersion.XY);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.B2W2"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable B2W2 = GetTable("b2w2", GameVersion.B2W2);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.BW"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable BW = GetTable("bw", GameVersion.BW);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.HGSS"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable HGSS = GetTable("hgss", GameVersion.HGSS);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.Pt"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable Pt = GetTable("pt", GameVersion.Pt);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.DP"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable DP = GetTable("dp", GameVersion.DP);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.LG"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable LG = GetTable("lg", GameVersion.LG);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.FR"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable FR = GetTable("fr", GameVersion.FR);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.E"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable E = GetTable("e", GameVersion.E);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.RS"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable RS = GetTable("rs", GameVersion.RS);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.C"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable C = GetTable("c", GameVersion.C);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.GS"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable GS = GetTable("c", GameVersion.GS);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.RB"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable RB = GetTable("rb", GameVersion.RBY);
|
||||
/// <summary>
|
||||
/// Personal Table used in <see cref="GameVersion.YW"/>.
|
||||
/// </summary>
|
||||
public static readonly PersonalTable Y = GetTable("y", GameVersion.RBY);
|
||||
private static PersonalTable GetTable(string game, GameVersion format)
|
||||
{
|
||||
|
@ -139,6 +190,13 @@ namespace PKHeX.Core
|
|||
Table[i] = get(entries[i]);
|
||||
}
|
||||
private readonly PersonalInfo[] Table;
|
||||
|
||||
/// <summary>
|
||||
/// Gets an index from the inner <see cref="Table"/> array.
|
||||
/// </summary>
|
||||
/// <remarks>Has built in length checks; returns empty (0) entry if out of range.</remarks>
|
||||
/// <param name="index">Index to retrieve</param>
|
||||
/// <returns>Requested index entry</returns>
|
||||
public PersonalInfo this[int index]
|
||||
{
|
||||
get
|
||||
|
@ -155,22 +213,52 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the abilities possible for a given <see cref="PKM.Species"/> and <see cref="PKM.AltForm"/>.
|
||||
/// </summary>
|
||||
/// <param name="species"><see cref="PKM.Species"/></param>
|
||||
/// <param name="forme"><see cref="PKM.AltForm"/></param>
|
||||
/// <returns>Array of possible abilities</returns>
|
||||
public int[] GetAbilities(int species, int forme)
|
||||
{
|
||||
return GetFormeEntry(species, forme).Abilities;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="PersonalInfo"/> entry index for a given <see cref="PKM.Species"/> and <see cref="PKM.AltForm"/>.
|
||||
/// </summary>
|
||||
/// <param name="species"><see cref="PKM.Species"/></param>
|
||||
/// <param name="forme"><see cref="PKM.AltForm"/></param>
|
||||
/// <returns>Entry index for the input criteria</returns>
|
||||
public int GetFormeIndex(int species, int forme)
|
||||
{
|
||||
if (species >= Table.Length)
|
||||
{ species = 0; Debug.WriteLine($"Requested out of bounds {nameof(species)}: {species} (max={Table.Length-1}"); }
|
||||
return this[species].FormeIndex(species, forme);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="PersonalInfo"/> entry for a given <see cref="PKM.Species"/> and <see cref="PKM.AltForm"/>.
|
||||
/// </summary>
|
||||
/// <param name="species"><see cref="PKM.Species"/></param>
|
||||
/// <param name="forme"><see cref="PKM.AltForm"/></param>
|
||||
/// <returns>Entry for the input criteria</returns>
|
||||
public PersonalInfo GetFormeEntry(int species, int forme)
|
||||
{
|
||||
return this[GetFormeIndex(species, forme)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Count of entries in the table, which includes default species entries and their separate <see cref="PKM.AltForm"/> entreis.
|
||||
/// </summary>
|
||||
public int TableLength => Table.Length;
|
||||
|
||||
/// <summary>
|
||||
/// Gets form names for every species.
|
||||
/// </summary>
|
||||
/// <param name="species">Raw string resource (Species) for the corresponding table.</param>
|
||||
/// <param name="MaxSpecies">Max Species ID (<see cref="PKM.Species"/>)</param>
|
||||
/// <returns>Array of species containing an array of form names for that species.</returns>
|
||||
public string[][] GetFormList(string[] species, int MaxSpecies)
|
||||
{
|
||||
string[][] FormList = new string[MaxSpecies+1][];
|
||||
|
@ -186,6 +274,16 @@ namespace PKHeX.Core
|
|||
|
||||
return FormList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an arranged list of Form names and indexes for use with the individual <see cref="PersonalInfo"/> <see cref="PKM.AltForm"/> values.
|
||||
/// </summary>
|
||||
/// <param name="AltForms">Raw string resource (Forms) for the corresponding table.</param>
|
||||
/// <param name="species">Raw string resource (Species) for the corresponding table.</param>
|
||||
/// <param name="MaxSpecies">Max Species ID (<see cref="PKM.Species"/>)</param>
|
||||
/// <param name="baseForm">Pointers for base form IDs</param>
|
||||
/// <param name="formVal">Pointers for table indexes for each form</param>
|
||||
/// <returns>Sanitized list of species names, and outputs indexes for various lookup purposes.</returns>
|
||||
public string[] GetPersonalEntryList(string[][] AltForms, string[] species, int MaxSpecies, out int[] baseForm, out int[] formVal)
|
||||
{
|
||||
string[] result = new string[Table.Length];
|
||||
|
@ -207,6 +305,14 @@ namespace PKHeX.Core
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if either of the input type combinations exist in the table.
|
||||
/// </summary>
|
||||
/// <remarks>Only useful for checking Generation 1 <see cref="PK1.Type_A"/> and <see cref="PK1.Type_B"/> properties.</remarks>
|
||||
/// <param name="Type1">First type</param>
|
||||
/// <param name="Type2">Second type</param>
|
||||
/// <returns>Indication that the combination exists in the table.</returns>
|
||||
public bool IsValidTypeCombination(int Type1, int Type2)
|
||||
{
|
||||
return Table.Any(p => p.Types[0] == Type1 && p.Types[1] == Type2);
|
||||
|
|
Loading…
Add table
Reference in a new issue