Misc changes

Properly handle egg hatch counters for generated mystery gifts, as well
as HT friendship for gen6+
fetch form specific (friendship doesn't change but abilities fetch
species specific data later, so just fetch once up front). Do not depend
on save file as SAV7 importing PGF may have different abilities
allocated
Pad buttons for folder popup
fix double Japanese/International error message for importing jpk1<->pk1
This commit is contained in:
Kurt 2017-05-16 20:34:24 -07:00
parent b4d18baf83
commit f674d45854
6 changed files with 16 additions and 10 deletions

View file

@ -160,13 +160,14 @@ namespace PKHeX.Core
Year = (byte)dt.Year;
}
int currentLevel = Level > 0 ? Level : (int)(Util.rnd32() % 100 + 1);
var pi = PersonalTable.B2W2.getFormeEntry(Species, Form);
PK5 pk = new PK5
{
Species = Species,
HeldItem = HeldItem,
Met_Level = currentLevel,
Nature = Nature != 0xFF ? Nature : (int)(Util.rnd32() % 25),
Gender = PersonalTable.B2W2[Species].Gender == 255 ? 2 : (Gender != 2 ? Gender : PersonalTable.B2W2[Species].RandomGender),
Gender = pi.Gender == 255 ? 2 : (Gender != 2 ? Gender : pi.RandomGender),
AltForm = Form,
Version = OriginGame == 0 ? new[] {20, 21, 22, 23}[Util.rnd32() & 0x3] : OriginGame,
Language = Language == 0 ? SAV.Language : Language,
@ -205,9 +206,9 @@ namespace PKHeX.Core
RibbonChampionNational = RibbonChampionNational,
RibbonChampionWorld = RibbonChampionWorld,
OT_Friendship = PersonalTable.B2W2[Species].BaseFriendship,
FatefulEncounter = true,
};
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
pk.Move1_PP = pk.getMovePP(Move1, 0);
pk.Move2_PP = pk.getMovePP(Move2, 0);
pk.Move3_PP = pk.getMovePP(Move3, 0);
@ -251,7 +252,7 @@ namespace PKHeX.Core
break;
}
pk.HiddenAbility = av == 2;
pk.Ability = PersonalTable.B2W2.getAbilities(Species, pk.AltForm)[av];
pk.Ability = pi.Abilities[av];
if (PID != 0)
pk.PID = PID;

View file

@ -204,6 +204,7 @@ namespace PKHeX.Core
return null;
PK4 pk4 = new PK4(PK.Data);
var pi = PersonalTable.HGSS.getFormeEntry(Species, PK.AltForm);
if (!IsHatched && Detail == 0)
{
pk4.OT_Name = SAV.OT;
@ -228,6 +229,7 @@ namespace PKHeX.Core
pk4.Nickname = "MANAPHY";
pk4.Egg_Location = 1; // Ranger (will be +3000 later)
}
pk4.CurrentFriendship = pk4.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
// Generate IV
uint seed = Util.rnd32();

View file

@ -278,7 +278,7 @@ namespace PKHeX.Core
return null;
int currentLevel = Level > 0 ? Level : (int)(Util.rnd32()%100 + 1);
var pi = PersonalTable.AO[Species];
var pi = PersonalTable.AO.getFormeEntry(Species, Form);
PK6 pk = new PK6
{
Species = Species,
@ -344,6 +344,7 @@ namespace PKHeX.Core
EVs = EVs,
};
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
pk.Move1_PP = pk.getMovePP(Move1, 0);
pk.Move2_PP = pk.getMovePP(Move2, 0);
pk.Move3_PP = pk.getMovePP(Move3, 0);
@ -412,7 +413,7 @@ namespace PKHeX.Core
av = (int)(Util.rnd32()%(AbilityType - 1));
break;
}
pk.Ability = PersonalTable.AO.getAbilities(Species, pk.AltForm)[av];
pk.Ability = pi.Abilities[av];
pk.AbilityNumber = 1 << av;
switch (PIDType)

View file

@ -303,7 +303,7 @@ namespace PKHeX.Core
int currentLevel = Level > 0 ? Level : (int)(Util.rnd32()%100 + 1);
int metLevel = MetLevel > 0 ? MetLevel : currentLevel;
var pi = PersonalTable.SM[Species];
var pi = PersonalTable.SM.getFormeEntry(Species, Form);
PK7 pk = new PK7
{
Species = Species,
@ -369,6 +369,7 @@ namespace PKHeX.Core
EVs = EVs,
};
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
pk.Move1_PP = pk.getMovePP(Move1, 0);
pk.Move2_PP = pk.getMovePP(Move2, 0);
pk.Move3_PP = pk.getMovePP(Move3, 0);
@ -423,7 +424,7 @@ namespace PKHeX.Core
av = (int)(Util.rnd32()%(AbilityType - 1));
break;
}
pk.Ability = PersonalTable.SM.getAbilities(Species, pk.AltForm)[av];
pk.Ability = pi.Abilities[av];
pk.AbilityNumber = 1 << av;
switch (PIDType)

View file

@ -744,9 +744,9 @@ namespace PKHeX.WinForms
WinFormsUtil.Alert("Conversion failed.", c);
else if (SAV.Generation < 3 && ((pk as PK1)?.Japanese ?? ((PK2)pk).Japanese) != SAV.Japanese)
{
string a_lang = SAV.Japanese ? "an International" : "a Japanese";
string pk_type = pk.GetType().Name;
WinFormsUtil.Alert($"Cannot load {a_lang} {pk_type} in {a_lang} save file.");
var strs = new[] {"International", "Japanese"};
var val = SAV.Japanese ? 0 : 1;
WinFormsUtil.Alert($"Cannot load {strs[val]} {pk.GetType().Name}s to {strs[val^1]} saves.");
}
else
populateFields(pk);

View file

@ -38,6 +38,7 @@
this.FLP_Buttons.Dock = System.Windows.Forms.DockStyle.Fill;
this.FLP_Buttons.Location = new System.Drawing.Point(0, 0);
this.FLP_Buttons.Name = "FLP_Buttons";
this.FLP_Buttons.Padding = new System.Windows.Forms.Padding(3);
this.FLP_Buttons.Size = new System.Drawing.Size(304, 161);
this.FLP_Buttons.TabIndex = 0;
//