PKHeX/PKHeX.Core/PersonalInfo/PersonalInfo.cs
Kurt 88830e0d00
Update from .NET Framework 4.6 to .NET 7 (#3729)
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now.

Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes.

Adds functionality for Batch Editor commands to `>`, `<` and <=/>=

TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants.

Main window has a new layout to account for DPI scaling (8 point grid)

Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects
Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724)
Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720)
Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714)
Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691)
Added: Properties for ribbon/mark count (closes #3659)
Fixed: Traded SV eggs are now checked correctly (closes #3692)
2023-01-21 20:02:33 -08:00

101 lines
3.3 KiB
C#

namespace PKHeX.Core;
/// <summary>
/// Stat/misc data for individual species or their associated alternate form data.
/// </summary>
public abstract class PersonalInfo : IPersonalInfo
{
public abstract byte[] Write();
public abstract int HP { get; set; }
public abstract int ATK { get; set; }
public abstract int DEF { get; set; }
public abstract int SPE { get; set; }
public abstract int SPA { get; set; }
public abstract int SPD { get; set; }
public abstract int EV_HP { get; set; }
public abstract int EV_ATK { get; set; }
public abstract int EV_DEF { get; set; }
public abstract int EV_SPE { get; set; }
public abstract int EV_SPA { get; set; }
public abstract int EV_SPD { get; set; }
public abstract byte Type1 { get; set; }
public abstract byte Type2 { get; set; }
public abstract int EggGroup1 { get; set; }
public abstract int EggGroup2 { get; set; }
public abstract int CatchRate { get; set; }
public virtual int EvoStage { get; set; }
public abstract byte Gender { get; set; }
public abstract int HatchCycles { get; set; }
public abstract int BaseFriendship { get; set; }
public abstract byte EXPGrowth { get; set; }
public abstract int GetIndexOfAbility(int abilityID);
public abstract int GetAbilityAtIndex(int abilityIndex);
public abstract int AbilityCount { get; }
public abstract int EscapeRate { get; set; }
public virtual byte FormCount { get; set; } = 1;
public virtual int FormStatsIndex { get; set; }
public abstract int BaseEXP { get; set; }
public abstract int Color { get; set; }
public virtual int Height { get; set; }
public virtual int Weight { get; set; }
public int FormIndex(ushort species, byte form)
{
if (!HasForm(form))
return species;
return FormStatsIndex + form - 1;
}
public bool HasForm(byte form)
{
if (form == 0) // no form requested
return false;
if (FormStatsIndex <= 0) // no forms present
return false;
if (form >= FormCount) // beyond range of species' forms
return false;
return true;
}
public const byte RatioMagicGenderless = 255;
public const byte RatioMagicFemale = 254;
public const byte RatioMagicMale = 0;
public static bool IsSingleGender(byte gt) => gt - 1u >= 253;
public bool IsDualGender => Gender - 1u < 253;
public bool Genderless => Gender == RatioMagicGenderless;
public bool OnlyFemale => Gender == RatioMagicFemale;
public bool OnlyMale => Gender == RatioMagicMale;
public bool HasForms => FormCount > 1;
/// <summary>
/// Checks to see if the <see cref="PKM.Form"/> is valid within the <see cref="FormCount"/>
/// </summary>
/// <param name="form"></param>
public bool IsFormWithinRange(byte form)
{
if (form == 0)
return true;
return form < FormCount;
}
}
public interface IPersonalInfoTM
{
bool GetIsLearnTM(int index);
void SetIsLearnTM(int index, bool value);
}
public interface IPersonalInfoTutorType
{
bool GetIsLearnTutorType(int index);
void SetIsLearnTutorType(int index, bool value);
}
public interface IPersonalInfoTR
{
bool GetIsLearnTR(int index);
void SetIsLearnTR(int index, bool value);
}