mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Fill empty ability values with ability1
update handling that checked for this case to instead check for equivalence to ability1 instead of 0 was generating a PGF with ability[1] = 0, which is not correct. Just fix the binaries to behave and get rid of all the workarounds since future tables don't have missing values.
This commit is contained in:
parent
88b5277062
commit
f8a1d26694
17 changed files with 17 additions and 18 deletions
|
@ -1098,8 +1098,6 @@ namespace PKHeX.Core
|
|||
private void VerifyAbility()
|
||||
{
|
||||
int[] abilities = pkm.PersonalInfo.Abilities;
|
||||
if (abilities[1] == 0)
|
||||
abilities[1] = abilities[0];
|
||||
int abilval = Array.IndexOf(abilities, pkm.Ability);
|
||||
if (abilval < 0)
|
||||
{
|
||||
|
@ -1226,8 +1224,8 @@ namespace PKHeX.Core
|
|||
}
|
||||
private bool? VerifyAbilityGen3Transfer(int[] abilities, int abilval, int Species_g3)
|
||||
{
|
||||
var abilities_g3 = PersonalTable.E[Species_g3].Abilities.Where(a => a != 0).Distinct().ToArray();
|
||||
if (abilities_g3.Length == 2) // Excluding Colosseum/XD, a gen3 pkm must match PID if it has 2 unique abilities
|
||||
var pers = (PersonalInfoG3)PersonalTable.E[Species_g3];
|
||||
if (pers.Ability1 != pers.Ability2) // Excluding Colosseum/XD, a gen3 pkm must match PID if it has 2 unique abilities
|
||||
return pkm.Version != (int)GameVersion.CXD;
|
||||
|
||||
int Species_g4 = Info.EvoChainsAllGens[4].FirstOrDefault()?.Species ?? 0;
|
||||
|
@ -1239,7 +1237,7 @@ namespace PKHeX.Core
|
|||
if (Evolutions_g45 > 1)
|
||||
{
|
||||
// Evolutions_g45 > 1 and Species_g45 = Species_g3 with means both options, evolve in gen 4-5 or not evolve, are possible
|
||||
if (pkm.Ability == abilities_g3[0])
|
||||
if (pkm.Ability == pers.Ability1)
|
||||
// It could evolve in gen 4-5 an have generation 3 only ability
|
||||
// that means it have not actually evolved in gen 4-5, ability do not need to match PID
|
||||
return null;
|
||||
|
@ -1250,7 +1248,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
// Evolutions_g45 == 1 means it have not evolved in gen 4-5 games,
|
||||
// ability do not need to match PID, but only generation 3 ability is allowed
|
||||
if (pkm.Ability != abilities_g3[0])
|
||||
if (pkm.Ability != pers.Ability1)
|
||||
// Not evolved in gen4-5 but do not have generation 3 only ability
|
||||
AddLine(Severity.Invalid, V373, CheckIdentifier.Ability);
|
||||
return null;
|
||||
|
|
|
@ -90,8 +90,9 @@ namespace PKHeX.Core
|
|||
{
|
||||
foreach (EncounterStatic s in t)
|
||||
{
|
||||
s.Location = 75; //Entree Forest
|
||||
s.Ability = PersonalTable.B2W2.GetAbilities(s.Species, s.Form)[2] == 0 ? 1 : 4; // Check if has HA
|
||||
s.Location = 75; // Entree Forest
|
||||
var p = (PersonalInfoBW)PersonalTable.B2W2[s.Species];
|
||||
s.Ability = p.HasHiddenAbility ? 4 : 1;
|
||||
s.Shiny = Shiny.Never;
|
||||
}
|
||||
|
||||
|
|
|
@ -668,7 +668,7 @@ namespace PKHeX.Core
|
|||
int[] abilities = PersonalInfo.Abilities;
|
||||
if (n < abilities.Length)
|
||||
{
|
||||
if (abilities[n] == 0)
|
||||
if (abilities[n] == abilities[0])
|
||||
n = 0;
|
||||
Ability = abilities[n];
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
public override bool WasGiftEgg => IsEgg && Met_Location == 253; // Gift Egg, indistinguible from normal eggs after hatch
|
||||
public override bool WasEventEgg => IsEgg && Met_Location == 255; // Event Egg, indistinguible from normal eggs after hatch
|
||||
|
||||
public override int Ability { get { int[] abils = PersonalInfo.Abilities; return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } }
|
||||
public override int Ability { get { var pi = (PersonalInfoG3)PersonalInfo; return pi.Abilities[pi.HasSecondAbility ? AbilityNumber >> 1 : 0]; } set { } }
|
||||
public override uint EncryptionConstant { get => PID; set { } }
|
||||
public override int Nature { get => (int)(PID % 25); set { } }
|
||||
public override int AltForm { get => Species == 201 ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
|
|
|
@ -86,5 +86,7 @@ namespace PKHeX.Core
|
|||
AbilityH = (byte)value[2];
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasHiddenAbility => AbilityH != Ability1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,5 +69,7 @@ namespace PKHeX.Core
|
|||
Ability2 = (byte)value[1];
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasSecondAbility => Ability1 != Ability2;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -355,7 +355,7 @@ namespace PKHeX.WinForms.Controls
|
|||
return 0;
|
||||
if (abilityIndex >= 2)
|
||||
return 2;
|
||||
if (abils[0] == abils[1] || abils[1] == 0)
|
||||
if (abils[0] == abils[1])
|
||||
return pk.PIDAbility;
|
||||
return abilityIndex;
|
||||
}
|
||||
|
|
|
@ -392,14 +392,10 @@ namespace PKHeX.WinForms.Controls
|
|||
private static List<ComboItem> GetAbilityList(PKM pkm)
|
||||
{
|
||||
var abils = pkm.PersonalInfo.Abilities;
|
||||
if (abils[1] == 0 && pkm.Format != 3)
|
||||
abils[1] = abils[0];
|
||||
if (pkm.Format == 3 && abils[1] == abils[0])
|
||||
abils = new[] {abils[0]};
|
||||
|
||||
var list = abils.Where(a => a != 0).Select(GetItem).ToList();
|
||||
if (list.Count == 0)
|
||||
list.Add(GetItem(0, 0));
|
||||
|
||||
return list;
|
||||
return abils.Select(GetItem).ToList();
|
||||
|
||||
ComboItem GetItem(int ability, int index) => new ComboItem
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue