Merge pull request #2 from kwsch/master

Update from upstream repo kwsch/PKHeX
This commit is contained in:
wwwwwwzx 2017-03-22 19:57:45 -07:00 committed by GitHub
commit a11d3f0dd0
4 changed files with 26 additions and 33 deletions

View file

@ -101,12 +101,8 @@ namespace PKHeX.WinForms
setEntry();
editing = true;
int bspecies;
int fspecies = LB_Species.SelectedIndex + 1;
if (fspecies <= SAV.MaxSpeciesID)
bspecies = fspecies;
else
bspecies = baseSpecies[fspecies - SAV.MaxSpeciesID - 1];
var bspecies = fspecies <= SAV.MaxSpeciesID ? fspecies : baseSpecies[fspecies - SAV.MaxSpeciesID - 1];
int form = LB_Forms.SelectedIndex;
if (form > 0)
{
@ -135,41 +131,36 @@ namespace PKHeX.WinForms
LB_Forms.DataSource = null;
LB_Forms.Items.Clear();
int bspecies;
int fspecies = LB_Species.SelectedIndex + 1;
if (fspecies <= SAV.MaxSpeciesID)
bspecies = fspecies;
else
bspecies = baseSpecies[fspecies - SAV.MaxSpeciesID - 1];
var bspecies = fspecies <= SAV.MaxSpeciesID ? fspecies : baseSpecies[fspecies - SAV.MaxSpeciesID - 1];
bool hasForms = SAV.Personal[bspecies].HasFormes || new[] { 201, 664, 665, 414 }.Contains(bspecies);
LB_Forms.Enabled = hasForms;
if (!hasForms) return false;
var ds = PKX.getFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, new[] { "♂", "♀", "-" }, SAV.Generation).ToList();
var ds = PKX.getFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, Main.gendersymbols, SAV.Generation).ToList();
if (ds.Count == 1 && string.IsNullOrEmpty(ds[0]))
{ // empty (Alolan Totems)
{
// empty (Alolan Totems)
LB_Forms.Enabled = false;
return false;
}
LB_Forms.DataSource = ds;
if (fspecies <= SAV.MaxSpeciesID)
LB_Forms.SelectedIndex = 0;
else
{
LB_Forms.DataSource = ds;
if (fspecies <= SAV.MaxSpeciesID)
LB_Forms.SelectedIndex = 0;
int fc = SAV.Personal[bspecies].FormeCount;
if (fc <= 1)
return true;
int f = SaveUtil.getDexFormIndexSM(bspecies, fc, SAV.MaxSpeciesID - 1);
if (f < 0)
return true; // bit index valid
if (f > fspecies - LB_Forms.Items.Count - 1)
LB_Forms.SelectedIndex = fspecies - f - 1;
else
{
int fc = SAV.Personal[bspecies].FormeCount;
if (fc > 1) // actually has forms
{
int f = SaveUtil.getDexFormIndexSM(bspecies, fc, SAV.MaxSpeciesID - 1);
if (f >= 0)
{ // bit index valid
if (f > fspecies - LB_Forms.Items.Count - 1)
LB_Forms.SelectedIndex = fspecies - f - 1;
else
LB_Forms.SelectedIndex = -1;
}
}
}
LB_Forms.SelectedIndex = -1;
}
return true;
}

View file

@ -242,6 +242,7 @@ namespace PKHeX.Core
public static string V111 {get; set;} = "Hidden Ability on non-SOS wild encounter.";
public static string V112 {get; set;} = "Hidden Ability not available.";
public static string V217 {get; set;} = "Hidden Grotto captures should have Hidden Ability.";
public static string V218 {get; set;} = "Hidden Ability not available from Wild Encounter.";
public static string V115 {get; set;} = "Ability matches ability number."; // Valid
public static string V113 {get; set;} = "Ability does not match PID.";

View file

@ -987,11 +987,12 @@ namespace PKHeX.Core
}
if (pkm.GenNumber == 5)
{
if (EncounterType == typeof(EncounterSlot[]) && !((EncounterSlot[])EncounterMatch).Any(slot => slot.Type != SlotType.HiddenGrotto)) //encounter only at HiddenGrotto
if (EncounterType == typeof(EncounterSlot[]))
{
if (pkm.AbilityNumber != 4)
bool grotto = ((EncounterSlot[])EncounterMatch).All(slot => slot.Type == SlotType.HiddenGrotto); //encounter only at HiddenGrotto
if (pkm.AbilityNumber == 4 ^ grotto)
{
AddLine(Severity.Invalid, V217, CheckIdentifier.Ability);
AddLine(Severity.Invalid, grotto ? V217 : V218, CheckIdentifier.Ability);
return;
}
}

View file

@ -583,7 +583,7 @@ namespace PKHeX.Core
081, 082, 083, 084, 085, 087, 088, 089, 090, 091, 092, 093, 094, 095, 096, 097, 098, 099, 100, //086: Hall of Origin unreleased event
101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
};
internal static readonly int[] ValidMet_Pt = ValidMet_DP.Concat(new int[]
internal static readonly int[] ValidMet_Pt = ValidMet_DP.Concat(new[]
{
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
}).ToArray();