mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 14:00:21 +00:00
Unify concepts with different names
AltForm & Form & Forme => Form GenNumber & Generation => Generation Extract out SpeciesForm interface, and re-add IGeneration For those using PKHeX as a dependency, this should be a pretty straightforward manual replacement... GenNumber and AltForm should be quick find-replace`s.
This commit is contained in:
parent
7c4c1e0913
commit
62018cce1a
152 changed files with 575 additions and 578 deletions
|
@ -88,7 +88,7 @@ namespace PKHeX.Core
|
|||
private static IEnumerable<Ball> GetBallListFromColor(PKM pkm)
|
||||
{
|
||||
// Gen1/2 don't store color in personal info
|
||||
var pi = pkm.Format >= 3 ? pkm.PersonalInfo : PersonalTable.USUM.GetFormeEntry(pkm.Species, 0);
|
||||
var pi = pkm.Format >= 3 ? pkm.PersonalInfo : PersonalTable.USUM.GetFormEntry(pkm.Species, 0);
|
||||
var color = (PersonalColor)pi.Color;
|
||||
var balls = BallColors[color];
|
||||
var currentBall = (Ball)pkm.Ball;
|
||||
|
|
|
@ -49,23 +49,23 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the <see cref="PKM.AltForm"/> value, with special consideration for <see cref="PKM.Format"/> values which derive the <see cref="PKM.AltForm"/> value.
|
||||
/// Sets the <see cref="PKM.Form"/> value, with special consideration for <see cref="PKM.Format"/> values which derive the <see cref="PKM.Form"/> value.
|
||||
/// </summary>
|
||||
/// <param name="pk">Pokémon to modify.</param>
|
||||
/// <param name="form">Desired <see cref="PKM.AltForm"/> value to set.</param>
|
||||
public static void SetAltForm(this PKM pk, int form)
|
||||
/// <param name="form">Desired <see cref="PKM.Form"/> value to set.</param>
|
||||
public static void SetForm(this PKM pk, int form)
|
||||
{
|
||||
switch (pk.Format)
|
||||
{
|
||||
case 2:
|
||||
while (pk.AltForm != form)
|
||||
while (pk.Form != form)
|
||||
pk.SetRandomIVs();
|
||||
break;
|
||||
case 3:
|
||||
pk.SetPIDUnown3(form);
|
||||
break;
|
||||
default:
|
||||
pk.AltForm = form;
|
||||
pk.Form = form;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace PKHeX.Core
|
|||
if (pk is PK5 pk5 && index == 2)
|
||||
pk5.HiddenAbility = true;
|
||||
else if (pk.Format <= 5)
|
||||
pk.PID = PKX.GetRandomPID(Util.Rand, pk.Species, pk.Gender, pk.Version, pk.Nature, pk.AltForm, (uint)(index * 0x10001));
|
||||
pk.PID = PKX.GetRandomPID(Util.Rand, pk.Species, pk.Gender, pk.Version, pk.Nature, pk.Form, (uint)(index * 0x10001));
|
||||
pk.RefreshAbility(index);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ namespace PKHeX.Core
|
|||
/// <param name="pk">Pokémon to modify.</param>
|
||||
public static void SetRandomEC(this PKM pk)
|
||||
{
|
||||
int gen = pk.GenNumber;
|
||||
int gen = pk.Generation;
|
||||
if (2 < gen && gen < 6)
|
||||
{
|
||||
pk.EncryptionConstant = pk.PID;
|
||||
|
@ -224,7 +224,7 @@ namespace PKHeX.Core
|
|||
pk.SetMarkings();
|
||||
|
||||
pk.SetNickname(Set.Nickname);
|
||||
pk.SetAltForm(Set.FormIndex);
|
||||
pk.SetForm(Set.Form);
|
||||
pk.SetGender(Set.Gender);
|
||||
pk.SetMaximumPPUps(Set.Moves);
|
||||
pk.SetAbility(Set.Ability);
|
||||
|
@ -377,7 +377,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
bool traded = origin == dest;
|
||||
var today = pk.MetDate = DateTime.Today;
|
||||
pk.Egg_Location = EncounterSuggestion.GetSuggestedEncounterEggLocationEgg(pk.GenNumber, traded);
|
||||
pk.Egg_Location = EncounterSuggestion.GetSuggestedEncounterEggLocationEgg(pk.Generation, traded);
|
||||
pk.EggMetDate = today;
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ namespace PKHeX.Core
|
|||
return string.Empty;
|
||||
|
||||
int location = eggmet ? pk.Egg_Location : pk.Met_Location;
|
||||
return GameInfo.GetLocationName(eggmet, location, pk.Format, pk.GenNumber, (GameVersion)pk.Version);
|
||||
return GameInfo.GetLocationName(eggmet, location, pk.Format, pk.Generation, (GameVersion)pk.Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
public interface IBattleTemplate : IGigantamax
|
||||
public interface IBattleTemplate : ISpeciesForm, IGigantamax, INature
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="PKM.Species"/> of the Set entity.
|
||||
/// </summary>
|
||||
int Species { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="PKM.Format"/> of the Set entity it is specific to.
|
||||
/// </summary>
|
||||
|
@ -48,19 +43,9 @@
|
|||
int Friendship { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="PKM.StatNature"/> of the Set entity.
|
||||
/// <see cref="PKM.Form"/> name of the Set entity, stored in PKHeX style (instead of Showdown's)
|
||||
/// </summary>
|
||||
int Nature { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="PKM.AltForm"/> name of the Set entity, stored in PKHeX style (instead of Showdown's)
|
||||
/// </summary>
|
||||
string Form { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="PKM.AltForm"/> of the Set entity.
|
||||
/// </summary>
|
||||
int FormIndex { get; }
|
||||
string FormName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="PKM.HPType"/> of the Set entity.
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace PKHeX.Core
|
|||
|
||||
public int AbilityNum => pkm.Format > 5 ? pkm.AbilityNumber : -1;
|
||||
public int GenderFlag => pkm.Gender;
|
||||
public int AltForms => pkm.AltForm;
|
||||
public int Form => pkm.Form;
|
||||
public int PKRS_Strain => pkm.PKRS_Strain;
|
||||
public int PKRS_Days => pkm.PKRS_Days;
|
||||
public int MetLevel => pkm.Met_Level;
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace PKHeX.Core
|
|||
new BoxManipSort(BoxManipType.SortTraining, list => list.OrderByCustom(pk => (pk.MaxEV * 6) - pk.EVTotal)),
|
||||
new BoxManipSortComplex(BoxManipType.SortOwner, (list, sav) => list.OrderByOwnership(sav)),
|
||||
new BoxManipSort(BoxManipType.SortType, list => list.OrderByCustom(pk => pk.PersonalInfo.Type1, pk => pk.PersonalInfo.Type2)),
|
||||
new BoxManipSort(BoxManipType.SortVersion, list => list.OrderByCustom(pk => pk.GenNumber, pk => pk.Version, pk => pk.Met_Location), s => s.Generation >= 3),
|
||||
new BoxManipSort(BoxManipType.SortVersion, list => list.OrderByCustom(pk => pk.Generation, pk => pk.Version, pk => pk.Met_Location), s => s.Generation >= 3),
|
||||
new BoxManipSort(BoxManipType.SortBST, list => list.OrderByCustom(pk => pk.PersonalInfo.BST)),
|
||||
new BoxManipSort(BoxManipType.SortCP, list => list.OrderByCustom(pk => pk is PB7 pb7 ? pb7.Stat_CP : 0), s => s is SAV7b),
|
||||
new BoxManipSort(BoxManipType.SortLegal, list => list.OrderByCustom(pk => !new LegalityAnalysis(pk).Valid)),
|
||||
|
@ -52,7 +52,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
new BoxManipClear(BoxManipType.DeleteAll, _ => true),
|
||||
new BoxManipClear(BoxManipType.DeleteEggs, pk => pk.IsEgg, s => s.Generation >= 2),
|
||||
new BoxManipClearComplex(BoxManipType.DeletePastGen, (pk, sav) => pk.GenNumber != sav.Generation, s => s.Generation >= 4),
|
||||
new BoxManipClearComplex(BoxManipType.DeletePastGen, (pk, sav) => pk.Generation != sav.Generation, s => s.Generation >= 4),
|
||||
new BoxManipClearComplex(BoxManipType.DeleteForeign, (pk, sav) => !sav.IsOriginalHandler(pk, pk.Format > 2)),
|
||||
new BoxManipClear(BoxManipType.DeleteUntrained, pk => pk.EVTotal == 0),
|
||||
new BoxManipClear(BoxManipType.DeleteItemless, pk => pk.HeldItem == 0),
|
||||
|
|
|
@ -52,10 +52,10 @@ namespace PKHeX.Core
|
|||
public int Nature { get; set; } = -1;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Form { get; private set; } = string.Empty;
|
||||
public string FormName { get; private set; } = string.Empty;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int FormIndex { get; private set; }
|
||||
public int Form { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int[] EVs { get; private set; } = {00, 00, 00, 00, 00, 00};
|
||||
|
@ -103,15 +103,15 @@ namespace PKHeX.Core
|
|||
|
||||
ParseLines(lines);
|
||||
|
||||
Form = ConvertFormFromShowdown(Form, Species, Ability);
|
||||
FormName = ConvertFormFromShowdown(FormName, Species, Ability);
|
||||
// Set Form
|
||||
if (Form.Length == 0)
|
||||
if (FormName.Length == 0)
|
||||
{
|
||||
FormIndex = 0;
|
||||
Form = 0;
|
||||
return;
|
||||
}
|
||||
string[] formStrings = FormConverter.GetFormList(Species, Strings.Types, Strings.forms, genderForms, Format);
|
||||
FormIndex = Math.Max(0, Array.FindIndex(formStrings, z => z.Contains(Form)));
|
||||
Form = Math.Max(0, Array.FindIndex(formStrings, z => z.Contains(FormName)));
|
||||
}
|
||||
|
||||
private const int MaxMoveCount = 4;
|
||||
|
@ -233,7 +233,7 @@ namespace PKHeX.Core
|
|||
var result = new List<string>();
|
||||
|
||||
// First Line: Name, Nickname, Gender, Item
|
||||
var form = ConvertFormToShowdown(Form, Species);
|
||||
var form = ConvertFormToShowdown(FormName, Species);
|
||||
result.Add(GetStringFirstLine(form));
|
||||
|
||||
// IVs
|
||||
|
@ -372,19 +372,19 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
SetFormString(pkm.AltForm);
|
||||
SetFormString(pkm.Form);
|
||||
}
|
||||
|
||||
private void SetFormString(int index)
|
||||
{
|
||||
FormIndex = index;
|
||||
Form = index;
|
||||
if (index <= 0)
|
||||
{
|
||||
Form = string.Empty;
|
||||
FormName = string.Empty;
|
||||
return;
|
||||
}
|
||||
var forms = FormConverter.GetFormList(Species, Strings.Types, Strings.forms, genderForms, Format);
|
||||
Form = FormIndex >= forms.Length ? string.Empty : forms[index];
|
||||
FormName = Form >= forms.Length ? string.Empty : forms[index];
|
||||
}
|
||||
|
||||
private void ParseFirstLine(string first)
|
||||
|
@ -464,7 +464,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
|
||||
Species = StringUtil.FindIndexIgnoreCase(Strings.specieslist, spec.Substring(0, end));
|
||||
Form = spec.Substring(end + 1);
|
||||
FormName = spec.Substring(end + 1);
|
||||
|
||||
if (Species >= 0)
|
||||
return true;
|
||||
|
@ -476,7 +476,7 @@ namespace PKHeX.Core
|
|||
if (!spec.StartsWith(sn.Replace("♂", "-M").Replace("♀", "-F")))
|
||||
continue;
|
||||
Species = e;
|
||||
Form = spec.Substring(sn.Length);
|
||||
FormName = spec.Substring(sn.Length);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ namespace PKHeX.Core
|
|||
if (end < 0)
|
||||
return false;
|
||||
Species = StringUtil.FindIndexIgnoreCase(Strings.specieslist, spec.Substring(0, end));
|
||||
Form = spec.Substring(end + 1);
|
||||
FormName = spec.Substring(end + 1);
|
||||
|
||||
return Species >= 0;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace PKHeX.Core
|
|||
/// <param name="isEggLocation">Location is from the <see cref="PKM.Egg_Location"/></param>
|
||||
/// <param name="location">Location value</param>
|
||||
/// <param name="format">Current <see cref="PKM.Format"/></param>
|
||||
/// <param name="generation"><see cref="PKM.GenNumber"/> of origin</param>
|
||||
/// <param name="generation"><see cref="PKM.Generation"/> of origin</param>
|
||||
/// <param name="version">Current GameVersion (only applicable for <see cref="GameVersion.Gen7b"/> differentiation)</param>
|
||||
/// <returns>Location name</returns>
|
||||
public static string GetLocationName(bool isEggLocation, int location, int format, int generation, GameVersion version)
|
||||
|
|
|
@ -437,7 +437,7 @@ namespace PKHeX.Core
|
|||
/// <param name="isEggLocation">Location is from the <see cref="PKM.Egg_Location"/></param>
|
||||
/// <param name="location">Location value</param>
|
||||
/// <param name="format">Current <see cref="PKM.Format"/></param>
|
||||
/// <param name="generation"><see cref="PKM.GenNumber"/> of origin</param>
|
||||
/// <param name="generation"><see cref="PKM.Generation"/> of origin</param>
|
||||
/// <param name="version">Current GameVersion (only applicable for <see cref="GameVersion.Gen7b"/> differentiation)</param>
|
||||
/// <returns>Location name</returns>
|
||||
public string GetLocationName(bool isEggLocation, int location, int format, int generation, GameVersion version)
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace PKHeX.Core
|
|||
if (slot.Species != evo.Species)
|
||||
continue;
|
||||
|
||||
if (slot.Form != evo.Form && !AltFormInfo.WildChangeFormAfter.Contains(slot.Species) && slot.Species != (int)Species.Unown)
|
||||
if (slot.Form != evo.Form && !FormInfo.WildChangeFormAfter.Contains(slot.Species) && slot.Species != (int)Species.Unown)
|
||||
break;
|
||||
if (!slot.IsLevelWithinRange(lvl))
|
||||
break;
|
||||
|
@ -93,7 +93,7 @@ namespace PKHeX.Core
|
|||
if (slot.Species != evo.Species)
|
||||
continue;
|
||||
|
||||
if (slot.Form != evo.Form && !AltFormInfo.WildChangeFormAfter.Contains(slot.Species) && slot.Species != (int)Species.Unown)
|
||||
if (slot.Form != evo.Form && !FormInfo.WildChangeFormAfter.Contains(slot.Species) && slot.Species != (int)Species.Unown)
|
||||
break;
|
||||
if (slot.LevelMin > evo.Level)
|
||||
break;
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace PKHeX.Core
|
|||
if (!slot.IsLevelWithinRange(pkm.Met_Level))
|
||||
break;
|
||||
|
||||
if (slot.Form != evo.Form && !AltFormInfo.WildChangeFormAfter.Contains(slot.Species))
|
||||
if (slot.Form != evo.Form && !FormInfo.WildChangeFormAfter.Contains(slot.Species))
|
||||
break;
|
||||
|
||||
yield return slot;
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace PKHeX.Core
|
|||
if (!slot.IsLevelWithinRange(pkm.Met_Level))
|
||||
break;
|
||||
|
||||
if (slot.Form != evo.Form && slot.Form < RandomFormVivillon && !AltFormInfo.WildChangeFormAfter.Contains(slot.Species))
|
||||
if (slot.Form != evo.Form && slot.Form < RandomFormVivillon && !FormInfo.WildChangeFormAfter.Contains(slot.Species))
|
||||
{
|
||||
if (slot.Species != (int)Species.Flabébé)
|
||||
break;
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace PKHeX.Core
|
|||
if (!slot.IsLevelWithinRange(pkm.Met_Level))
|
||||
break;
|
||||
|
||||
if (slot.Form != evo.Form && !AltFormInfo.WildChangeFormAfter.Contains(slot.Species))
|
||||
if (slot.Form != evo.Form && !FormInfo.WildChangeFormAfter.Contains(slot.Species))
|
||||
{
|
||||
if (slot.Species != (int)Species.Minior) // Random Color, edge case
|
||||
break;
|
||||
|
|
|
@ -4,11 +4,11 @@ using System.Linq;
|
|||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <inheritdoc cref="EncounterArea" />
|
||||
/// <summary>
|
||||
/// <see cref="GameVersion.GO"/> encounter area for <see cref="GameVersion.GG"/>
|
||||
/// </summary>
|
||||
public sealed class EncounterArea7g : EncounterArea
|
||||
public sealed class EncounterArea7g : EncounterArea, ISpeciesForm
|
||||
{
|
||||
/// <summary> Species for the area </summary>
|
||||
/// <remarks> Due to how the encounter data is packaged by PKHeX, each species-form is grouped together. </remarks>
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace PKHeX.Core
|
|||
if (!slot.IsLevelWithinRange(met))
|
||||
break;
|
||||
|
||||
if (slot.Form != evo.Form && !AltFormInfo.WildChangeFormAfter.Contains(evo.Species))
|
||||
if (slot.Form != evo.Form && !FormInfo.WildChangeFormAfter.Contains(evo.Species))
|
||||
break;
|
||||
|
||||
yield return slot;
|
||||
|
@ -71,7 +71,7 @@ namespace PKHeX.Core
|
|||
if (slot.LevelMin > 60)
|
||||
break; // Can't downlevel, only boost to 60.
|
||||
|
||||
if (slot.Form != evo.Form && !AltFormInfo.WildChangeFormAfter.Contains(evo.Species))
|
||||
if (slot.Form != evo.Form && !FormInfo.WildChangeFormAfter.Contains(evo.Species))
|
||||
break;
|
||||
|
||||
yield return slot;
|
||||
|
|
|
@ -4,11 +4,11 @@ using System.Linq;
|
|||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <inheritdoc cref="EncounterArea" />
|
||||
/// <summary>
|
||||
/// <see cref="GameVersion.GO"/> encounter area for direct-to-HOME transfers.
|
||||
/// </summary>
|
||||
public sealed class EncounterArea8g : EncounterArea
|
||||
public sealed class EncounterArea8g : EncounterArea, ISpeciesForm
|
||||
{
|
||||
/// <summary> Species for the area </summary>
|
||||
/// <remarks> Due to how the encounter data is packaged by PKHeX, each species-form is grouped together. </remarks>
|
||||
|
@ -74,12 +74,12 @@ namespace PKHeX.Core
|
|||
var pi8 = (PersonalInfoSWSH)pt8[species];
|
||||
if (pi8.IsPresentInGame)
|
||||
{
|
||||
bool lgpe = (species <= 151 || species == 808 || species == 809) && (form == 0 || ptGG[species].HasForme(form));
|
||||
bool lgpe = (species <= 151 || species == 808 || species == 809) && (form == 0 || ptGG[species].HasForm(form));
|
||||
return lgpe ? GameVersion.GG : GameVersion.SWSH;
|
||||
}
|
||||
if (species <= Legal.MaxSpeciesID_7_USUM)
|
||||
{
|
||||
bool lgpe = species <= 151 && (form == 0 || ptGG[species].HasForme(form));
|
||||
bool lgpe = species <= 151 && (form == 0 || ptGG[species].HasForm(form));
|
||||
return lgpe ? GameVersion.GG : GameVersion.USUM;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace PKHeX.Core
|
|||
if (pkm.TSV == 0) // HOME doesn't assign TSV=0 to accounts.
|
||||
yield break;
|
||||
|
||||
var sf = chain.FirstOrDefault(z => z.Species == Species && (z.Form == Form || AltFormInfo.IsFormChangeable(Species, Form, z.Form, pkm.Format)));
|
||||
var sf = chain.FirstOrDefault(z => z.Species == Species && (z.Form == Form || FormInfo.IsFormChangeable(Species, Form, z.Form, pkm.Format)));
|
||||
if (sf == null)
|
||||
yield break;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace PKHeX.Core
|
|||
pk.Gender = pk.GetSaneGender();
|
||||
|
||||
var pi = pk.PersonalInfo;
|
||||
for (int f = 0; f < pi.FormeCount; f++)
|
||||
for (int f = 0; f < pi.FormCount; f++)
|
||||
{
|
||||
var entry = tr.GetLivingEntry(pk, s, f, destType);
|
||||
if (entry == null)
|
||||
|
@ -46,7 +46,7 @@ namespace PKHeX.Core
|
|||
public static PKM? GetLivingEntry(this ITrainerInfo tr, PKM template, int species, int form, Type destType)
|
||||
{
|
||||
template.Species = species;
|
||||
template.AltForm = form;
|
||||
template.Form = form;
|
||||
template.Gender = template.GetSaneGender();
|
||||
|
||||
var f = EncounterMovesetGenerator.GeneratePKMs(template, tr).FirstOrDefault();
|
||||
|
@ -59,7 +59,7 @@ namespace PKHeX.Core
|
|||
|
||||
result.CurrentLevel = 100;
|
||||
result.Species = species;
|
||||
result.AltForm = form;
|
||||
result.Form = form;
|
||||
|
||||
result.Heal();
|
||||
return result;
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace PKHeX.Core
|
|||
return GetMaxSpeciesOrigin(1);
|
||||
if (pkm.Format == 2 || pkm.VC)
|
||||
return GetMaxSpeciesOrigin(2);
|
||||
return GetMaxSpeciesOrigin(pkm.GenNumber);
|
||||
return GetMaxSpeciesOrigin(pkm.Generation);
|
||||
}
|
||||
|
||||
internal static int GetMaxSpeciesOrigin(int generation)
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace PKHeX.Core
|
|||
if (pk is PK6 pk6)
|
||||
pk6.SetHatchMemory6();
|
||||
|
||||
SetAltForm(pk, sav);
|
||||
SetForm(pk, sav);
|
||||
|
||||
pk.SetRandomEC();
|
||||
pk.RelearnMoves = moves;
|
||||
|
@ -72,18 +72,18 @@ namespace PKHeX.Core
|
|||
return pk;
|
||||
}
|
||||
|
||||
private void SetAltForm(PKM pk, ITrainerInfo sav)
|
||||
private void SetForm(PKM pk, ITrainerInfo sav)
|
||||
{
|
||||
switch (Species)
|
||||
{
|
||||
case (int)Core.Species.Minior:
|
||||
pk.AltForm = Util.Rand.Next(7, 14);
|
||||
pk.Form = Util.Rand.Next(7, 14);
|
||||
break;
|
||||
case (int)Core.Species.Scatterbug:
|
||||
case (int)Core.Species.Spewpa:
|
||||
case (int)Core.Species.Vivillon:
|
||||
if (sav is IRegionOrigin o)
|
||||
pk.AltForm = Vivillon3DS.GetPattern((byte)o.Country, (byte)o.Region);
|
||||
pk.Form = Vivillon3DS.GetPattern((byte)o.Country, (byte)o.Region);
|
||||
// else 0
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ namespace PKHeX.Core
|
|||
public EncounterInvalid(PKM pkm)
|
||||
{
|
||||
Species = pkm.Species;
|
||||
Form = pkm.AltForm;
|
||||
Form = pkm.Form;
|
||||
LevelMin = pkm.Met_Level;
|
||||
LevelMax = pkm.CurrentLevel;
|
||||
EggEncounter = pkm.WasEgg;
|
||||
Generation = pkm.GenNumber;
|
||||
Generation = pkm.Generation;
|
||||
Version = (GameVersion)pkm.Version;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace PKHeX.Core
|
|||
pk.Ball = (int)(ball == Ball.None ? Ball.Poke : ball);
|
||||
pk.Language = lang;
|
||||
pk.OT_Friendship = pk.PersonalInfo.BaseFriendship;
|
||||
pk.AltForm = GetWildAltForm(pk, Form, sav);
|
||||
pk.Form = GetWildForm(pk, Form, sav);
|
||||
|
||||
SetMetData(pk, level, Location);
|
||||
SetPINGA(pk, criteria);
|
||||
|
@ -138,7 +138,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
PIDGenerator.SetRandomWildPID(pk, pk.Format, nature, ability, gender);
|
||||
ability ^= 1; // some nature-forms cannot have a certain PID-ability set, so just flip it as Unown doesn't have dual abilities.
|
||||
} while (pk.AltForm != Form);
|
||||
} while (pk.Form != Form);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ namespace PKHeX.Core
|
|||
private const int FormVivillon = 30;
|
||||
private const int FormRandom = 31;
|
||||
|
||||
private static int GetWildAltForm(PKM pk, int form, ITrainerInfo sav)
|
||||
private static int GetWildForm(PKM pk, int form, ITrainerInfo sav)
|
||||
{
|
||||
if (form < FormDynamic) // specified form
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ namespace PKHeX.Core
|
|||
return form;
|
||||
}
|
||||
if (form == FormRandom) // flagged as totally random
|
||||
return Util.Rand.Next(pk.PersonalInfo.FormeCount);
|
||||
return Util.Rand.Next(pk.PersonalInfo.FormCount);
|
||||
|
||||
int spec = pk.Species;
|
||||
if ((int) Core.Species.Scatterbug <= spec && spec <= (int) Core.Species.Vivillon)
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk.EncryptionConstant = Util.Rand32();
|
||||
pk.Species = Species;
|
||||
pk.AltForm = Form;
|
||||
pk.Form = Form;
|
||||
|
||||
int lang = (int)Language.GetSafeLanguage(Generation, (LanguageID)sav.Language);
|
||||
int level = GetMinimalLevel();
|
||||
|
@ -260,7 +260,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (SkipFormCheck)
|
||||
return true;
|
||||
return Form == evo.Form || AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format);
|
||||
return Form == evo.Form || FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format);
|
||||
}
|
||||
|
||||
protected virtual bool IsMatchEggLocation(PKM pkm)
|
||||
|
|
|
@ -24,13 +24,13 @@ namespace PKHeX.Core
|
|||
if (SkipFormCheck)
|
||||
return true;
|
||||
|
||||
if (AltFormInfo.IsTotemForm(Species, Form, Generation))
|
||||
if (FormInfo.IsTotemForm(Species, Form, Generation))
|
||||
{
|
||||
var expectForm = pkm.Format == 7 ? Form : AltFormInfo.GetTotemBaseForm(Species, Form);
|
||||
var expectForm = pkm.Format == 7 ? Form : FormInfo.GetTotemBaseForm(Species, Form);
|
||||
return expectForm == evo.Form;
|
||||
}
|
||||
|
||||
return Form == evo.Form || AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format);
|
||||
return Form == evo.Form || FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format);
|
||||
}
|
||||
|
||||
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (base.IsMatchDeferred(pkm))
|
||||
return true;
|
||||
if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, pkm.AltForm, Species, Form))
|
||||
if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, pkm.Form, Species, Form))
|
||||
return true;
|
||||
if (Species == (int)Core.Species.Alcremie && pkm is IFormArgument a && a.FormArgument != 0)
|
||||
return true;
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace PKHeX.Core
|
|||
|
||||
pk.EncryptionConstant = Util.Rand32();
|
||||
pk.Species = species;
|
||||
pk.AltForm = Form;
|
||||
pk.Form = Form;
|
||||
pk.Language = lang;
|
||||
pk.OT_Name = pk.Format == 1 ? StringConverter12.G1TradeOTStr : HasTrainerName ? GetOT(lang) : sav.OT;
|
||||
pk.OT_Gender = HasTrainerName ? Math.Max(0, OTGender) : sav.Gender;
|
||||
|
@ -242,7 +242,7 @@ namespace PKHeX.Core
|
|||
if (CurrentLevel != -1 && CurrentLevel > pkm.CurrentLevel)
|
||||
return false;
|
||||
|
||||
if (Form != evo.Form && !AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
if (OTGender != -1 && OTGender != pkm.OT_Gender)
|
||||
return false;
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace PKHeX.Core
|
|||
public static IEnumerable<EncounterEgg> GenerateEggs(PKM pkm, bool all = false)
|
||||
{
|
||||
var table = EvolutionTree.GetEvolutionTree(pkm, Math.Max(2, pkm.Format));
|
||||
int maxSpeciesOrigin = GetMaxSpeciesOrigin(pkm.GenNumber);
|
||||
int maxSpeciesOrigin = GetMaxSpeciesOrigin(pkm.Generation);
|
||||
var evos = table.GetValidPreEvolutions(pkm, maxLevel: 100, maxSpeciesOrigin: maxSpeciesOrigin, skipChecks: true);
|
||||
return GenerateEggs(pkm, evos, all);
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ namespace PKHeX.Core
|
|||
if (NoHatchFromEgg.Contains(species))
|
||||
yield break;
|
||||
|
||||
int gen = pkm.GenNumber;
|
||||
int gen = pkm.Generation;
|
||||
if (gen <= 1)
|
||||
yield break; // can't get eggs
|
||||
if (NoHatchFromEggForm(species, pkm.AltForm, gen))
|
||||
if (NoHatchFromEggForm(species, pkm.Form, gen))
|
||||
yield break; // can't originate from eggs
|
||||
|
||||
// version is a true indicator for all generation 3-5 origins
|
||||
|
@ -60,7 +60,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (form == 0)
|
||||
return false;
|
||||
if (AltFormInfo.IsTotemForm(species, form, gen))
|
||||
if (FormInfo.IsTotemForm(species, form, gen))
|
||||
return true;
|
||||
if (species == (int) Species.Pichu)
|
||||
return true; // can't get Spiky Ear Pichu eggs
|
||||
|
@ -73,8 +73,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
// Sanity check form for origin
|
||||
var gameInfo = GameData.GetPersonal(game);
|
||||
var entry = gameInfo.GetFormeEntry(species, form);
|
||||
return form >= entry.FormeCount && !(species == (int)Species.Rotom && form <= 5);
|
||||
var entry = gameInfo.GetFormEntry(species, form);
|
||||
return form >= entry.FormCount && !(species == (int)Species.Rotom && form <= 5);
|
||||
}
|
||||
|
||||
// Gen6+ update the origin game when hatched. Quick manip for X.Y<->A.O | S.M<->US.UM, ie X->A
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace PKHeX.Core
|
|||
return moves.Intersect(Legal.InvalidSketch).ToArray(); // Can learn anything
|
||||
|
||||
// Roughly determine the generation the PKM is originating from
|
||||
int origin = pk.GenNumber;
|
||||
int origin = pk.Generation;
|
||||
if (origin < 0)
|
||||
origin = ((GameVersion)pk.Version).GetGeneration();
|
||||
|
||||
|
@ -282,7 +282,7 @@ namespace PKHeX.Core
|
|||
yield return enc;
|
||||
}
|
||||
|
||||
int gen = pk.GenNumber;
|
||||
int gen = pk.Generation;
|
||||
if ((uint)gen >= 3)
|
||||
yield break;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace PKHeX.Core
|
|||
|
||||
internal static EncounterStatic? GetStaticLocation(PKM pkm, int species = -1)
|
||||
{
|
||||
switch (pkm.GenNumber)
|
||||
switch (pkm.Generation)
|
||||
{
|
||||
case 1:
|
||||
return EncounterStatic7.GetVC1(species, pkm.Met_Level);
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static IEnumerable<EncounterTrade> GetEncounterTradeTable(PKM pkm)
|
||||
{
|
||||
return pkm.GenNumber switch
|
||||
return pkm.Generation switch
|
||||
{
|
||||
3 => (pkm.FRLG ? Encounters3.TradeGift_FRLG : Encounters3.TradeGift_RSE),
|
||||
4 => (pkm.HGSS ? Encounters4.TradeGift_HGSS : Encounters4.TradeGift_DPPt),
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace PKHeX.Core
|
|||
public static IEnumerable<MysteryGift> GetPossible(PKM pkm, IReadOnlyList<DexLevel> chain)
|
||||
{
|
||||
// Ranger Manaphy is a PGT and is not in the PCD[] for gen4. Check manually.
|
||||
int gen = pkm.GenNumber;
|
||||
int gen = pkm.Generation;
|
||||
if (gen == 4 && pkm.Species == (int) Species.Manaphy)
|
||||
yield return RangerManaphy;
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace PKHeX.Core
|
|||
|
||||
public static IEnumerable<MysteryGift> GetValidGifts(PKM pkm, IReadOnlyList<DexLevel> chain)
|
||||
{
|
||||
int gen = pkm.GenNumber;
|
||||
int gen = pkm.Generation;
|
||||
if (pkm.IsEgg && pkm.Format != gen) // transferred
|
||||
return Array.Empty<MysteryGift>();
|
||||
|
||||
|
|
|
@ -3,16 +3,13 @@
|
|||
/// <summary>
|
||||
/// Common Encounter Properties base interface.
|
||||
/// </summary>
|
||||
public interface IEncounterable : IVersion
|
||||
public interface IEncounterable : ISpeciesForm, IVersion, IGeneration
|
||||
{
|
||||
int Species { get; }
|
||||
int Form { get; }
|
||||
string Name { get; }
|
||||
string LongName { get; }
|
||||
bool EggEncounter { get; }
|
||||
int LevelMin { get; }
|
||||
int LevelMax { get; }
|
||||
int Generation { get; }
|
||||
|
||||
PKM ConvertToPKM(ITrainerInfo sav);
|
||||
PKM ConvertToPKM(ITrainerInfo sav, EncounterCriteria criteria);
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace PKHeX.Core
|
|||
|
||||
public static int GetSuggestedEncounterEggMetLevel(PKM pkm)
|
||||
{
|
||||
if (!pkm.IsNative && pkm.GenNumber < 5)
|
||||
if (!pkm.IsNative && pkm.Generation < 5)
|
||||
return pkm.CurrentLevel; // be generous with transfer conditions
|
||||
if (pkm.Format < 5) // and native
|
||||
return pkm.Format == 2 && pkm.Met_Location != 0 ? 1 : 0;
|
||||
|
@ -48,7 +48,7 @@ namespace PKHeX.Core
|
|||
|
||||
public static int GetSuggestedEncounterEggLocationEgg(PKM pkm, bool traded = false)
|
||||
{
|
||||
return GetSuggestedEncounterEggLocationEgg(pkm.GenNumber, traded);
|
||||
return GetSuggestedEncounterEggLocationEgg(pkm.Generation, traded);
|
||||
}
|
||||
|
||||
public static int GetSuggestedEncounterEggLocationEgg(int generation, bool traded = false)
|
||||
|
@ -207,7 +207,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class EncounterSuggestionData : IRelearn
|
||||
public sealed class EncounterSuggestionData : ISpeciesForm, IRelearn
|
||||
{
|
||||
private readonly IEncounterable? Encounter;
|
||||
|
||||
|
@ -217,7 +217,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
Encounter = enc;
|
||||
Species = pkm.Species;
|
||||
Form = pkm.AltForm;
|
||||
Form = pkm.Form;
|
||||
Location = met;
|
||||
|
||||
LevelMin = enc.LevelMin;
|
||||
|
@ -227,7 +227,7 @@ namespace PKHeX.Core
|
|||
public EncounterSuggestionData(PKM pkm, int met, int lvl)
|
||||
{
|
||||
Species = pkm.Species;
|
||||
Form = pkm.AltForm;
|
||||
Form = pkm.Form;
|
||||
Location = met;
|
||||
|
||||
LevelMin = lvl;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Returns the verification method appropriate for the input PKM</returns>
|
||||
public static Func<PKM, LegalInfo, CheckResult> GetEncounterVerifierMethod(PKM pkm)
|
||||
{
|
||||
switch (pkm.GenNumber)
|
||||
switch (pkm.Generation)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace PKHeX.Core
|
|||
return new CheckResult(CheckIdentifier.GameOrigin);
|
||||
|
||||
var ver = (int)val >> 16;
|
||||
if (ver != 0 && !CanVersionReceiveGift(g.Format, ver, pk.Version))
|
||||
if (ver != 0 && !CanVersionReceiveGift(g.Generation, ver, pk.Version))
|
||||
return new CheckResult(Severity.Invalid, LEncGiftVersionNotDistributed, CheckIdentifier.GameOrigin);
|
||||
|
||||
var lang = val & MysteryGiftRestriction.LangRestrict;
|
||||
|
@ -72,12 +72,12 @@ namespace PKHeX.Core
|
|||
return false; // no data
|
||||
if (!val.HasFlagFast(MysteryGiftRestriction.OTReplacedOnTrade))
|
||||
return false;
|
||||
return CurrentOTMatchesReplaced(g.Format, pk.OT_Name);
|
||||
return CurrentOTMatchesReplaced(g.Generation, pk.OT_Name);
|
||||
}
|
||||
|
||||
private static bool CanVersionReceiveGift(int format, int version4bit, int version)
|
||||
private static bool CanVersionReceiveGift(int generation, int version4bit, int version)
|
||||
{
|
||||
return format switch
|
||||
return generation switch
|
||||
{
|
||||
_ => false
|
||||
};
|
||||
|
|
|
@ -472,7 +472,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
learnInfo.EggMovesLearned.Add(m);
|
||||
if (pkm.TradebackStatus == TradebackType.Any && pkm.GenNumber == 1)
|
||||
if (pkm.TradebackStatus == TradebackType.Any && pkm.Generation == 1)
|
||||
pkm.TradebackStatus = TradebackType.WasTradeback;
|
||||
}
|
||||
if (!learnInfo.Source.EggEventSource.Contains(move))
|
||||
|
@ -490,7 +490,7 @@ namespace PKHeX.Core
|
|||
res[m] = new CheckMoveResult(SpecialEgg, gen, Valid, LMoveSourceEggEvent, Move);
|
||||
}
|
||||
}
|
||||
if (pkm.TradebackStatus == TradebackType.Any && pkm.GenNumber == 1)
|
||||
if (pkm.TradebackStatus == TradebackType.Any && pkm.Generation == 1)
|
||||
pkm.TradebackStatus = TradebackType.WasTradeback;
|
||||
learnInfo.EventEggMoves.Add(m);
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ namespace PKHeX.Core
|
|||
private static CheckMoveResult[] VerifyPreRelearnEggBase(PKM pkm, IReadOnlyList<int> currentMoves, EggInfoSource infoset)
|
||||
{
|
||||
CheckMoveResult[] res = new CheckMoveResult[4];
|
||||
var gen = pkm.GenNumber;
|
||||
var gen = pkm.Generation;
|
||||
// Obtain level1 moves
|
||||
var reqBase = GetRequiredBaseMoveCount(currentMoves, infoset);
|
||||
|
||||
|
@ -900,7 +900,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
// VC case: check transfer games in reverse order (8, 7..) then past games.
|
||||
int[] xfer = GetGenMovesOrder(pkm.Format, 7);
|
||||
int[] past = GetGenMovesCheckOrderGB(pkm, pkm.GenNumber);
|
||||
int[] past = GetGenMovesCheckOrderGB(pkm, pkm.Generation);
|
||||
int end = xfer.Length;
|
||||
Array.Resize(ref xfer, xfer.Length + past.Length);
|
||||
past.CopyTo(xfer, end);
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
Geography,
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="CheckResult"/> pertains to the <see cref="PKM.AltForm"/>.
|
||||
/// The <see cref="CheckResult"/> pertains to the <see cref="PKM.Form"/>.
|
||||
/// </summary>
|
||||
Form,
|
||||
|
||||
|
@ -130,7 +130,7 @@
|
|||
|
||||
/// <summary>
|
||||
/// The <see cref="CheckResult"/> pertains to the <see cref="PKM"/>'s <see cref="PKM.Version"/> compatibility.
|
||||
/// <remarks>This is used for parsing checks to ensure the <see cref="PKM"/> didn't debut on a future <see cref="PKM.GenNumber"/></remarks>
|
||||
/// <remarks>This is used for parsing checks to ensure the <see cref="PKM"/> didn't debut on a future <see cref="PKM.Generation"/></remarks>
|
||||
/// </summary>
|
||||
GameOrigin,
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace PKHeX.Core
|
|||
if (hasMet)
|
||||
return pkm.CurrentLevel;
|
||||
|
||||
int generation = pkm.GenNumber;
|
||||
int generation = pkm.Generation;
|
||||
if (generation >= 4)
|
||||
return met;
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var species = pkm.Species;
|
||||
|
||||
if (Future_LevelUp.TryGetValue(species | (pkm.AltForm << 11), out var delta))
|
||||
if (Future_LevelUp.TryGetValue(species | (pkm.Form << 11), out var delta))
|
||||
return met - delta;
|
||||
|
||||
if (generation < 4 && Future_LevelUp4.Contains(species) && (pkm.Format <= 7 || !Future_LevelUp4_Not8.Contains(species)))
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace PKHeX.Core
|
|||
if (maxLevel < 0)
|
||||
maxLevel = pkm.CurrentLevel;
|
||||
|
||||
if (maxspeciesorigin == -1 && pkm.InhabitedGeneration(2) && pkm.Format <= 2 && pkm.GenNumber == 1)
|
||||
if (maxspeciesorigin == -1 && pkm.InhabitedGeneration(2) && pkm.Format <= 2 && pkm.Generation == 1)
|
||||
maxspeciesorigin = MaxSpeciesID_2;
|
||||
|
||||
int tree = Math.Max(2, pkm.Format);
|
||||
|
@ -255,7 +255,7 @@ namespace PKHeX.Core
|
|||
if (pkm.Format <= 2)
|
||||
return 2;
|
||||
|
||||
var origin = pkm.GenNumber;
|
||||
var origin = pkm.Generation;
|
||||
if (!pkm.HasOriginalMetLocation && generation != origin)
|
||||
return pkm.Met_Level;
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ namespace PKHeX.Core
|
|||
return !pkm.IsUntraded || skipChecks;
|
||||
|
||||
// Special Level Up Cases -- return false if invalid
|
||||
case LevelUpNatureAmped when GetAmpLowKeyResult(pkm.Nature) != pkm.AltForm && !skipChecks:
|
||||
case LevelUpNatureLowKey when GetAmpLowKeyResult(pkm.Nature) != pkm.AltForm && !skipChecks:
|
||||
case LevelUpNatureAmped when GetAmpLowKeyResult(pkm.Nature) != pkm.Form && !skipChecks:
|
||||
case LevelUpNatureLowKey when GetAmpLowKeyResult(pkm.Nature) != pkm.Form && !skipChecks:
|
||||
return false;
|
||||
|
||||
case LevelUpBeauty when !(pkm is IContestStats s) || s.CNT_Beauty < Argument:
|
||||
|
@ -101,7 +101,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
case LevelUpFemale when pkm.Gender != 1:
|
||||
return false;
|
||||
case LevelUpFormFemale1 when pkm.Gender != 1 || pkm.AltForm != 1:
|
||||
case LevelUpFormFemale1 when pkm.Gender != 1 || pkm.Form != 1:
|
||||
return false;
|
||||
|
||||
case LevelUpVersion when ((pkm.Version & 1) != (Argument & 1) && pkm.IsUntraded) || skipChecks:
|
||||
|
@ -127,7 +127,7 @@ namespace PKHeX.Core
|
|||
|
||||
private bool HasMetLevelIncreased(PKM pkm, int lvl)
|
||||
{
|
||||
int origin = pkm.GenNumber;
|
||||
int origin = pkm.Generation;
|
||||
switch (origin)
|
||||
{
|
||||
case 1: // No met data in RBY
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
for (int sSpecies = 1; sSpecies <= MaxSpeciesTree; sSpecies++)
|
||||
{
|
||||
var fc = Personal[sSpecies].FormeCount;
|
||||
var fc = Personal[sSpecies].FormCount;
|
||||
for (int sForm = 0; sForm < fc; sForm++)
|
||||
{
|
||||
var index = sSpecies;
|
||||
|
@ -117,10 +117,10 @@ namespace PKHeX.Core
|
|||
{
|
||||
for (int sSpecies = 1; sSpecies <= MaxSpeciesTree; sSpecies++)
|
||||
{
|
||||
var fc = Personal[sSpecies].FormeCount;
|
||||
var fc = Personal[sSpecies].FormCount;
|
||||
for (int sForm = 0; sForm < fc; sForm++)
|
||||
{
|
||||
var index = Personal.GetFormeIndex(sSpecies, sForm);
|
||||
var index = Personal.GetFormIndex(sSpecies, sForm);
|
||||
var evos = Entries[index];
|
||||
foreach (var evo in evos)
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
return new List<EvoCriteria>(1)
|
||||
{
|
||||
new EvoCriteria(pkm.Species, pkm.AltForm) { Level = maxLevel, MinLevel = maxLevel },
|
||||
new EvoCriteria(pkm.Species, pkm.Form) { Level = maxLevel, MinLevel = maxLevel },
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ namespace PKHeX.Core
|
|||
public IEnumerable<int> GetEvolutions(int species, int form)
|
||||
{
|
||||
int format = Game - Gen1 + 1;
|
||||
int index = format < 7 ? species : Personal.GetFormeIndex(species, form);
|
||||
int index = format < 7 ? species : Personal.GetFormIndex(species, form);
|
||||
var evos = Entries[index];
|
||||
foreach (var method in evos)
|
||||
{
|
||||
|
@ -299,7 +299,7 @@ namespace PKHeX.Core
|
|||
private List<EvoCriteria> GetExplicitLineage(PKM pkm, int maxLevel, bool skipChecks, int maxSpeciesOrigin, int minLevel)
|
||||
{
|
||||
int species = pkm.Species;
|
||||
int form = pkm.AltForm;
|
||||
int form = pkm.Form;
|
||||
int lvl = maxLevel;
|
||||
var first = new EvoCriteria(species, form) { Level = lvl };
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
/// <param name="pk">Input data to check</param>
|
||||
/// <param name="table"><see cref="SaveFile"/> specific personal data</param>
|
||||
public LegalityAnalysis(PKM pk, PersonalTable table) : this(pk, table.GetFormeEntry(pk.Species, pk.AltForm)) { }
|
||||
public LegalityAnalysis(PKM pk, PersonalTable table) : this(pk, table.GetFormEntry(pk.Species, pk.Form)) { }
|
||||
|
||||
/// <summary>
|
||||
/// Checks the input <see cref="PKM"/> data for legality.
|
||||
|
@ -176,7 +176,7 @@ namespace PKHeX.Core
|
|||
if (pkm.Format <= 2) // prior to storing GameVersion
|
||||
return ParsePK1;
|
||||
|
||||
int gen = pkm.GenNumber;
|
||||
int gen = pkm.Generation;
|
||||
if (gen <= 0)
|
||||
gen = pkm.Format;
|
||||
return gen switch
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
internal static IEnumerable<int> GetValidRelearn(PKM pkm, int species, int form, bool inheritlvlmoves, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
if (pkm.GenNumber < 6)
|
||||
if (pkm.Generation < 6)
|
||||
return Array.Empty<int>();
|
||||
|
||||
var r = new List<int>();
|
||||
|
@ -138,7 +138,7 @@ namespace PKHeX.Core
|
|||
break;
|
||||
if (pkm.InhabitedGeneration(7))
|
||||
{
|
||||
int index = PersonalTable.SM.GetFormeIndex(species, form);
|
||||
int index = PersonalTable.SM.GetFormIndex(species, form);
|
||||
return LevelUpSM[index].GetMoves(lvl);
|
||||
}
|
||||
break;
|
||||
|
@ -148,7 +148,7 @@ namespace PKHeX.Core
|
|||
case GameVersion.USUM:
|
||||
if (pkm.InhabitedGeneration(7))
|
||||
{
|
||||
int index = PersonalTable.USUM.GetFormeIndex(species, form);
|
||||
int index = PersonalTable.USUM.GetFormIndex(species, form);
|
||||
return LevelUpUSUM[index].GetMoves(lvl);
|
||||
}
|
||||
break;
|
||||
|
@ -158,7 +158,7 @@ namespace PKHeX.Core
|
|||
case GameVersion.SWSH:
|
||||
if (pkm.InhabitedGeneration(8))
|
||||
{
|
||||
int index = PersonalTable.SWSH.GetFormeIndex(species, form);
|
||||
int index = PersonalTable.SWSH.GetFormIndex(species, form);
|
||||
return LevelUpSWSH[index].GetMoves(lvl);
|
||||
}
|
||||
break;
|
||||
|
@ -206,7 +206,7 @@ namespace PKHeX.Core
|
|||
moves.AddRange(GetValidPostEvolutionMoves(pkm, species, evoChains[i], i, Version));
|
||||
}
|
||||
|
||||
if (pkm.GenNumber >= 6)
|
||||
if (pkm.Generation >= 6)
|
||||
moves.AddRange(pkm.RelearnMoves.Where(m => m != 0));
|
||||
return moves.Distinct().ToList();
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace PKHeX.Core
|
|||
if (pkm.Format == 3 && species == (int)Species.Deoxys)
|
||||
formCount = 4;
|
||||
else
|
||||
formCount = pkm.PersonalInfo.FormeCount;
|
||||
formCount = pkm.PersonalInfo.FormCount;
|
||||
|
||||
for (int form = 0; form < formCount; form++)
|
||||
r.AddRange(GetMoves(pkm, species, minLvLG1, minLvLG2, chain[0].Level, form, Tutor, version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, generation));
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (pkm.Species == enc.Species)
|
||||
{
|
||||
return MoveLevelUp.GetEncounterMoves(pkm.Species, pkm.AltForm, pkm.CurrentLevel, (GameVersion)pkm.Version);
|
||||
return MoveLevelUp.GetEncounterMoves(pkm.Species, pkm.Form, pkm.CurrentLevel, (GameVersion)pkm.Version);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace PKHeX.Core
|
|||
if (Relearn && pkm.Format >= 6)
|
||||
r.AddRange(pkm.RelearnMoves);
|
||||
|
||||
int start = pkm.GenNumber;
|
||||
int start = pkm.Generation;
|
||||
if (start < 0)
|
||||
start = pkm.Format; // be generous instead of returning nothing
|
||||
if (pkm is IBattleVersion b)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace PKHeX.Core
|
|||
: (IReadOnlyList<int>)Array.Empty<int>();
|
||||
|
||||
// Only TM/HM moves from the source game of the egg, not any other games from the same generation
|
||||
TMHM = MoveTechnicalMachine.GetTMHM(pkm, pkm.Species, pkm.AltForm, e.Generation, e.Version).ToList();
|
||||
TMHM = MoveTechnicalMachine.GetTMHM(pkm, pkm.Species, pkm.Form, e.Generation, e.Version).ToList();
|
||||
|
||||
// Non-Base moves that can magically appear in the regular movepool
|
||||
bool volt = (e.Generation > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
|
||||
|
|
|
@ -30,13 +30,13 @@ namespace PKHeX.Core
|
|||
|
||||
public List<int> AddMoves(List<int> moves, int species, int form, int max, int min = 0)
|
||||
{
|
||||
int index = Table.GetFormeIndex(species, form);
|
||||
int index = Table.GetFormIndex(species, form);
|
||||
return AddMovesIndex(moves, index, max, min);
|
||||
}
|
||||
|
||||
public List<int> AddMoves1(List<int> moves, int species, int form, int max, int min)
|
||||
{
|
||||
int index = Table.GetFormeIndex(species, form);
|
||||
int index = Table.GetFormIndex(species, form);
|
||||
return AddMovesIndex1(moves, index, max, min);
|
||||
}
|
||||
|
||||
|
@ -49,13 +49,13 @@ namespace PKHeX.Core
|
|||
|
||||
public List<int> GetMoves(int species, int form, int min, int max)
|
||||
{
|
||||
int index = Table.GetFormeIndex(species, form);
|
||||
int index = Table.GetFormIndex(species, form);
|
||||
return Learn[index].GetMoveList(max, min);
|
||||
}
|
||||
|
||||
public LearnVersion GetIsLevelUp(int species, int form, int move)
|
||||
{
|
||||
int index = Table.GetFormeIndex(species, form);
|
||||
int index = Table.GetFormIndex(species, form);
|
||||
if (index <= 0)
|
||||
return LearnNONE;
|
||||
var lv = Learn[index].GetLevelLearnMove(move);
|
||||
|
@ -66,7 +66,7 @@ namespace PKHeX.Core
|
|||
|
||||
public LearnVersion GetIsLevelUp(int species, int form, int move, int max)
|
||||
{
|
||||
int index = Table.GetFormeIndex(species, form);
|
||||
int index = Table.GetFormIndex(species, form);
|
||||
if (index <= 0)
|
||||
return LearnNONE;
|
||||
var lv = Learn[index].GetLevelLearnMove(move);
|
||||
|
@ -77,7 +77,7 @@ namespace PKHeX.Core
|
|||
|
||||
public LearnVersion GetIsLevelUpMin(int species, int move, int max, int min, int form)
|
||||
{
|
||||
int index = Table.GetFormeIndex(species, form);
|
||||
int index = Table.GetFormIndex(species, form);
|
||||
if (index <= 0)
|
||||
return LearnNONE;
|
||||
var lv = Learn[index].GetLevelLearnMove(move, min);
|
||||
|
@ -88,7 +88,7 @@ namespace PKHeX.Core
|
|||
|
||||
public LearnVersion GetIsLevelUpG1(int species, int form, int move, int max, int min = 0)
|
||||
{
|
||||
int index = PersonalTable.RB.GetFormeIndex(species, form);
|
||||
int index = PersonalTable.RB.GetFormIndex(species, form);
|
||||
if (index == 0)
|
||||
return LearnNONE;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
public static int[] GetEggMoves(PKM pkm, int species, int formnum, GameVersion version)
|
||||
{
|
||||
int gen = pkm.Format <= 2 || pkm.VC ? 2 : pkm.GenNumber;
|
||||
int gen = pkm.Format <= 2 || pkm.VC ? 2 : pkm.Generation;
|
||||
if (!pkm.InhabitedGeneration(gen, species) || (pkm.PersonalInfo.Genderless && !FixedGenderFromBiGender.Contains(species)))
|
||||
return Array.Empty<int>();
|
||||
|
||||
|
@ -103,7 +103,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
return Array.Empty<int>();
|
||||
|
||||
int[] getMoves(IReadOnlyList<Learnset> moves, PersonalTable table) => moves[table.GetFormeIndex(species, formnum)].GetMoves(lvl);
|
||||
int[] getMoves(IReadOnlyList<Learnset> moves, PersonalTable table) => moves[table.GetFormIndex(species, formnum)].GetMoves(lvl);
|
||||
}
|
||||
|
||||
public static bool GetIsSharedEggMove(PKM pkm, int gen, int move)
|
||||
|
@ -111,7 +111,7 @@ namespace PKHeX.Core
|
|||
if (gen < 8 || pkm.IsEgg)
|
||||
return false;
|
||||
var table = PersonalTable.SWSH;
|
||||
var entry = (PersonalInfoSWSH)table.GetFormeEntry(pkm.Species, pkm.AltForm);
|
||||
var entry = (PersonalInfoSWSH)table.GetFormEntry(pkm.Species, pkm.Form);
|
||||
var baseSpecies = entry.HatchSpecies;
|
||||
var baseForm = entry.HatchFormIndexEverstone;
|
||||
var egg = GetEggMoves(8, baseSpecies, baseForm, GameVersion.SW);
|
||||
|
|
|
@ -488,14 +488,14 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (version <= 0)
|
||||
version = (GameVersion)pk.Version;
|
||||
return GetEncounterMoves(pk.Species, pk.AltForm, level, version);
|
||||
return GetEncounterMoves(pk.Species, pk.Form, level, version);
|
||||
}
|
||||
|
||||
private static int[] GetEncounterMoves1(int species, int level, GameVersion version)
|
||||
{
|
||||
var learn = GameData.GetLearnsets(version);
|
||||
var table = GameData.GetPersonal(version);
|
||||
var index = table.GetFormeIndex(species, 0);
|
||||
var index = table.GetFormIndex(species, 0);
|
||||
var lvl0 = (int[])((PersonalInfoG1) table[index]).Moves.Clone();
|
||||
int start = Math.Max(0, Array.FindIndex(lvl0, z => z == 0));
|
||||
|
||||
|
@ -506,7 +506,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var learn = GameData.GetLearnsets(version);
|
||||
var table = GameData.GetPersonal(version);
|
||||
var index = table.GetFormeIndex(species, 0);
|
||||
var index = table.GetFormIndex(species, 0);
|
||||
var lvl0 = learn[species].GetEncounterMoves(1);
|
||||
int start = Math.Max(0, Array.FindIndex(lvl0, z => z == 0));
|
||||
|
||||
|
@ -521,7 +521,7 @@ namespace PKHeX.Core
|
|||
return GetEncounterMoves2(species, level, version);
|
||||
var learn = GameData.GetLearnsets(version);
|
||||
var table = GameData.GetPersonal(version);
|
||||
var index = table.GetFormeIndex(species, form);
|
||||
var index = table.GetFormIndex(species, form);
|
||||
return learn[index].GetEncounterMoves(level);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
for (int i = 0; i < Legal.TM_3.Length; i++)
|
||||
{
|
||||
if (Legal.TM_4[i] == move && PersonalTable.HGSS.GetFormeEntry(species, form).TMHM[i])
|
||||
if (Legal.TM_4[i] == move && PersonalTable.HGSS.GetFormEntry(species, form).TMHM[i])
|
||||
return GameVersion.Gen4;
|
||||
}
|
||||
|
||||
|
@ -100,11 +100,11 @@ namespace PKHeX.Core
|
|||
switch (move)
|
||||
{
|
||||
case 250: // Whirlpool
|
||||
if (PersonalTable.HGSS.GetFormeEntry(species, form).TMHM[96])
|
||||
if (PersonalTable.HGSS.GetFormEntry(species, form).TMHM[96])
|
||||
return GameVersion.HGSS;
|
||||
break;
|
||||
case 432: // Defog
|
||||
if (PersonalTable.Pt.GetFormeEntry(species, form).TMHM[96])
|
||||
if (PersonalTable.Pt.GetFormEntry(species, form).TMHM[96])
|
||||
return GameVersion.DPPt;
|
||||
break;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (m == move)
|
||||
{
|
||||
if (PersonalTable.Pt.GetFormeEntry(species, form).TMHM[i + 92])
|
||||
if (PersonalTable.Pt.GetFormEntry(species, form).TMHM[i + 92])
|
||||
return GameVersion.DPPt;
|
||||
break;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (m == move)
|
||||
{
|
||||
if (PersonalTable.HGSS.GetFormeEntry(species, form).TMHM[i + 92])
|
||||
if (PersonalTable.HGSS.GetFormEntry(species, form).TMHM[i + 92])
|
||||
return GameVersion.HGSS;
|
||||
break;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ namespace PKHeX.Core
|
|||
for (int i = 0; i < Legal.TMHM_BW.Length; i++)
|
||||
{
|
||||
if (Legal.TMHM_BW[i] == move)
|
||||
return PersonalTable.B2W2.GetFormeEntry(species, form).TMHM[i] ? GameVersion.Gen5 : Legal.NONE;
|
||||
return PersonalTable.B2W2.GetFormEntry(species, form).TMHM[i] ? GameVersion.Gen5 : Legal.NONE;
|
||||
}
|
||||
return Legal.NONE;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (Legal.TMHM_XY[i] != move)
|
||||
continue;
|
||||
if (PersonalTable.XY.GetFormeEntry(species, form).TMHM[i])
|
||||
if (PersonalTable.XY.GetFormEntry(species, form).TMHM[i])
|
||||
return GameVersion.XY;
|
||||
break;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (Legal.TMHM_AO[i] != move)
|
||||
continue;
|
||||
if (PersonalTable.AO.GetFormeEntry(species, form).TMHM[i])
|
||||
if (PersonalTable.AO.GetFormEntry(species, form).TMHM[i])
|
||||
return GameVersion.ORAS;
|
||||
break;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (Legal.TMHM_GG[i] != move)
|
||||
continue;
|
||||
if (PersonalTable.GG.GetFormeEntry(species, form).TMHM[i])
|
||||
if (PersonalTable.GG.GetFormEntry(species, form).TMHM[i])
|
||||
return GameVersion.GG;
|
||||
break;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (Legal.TMHM_SM[i] != move)
|
||||
continue;
|
||||
if (PersonalTable.SM.GetFormeEntry(species, form).TMHM[i])
|
||||
if (PersonalTable.SM.GetFormEntry(species, form).TMHM[i])
|
||||
return GameVersion.SM;
|
||||
break;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (Legal.TMHM_SM[i] != move)
|
||||
continue;
|
||||
if (PersonalTable.USUM.GetFormeEntry(species, form).TMHM[i])
|
||||
if (PersonalTable.USUM.GetFormEntry(species, form).TMHM[i])
|
||||
return GameVersion.USUM;
|
||||
break;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (Legal.TMHM_SWSH[i] != move)
|
||||
continue;
|
||||
if (PersonalTable.SWSH.GetFormeEntry(species, form).TMHM[i])
|
||||
if (PersonalTable.SWSH.GetFormEntry(species, form).TMHM[i])
|
||||
return GameVersion.SWSH;
|
||||
break;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (Legal.TMHM_SWSH[i + 100] != move)
|
||||
continue;
|
||||
if (!PersonalTable.SWSH.GetFormeEntry(species, form).TMHM[i + 100])
|
||||
if (!PersonalTable.SWSH.GetFormEntry(species, form).TMHM[i + 100])
|
||||
break;
|
||||
if (allowBit)
|
||||
return GameVersion.SWSH;
|
||||
|
@ -275,7 +275,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMachine1(List<int> r, int species)
|
||||
{
|
||||
int index = PersonalTable.RB.GetFormeIndex(species, 0);
|
||||
int index = PersonalTable.RB.GetFormIndex(species, 0);
|
||||
if (index == 0)
|
||||
return;
|
||||
var pi_rb = (PersonalInfoG1)PersonalTable.RB[index];
|
||||
|
@ -286,7 +286,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMachine2(List<int> r, int species)
|
||||
{
|
||||
int index = PersonalTable.C.GetFormeIndex(species, 0);
|
||||
int index = PersonalTable.C.GetFormIndex(species, 0);
|
||||
if (index == 0)
|
||||
return;
|
||||
var pi_c = PersonalTable.C[index];
|
||||
|
@ -295,7 +295,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMachine3(List<int> r, int species, int format, bool RemoveTransfer)
|
||||
{
|
||||
int index = PersonalTable.E.GetFormeIndex(species, 0);
|
||||
int index = PersonalTable.E.GetFormIndex(species, 0);
|
||||
if (index == 0)
|
||||
return;
|
||||
var pi_c = PersonalTable.E[index];
|
||||
|
@ -309,8 +309,8 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMachine4(List<int> r, int species, int format, bool RemoveTransfer, int form)
|
||||
{
|
||||
var pi_hgss = PersonalTable.HGSS.GetFormeEntry(species, form);
|
||||
var pi_dppt = PersonalTable.Pt.GetFormeEntry(species, form);
|
||||
var pi_hgss = PersonalTable.HGSS.GetFormEntry(species, form);
|
||||
var pi_dppt = PersonalTable.Pt.GetFormEntry(species, form);
|
||||
r.AddRange(Legal.TM_4.Where((_, m) => pi_hgss.TMHM[m]));
|
||||
|
||||
if (RemoveTransfer && format > 4)
|
||||
|
@ -331,7 +331,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMachine5(List<int> r, int species, int form)
|
||||
{
|
||||
var pi = PersonalTable.B2W2.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.B2W2.GetFormEntry(species, form);
|
||||
r.AddRange(Legal.TMHM_BW.Where((_, m) => pi.TMHM[m]));
|
||||
}
|
||||
|
||||
|
@ -397,13 +397,13 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMachine6XY(List<int> r, int species, int form)
|
||||
{
|
||||
var pi = PersonalTable.XY.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.XY.GetFormEntry(species, form);
|
||||
r.AddRange(Legal.TMHM_XY.Where((_, m) => pi.TMHM[m]));
|
||||
}
|
||||
|
||||
private static void AddMachine6AO(List<int> r, int species, int form)
|
||||
{
|
||||
var pi = PersonalTable.AO.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.AO.GetFormEntry(species, form);
|
||||
r.AddRange(Legal.TMHM_AO.Where((_, m) => pi.TMHM[m]));
|
||||
}
|
||||
|
||||
|
@ -411,13 +411,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (species > Legal.MaxSpeciesID_7)
|
||||
return;
|
||||
var pi = PersonalTable.SM.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.SM.GetFormEntry(species, form);
|
||||
r.AddRange(Legal.TMHM_SM.Where((_, m) => pi.TMHM[m]));
|
||||
}
|
||||
|
||||
private static void AddMachineUSUM(List<int> r, int species, int form)
|
||||
{
|
||||
var pi = PersonalTable.USUM.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.USUM.GetFormEntry(species, form);
|
||||
r.AddRange(Legal.TMHM_SM.Where((_, m) => pi.TMHM[m]));
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (species > Legal.MaxSpeciesID_7b)
|
||||
return;
|
||||
var pi = PersonalTable.GG.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.GG.GetFormEntry(species, form);
|
||||
r.AddRange(Legal.TMHM_GG.Where((_, m) => pi.TMHM[m]));
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (species > Legal.MaxSpeciesID_8)
|
||||
return;
|
||||
var pi = PersonalTable.SWSH.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.SWSH.GetFormEntry(species, form);
|
||||
var tmhm = pi.TMHM;
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static GameVersion GetIsTutor4(int species, int form, int move)
|
||||
{
|
||||
var pi = PersonalTable.HGSS.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.HGSS.GetFormEntry(species, form);
|
||||
for (int i = 0; i < Tutors_4.Length; i++)
|
||||
{
|
||||
if (Tutors_4[i] == move && pi.TypeTutors[i])
|
||||
|
@ -99,7 +99,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static GameVersion GetIsTutor5(PKM pkm, int species, int form, bool specialTutors, int move)
|
||||
{
|
||||
var pi = PersonalTable.B2W2.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.B2W2.GetFormEntry(species, form);
|
||||
var arr = TypeTutor6;
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static GameVersion GetIsTutor6(PKM pkm, int species, int form, bool specialTutors, int move)
|
||||
{
|
||||
var pi = PersonalTable.AO.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.AO.GetFormEntry(species, form);
|
||||
var arr = TypeTutor6;
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static GameVersion GetIsTutor7(PKM pkm, int species, int form, bool specialTutors, int move)
|
||||
{
|
||||
var pi = PersonalTable.USUM.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.USUM.GetFormEntry(species, form);
|
||||
var arr = TypeTutor6;
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static GameVersion GetIsTutor8(PKM pkm, int species, int form, bool specialTutors, int move)
|
||||
{
|
||||
var pi = (PersonalInfoSWSH)PersonalTable.SWSH.GetFormeEntry(species, form);
|
||||
var pi = (PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(species, form);
|
||||
var arr = TypeTutor8;
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMovesTutor4(List<int> moves, int species, int form)
|
||||
{
|
||||
var pi = PersonalTable.HGSS.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.HGSS.GetFormEntry(species, form);
|
||||
moves.AddRange(Tutors_4.Where((_, i) => pi.TypeTutors[i]));
|
||||
moves.AddRange(SpecialTutors_4.Where((_, i) => SpecialTutors_Compatibility_4[i].Any(e => e == species)));
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ namespace PKHeX.Core
|
|||
var pi = PersonalTable.B2W2[species];
|
||||
moves.AddRange(TypeTutor6.Where((_, i) => pi.TypeTutors[i]));
|
||||
if (pkm.InhabitedGeneration(5) && specialTutors)
|
||||
moves.AddRange(GetTutors(PersonalTable.B2W2.GetFormeEntry(species, form), Tutors_B2W2));
|
||||
moves.AddRange(GetTutors(PersonalTable.B2W2.GetFormEntry(species, form), Tutors_B2W2));
|
||||
}
|
||||
|
||||
private static void AddMovesTutor6(List<int> moves, int species, int form, PKM pkm, bool specialTutors)
|
||||
|
@ -259,14 +259,14 @@ namespace PKHeX.Core
|
|||
var pi = PersonalTable.AO[species];
|
||||
moves.AddRange(TypeTutor6.Where((_, i) => pi.TypeTutors[i]));
|
||||
if (specialTutors && pkm.HasVisitedORAS(species))
|
||||
moves.AddRange(GetTutors(PersonalTable.AO.GetFormeEntry(species, form), Tutors_AO));
|
||||
moves.AddRange(GetTutors(PersonalTable.AO.GetFormEntry(species, form), Tutors_AO));
|
||||
}
|
||||
|
||||
private static void AddMovesTutor7(List<int> moves, int species, int form, PKM pkm, bool specialTutors)
|
||||
{
|
||||
if (pkm.GG)
|
||||
return;
|
||||
var pi = PersonalTable.USUM.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.USUM.GetFormEntry(species, form);
|
||||
moves.AddRange(TypeTutor6.Where((_, i) => pi.TypeTutors[i]));
|
||||
if (specialTutors && pkm.HasVisitedUSUM(species))
|
||||
moves.AddRange(GetTutors(pi, Tutors_USUM));
|
||||
|
@ -274,7 +274,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMovesTutor8(List<int> moves, int species, int form, PKM pkm, bool specialTutors)
|
||||
{
|
||||
var pi = (PersonalInfoSWSH)PersonalTable.SWSH.GetFormeEntry(species, form);
|
||||
var pi = (PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(species, form);
|
||||
if (!pi.IsPresentInGame)
|
||||
return;
|
||||
moves.AddRange(TypeTutor8.Where((_, i) => pi.TypeTutors[i]));
|
||||
|
@ -305,15 +305,15 @@ namespace PKHeX.Core
|
|||
r.Add(547); // Relic Song
|
||||
break;
|
||||
case (int)Species.Pikachu when Generation == 6 && pkm.Format == 6:
|
||||
int index = pkm.AltForm - 1;
|
||||
int index = pkm.Form - 1;
|
||||
if ((uint)index < CosplayPikachuMoves.Length)
|
||||
r.Add(CosplayPikachuMoves[index]);
|
||||
break;
|
||||
|
||||
case (int)Species.Pikachu when Generation == 7 && pkm.AltForm == 8:
|
||||
case (int)Species.Pikachu when Generation == 7 && pkm.Form == 8:
|
||||
r.AddRange(Tutor_StarterPikachu);
|
||||
break;
|
||||
case (int)Species.Eevee when Generation == 7 && pkm.AltForm == 1:
|
||||
case (int)Species.Eevee when Generation == 7 && pkm.Form == 1:
|
||||
r.AddRange(Tutor_StarterEevee);
|
||||
break;
|
||||
|
||||
|
@ -333,17 +333,17 @@ namespace PKHeX.Core
|
|||
{
|
||||
case (int)Species.Rotom when Generation >= 4:
|
||||
var formMoves = RotomMoves;
|
||||
var form = pkm.AltForm - 1;
|
||||
var form = pkm.Form - 1;
|
||||
if ((uint)form < formMoves.Length)
|
||||
r.Add(RotomMoves[form]);
|
||||
break;
|
||||
case (int)Species.Zygarde when Generation == 7:
|
||||
r.AddRange(ZygardeMoves);
|
||||
break;
|
||||
case (int)Species.Necrozma when pkm.AltForm == 1: // Sun
|
||||
case (int)Species.Necrozma when pkm.Form == 1: // Sun
|
||||
r.Add(713);
|
||||
break;
|
||||
case (int)Species.Necrozma when pkm.AltForm == 2: // Moon
|
||||
case (int)Species.Necrozma when pkm.Form == 2: // Moon
|
||||
r.Add(714);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace PKHeX.Core
|
|||
|
||||
// gather possible nature determination seeds until a same-nature PID breaks the unrolling
|
||||
var seeds = pk.Species == (int)Species.Unown && pk.FRLG // reversed await case
|
||||
? SeedInfo.GetSeedsUntilUnownForm(pidiv, info, pk.AltForm)
|
||||
? SeedInfo.GetSeedsUntilUnownForm(pidiv, info, pk.Form)
|
||||
: SeedInfo.GetSeedsUntilNature(pidiv, info);
|
||||
|
||||
var frames = pidiv.Type == PIDType.CuteCharm
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
public static bool Verify<T>(this T raid, PK8 pk8, ulong seed) where T: EncounterStatic8Nest<T>
|
||||
{
|
||||
var pi = PersonalTable.SWSH.GetFormeEntry(raid.Species, raid.Form);
|
||||
var pi = PersonalTable.SWSH.GetFormEntry(raid.Species, raid.Form);
|
||||
var ratio = pi.Gender;
|
||||
var abil = RemapAbilityToParam(raid.Ability);
|
||||
var IVs = raid.IVs.Count == 0 ? GetBlankIVTemplate() : PKX.ReorderSpeedLast((int[])((int[])raid.IVs).Clone());
|
||||
|
@ -17,8 +17,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
// Ensure the species-form is set correctly (nature)
|
||||
pk8.Species = raid.Species;
|
||||
pk8.AltForm = raid.Form;
|
||||
var pi = PersonalTable.SWSH.GetFormeEntry(raid.Species, raid.Form);
|
||||
pk8.Form = raid.Form;
|
||||
var pi = PersonalTable.SWSH.GetFormEntry(raid.Species, raid.Form);
|
||||
var ratio = pi.Gender;
|
||||
var abil = RemapAbilityToParam(raid.Ability);
|
||||
var IVs = raid.IVs.Count == 0 ? GetBlankIVTemplate() : PKX.ReorderSpeedLast((int[])((int[])raid.IVs).Clone());
|
||||
|
@ -142,14 +142,14 @@ namespace PKHeX.Core
|
|||
|
||||
if (nature_param == -1)
|
||||
{
|
||||
if (pk.Species == (int) Species.Toxtricity && pk.AltForm == 0)
|
||||
if (pk.Species == (int) Species.Toxtricity && pk.Form == 0)
|
||||
{
|
||||
var table = Nature0;
|
||||
var choice = table[rng.NextInt((uint)table.Length)];
|
||||
if (pk.Nature != choice)
|
||||
return false;
|
||||
}
|
||||
else if (pk.Species == (int) Species.Toxtricity && pk.AltForm == 1)
|
||||
else if (pk.Species == (int) Species.Toxtricity && pk.Form == 1)
|
||||
{
|
||||
var table = Nature1;
|
||||
var choice = table[rng.NextInt((uint)table.Length)];
|
||||
|
@ -267,12 +267,12 @@ namespace PKHeX.Core
|
|||
int nature;
|
||||
if (nature_param == -1)
|
||||
{
|
||||
if (pk.Species == (int)Species.Toxtricity && pk.AltForm == 0)
|
||||
if (pk.Species == (int)Species.Toxtricity && pk.Form == 0)
|
||||
{
|
||||
var table = Nature0;
|
||||
nature = table[rng.NextInt((uint)table.Length)];
|
||||
}
|
||||
else if (pk.Species == (int)Species.Toxtricity && pk.AltForm == 1)
|
||||
else if (pk.Species == (int)Species.Toxtricity && pk.Form == 1)
|
||||
{
|
||||
var table = Nature1;
|
||||
nature = table[rng.NextInt((uint)table.Length)];
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace PKHeX
|
|||
{
|
||||
var result = new int[moves.Count];
|
||||
|
||||
int index = PersonalTable.RB.GetFormeIndex(species, 0);
|
||||
int index = PersonalTable.RB.GetFormIndex(species, 0);
|
||||
if (index == 0)
|
||||
return result;
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace PKHeX.Core
|
|||
|
||||
// Store repeatedly accessed values
|
||||
Game = (GameVersion)pkm.Version;
|
||||
Generation = pkm.GenNumber;
|
||||
Generation = pkm.Generation;
|
||||
}
|
||||
|
||||
/// <summary>List of all near-matches that were rejected for a given reason.</summary>
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Contains logic for Alternate Form information.
|
||||
/// </summary>
|
||||
public static class AltFormInfo
|
||||
public static class FormInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if the form cannot exist outside of a Battle.
|
||||
|
@ -244,8 +244,8 @@ namespace PKHeX.Core
|
|||
/// <param name="species">Entity species</param>
|
||||
/// <param name="form">Entity form</param>
|
||||
/// <param name="format">Current generation format</param>
|
||||
/// <seealso cref="HasFormeValuesNotIndicatedByPersonal"/>
|
||||
public static bool IsValidOutOfBoundsForme(int species, int form, int format)
|
||||
/// <seealso cref="HasFormValuesNotIndicatedByPersonal"/>
|
||||
public static bool IsValidOutOfBoundsForm(int species, int form, int format)
|
||||
{
|
||||
return (Species) species switch
|
||||
{
|
||||
|
@ -260,28 +260,28 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the <see cref="PKM"/> data should have a drop-down selection visible for the <see cref="PKM.AltForm"/> value.
|
||||
/// Checks if the <see cref="PKM"/> data should have a drop-down selection visible for the <see cref="PKM.Form"/> value.
|
||||
/// </summary>
|
||||
/// <param name="pi">Game specific personal info</param>
|
||||
/// <param name="species"><see cref="Species"/> ID</param>
|
||||
/// <param name="format"><see cref="PKM.AltForm"/> ID</param>
|
||||
/// <param name="format"><see cref="PKM.Form"/> ID</param>
|
||||
/// <returns>True if has formes that can be provided by <see cref="FormConverter.GetFormList"/>, otherwise false for none.</returns>
|
||||
public static bool HasFormSelection(PersonalInfo pi, int species, int format)
|
||||
{
|
||||
if (format <= 3 && species != (int)Unown)
|
||||
return false;
|
||||
|
||||
if (HasFormeValuesNotIndicatedByPersonal.Contains(species))
|
||||
if (HasFormValuesNotIndicatedByPersonal.Contains(species))
|
||||
return true;
|
||||
|
||||
int count = pi.FormeCount;
|
||||
int count = pi.FormCount;
|
||||
return count > 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <seealso cref="IsValidOutOfBoundsForme"/>
|
||||
/// <seealso cref="IsValidOutOfBoundsForm"/>
|
||||
/// </summary>
|
||||
private static readonly HashSet<int> HasFormeValuesNotIndicatedByPersonal = new HashSet<int>
|
||||
private static readonly HashSet<int> HasFormValuesNotIndicatedByPersonal = new HashSet<int>
|
||||
{
|
||||
(int)Unown,
|
||||
(int)Mothim, // (Burmy forme carried over, not cleared)
|
|
@ -68,7 +68,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
var enc = data.EncounterMatch;
|
||||
if (enc is MysteryGift g && g.Format >= 4)
|
||||
if (enc is MysteryGift g && g.Generation >= 4)
|
||||
return VerifyAbilityMG(data, g, abilities);
|
||||
|
||||
if (format < 6)
|
||||
|
|
|
@ -201,7 +201,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (!Legal.Inherit_Apricorn7.Contains(species))
|
||||
return GetInvalid(LBallSpecies);
|
||||
if (Legal.Ban_NoHidden7Apricorn.Contains(species | pkm.AltForm << 11) && IsHiddenAndNotPossible(pkm))
|
||||
if (Legal.Ban_NoHidden7Apricorn.Contains(species | pkm.Form << 11) && IsHiddenAndNotPossible(pkm))
|
||||
return GetInvalid(LBallAbility);
|
||||
return GetValid(LBallSpeciesPass);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (ball == Beast)
|
||||
{
|
||||
if (species == (int)Species.Flabébé && pkm.AltForm == 3 && IsHiddenAndNotPossible(pkm))
|
||||
if (species == (int)Species.Flabébé && pkm.Form == 3 && IsHiddenAndNotPossible(pkm))
|
||||
return GetInvalid(LBallAbility); // Can't obtain Flabébé-Blue with Hidden Ability in wild
|
||||
if (species == (int)Species.Voltorb && IsHiddenAndNotPossible(pkm))
|
||||
return GetInvalid(LBallAbility); // Can't obtain with Hidden Ability in wild (can only breed with Ditto)
|
||||
|
@ -285,7 +285,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (!Legal.Inherit_Apricorn7.Contains(species))
|
||||
return GetInvalid(LBallSpecies);
|
||||
if (Legal.Ban_NoHidden8Apricorn.Contains(species | pkm.AltForm << 11) && IsHiddenAndNotPossible(pkm)) // lineage is 3->2->origin
|
||||
if (Legal.Ban_NoHidden8Apricorn.Contains(species | pkm.Form << 11) && IsHiddenAndNotPossible(pkm)) // lineage is 3->2->origin
|
||||
return GetInvalid(LBallAbility);
|
||||
return GetValid(LBallSpeciesPass);
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (ball == Beast)
|
||||
{
|
||||
if (species == (int)Species.Flabébé && pkm.AltForm == 3 && IsHiddenAndNotPossible(pkm))
|
||||
if (species == (int)Species.Flabébé && pkm.Form == 3 && IsHiddenAndNotPossible(pkm))
|
||||
return GetInvalid(LBallAbility); // Can't obtain Flabébé-Blue with Hidden Ability in wild
|
||||
if (((int)Species.Pikipek <= species && species <= (int)Species.Kommoo) || (Legal.AlolanCaptureOffspring.Contains(species) && !Legal.PastGenAlolanNativesUncapturable.Contains(species)))
|
||||
return GetValid(LBallSpeciesPass);
|
||||
|
@ -353,7 +353,7 @@ namespace PKHeX.Core
|
|||
|
||||
// Everything breed-able that is in the Galar Dex can be captured in-game.
|
||||
var pt = PersonalTable.SWSH;
|
||||
var pi = (PersonalInfoSWSH) pt.GetFormeEntry(species, 0);
|
||||
var pi = (PersonalInfoSWSH) pt.GetFormEntry(species, 0);
|
||||
if (pi.IsInDex)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using static PKHeX.Core.LegalityCheckStrings;
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies the <see cref="PKM.AltForm"/> value.
|
||||
/// Verifies the <see cref="PKM.Form"/> value.
|
||||
/// </summary>
|
||||
public sealed class FormVerifier : Verifier
|
||||
{
|
||||
|
@ -30,8 +30,8 @@ namespace PKHeX.Core
|
|||
var pkm = data.pkm;
|
||||
var PersonalInfo = data.PersonalInfo;
|
||||
|
||||
int count = PersonalInfo.FormeCount;
|
||||
var form = pkm.AltForm;
|
||||
int count = PersonalInfo.FormCount;
|
||||
var form = pkm.Form;
|
||||
if (count <= 1 && form == 0)
|
||||
return VALID; // no forms to check
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace PKHeX.Core
|
|||
var EncounterMatch = data.EncounterMatch;
|
||||
var Info = data.Info;
|
||||
|
||||
if (!PersonalInfo.IsFormeWithinRange(form) && !AltFormInfo.IsValidOutOfBoundsForme(species, form, Info.Generation))
|
||||
if (!PersonalInfo.IsFormWithinRange(form) && !FormInfo.IsValidOutOfBoundsForm(species, form, Info.Generation))
|
||||
return GetInvalid(string.Format(LFormInvalidRange, count - 1, form));
|
||||
|
||||
if (EncounterMatch is EncounterSlot w && w.Area.Type == SlotType.FriendSafari)
|
||||
|
@ -48,7 +48,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
else if (EncounterMatch is EncounterEgg)
|
||||
{
|
||||
if (AltFormInfo.IsTotemForm(species, form, data.Info.Generation))
|
||||
if (FormInfo.IsTotemForm(species, form, data.Info.Generation))
|
||||
return GetInvalid(LFormInvalidGame);
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace PKHeX.Core
|
|||
case (int)Species.Toxtricity when Info.EncounterMatch.Species == (int)Species.Toxtricity:
|
||||
{
|
||||
// The game enforces the Nature for Toxtricity encounters too!
|
||||
if (pkm.AltForm != EvolutionMethod.GetAmpLowKeyResult(pkm.Nature))
|
||||
if (pkm.Form != EvolutionMethod.GetAmpLowKeyResult(pkm.Nature))
|
||||
return GetInvalid(LFormInvalidNature);
|
||||
break;
|
||||
}
|
||||
|
@ -176,13 +176,13 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
var format = pkm.Format;
|
||||
if (AltFormInfo.IsBattleOnlyForm(species, form, format))
|
||||
if (FormInfo.IsBattleOnlyForm(species, form, format))
|
||||
return GetInvalid(LFormBattle);
|
||||
|
||||
if (form == 0)
|
||||
return VALID;
|
||||
|
||||
// everything below here is currently an altform
|
||||
// everything below here is not Form 0, so it has a form.
|
||||
if (format >= 7 && Info.Generation < 7)
|
||||
{
|
||||
if (species == 25 || Legal.AlolanOriginForms.Contains(species) || Legal.AlolanVariantEvolutions12.Contains(data.EncounterOriginal.Species))
|
||||
|
@ -248,18 +248,18 @@ namespace PKHeX.Core
|
|||
var pkm = data.pkm;
|
||||
switch (pkm.Species)
|
||||
{
|
||||
case (int)Species.Floette when !SafariFloette.Contains(pkm.AltForm): // Floette
|
||||
case (int)Species.Florges when !SafariFloette.Contains(pkm.AltForm): // Florges
|
||||
case (int)Species.Floette when !SafariFloette.Contains(pkm.Form): // Floette
|
||||
case (int)Species.Florges when !SafariFloette.Contains(pkm.Form): // Florges
|
||||
data.AddLine(GetInvalid(LFormSafariFlorgesColor));
|
||||
break;
|
||||
case 710 when pkm.AltForm != 0: // Pumpkaboo
|
||||
case (int)Species.Gourgeist when pkm.AltForm != 0: // Average
|
||||
case 710 when pkm.Form != 0: // Pumpkaboo
|
||||
case (int)Species.Gourgeist when pkm.Form != 0: // Average
|
||||
data.AddLine(GetInvalid(LFormSafariPumpkabooAverage));
|
||||
break;
|
||||
case (int)Species.Gastrodon when pkm.AltForm != 0: // West
|
||||
case (int)Species.Gastrodon when pkm.Form != 0: // West
|
||||
data.AddLine(GetInvalid(LFormSafariFlorgesColor));
|
||||
break;
|
||||
case (int)Species.Sawsbuck when pkm.AltForm != 0: // Sawsbuck
|
||||
case (int)Species.Sawsbuck when pkm.Form != 0: // Sawsbuck
|
||||
data.AddLine(GetInvalid(LFormSafariSawsbuckSpring));
|
||||
break;
|
||||
}
|
||||
|
@ -280,9 +280,9 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (arg > 5)
|
||||
return GetInvalid(LFormArgumentHigh);
|
||||
if (arg == 0 && pkm.AltForm != 0)
|
||||
if (arg == 0 && pkm.Form != 0)
|
||||
return GetInvalid(LFormArgumentNotAllowed);
|
||||
if (arg != 0 && pkm.AltForm == 0)
|
||||
if (arg != 0 && pkm.Form == 0)
|
||||
return GetInvalid(LFormArgumentNotAllowed);
|
||||
break;
|
||||
}
|
||||
|
@ -290,13 +290,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (arg > 3)
|
||||
return GetInvalid(LFormArgumentHigh);
|
||||
if (arg == 0 && pkm.AltForm != 0)
|
||||
if (arg == 0 && pkm.Form != 0)
|
||||
return GetInvalid(LFormArgumentNotAllowed);
|
||||
if (arg != 0 && pkm.AltForm == 0)
|
||||
if (arg != 0 && pkm.Form == 0)
|
||||
return GetInvalid(LFormArgumentNotAllowed);
|
||||
break;
|
||||
}
|
||||
case (int)Species.Yamask when pkm.AltForm == 1:
|
||||
case (int)Species.Yamask when pkm.Form == 1:
|
||||
{
|
||||
if (pkm.IsEgg)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace PKHeX.Core
|
|||
switch (memory.MemoryID)
|
||||
{
|
||||
// {0} saw {2} carrying {1} on its back. {4} that {3}.
|
||||
case 21 when gen != 6 || !Legal.GetCanLearnMachineMove(new PK6 {Species = memory.Variable, EXP = Experience.GetEXP(100, PersonalTable.XY.GetFormeIndex(memory.Variable, 0))}, 19, 6):
|
||||
case 21 when gen != 6 || !Legal.GetCanLearnMachineMove(new PK6 {Species = memory.Variable, EXP = Experience.GetEXP(100, PersonalTable.XY.GetFormIndex(memory.Variable, 0))}, 19, 6):
|
||||
return GetInvalid(string.Format(LMemoryArgBadMove, memory.Handler));
|
||||
|
||||
case 16 when memory.Variable == 0 && !Legal.GetCanKnowMove(pkm, gen, memory.Variable, info.EvoChainsAllGens[gen]):
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace PKHeX.Core
|
|||
return; // Can have either state
|
||||
VerifyWC3Shiny(data, w);
|
||||
break;
|
||||
case MysteryGift g when g.Format != 3: // WC3
|
||||
case MysteryGift g when g.Generation != 3: // WC3
|
||||
VerifyReceivability(data, g);
|
||||
VerifyFatefulMysteryGift(data, g);
|
||||
return;
|
||||
|
@ -302,7 +302,7 @@ namespace PKHeX.Core
|
|||
// No point using the evolution tree. Just handle certain species.
|
||||
switch (pkm.Species)
|
||||
{
|
||||
case (int)Species.Lycanroc when pkm.Format == 7 && ((pkm.AltForm == 0 && Moon()) || (pkm.AltForm == 1 && Sun())):
|
||||
case (int)Species.Lycanroc when pkm.Format == 7 && ((pkm.Form == 0 && Moon()) || (pkm.Form == 1 && Sun())):
|
||||
case (int)Species.Solgaleo when Moon():
|
||||
case (int)Species.Lunala when Sun():
|
||||
bool Sun() => (pkm.Version & 1) == 0;
|
||||
|
@ -374,7 +374,7 @@ namespace PKHeX.Core
|
|||
return Math.Abs(ia - ib) <= 7;
|
||||
}
|
||||
|
||||
private static bool IsStarter(PKM pb7) => (pb7.Species == (int)Species.Pikachu && pb7.AltForm == 8) || (pb7.Species == (int)Species.Eevee && pb7.AltForm == 1);
|
||||
private static bool IsStarter(PKM pb7) => (pb7.Species == (int)Species.Pikachu && pb7.Form == 8) || (pb7.Species == (int)Species.Eevee && pb7.Form == 1);
|
||||
|
||||
private void VerifySWSHStats(LegalityAnalysis data, PK8 pk8)
|
||||
{
|
||||
|
@ -400,7 +400,7 @@ namespace PKHeX.Core
|
|||
bool originGMax = enc is IGigantamax g && g.CanGigantamax;
|
||||
if (originGMax != pk8.CanGigantamax)
|
||||
{
|
||||
bool ok = !pk8.IsEgg && pk8.CanToggleGigantamax(pk8.Species, pk8.AltForm, enc.Species, enc.Form);
|
||||
bool ok = !pk8.IsEgg && pk8.CanToggleGigantamax(pk8.Species, pk8.Form, enc.Species, enc.Form);
|
||||
var chk = ok ? GetValid(LStatGigantamaxValid) : GetInvalid(LStatGigantamaxInvalid);
|
||||
data.AddLine(chk);
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ namespace PKHeX.Core
|
|||
// Calyrex-0 cannot reacquire the move via relearner, even though the TR is checked off in the TR list.
|
||||
if (pk8.Species == (int) Species.Calyrex)
|
||||
{
|
||||
var form = pk8.AltForm;
|
||||
var form = pk8.Form;
|
||||
// Check if another alt form can learn the TR
|
||||
if ((form != 1 && CanLearnTR((int) Species.Calyrex, 1, i)) || (form != 2 && CanLearnTR((int) Species.Calyrex, 2, i)))
|
||||
continue;
|
||||
|
@ -438,7 +438,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool CanLearnTR(int species, int form, int tr)
|
||||
{
|
||||
var pi = PersonalTable.SWSH.GetFormeEntry(species, form);
|
||||
var pi = PersonalTable.SWSH.GetFormEntry(species, form);
|
||||
return pi.TMHM[tr + 100];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (pkm is IRibbonSetUnique4 u4)
|
||||
{
|
||||
if (!IsAllowedBattleFrontier(pkm.Species, pkm.AltForm, 4) || gen > 4)
|
||||
if (!IsAllowedBattleFrontier(pkm.Species, pkm.Form, 4) || gen > 4)
|
||||
{
|
||||
foreach (var z in GetInvalidRibbonsNone(u4.RibbonBitsAbility(), u4.RibbonNamesAbility()))
|
||||
yield return z;
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var pkm = data.pkm;
|
||||
int species = pkm.Species;
|
||||
var pi = (PersonalInfoSWSH)PersonalTable.SWSH.GetFormeEntry(species, pkm.AltForm);
|
||||
var pi = (PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(species, pkm.Form);
|
||||
if (!pi.IsPresentInGame) // Can't transfer
|
||||
{
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
|
@ -136,11 +136,11 @@ namespace PKHeX.Core
|
|||
}
|
||||
else if (enc.Generation < 8 && pkm.Format >= 8)
|
||||
{
|
||||
if (enc is EncounterStatic7 s && AltFormInfo.IsTotemForm(s.Species, s.Form, 7))
|
||||
if (enc is EncounterStatic7 s && FormInfo.IsTotemForm(s.Species, s.Form, 7))
|
||||
{
|
||||
if (Legal.Totem_NoTransfer.Contains(s.Species))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
if (pkm.AltForm != AltFormInfo.GetTotemBaseForm(s.Species, s.Form))
|
||||
if (pkm.Form != FormInfo.GetTotemBaseForm(s.Species, s.Form))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
else if (pkm.Species == (int)Species.Unown)
|
||||
{
|
||||
if (pkm.AltForm != 8 && pkm.AltForm != 21 && pkm.IsShiny) // impossibly form-shiny (not I or V)
|
||||
if (pkm.Form != 8 && pkm.Form != 21 && pkm.IsShiny) // impossibly form-shiny (not I or V)
|
||||
yield return GetInvalid(LEncStaticPIDShiny, CheckIdentifier.PID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace PKHeX.Core
|
|||
|
||||
public string Extension => GetType().Name.ToLower();
|
||||
public string FileName => $"{CardHeader}.{Extension}";
|
||||
public abstract int Format { get; }
|
||||
public abstract int Generation { get; }
|
||||
|
||||
public PKM ConvertToPKM(ITrainerInfo sav) => ConvertToPKM(sav, EncounterCriteria.Unrestricted);
|
||||
public abstract PKM ConvertToPKM(ITrainerInfo sav, EncounterCriteria criteria);
|
||||
|
@ -165,7 +165,7 @@ namespace PKHeX.Core
|
|||
|
||||
public virtual GameVersion Version
|
||||
{
|
||||
get => GameUtil.GetVersion(Format);
|
||||
get => GameUtil.GetVersion(Generation);
|
||||
set { }
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,6 @@ namespace PKHeX.Core
|
|||
public int LevelMax => Level;
|
||||
public abstract int Ball { get; set; }
|
||||
public virtual bool EggEncounter => IsEgg;
|
||||
public int Generation => Format;
|
||||
public abstract int EggLocation { get; set; }
|
||||
|
||||
public int TrainerID7 => (int)((uint)(TID | (SID << 16)) % 1000000);
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddLinesPKM(MysteryGift gift, IBasicStrings strings, ICollection<string> result)
|
||||
{
|
||||
var id = gift.Format < 7 ? $"{gift.TID:D5}/{gift.SID:D5}" : $"[{gift.TrainerSID7:D4}]{gift.TrainerID7:D6}";
|
||||
var id = gift.Generation < 7 ? $"{gift.TID:D5}/{gift.SID:D5}" : $"[{gift.TrainerSID7:D4}]{gift.TrainerID7:D6}";
|
||||
|
||||
var first =
|
||||
$"{strings.Species[gift.Species]} @ {strings.Item[gift.HeldItem]} --- "
|
||||
|
@ -121,7 +121,7 @@ namespace PKHeX.Core
|
|||
/// <returns>True if compatible, false if incompatible.</returns>
|
||||
public static bool IsCardCompatible(this MysteryGift g, SaveFile sav, out string message)
|
||||
{
|
||||
if (g.Format != sav.Generation)
|
||||
if (g.Generation != sav.Generation)
|
||||
{
|
||||
message = MsgMysteryGiftSlotSpecialReject;
|
||||
return false;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace PKHeX.Core
|
|||
public sealed class PCD : DataMysteryGift, IRibbonSetEvent3, IRibbonSetEvent4
|
||||
{
|
||||
public const int Size = 0x358; // 856
|
||||
public override int Format => 4;
|
||||
public override int Generation => 4;
|
||||
|
||||
public override int Level
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
}
|
||||
|
||||
if (wc.AltForm != evo.Form && !AltFormInfo.IsFormChangeable(wc.Species, wc.AltForm, pkm.AltForm, pkm.Format))
|
||||
if (wc.Form != evo.Form && !FormInfo.IsFormChangeable(wc.Species, wc.Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
|
||||
if (wc.Ball != pkm.Ball) return false;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace PKHeX.Core
|
|||
public sealed class PGF : DataMysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, ILangNick, IContestStats, INature
|
||||
{
|
||||
public const int Size = 0xCC;
|
||||
public override int Format => 5;
|
||||
public override int Generation => 5;
|
||||
|
||||
public PGF() : this(new byte[Size]) { }
|
||||
public PGF(byte[] data) : base(data) { }
|
||||
|
@ -177,14 +177,14 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
int currentLevel = Level > 0 ? Level : rnd.Next(1, 101);
|
||||
var pi = PersonalTable.B2W2.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.B2W2.GetFormEntry(Species, Form);
|
||||
PK5 pk = new PK5
|
||||
{
|
||||
Species = Species,
|
||||
HeldItem = HeldItem,
|
||||
Met_Level = currentLevel,
|
||||
Nature = Nature != -1 ? Nature : rnd.Next(25),
|
||||
AltForm = Form,
|
||||
Form = Form,
|
||||
Version = OriginGame == 0 ? sav.Game : OriginGame,
|
||||
Language = Language == 0 ? sav.Language : Language,
|
||||
Ball = Ball,
|
||||
|
@ -248,7 +248,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
pk.IsNicknamed = IsNicknamed;
|
||||
pk.Nickname = IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Format);
|
||||
pk.Nickname = IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Generation);
|
||||
|
||||
SetPINGA(pk, criteria);
|
||||
|
||||
|
@ -265,13 +265,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk.IsEgg = true;
|
||||
pk.EggMetDate = Date;
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Generation);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
|
||||
private void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
{
|
||||
var pi = PersonalTable.B2W2.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.B2W2.GetFormEntry(Species, Form);
|
||||
pk.Nature = (int)criteria.GetNature((Nature)Nature);
|
||||
pk.Gender = pi.Genderless ? 2 : Gender != 2 ? Gender : criteria.GetGender(-1, pi);
|
||||
var av = GetAbilityIndex(criteria, pi);
|
||||
|
@ -369,7 +369,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
}
|
||||
|
||||
if (Form != evo.Form && !AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
|
||||
if (Level != pkm.Met_Level) return false;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace PKHeX.Core
|
|||
public sealed class PGT : DataMysteryGift, IRibbonSetEvent3, IRibbonSetEvent4
|
||||
{
|
||||
public const int Size = 0x104; // 260
|
||||
public override int Format => 4;
|
||||
public override int Generation => 4;
|
||||
|
||||
public override int Level
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ namespace PKHeX.Core
|
|||
public override int HeldItem { get => PK.HeldItem; set => PK.HeldItem = value; }
|
||||
public override bool IsShiny => PK.IsShiny;
|
||||
public override int Gender { get => PK.Gender; set => PK.Gender = value; }
|
||||
public override int Form { get => PK.AltForm; set => PK.AltForm = value; }
|
||||
public override int Form { get => PK.Form; set => PK.Form = value; }
|
||||
public override int TID { get => (ushort)PK.TID; set => PK.TID = value; }
|
||||
public override int SID { get => (ushort)PK.SID; set => PK.SID = value; }
|
||||
public override string OT_Name { get => PK.OT_Name; set => PK.OT_Name = value; }
|
||||
|
@ -231,7 +231,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk4.IsEgg = true;
|
||||
pk4.IsNicknamed = false;
|
||||
pk4.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk4.Language, Format);
|
||||
pk4.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk4.Language, Generation);
|
||||
pk4.EggMetDate = DateTime.Now;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace PKHeX.Core
|
|||
public const int SizeFull = 0x310;
|
||||
private const int CardStart = SizeFull - Size;
|
||||
|
||||
public override int Format => 7;
|
||||
public override int Generation => 7;
|
||||
|
||||
public WB7() : this(new byte[SizeFull]) { }
|
||||
public WB7(byte[] data) : base(data) { }
|
||||
|
@ -302,7 +302,7 @@ namespace PKHeX.Core
|
|||
|
||||
int currentLevel = Level > 0 ? Level : rnd.Next(1, 101);
|
||||
int metLevel = MetLevel > 0 ? MetLevel : currentLevel;
|
||||
var pi = PersonalTable.GG.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.GG.GetFormEntry(Species, Form);
|
||||
var OT = GetOT(sav.Language);
|
||||
|
||||
var pk = new PB7
|
||||
|
@ -312,7 +312,7 @@ namespace PKHeX.Core
|
|||
TID = TID,
|
||||
SID = SID,
|
||||
Met_Level = metLevel,
|
||||
AltForm = Form,
|
||||
Form = Form,
|
||||
EncryptionConstant = EncryptionConstant != 0 ? EncryptionConstant : Util.Rand32(),
|
||||
Version = OriginGame != 0 ? OriginGame : sav.Game,
|
||||
Language = sav.Language,
|
||||
|
@ -347,7 +347,7 @@ namespace PKHeX.Core
|
|||
};
|
||||
pk.SetMaximumPPCurrent();
|
||||
|
||||
if ((sav.Generation > Format && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
if ((sav.Generation > Generation && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
{
|
||||
// give random valid game
|
||||
do { pk.Version = (int)GameVersion.GP + rnd.Next(2); }
|
||||
|
@ -362,7 +362,7 @@ namespace PKHeX.Core
|
|||
|
||||
pk.MetDate = Date ?? DateTime.Now;
|
||||
pk.IsNicknamed = GetIsNicknamed(pk.Language);
|
||||
pk.Nickname = pk.IsNicknamed ? GetNickname(pk.Language) : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Format);
|
||||
pk.Nickname = pk.IsNicknamed ? GetNickname(pk.Language) : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Generation);
|
||||
|
||||
SetPINGA(pk, criteria);
|
||||
|
||||
|
@ -382,13 +382,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk.IsEgg = true;
|
||||
pk.EggMetDate = Date;
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Generation);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
|
||||
private void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
{
|
||||
var pi = PersonalTable.GG.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.GG.GetFormEntry(Species, Form);
|
||||
pk.Nature = (int)criteria.GetNature((Nature)Nature);
|
||||
pk.Gender = criteria.GetGender(Gender, pi);
|
||||
var av = GetAbilityIndex(criteria, pi);
|
||||
|
@ -471,7 +471,7 @@ namespace PKHeX.Core
|
|||
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
||||
}
|
||||
|
||||
if (Form != evo.Form && !AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
|
||||
if (IsEgg)
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace PKHeX.Core
|
|||
public bool Fateful { get; set; } // Obedience Flag
|
||||
|
||||
// Mystery Gift Properties
|
||||
public override int Format => 3;
|
||||
public override int Generation => 3;
|
||||
public override int Level { get; set; }
|
||||
public override int Ball { get; set; } = 4;
|
||||
public override bool IsShiny => Shiny == Shiny.Always;
|
||||
|
@ -249,7 +249,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
if (Form != evo.Form && !AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
|
||||
if (Language != -1 && Language != pkm.Language) return false;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
public const int Size = 0x108;
|
||||
public const uint EonTicketConst = 0x225D73C2;
|
||||
public override int Format => 6;
|
||||
public override int Generation => 6;
|
||||
|
||||
public WC6() : this(new byte[Size]) { }
|
||||
public WC6(byte[] data) : base(data) { }
|
||||
|
@ -273,7 +273,7 @@ namespace PKHeX.Core
|
|||
var rnd = Util.Rand;
|
||||
|
||||
int currentLevel = Level > 0 ? Level : rnd.Next(1, 101);
|
||||
var pi = PersonalTable.AO.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.AO.GetFormEntry(Species, Form);
|
||||
PK6 pk = new PK6
|
||||
{
|
||||
Species = Species,
|
||||
|
@ -281,7 +281,7 @@ namespace PKHeX.Core
|
|||
TID = TID,
|
||||
SID = SID,
|
||||
Met_Level = currentLevel,
|
||||
AltForm = Form,
|
||||
Form = Form,
|
||||
EncryptionConstant = EncryptionConstant != 0 ? EncryptionConstant : Util.Rand32(),
|
||||
Version = OriginGame != 0 ? OriginGame : sav.Game,
|
||||
Language = Language != 0 ? Language : sav.Language,
|
||||
|
@ -350,7 +350,7 @@ namespace PKHeX.Core
|
|||
|
||||
pk.MetDate = Date ?? DateTime.Now;
|
||||
|
||||
if ((sav.Generation > Format && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
if ((sav.Generation > Generation && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
{
|
||||
// give random valid game
|
||||
do { pk.Version = (int)GameVersion.X + rnd.Next(4); }
|
||||
|
@ -377,7 +377,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
pk.IsNicknamed = IsNicknamed;
|
||||
pk.Nickname = IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Format);
|
||||
pk.Nickname = IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Generation);
|
||||
|
||||
SetPINGA(pk, criteria);
|
||||
|
||||
|
@ -393,13 +393,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk.IsEgg = true;
|
||||
pk.EggMetDate = Date;
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Generation);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
|
||||
private void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
{
|
||||
var pi = PersonalTable.AO.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.AO.GetFormEntry(Species, Form);
|
||||
pk.Nature = (int)criteria.GetNature((Nature)Nature);
|
||||
pk.Gender = criteria.GetGender(Gender, pi);
|
||||
var av = GetAbilityIndex(criteria, pi);
|
||||
|
@ -487,7 +487,7 @@ namespace PKHeX.Core
|
|||
if (EncryptionConstant != 0 && EncryptionConstant != pkm.EncryptionConstant) return false;
|
||||
if (Language != 0 && Language != pkm.Language) return false;
|
||||
}
|
||||
if (Form != evo.Form && !AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
|
||||
if (IsEgg)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace PKHeX.Core
|
|||
public sealed class WC7 : DataMysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, ILangNick, IContestStats, INature, IMemoryOT
|
||||
{
|
||||
public const int Size = 0x108;
|
||||
public override int Format => 7;
|
||||
public override int Generation => 7;
|
||||
|
||||
public WC7() : this(new byte[Size]) { }
|
||||
public WC7(byte[] data) : base(data) { }
|
||||
|
@ -317,7 +317,7 @@ namespace PKHeX.Core
|
|||
|
||||
int currentLevel = Level > 0 ? Level : rnd.Next(1, 101);
|
||||
int metLevel = MetLevel > 0 ? MetLevel : currentLevel;
|
||||
var pi = PersonalTable.USUM.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.USUM.GetFormEntry(Species, Form);
|
||||
PK7 pk = new PK7
|
||||
{
|
||||
Species = Species,
|
||||
|
@ -325,7 +325,7 @@ namespace PKHeX.Core
|
|||
TID = TID,
|
||||
SID = SID,
|
||||
Met_Level = metLevel,
|
||||
AltForm = Form,
|
||||
Form = Form,
|
||||
EncryptionConstant = EncryptionConstant != 0 ? EncryptionConstant : Util.Rand32(),
|
||||
Version = OriginGame != 0 ? OriginGame : sav.Game,
|
||||
Language = Language != 0 ? Language : sav.Language,
|
||||
|
@ -392,7 +392,7 @@ namespace PKHeX.Core
|
|||
|
||||
pk.SetMaximumPPCurrent();
|
||||
|
||||
if ((sav.Generation > Format && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
if ((sav.Generation > Generation && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
{
|
||||
// give random valid game
|
||||
do { pk.Version = (int)GameVersion.SN + rnd.Next(4); }
|
||||
|
@ -408,7 +408,7 @@ namespace PKHeX.Core
|
|||
pk.MetDate = Date ?? DateTime.Now;
|
||||
|
||||
pk.IsNicknamed = IsNicknamed;
|
||||
pk.Nickname = IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Format);
|
||||
pk.Nickname = IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Generation);
|
||||
|
||||
SetPINGA(pk, criteria);
|
||||
|
||||
|
@ -424,13 +424,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk.IsEgg = true;
|
||||
pk.EggMetDate = Date;
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Generation);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
|
||||
private void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
{
|
||||
var pi = PersonalTable.USUM.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.USUM.GetFormEntry(Species, Form);
|
||||
pk.Nature = (int)criteria.GetNature((Nature)Nature);
|
||||
pk.Gender = criteria.GetGender(Gender, pi);
|
||||
var av = GetAbilityIndex(criteria, pi);
|
||||
|
@ -518,7 +518,7 @@ namespace PKHeX.Core
|
|||
if (Language != 0 && Language != pkm.Language) return false;
|
||||
}
|
||||
|
||||
if (Form != evo.Form && !AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
|
||||
if (IsEgg)
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace PKHeX.Core
|
|||
public const int Size = 0x2D0;
|
||||
public const int CardStart = 0x0;
|
||||
|
||||
public override int Format => 8;
|
||||
public override int Generation => 8;
|
||||
|
||||
public enum GiftType : byte
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ namespace PKHeX.Core
|
|||
|
||||
int currentLevel = Level > 0 ? Level : Util.Rand.Next(1, 101);
|
||||
int metLevel = MetLevel > 0 ? MetLevel : currentLevel;
|
||||
var pi = PersonalTable.SWSH.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.SWSH.GetFormEntry(Species, Form);
|
||||
var OT = GetOT(sav.Language);
|
||||
|
||||
var pk = new PK8
|
||||
|
@ -332,7 +332,7 @@ namespace PKHeX.Core
|
|||
TID = TID,
|
||||
SID = SID,
|
||||
Species = Species,
|
||||
AltForm = Form,
|
||||
Form = Form,
|
||||
CurrentLevel = currentLevel,
|
||||
Ball = Ball != 0 ? Ball : 4, // Default is Pokeball
|
||||
Met_Level = metLevel,
|
||||
|
@ -375,7 +375,7 @@ namespace PKHeX.Core
|
|||
};
|
||||
pk.SetMaximumPPCurrent();
|
||||
|
||||
if ((sav.Generation > Format && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
if ((sav.Generation > Generation && OriginGame == 0) || !CanBeReceivedByVersion(pk.Version))
|
||||
{
|
||||
// give random valid game
|
||||
var rnd = Util.Rand;
|
||||
|
@ -400,14 +400,14 @@ namespace PKHeX.Core
|
|||
|
||||
// Official code explicitly corrects for Meowstic
|
||||
if (pk.Species == (int)Core.Species.Meowstic)
|
||||
pk.AltForm = pk.Gender;
|
||||
pk.Form = pk.Gender;
|
||||
|
||||
pk.MetDate = DateTime.Now;
|
||||
|
||||
var nickname_language = GetNicknameLanguage(sav.Language);
|
||||
pk.Language = nickname_language != 0 ? nickname_language : sav.Language;
|
||||
pk.IsNicknamed = GetIsNicknamed(pk.Language);
|
||||
pk.Nickname = pk.IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Format);
|
||||
pk.Nickname = pk.IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, pk.Language, Generation);
|
||||
|
||||
for (var i = 0; i < RibbonBytesCount; i++)
|
||||
{
|
||||
|
@ -437,13 +437,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk.IsEgg = true;
|
||||
pk.EggMetDate = DateTime.Now;
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(0, pk.Language, Generation);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
|
||||
private void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
{
|
||||
var pi = PersonalTable.SWSH.GetFormeEntry(Species, Form);
|
||||
var pi = PersonalTable.SWSH.GetFormEntry(Species, Form);
|
||||
pk.Nature = (int)criteria.GetNature(Nature == -1 ? Core.Nature.Random : (Nature)Nature);
|
||||
pk.StatNature = pk.Nature;
|
||||
pk.Gender = criteria.GetGender(Gender, pi);
|
||||
|
@ -561,7 +561,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
if (Form != evo.Form && !AltFormInfo.IsFormChangeable(Species, Form, pkm.AltForm, pkm.Format))
|
||||
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format))
|
||||
return false;
|
||||
|
||||
if (IsEgg)
|
||||
|
@ -595,7 +595,7 @@ namespace PKHeX.Core
|
|||
if (Nature != -1 && pkm.Nature != Nature) return false;
|
||||
if (Gender != 3 && Gender != pkm.Gender) return false;
|
||||
|
||||
if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, pkm.AltForm, Species, Form))
|
||||
if (pkm is IGigantamax g && g.CanGigantamax != CanGigantamax && !g.CanToggleGigantamax(pkm.Species, pkm.Form, Species, Form))
|
||||
return false;
|
||||
|
||||
if (!(pkm is IDynamaxLevel dl && dl.DynamaxLevel >= DynamaxLevel))
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
// Mystery Gift implementation
|
||||
public override int Format => 7;
|
||||
public override int Generation => 7;
|
||||
protected override bool IsMatchExact(PKM pkm, DexLevel evo) => false;
|
||||
protected override bool IsMatchDeferred(PKM pkm) => false;
|
||||
public override int Location { get; set; }
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override bool FatefulEncounter { get => (Data[0x40] & 0x80) == 0x80; set => Data[0x40] = (byte)((Data[0x40] & ~0x80) | (value ? 0x80 : 0)); }
|
||||
public override int Gender { get => (Data[0x40] >> 5) & 0x3; set => Data[0x40] = (byte)((Data[0x40] & ~0x60) | ((value & 3) << 5)); }
|
||||
public override int AltForm { get => Data[0x40] & 0x1F; set => Data[0x40] = (byte)((Data[0x40] & ~0x1F) | (value & 0x1F)); }
|
||||
public override int Form { get => Data[0x40] & 0x1F; set => Data[0x40] = (byte)((Data[0x40] & ~0x1F) | (value & 0x1F)); }
|
||||
public override int ShinyLeaf { get => Data[0x41]; set => Data[0x41] = (byte)value; }
|
||||
// 0x43-0x47 Unused
|
||||
#endregion
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace PKHeX.Core
|
|||
public override int SIZE_STORED => SIZE;
|
||||
private const int SIZE = 260;
|
||||
public override int Format => 7;
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.GG.GetFormeEntry(Species, AltForm);
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.GG.GetFormEntry(Species, Form);
|
||||
|
||||
public PB7() : base(SIZE) { }
|
||||
public PB7(byte[] data) : base(DecryptParty(data)) { }
|
||||
|
@ -108,7 +108,7 @@ namespace PKHeX.Core
|
|||
public override int Nature { get => Data[0x1C]; set => Data[0x1C] = (byte)value; }
|
||||
public override bool FatefulEncounter { get => (Data[0x1D] & 1) == 1; set => Data[0x1D] = (byte)((Data[0x1D] & ~0x01) | (value ? 1 : 0)); }
|
||||
public override int Gender { get => (Data[0x1D] >> 1) & 0x3; set => Data[0x1D] = (byte)((Data[0x1D] & ~0x06) | (value << 1)); }
|
||||
public override int AltForm { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)((Data[0x1D] & 0x07) | (value << 3)); }
|
||||
public override int Form { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)((Data[0x1D] & 0x07) | (value << 3)); }
|
||||
public override int EV_HP { get => Data[0x1E]; set => Data[0x1E] = (byte)value; }
|
||||
public override int EV_ATK { get => Data[0x1F]; set => Data[0x1F] = (byte)value; }
|
||||
public override int EV_DEF { get => Data[0x20]; set => Data[0x20] = (byte)value; }
|
||||
|
@ -639,7 +639,7 @@ namespace PKHeX.Core
|
|||
IsNicknamed = IsNicknamed,
|
||||
FatefulEncounter = FatefulEncounter,
|
||||
Gender = Gender,
|
||||
AltForm = AltForm,
|
||||
Form = Form,
|
||||
Nature = Nature,
|
||||
Nickname = Nickname,
|
||||
Version = Version,
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace PKHeX.Core
|
|||
Met_Location = Locations.Transfer2, // "Johto region", hardcoded.
|
||||
Gender = Gender,
|
||||
IsNicknamed = false,
|
||||
AltForm = AltForm,
|
||||
Form = Form,
|
||||
|
||||
CurrentHandler = 1,
|
||||
HT_Name = PKMConverter.OT_Name,
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace PKHeX.Core
|
|||
SID = SID,
|
||||
EXP = IsEgg ? Experience.GetEXP(5, PersonalInfo.EXPGrowth) : EXP,
|
||||
Gender = PKX.GetGenderFromPID(Species, PID),
|
||||
AltForm = AltForm,
|
||||
Form = Form,
|
||||
// IsEgg = false, -- already false
|
||||
OT_Friendship = 70,
|
||||
Markings = Markings,
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace PKHeX.Core
|
|||
public override int SIZE_PARTY => PokeCrypto.SIZE_4PARTY;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_4STORED;
|
||||
public override int Format => 4;
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.HGSS.GetFormeEntry(Species, AltForm);
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.HGSS.GetFormEntry(Species, Form);
|
||||
|
||||
public PK4() : base(PokeCrypto.SIZE_4PARTY) { }
|
||||
public PK4(byte[] data) : base(DecryptParty(data)) { }
|
||||
|
@ -162,7 +162,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override bool FatefulEncounter { get => (Data[0x40] & 1) == 1; set => Data[0x40] = (byte)((Data[0x40] & ~0x01) | (value ? 1 : 0)); }
|
||||
public override int Gender { get => (Data[0x40] >> 1) & 0x3; set => Data[0x40] = (byte)((Data[0x40] & ~0x06) | (value << 1)); }
|
||||
public override int AltForm { get => Data[0x40] >> 3; set => Data[0x40] = (byte)((Data[0x40] & 0x07) | (value << 3)); }
|
||||
public override int Form { get => Data[0x40] >> 3; set => Data[0x40] = (byte)((Data[0x40] & 0x07) | (value << 3)); }
|
||||
public override int ShinyLeaf { get => Data[0x41]; set => Data[0x41] = (byte) value; }
|
||||
// 0x43-0x47 Unused
|
||||
#endregion
|
||||
|
@ -355,8 +355,8 @@ namespace PKHeX.Core
|
|||
BK4 bk4 = ConvertTo<BK4>();
|
||||
|
||||
// Enforce DP content only (no PtHGSS)
|
||||
if (AltForm != 0 && !PersonalTable.DP[Species].HasFormes && Species != 201)
|
||||
bk4.AltForm = 0;
|
||||
if (Form != 0 && !PersonalTable.DP[Species].HasForms && Species != 201)
|
||||
bk4.Form = 0;
|
||||
if (HeldItem > Legal.MaxItemID_4_DP)
|
||||
bk4.HeldItem = 0;
|
||||
bk4.RefreshChecksum();
|
||||
|
@ -381,7 +381,7 @@ namespace PKHeX.Core
|
|||
// Arceus Type Changing -- Plate forcibly removed.
|
||||
if (pk5.Species == (int)Core.Species.Arceus)
|
||||
{
|
||||
pk5.AltForm = 0;
|
||||
pk5.Form = 0;
|
||||
pk5.HeldItem = 0;
|
||||
}
|
||||
else if(!Legal.HeldItems_BW.Contains((ushort)HeldItem))
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace PKHeX.Core
|
|||
public override int SIZE_PARTY => PokeCrypto.SIZE_5PARTY;
|
||||
public override int SIZE_STORED => PokeCrypto.SIZE_5STORED;
|
||||
public override int Format => 5;
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.B2W2.GetFormeEntry(Species, AltForm);
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.B2W2.GetFormEntry(Species, Form);
|
||||
|
||||
public PK5() : base(PokeCrypto.SIZE_5PARTY) { }
|
||||
public PK5(byte[] data) : base(DecryptParty(data)) { }
|
||||
|
@ -176,7 +176,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override bool FatefulEncounter { get => (Data[0x40] & 1) == 1; set => Data[0x40] = (byte)((Data[0x40] & ~0x01) | (value ? 1 : 0)); }
|
||||
public override int Gender { get => (Data[0x40] >> 1) & 0x3; set => Data[0x40] = (byte)((Data[0x40] & ~0x06) | (value << 1)); }
|
||||
public override int AltForm { get => Data[0x40] >> 3; set => Data[0x40] = (byte)((Data[0x40] & 0x07) | (value << 3)); }
|
||||
public override int Form { get => Data[0x40] >> 3; set => Data[0x40] = (byte)((Data[0x40] & 0x07) | (value << 3)); }
|
||||
public override int Nature { get => Data[0x41]; set => Data[0x41] = (byte)value; }
|
||||
public bool HiddenAbility { get => (Data[0x42] & 1) == 1; set => Data[0x42] = (byte)((Data[0x42] & ~0x01) | (value ? 1 : 0)); }
|
||||
public bool NPokémon { get => (Data[0x42] & 2) == 2; set => Data[0x42] = (byte)((Data[0x42] & ~0x02) | (value ? 2 : 0)); }
|
||||
|
@ -373,7 +373,7 @@ namespace PKHeX.Core
|
|||
|
||||
FatefulEncounter = FatefulEncounter,
|
||||
Gender = Gender,
|
||||
AltForm = AltForm,
|
||||
Form = Form,
|
||||
Nature = Nature,
|
||||
|
||||
Version = Version,
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override int Format => 6;
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.AO.GetFormeEntry(Species, AltForm);
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.AO.GetFormEntry(Species, Form);
|
||||
|
||||
public PK6() : base(PokeCrypto.SIZE_6PARTY) { }
|
||||
public PK6(byte[] data) : base(DecryptParty(data)) { }
|
||||
|
@ -96,7 +96,7 @@ namespace PKHeX.Core
|
|||
public override int Nature { get => Data[0x1C]; set => Data[0x1C] = (byte)value; }
|
||||
public override bool FatefulEncounter { get => (Data[0x1D] & 1) == 1; set => Data[0x1D] = (byte)((Data[0x1D] & ~0x01) | (value ? 1 : 0)); }
|
||||
public override int Gender { get => (Data[0x1D] >> 1) & 0x3; set => Data[0x1D] = (byte)((Data[0x1D] & ~0x06) | (value << 1)); }
|
||||
public override int AltForm { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)((Data[0x1D] & 0x07) | (value << 3)); }
|
||||
public override int Form { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)((Data[0x1D] & 0x07) | (value << 3)); }
|
||||
public override int EV_HP { get => Data[0x1E]; set => Data[0x1E] = (byte)value; }
|
||||
public override int EV_ATK { get => Data[0x1F]; set => Data[0x1F] = (byte)value; }
|
||||
public override int EV_DEF { get => Data[0x20]; set => Data[0x20] = (byte)value; }
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override int Format => 7;
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.USUM.GetFormeEntry(Species, AltForm);
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.USUM.GetFormEntry(Species, Form);
|
||||
|
||||
public PK7() : base(PokeCrypto.SIZE_6PARTY) { }
|
||||
public PK7(byte[] data) : base(DecryptParty(data)) { }
|
||||
|
@ -96,7 +96,7 @@ namespace PKHeX.Core
|
|||
public override int Nature { get => Data[0x1C]; set => Data[0x1C] = (byte)value; }
|
||||
public override bool FatefulEncounter { get => (Data[0x1D] & 1) == 1; set => Data[0x1D] = (byte)((Data[0x1D] & ~0x01) | (value ? 1 : 0)); }
|
||||
public override int Gender { get => (Data[0x1D] >> 1) & 0x3; set => Data[0x1D] = (byte)((Data[0x1D] & ~0x06) | (value << 1)); }
|
||||
public override int AltForm { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)((Data[0x1D] & 0x07) | (value << 3)); }
|
||||
public override int Form { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)((Data[0x1D] & 0x07) | (value << 3)); }
|
||||
public override int EV_HP { get => Data[0x1E]; set => Data[0x1E] = (byte)value; }
|
||||
public override int EV_ATK { get => Data[0x1F]; set => Data[0x1F] = (byte)value; }
|
||||
public override int EV_DEF { get => Data[0x20]; set => Data[0x20] = (byte)value; }
|
||||
|
@ -449,12 +449,12 @@ namespace PKHeX.Core
|
|||
|
||||
if (IsUntraded)
|
||||
HT_Friendship = HT_Affection = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling = 0;
|
||||
if (GenNumber < 6)
|
||||
if (Generation < 6)
|
||||
/* OT_Affection = */ OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
|
||||
|
||||
this.SanitizeGeoLocationData();
|
||||
|
||||
if (GenNumber < 7) // must be transferred via bank, and must have memories
|
||||
if (Generation < 7) // must be transferred via bank, and must have memories
|
||||
{
|
||||
this.SetTradeMemory(true);
|
||||
// georegions cleared on 6->7, no need to set
|
||||
|
@ -539,7 +539,7 @@ namespace PKHeX.Core
|
|||
IsNicknamed = IsNicknamed,
|
||||
FatefulEncounter = FatefulEncounter,
|
||||
Gender = Gender,
|
||||
AltForm = AltForm,
|
||||
Form = Form,
|
||||
Nature = Nature,
|
||||
Nickname = IsNicknamed ? Nickname : SpeciesName.GetSpeciesNameGeneration(Species, Language, 8),
|
||||
Version = Version,
|
||||
|
@ -633,8 +633,8 @@ namespace PKHeX.Core
|
|||
};
|
||||
|
||||
// Wipe Totem Forms
|
||||
if (AltFormInfo.IsTotemForm(Species, AltForm, 7))
|
||||
pk8.AltForm = AltFormInfo.GetTotemBaseForm(Species, AltForm);
|
||||
if (FormInfo.IsTotemForm(Species, Form, 7))
|
||||
pk8.Form = FormInfo.GetTotemBaseForm(Species, Form);
|
||||
|
||||
// Fix PP and Stats
|
||||
pk8.Heal();
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
||||
public override int Format => 8;
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.SWSH.GetFormeEntry(Species, AltForm);
|
||||
public override PersonalInfo PersonalInfo => PersonalTable.SWSH.GetFormEntry(Species, Form);
|
||||
|
||||
public PK8() : base(PokeCrypto.SIZE_8PARTY) => AffixedRibbon = -1; // 00 would make it show Kalos Champion :)
|
||||
public PK8(byte[] data) : base(DecryptParty(data)) { }
|
||||
|
@ -72,7 +72,7 @@ namespace PKHeX.Core
|
|||
public override byte[] OT_Trash { get => GetData(0xF8, 24); set { if (value.Length == 24) value.CopyTo(Data, 0xF8); } }
|
||||
public override bool WasLink => Met_Location == Locations.LinkGift6 && Gen6;
|
||||
public override bool WasEvent => Locations.IsEventLocation5(Met_Location) || FatefulEncounter;
|
||||
public override bool WasEventEgg => GenNumber < 5 ? base.WasEventEgg : (Locations.IsEventLocation5(Egg_Location) || (FatefulEncounter && Egg_Location == Locations.LinkTrade6)) && Met_Level == 1;
|
||||
public override bool WasEventEgg => Generation < 5 ? base.WasEventEgg : (Locations.IsEventLocation5(Egg_Location) || (FatefulEncounter && Egg_Location == Locations.LinkTrade6)) && Met_Level == 1;
|
||||
|
||||
// Maximums
|
||||
public override int MaxIV => 31;
|
||||
|
@ -82,7 +82,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override int PSV => (int)((PID >> 16 ^ (PID & 0xFFFF)) >> 4);
|
||||
public override int TSV => (TID ^ SID) >> 4;
|
||||
public override bool IsUntraded => Data[0xA8] == 0 && Data[0xA8 + 1] == 0 && Format == GenNumber; // immediately terminated HT_Name data (\0)
|
||||
public override bool IsUntraded => Data[0xA8] == 0 && Data[0xA8 + 1] == 0 && Format == Generation; // immediately terminated HT_Name data (\0)
|
||||
|
||||
// Complex Generated Attributes
|
||||
public override int Characteristic
|
||||
|
@ -177,7 +177,7 @@ namespace PKHeX.Core
|
|||
public override int Gender { get => (Data[0x22] >> 2) & 0x3; set => Data[0x22] = (byte)((Data[0x22] & 0xF3) | (value << 2)); }
|
||||
// 0x23 alignment unused
|
||||
|
||||
public override int AltForm { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); }
|
||||
public override int Form { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); }
|
||||
public override int EV_HP { get => Data[0x26]; set => Data[0x26] = (byte)value; }
|
||||
public override int EV_ATK { get => Data[0x27]; set => Data[0x27] = (byte)value; }
|
||||
public override int EV_DEF { get => Data[0x28]; set => Data[0x28] = (byte)value; }
|
||||
|
@ -537,7 +537,7 @@ namespace PKHeX.Core
|
|||
if (IsUntraded)
|
||||
HT_Language = HT_Friendship = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling = 0;
|
||||
|
||||
int gen = GenNumber;
|
||||
int gen = Generation;
|
||||
if (gen < 6)
|
||||
OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;
|
||||
if (gen != 8) // must be transferred via HOME, and must have memories
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Object representing a <see cref="PKM"/>'s data and derived properties.
|
||||
/// </summary>
|
||||
public abstract class PKM : ITrainerID, ILangNick, IGameValueLimit, INature
|
||||
public abstract class PKM : ISpeciesForm, ITrainerID, IGeneration, ILangNick, IGameValueLimit, INature
|
||||
{
|
||||
public static readonly string[] Extensions = PKX.GetPKMExtensions();
|
||||
public abstract int SIZE_PARTY { get; }
|
||||
|
@ -59,7 +59,7 @@ namespace PKHeX.Core
|
|||
public virtual int StatNature { get => Nature; set => Nature = value; }
|
||||
public abstract int Ability { get; set; }
|
||||
public abstract int CurrentFriendship { get; set; }
|
||||
public abstract int AltForm { get; set; }
|
||||
public abstract int Form { get; set; }
|
||||
public abstract bool IsEgg { get; set; }
|
||||
public abstract bool IsNicknamed { get; set; }
|
||||
public abstract uint EXP { get; set; }
|
||||
|
@ -244,7 +244,7 @@ namespace PKHeX.Core
|
|||
public abstract int NickLength { get; }
|
||||
|
||||
// Derived
|
||||
public int SpecForm { get => Species + (AltForm << 11); set { Species = value & 0x7FF; AltForm = value >> 11; } }
|
||||
public int SpecForm { get => Species + (Form << 11); set { Species = value & 0x7FF; Form = value >> 11; } }
|
||||
public virtual int SpriteItem => HeldItem;
|
||||
public virtual bool IsShiny => TSV == PSV;
|
||||
public StorageSlotFlag StorageFlags { get; internal set; }
|
||||
|
@ -264,14 +264,14 @@ namespace PKHeX.Core
|
|||
|
||||
public int DisplayTID
|
||||
{
|
||||
get => GenNumber >= 7 ? TrainerID7 : TID;
|
||||
set { if (GenNumber >= 7) TrainerID7 = value; else TID = value; }
|
||||
get => Generation >= 7 ? TrainerID7 : TID;
|
||||
set { if (Generation >= 7) TrainerID7 = value; else TID = value; }
|
||||
}
|
||||
|
||||
public int DisplaySID
|
||||
{
|
||||
get => GenNumber >= 7 ? TrainerSID7 : SID;
|
||||
set { if (GenNumber >= 7) TrainerSID7 = value; else SID = value; }
|
||||
get => Generation >= 7 ? TrainerSID7 : SID;
|
||||
set { if (Generation >= 7) TrainerSID7 = value; else SID = value; }
|
||||
}
|
||||
|
||||
private void SetID7(int sid7, int tid7)
|
||||
|
@ -310,9 +310,9 @@ namespace PKHeX.Core
|
|||
public bool Gen3 => (Version >= 1 && Version <= 5) || Version == 15;
|
||||
public bool Gen2 => Version == (int)GameVersion.GSC;
|
||||
public bool Gen1 => Version == (int)GameVersion.RBY;
|
||||
public bool GenU => GenNumber <= 0;
|
||||
public bool GenU => Generation <= 0;
|
||||
|
||||
public int GenNumber
|
||||
public int Generation
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
get
|
||||
{
|
||||
string form = AltForm > 0 ? $"-{AltForm:00}" : string.Empty;
|
||||
string form = Form > 0 ? $"-{Form:00}" : string.Empty;
|
||||
string star = IsShiny ? " ★" : string.Empty;
|
||||
return $"{Species:000}{form}{star} - {Nickname} - {Checksum:X4}{EncryptionConstant:X8}";
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
get
|
||||
{
|
||||
if (GenNumber > 5 || Format > 5)
|
||||
if (Generation > 5 || Format > 5)
|
||||
return -1;
|
||||
|
||||
if (Version == (int) GameVersion.CXD)
|
||||
|
@ -510,7 +510,7 @@ namespace PKHeX.Core
|
|||
get
|
||||
{
|
||||
int loc = Egg_Location;
|
||||
return GenNumber switch
|
||||
return Generation switch
|
||||
{
|
||||
4 => (Legal.EggLocations4.Contains(loc) || (Species == (int) Core.Species.Manaphy && loc == Locations.Ranger4) || (loc == Locations.Faraway4 && PtHGSS)), // faraway
|
||||
5 => Legal.EggLocations5.Contains(loc),
|
||||
|
@ -528,7 +528,7 @@ namespace PKHeX.Core
|
|||
get
|
||||
{
|
||||
int loc = Egg_Location;
|
||||
switch (GenNumber)
|
||||
switch (Generation)
|
||||
{
|
||||
case 4: return loc == Locations.Daycare4 || loc == Locations.LinkTrade4 || (loc == Locations.Faraway4 && PtHGSS); // faraway
|
||||
case 5: return loc == Locations.Daycare5 || loc == Locations.LinkTrade5;
|
||||
|
@ -548,7 +548,7 @@ namespace PKHeX.Core
|
|||
if (!WasEgg)
|
||||
return false;
|
||||
int loc = Egg_Location;
|
||||
switch (GenNumber)
|
||||
switch (Generation)
|
||||
{
|
||||
case 4: return Legal.GiftEggLocation4.Contains(loc) || (loc == Locations.Faraway4 && HGSS); // faraway
|
||||
case 5: return loc == 60003;
|
||||
|
@ -579,10 +579,10 @@ namespace PKHeX.Core
|
|||
|
||||
public bool WasTradedEgg => Egg_Location == GetTradedEggLocation();
|
||||
public bool IsTradedEgg => Met_Location == GetTradedEggLocation();
|
||||
private int GetTradedEggLocation() => Locations.TradedEggLocation(GenNumber);
|
||||
private int GetTradedEggLocation() => Locations.TradedEggLocation(Generation);
|
||||
|
||||
public virtual bool IsUntraded => false;
|
||||
public virtual bool IsNative => GenNumber == Format;
|
||||
public virtual bool IsNative => Generation == Format;
|
||||
public virtual bool IsOriginValid => Species <= Legal.GetMaxSpeciesOrigin(Format);
|
||||
|
||||
/// <summary>
|
||||
|
@ -617,7 +617,7 @@ namespace PKHeX.Core
|
|||
if (Format < generation)
|
||||
return false; // Future
|
||||
|
||||
int gen = GenNumber;
|
||||
int gen = Generation;
|
||||
return generation switch
|
||||
{
|
||||
1 => (Format == 1 || VC), // species compat checked via sanity above
|
||||
|
@ -636,7 +636,7 @@ namespace PKHeX.Core
|
|||
/// Checks if the PKM has its original met location.
|
||||
/// </summary>
|
||||
/// <returns>Returns false if the Met Location has been overwritten via generational transfer.</returns>
|
||||
public virtual bool HasOriginalMetLocation => !(Format < 3 || VC || (GenNumber <= 4 && Format != GenNumber));
|
||||
public virtual bool HasOriginalMetLocation => !(Format < 3 || VC || (Generation <= 4 && Format != Generation));
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the current <see cref="Gender"/> is valid.
|
||||
|
@ -653,7 +653,7 @@ namespace PKHeX.Core
|
|||
if (gv == 0)
|
||||
return gender == 0;
|
||||
|
||||
int gen = GenNumber;
|
||||
int gen = Generation;
|
||||
if (gen <= 2 || gen >= 6)
|
||||
return gender == (gender & 1);
|
||||
|
||||
|
@ -891,7 +891,7 @@ namespace PKHeX.Core
|
|||
public virtual void SetShiny()
|
||||
{
|
||||
var rnd = Util.Rand;
|
||||
do { PID = PKX.GetRandomPID(rnd, Species, Gender, Version, Nature, AltForm, PID); }
|
||||
do { PID = PKX.GetRandomPID(rnd, Species, Gender, Version, Nature, Form, PID); }
|
||||
while (!IsShiny);
|
||||
if (Format >= 6 && (Gen3 || Gen4 || Gen5))
|
||||
EncryptionConstant = PID;
|
||||
|
@ -926,7 +926,7 @@ namespace PKHeX.Core
|
|||
public void SetPIDGender(int gender)
|
||||
{
|
||||
var rnd = Util.Rand;
|
||||
do PID = PKX.GetRandomPID(rnd, Species, gender, Version, Nature, AltForm, PID);
|
||||
do PID = PKX.GetRandomPID(rnd, Species, gender, Version, Nature, Form, PID);
|
||||
while (IsShiny);
|
||||
if (Format >= 6 && (Gen3 || Gen4 || Gen5))
|
||||
EncryptionConstant = PID;
|
||||
|
@ -942,16 +942,16 @@ namespace PKHeX.Core
|
|||
public void SetPIDNature(int nature)
|
||||
{
|
||||
var rnd = Util.Rand;
|
||||
do PID = PKX.GetRandomPID(rnd, Species, Gender, Version, nature, AltForm, PID);
|
||||
do PID = PKX.GetRandomPID(rnd, Species, Gender, Version, nature, Form, PID);
|
||||
while (IsShiny);
|
||||
if (Format >= 6 && (Gen3 || Gen4 || Gen5))
|
||||
EncryptionConstant = PID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies a <see cref="PID"/> to the <see cref="PKM"/> according to the specified <see cref="AltForm"/>.
|
||||
/// Applies a <see cref="PID"/> to the <see cref="PKM"/> according to the specified <see cref="Form"/>.
|
||||
/// </summary>
|
||||
/// <param name="form"><see cref="AltForm"/> to apply</param>
|
||||
/// <param name="form"><see cref="Form"/> to apply</param>
|
||||
/// <remarks>
|
||||
/// This method should only be used for Unown originating in Generation 3 games.
|
||||
/// If a <see cref="PKM"/> originated in a generation prior to Generation 6, the <see cref="EncryptionConstant"/> is updated.
|
||||
|
@ -1026,7 +1026,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Count of IVs that should be max.</returns>
|
||||
public int GetFlawlessIVCount()
|
||||
{
|
||||
if (GenNumber >= 6 && (Legal.Legends.Contains(Species) || Legal.SubLegends.Contains(Species)))
|
||||
if (Generation >= 6 && (Legal.Legends.Contains(Species) || Legal.SubLegends.Contains(Species)))
|
||||
return 3;
|
||||
if (XY)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace PKHeX.Core.Searching
|
|||
{
|
||||
1 => res.Where(pk => pk.VC || pk.Format < 3),
|
||||
2 => res.Where(pk => pk.VC || pk.Format < 3),
|
||||
_ => res.Where(pk => pk.GenNumber == generation)
|
||||
_ => res.Where(pk => pk.Generation == generation)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ namespace PKHeX.Core.Searching
|
|||
{
|
||||
1 => $"{pk.Species:000}{((PK1) pk).DV16:X4}",
|
||||
2 => $"{pk.Species:000}{((PK2) pk).DV16:X4}",
|
||||
_ => $"{pk.Species:000}{pk.PID:X8}{string.Join(" ", pk.IVs)}{pk.AltForm:00}"
|
||||
_ => $"{pk.Species:000}{pk.PID:X8}{string.Join(" ", pk.IVs)}{pk.Form:00}"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
public sealed override int Ability { get { var pi = (PersonalInfoG3)PersonalInfo; return AbilityBit && pi.Ability2 != 0 ? pi.Ability2 : pi.Ability1; } set { } }
|
||||
public sealed override uint EncryptionConstant { get => PID; set { } }
|
||||
public sealed override int Nature { get => (int)(PID % 25); set { } }
|
||||
public sealed override int AltForm { get => Species == (int)Core.Species.Unown ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
public sealed override int Form { get => Species == (int)Core.Species.Unown ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
public sealed override bool IsNicknamed { get => SpeciesName.IsNicknamed(Species, Nickname, Language, 3); set { } }
|
||||
public sealed override int Gender { get => PKX.GetGenderFromPID(Species, PID); set { } }
|
||||
public sealed override int Characteristic => -1;
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
Move4_PPUps = Move4_PPUps,
|
||||
|
||||
Gender = Gender,
|
||||
AltForm = AltForm,
|
||||
Form = Form,
|
||||
ShinyLeaf = ShinyLeaf,
|
||||
Version = Version,
|
||||
PKRS_Days = PKRS_Days,
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace PKHeX.Core
|
|||
|
||||
public sealed override int PSV => (int)((PID >> 16 ^ (PID & 0xFFFF)) >> 4);
|
||||
public sealed override int TSV => (TID ^ SID) >> 4;
|
||||
public sealed override bool IsUntraded => Data[0x78] == 0 && Data[0x78 + 1] == 0 && Format == GenNumber; // immediately terminated HT_Name data (\0)
|
||||
public sealed override bool IsUntraded => Data[0x78] == 0 && Data[0x78 + 1] == 0 && Format == Generation; // immediately terminated HT_Name data (\0)
|
||||
|
||||
// Complex Generated Attributes
|
||||
public sealed override int Characteristic
|
||||
|
@ -114,7 +114,7 @@ namespace PKHeX.Core
|
|||
// Legality Properties
|
||||
public sealed override bool WasLink => Met_Location == Locations.LinkGift6 && Gen6;
|
||||
public sealed override bool WasEvent => Locations.IsEventLocation5(Met_Location) || FatefulEncounter;
|
||||
public sealed override bool WasEventEgg => GenNumber < 5 ? base.WasEventEgg : (Locations.IsEventLocation5(Egg_Location) || (FatefulEncounter && Egg_Location == Locations.LinkTrade6)) && Met_Level == 1;
|
||||
public sealed override bool WasEventEgg => Generation < 5 ? base.WasEventEgg : (Locations.IsEventLocation5(Egg_Location) || (FatefulEncounter && Egg_Location == Locations.LinkTrade6)) && Met_Level == 1;
|
||||
|
||||
// Maximums
|
||||
public sealed override int MaxIV => 31;
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
get
|
||||
{
|
||||
string form = AltForm > 0 ? $"-{AltForm:00}" : string.Empty;
|
||||
string form = Form > 0 ? $"-{Form:00}" : string.Empty;
|
||||
string star = IsShiny ? " ★" : string.Empty;
|
||||
return $"{Species:000}{form}{star} - {Nickname} - {Checksums.CRC16_CCITT(Encrypt()):X4}";
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
public sealed override int AltForm
|
||||
public sealed override int Form
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -4,14 +4,16 @@
|
|||
/// Alternate form data has an associated value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="Species.Furfrou"/> How long (days) the form can last before reverting to AltForm-0 (5 days max)
|
||||
/// <see cref="Species.Hoopa"/>: How long (days) the form can last before reverting to AltForm-0 (3 days max)
|
||||
/// <see cref="Species.Furfrou"/> How long (days) the form can last before reverting to Form-0 (5 days max)
|
||||
/// <see cref="Species.Hoopa"/>: How long (days) the form can last before reverting to Form-0 (3 days max)
|
||||
/// <see cref="Species.Alcremie"/>: Topping (Strawberry, Star, etc); [0,7]
|
||||
/// <see cref="Species.Yamask"/> How much damage the Pokémon has taken as Yamask-1 [0,9999].
|
||||
/// <see cref="Species.Runerigus"/> How much damage the Pokémon has taken as Yamask-1 [0,9999].
|
||||
/// </remarks>
|
||||
public interface IFormArgument
|
||||
{
|
||||
/// <summary>
|
||||
/// Argument for the associated <see cref="PKM.AltForm"/>
|
||||
/// Argument for the associated <see cref="PKM.Form"/>
|
||||
/// </summary>
|
||||
uint FormArgument { get; set; }
|
||||
}
|
||||
|
|
7
PKHeX.Core/PKM/Shared/IGeneration.cs
Normal file
7
PKHeX.Core/PKM/Shared/IGeneration.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
public interface IGeneration
|
||||
{
|
||||
int Generation { get; }
|
||||
}
|
||||
}
|
8
PKHeX.Core/PKM/Shared/ISpeciesForm.cs
Normal file
8
PKHeX.Core/PKM/Shared/ISpeciesForm.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
public interface ISpeciesForm
|
||||
{
|
||||
int Species { get; }
|
||||
int Form { get; }
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
{
|
||||
if (tr is PKM p)
|
||||
{
|
||||
var format = p.GenNumber;
|
||||
var format = p.Generation;
|
||||
if ((format < 3 && p.Format >= 7) || format <= 0) // VC or bad gen
|
||||
return 4; // use TID/SID 16bit style
|
||||
return format;
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace PKHeX.Core
|
|||
public sealed class QRPK7 : IEncounterable
|
||||
{
|
||||
public GameVersion Version => (GameVersion)CassetteVersion;
|
||||
public int Form => AltForm;
|
||||
public string Name => nameof(QRPK7);
|
||||
public string LongName => Name;
|
||||
public bool EggEncounter => false;
|
||||
|
@ -45,7 +44,7 @@ namespace PKHeX.Core
|
|||
public int Nature => Data[0x22];
|
||||
public bool FatefulEncounter => (Data[0x23] & 1) == 1;
|
||||
public int Gender => (Data[0x23] >> 1) & 3;
|
||||
public int AltForm => Data[0x23] >> 3;
|
||||
public int Form => Data[0x23] >> 3;
|
||||
public int EV_HP => Data[0x24];
|
||||
public int EV_ATK => Data[0x25];
|
||||
public int EV_DEF => Data[0x26];
|
||||
|
@ -78,7 +77,7 @@ namespace PKHeX.Core
|
|||
Gender = Gender,
|
||||
Nature = Nature,
|
||||
FatefulEncounter = FatefulEncounter,
|
||||
AltForm = AltForm,
|
||||
Form = Form,
|
||||
HyperTrainFlags = HT_Flags,
|
||||
IV_HP = IV_HP,
|
||||
IV_ATK = IV_ATK,
|
||||
|
|
|
@ -5,7 +5,7 @@ using static PKHeX.Core.Species;
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves localized form names for indicating <see cref="PKM.AltForm"/> values.
|
||||
/// Retrieves localized form names for indicating <see cref="PKM.Form"/> values.
|
||||
/// </summary>
|
||||
public static class FormConverter
|
||||
{
|
||||
|
|
|
@ -326,7 +326,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if a PKM is transferable relative to in-game restrictions and <see cref="PKM.AltForm"/>.
|
||||
/// Checks to see if a PKM is transferable relative to in-game restrictions and <see cref="PKM.Form"/>.
|
||||
/// </summary>
|
||||
/// <param name="pk">PKM to convert</param>
|
||||
/// <param name="comment">Comment indicating why the <see cref="PKM"/> is not transferable.</param>
|
||||
|
@ -339,11 +339,11 @@ namespace PKHeX.Core
|
|||
comment = string.Empty;
|
||||
return false;
|
||||
|
||||
case 025 when pk.AltForm != 0 && pk.Gen6: // Cosplay Pikachu
|
||||
case 172 when pk.AltForm != 0 && pk.Gen4: // Spiky Eared Pichu
|
||||
case 025 when pk.AltForm == 8 && pk.LGPE: // Buddy Pikachu
|
||||
case 133 when pk.AltForm == 1 && pk.LGPE: // Buddy Eevee
|
||||
comment = MsgPKMConvertFailForme;
|
||||
case 025 when pk.Form != 0 && pk.Gen6: // Cosplay Pikachu
|
||||
case 172 when pk.Form != 0 && pk.Gen4: // Spiky Eared Pichu
|
||||
case 025 when pk.Form == 8 && pk.LGPE: // Buddy Pikachu
|
||||
case 133 when pk.Form == 1 && pk.LGPE: // Buddy Eevee
|
||||
comment = MsgPKMConvertFailForm;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace PKHeX.Core
|
|||
private static IOrderedEnumerable<PKM> FinalSortBy(this IOrderedEnumerable<PKM> result)
|
||||
{
|
||||
var postSorted = result
|
||||
.ThenBy(p => p.AltForm) // altforms sorted
|
||||
.ThenBy(p => p.Form) // forms sorted
|
||||
.ThenBy(p => p.Gender) // gender sorted
|
||||
.ThenBy(p => p.IsNicknamed);
|
||||
return postSorted;
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace PKHeX.Core
|
|||
/// <param name="gender">Current Gender</param>
|
||||
/// <param name="origin">Origin Generation</param>
|
||||
/// <param name="nature">Nature</param>
|
||||
/// <param name="form">AltForm</param>
|
||||
/// <param name="form">Form</param>
|
||||
/// <param name="oldPID">Current PID</param>
|
||||
/// <remarks>Used to retain ability bits.</remarks>
|
||||
/// <returns>Rerolled PID.</returns>
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace PKHeX.Core
|
|||
/// <returns>QR Message</returns>
|
||||
public static string GetMessage(DataMysteryGift mg)
|
||||
{
|
||||
var server = GetExploitURLPrefixWC(mg.Format);
|
||||
var server = GetExploitURLPrefixWC(mg.Generation);
|
||||
var data = mg.Write();
|
||||
return GetMessageBase64(data, server);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Stat/misc data for individual species or their associated alternate forme data.
|
||||
/// Stat/misc data for individual species or their associated alternate form data.
|
||||
/// </summary>
|
||||
public abstract class PersonalInfo
|
||||
{
|
||||
|
@ -159,19 +159,19 @@ namespace PKHeX.Core
|
|||
public abstract int EscapeRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Count of <see cref="PKM.AltForm"/> values the entry can have.
|
||||
/// Count of <see cref="PKM.Form"/> values the entry can have.
|
||||
/// </summary>
|
||||
public virtual int FormeCount { get; set; } = 1;
|
||||
public virtual int FormCount { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to the first <see cref="PKM.AltForm"/> <see cref="PersonalInfo"/> index
|
||||
/// Pointer to the first <see cref="PKM.Form"/> <see cref="PersonalInfo"/> index
|
||||
/// </summary>
|
||||
protected internal virtual int FormStatsIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to the <see cref="PKM.AltForm"/> sprite index.
|
||||
/// Pointer to the <see cref="PKM.Form"/> sprite index.
|
||||
/// </summary>
|
||||
public virtual int FormeSprite { get; set; }
|
||||
public virtual int FormSprite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Base Experience Yield factor
|
||||
|
@ -243,29 +243,29 @@ namespace PKHeX.Core
|
|||
internal void AddTypeTutors(byte[] data, int start = 0, int length = -1) => TypeTutors = GetBits(data, start, length);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="PersonalTable"/> <see cref="PKM.AltForm"/> entry index for the input criteria, with fallback for the original species entry.
|
||||
/// Gets the <see cref="PersonalTable"/> <see cref="PKM.Form"/> 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)
|
||||
/// <param name="form"><see cref="PKM.Form"/> to retrieve for</param>
|
||||
/// <returns>Index the <see cref="PKM.Form"/> exists as in the <see cref="PersonalTable"/>.</returns>
|
||||
public int FormIndex(int species, int form)
|
||||
{
|
||||
if (!HasForme(forme))
|
||||
if (!HasForm(form))
|
||||
return species;
|
||||
return FormStatsIndex + forme - 1;
|
||||
return FormStatsIndex + form - 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the <see cref="PersonalInfo"/> has the requested <see cref="PKM.AltForm"/> entry index available.
|
||||
/// Checks if the <see cref="PersonalInfo"/> has the requested <see cref="PKM.Form"/> entry index available.
|
||||
/// </summary>
|
||||
/// <param name="forme"><see cref="PKM.AltForm"/> to retrieve for</param>
|
||||
public bool HasForme(int forme)
|
||||
/// <param name="form"><see cref="PKM.Form"/> to retrieve for</param>
|
||||
public bool HasForm(int form)
|
||||
{
|
||||
if (forme <= 0) // no forme requested
|
||||
if (form <= 0) // no forme requested
|
||||
return false;
|
||||
if (FormStatsIndex <= 0) // no formes present
|
||||
return false;
|
||||
if (forme >= FormeCount) // beyond range of species' formes
|
||||
if (form >= FormCount) // beyond range of species' formes
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Indicates if the entry has Formes or not.
|
||||
/// </summary>
|
||||
public bool HasFormes => FormeCount > 1;
|
||||
public bool HasForms => FormCount > 1;
|
||||
|
||||
/// <summary>
|
||||
/// Base Stat Total sum of all stats.
|
||||
|
@ -321,15 +321,15 @@ namespace PKHeX.Core
|
|||
public int BST => HP + ATK + DEF + SPE + SPA + SPD;
|
||||
|
||||
/// <summary>
|
||||
/// Checks to see if the <see cref="PKM.AltForm"/> is valid within the <see cref="FormeCount"/>
|
||||
/// Checks to see if the <see cref="PKM.Form"/> is valid within the <see cref="FormCount"/>
|
||||
/// </summary>
|
||||
/// <param name="forme"></param>
|
||||
/// <param name="form"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsFormeWithinRange(int forme)
|
||||
public bool IsFormWithinRange(int form)
|
||||
{
|
||||
if (forme == 0)
|
||||
if (form == 0)
|
||||
return true;
|
||||
return forme < FormeCount;
|
||||
return form < FormCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -57,11 +57,11 @@ namespace PKHeX.Core
|
|||
|
||||
public sealed override int EscapeRate { get => Data[0x1B]; set => Data[0x1B] = (byte)value; }
|
||||
protected internal override int FormStatsIndex { get => BitConverter.ToUInt16(Data, 0x1C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); }
|
||||
public sealed override int FormeSprite { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); }
|
||||
public sealed override int FormeCount { get => Data[0x20]; set => Data[0x20] = (byte)value; }
|
||||
public sealed override int FormSprite { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); }
|
||||
public sealed override int FormCount { get => Data[0x20]; set => Data[0x20] = (byte)value; }
|
||||
public sealed override int Color { get => Data[0x21] & 0x3F; set => Data[0x21] = (byte)((Data[0x21] & 0xC0) | (value & 0x3F)); }
|
||||
public bool SpriteFlip { get => ((Data[0x21] >> 6) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x40) | (value ? 0x40 : 0)); }
|
||||
public bool SpriteForme { get => ((Data[0x21] >> 7) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x80) | (value ? 0x80 : 0)); }
|
||||
public bool SpriteForm { get => ((Data[0x21] >> 7) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x80) | (value ? 0x80 : 0)); }
|
||||
|
||||
public sealed override int BaseEXP { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); }
|
||||
public sealed override int Height { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); }
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
// Manually added attributes
|
||||
public override int FormeCount { get => Data[0x29]; set {} }
|
||||
public override int FormCount { get => Data[0x29]; set {} }
|
||||
protected internal override int FormStatsIndex { get => BitConverter.ToUInt16(Data, 0x2A); set {} }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,11 +80,11 @@ namespace PKHeX.Core
|
|||
public int AbilityH { get => BitConverter.ToUInt16(Data, 0x1C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); }
|
||||
public override int EscapeRate { get => 0; set { } } // moved?
|
||||
protected internal override int FormStatsIndex { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); }
|
||||
public override int FormeSprite { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } // ???
|
||||
public override int FormeCount { get => Data[0x20]; set => Data[0x20] = (byte)value; }
|
||||
public override int FormSprite { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } // ???
|
||||
public override int FormCount { get => Data[0x20]; set => Data[0x20] = (byte)value; }
|
||||
public override int Color { get => Data[0x21] & 0x3F; set => Data[0x21] = (byte)((Data[0x21] & 0xC0) | (value & 0x3F)); }
|
||||
public bool IsPresentInGame { get => ((Data[0x21] >> 6) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x40) | (value ? 0x40 : 0)); }
|
||||
public bool SpriteForme { get => ((Data[0x21] >> 7) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x80) | (value ? 0x80 : 0)); }
|
||||
public bool SpriteForm { get => ((Data[0x21] >> 7) & 1) == 1; set => Data[0x21] = (byte)((Data[0x21] & ~0x80) | (value ? 0x80 : 0)); }
|
||||
public override int BaseEXP { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); }
|
||||
public override int Height { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); }
|
||||
public override int Weight { get => BitConverter.ToUInt16(Data, 0x26); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); }
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue