mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-08 18:05:54 -05: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:
@@ -1098,8 +1098,6 @@ private void VerifyCXDStarterCorrelation(PIDIV pidiv)
|
||||
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 @@ private static bool IsAbilityCapsuleModified(PKM pkm, IReadOnlyList<int> abiliti
|
||||
}
|
||||
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 @@ private static bool IsAbilityCapsuleModified(PKM pkm, IReadOnlyList<int> abiliti
|
||||
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 @@ private static bool IsAbilityCapsuleModified(PKM pkm, IReadOnlyList<int> abiliti
|
||||
}
|
||||
// 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 @@ private static void MarkG5DreamWorld(ref EncounterStatic[] t)
|
||||
{
|
||||
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 @@ public void RefreshAbility(int n)
|
||||
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 abstract class _K3 : PKM, IRibbonSetEvent3, IRibbonSetCommon3, IRibbonSet
|
||||
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 @@ public override int[] Abilities
|
||||
AbilityH = (byte)value[2];
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasHiddenAbility => AbilityH != Ability1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,5 +69,7 @@ public override int[] Abilities
|
||||
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 @@ private static int GetAbilityIndex4(PKM pk, int[] abils)
|
||||
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 @@ private void SetAbilityList()
|
||||
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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user