mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-11 07:04:16 +00:00
Reorder mysterygift 5+ egg generating logic
Closes #1331 where IsEgg was checked before it was set handle legality cases (set nickname & flag)
This commit is contained in:
parent
c12eba2186
commit
ee29b4a31f
5 changed files with 18 additions and 13 deletions
|
@ -1738,7 +1738,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
else // Is Traded
|
||||
{
|
||||
if (pkm.Format == 6 && pkm.HT_Memory == 0)
|
||||
if (pkm.Format == 6 && pkm.HT_Memory == 0 && !pkm.IsEgg)
|
||||
return new CheckResult(Severity.Invalid, V150, CheckIdentifier.History);
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,6 @@ namespace PKHeX.Core
|
|||
|
||||
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);
|
||||
|
@ -283,12 +282,12 @@ namespace PKHeX.Core
|
|||
|
||||
if (IsEgg)
|
||||
{
|
||||
// pk.IsEgg = true;
|
||||
pk.IsEgg = true;
|
||||
pk.EggMetDate = Date;
|
||||
// Force hatch
|
||||
pk.IsEgg = false;
|
||||
pk.Met_Location = 4; // Nuvema Town
|
||||
pk.Nickname = PKX.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
|
||||
|
||||
pk.RefreshChecksum();
|
||||
return pk;
|
||||
|
|
|
@ -215,8 +215,10 @@ namespace PKHeX.Core
|
|||
pk4.Language = 2; // English
|
||||
pk4.Nickname = "MANAPHY";
|
||||
pk4.Egg_Location = 1; // Ranger (will be +3000 later)
|
||||
pk4.Move1_PP = pk4.GetMovePP(pk4.Move1, 0);
|
||||
pk4.Move2_PP = pk4.GetMovePP(pk4.Move2, 0);
|
||||
pk4.Move3_PP = pk4.GetMovePP(pk4.Move3, 0);
|
||||
}
|
||||
pk4.CurrentFriendship = pk4.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
|
||||
|
||||
// Generate IV
|
||||
uint seed = Util.Rand32();
|
||||
|
@ -258,12 +260,11 @@ namespace PKHeX.Core
|
|||
}
|
||||
else
|
||||
{
|
||||
pk4.Egg_Location = pk4.Egg_Location + 3000;
|
||||
if (SAV.Generation == 4)
|
||||
{
|
||||
pk4.IsEgg = true;
|
||||
pk4.Met_Location = pk4.Egg_Location + 3000;
|
||||
pk4.Egg_Location = 0;
|
||||
pk4.IsNicknamed = true;
|
||||
pk4.IsNicknamed = false;
|
||||
pk4.Nickname = PKX.GetSpeciesNameGeneration(0, pk4.Language, Format);
|
||||
pk4.MetDate = DateTime.Now;
|
||||
}
|
||||
|
@ -271,10 +272,12 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk4.IsEgg = false;
|
||||
// Met Location is modified when transferred to pk5; don't worry about it.
|
||||
pk4.Egg_Location = pk4.Egg_Location + 3000;
|
||||
pk4.EggMetDate = DateTime.Now;
|
||||
}
|
||||
while (pk4.IsShiny)
|
||||
pk4.PID = RNG.ARNG.Next(pk4.PID);
|
||||
}
|
||||
pk4.CurrentFriendship = pk4.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
|
||||
if (pk4.Species == 201) // Never will be true; Unown was never distributed.
|
||||
pk4.AltForm = PKX.GetUnownForm(pk4.PID);
|
||||
|
||||
|
|
|
@ -344,7 +344,6 @@ 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);
|
||||
|
@ -438,7 +437,10 @@ namespace PKHeX.Core
|
|||
{
|
||||
pk.IsEgg = true;
|
||||
pk.EggMetDate = Date;
|
||||
pk.Nickname = PKX.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
|
||||
|
||||
pk.RefreshChecksum();
|
||||
return pk;
|
||||
|
|
|
@ -369,7 +369,6 @@ 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);
|
||||
|
@ -450,7 +449,9 @@ namespace PKHeX.Core
|
|||
pk.IsEgg = true;
|
||||
pk.EggMetDate = Date;
|
||||
pk.Nickname = PKX.GetSpeciesNameGeneration(0, pk.Language, Format);
|
||||
pk.IsNicknamed = true;
|
||||
}
|
||||
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
|
||||
|
||||
pk.RefreshChecksum();
|
||||
return pk;
|
||||
|
|
Loading…
Reference in a new issue