mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 04:08:26 -05:00
If pokemon is transfer from gen 3 to 4 or latter and it can be from an egg (pokeball 4, level and met level above 5, etc) check always for an egg encounter first, if does not match egg encounter then check other encounters
When verify moves for this pokemon it here is a non egg possible encounter first check moves from that encounter and if does not match check egg encounters Also for gen 2 unhatched eggs ignore gen 1 encounters
This commit is contained in:
@@ -738,8 +738,19 @@ private CheckResult verifyEncounter()
|
||||
|
||||
EncounterMatch = null; // Reset Encounter Object, test for remaining encounters
|
||||
}
|
||||
|
||||
if (pkm.WasEgg)
|
||||
|
||||
if(pkm.Gen3 && !pkm.HasOriginalMetLocation)
|
||||
{
|
||||
bool WasEgg = Legal.getWasEgg23(pkm) && !Legal.NoHatchFromEgg.Contains(pkm.Species);
|
||||
if(WasEgg)
|
||||
{
|
||||
pkm.WasEgg = true;
|
||||
var v = verifyEncounterEgg();
|
||||
if (v.Valid)
|
||||
return v;
|
||||
}
|
||||
}
|
||||
else if (pkm.WasEgg)
|
||||
return verifyEncounterEgg();
|
||||
|
||||
if (null != (EncounterMatch = Legal.getValidFriendSafari(pkm)))
|
||||
@@ -2202,6 +2213,16 @@ private CheckResult[] verifyMovesWasEggPreRelearn(int[] Moves, List<int>[] valid
|
||||
{
|
||||
CheckResult[] res = new CheckResult[4];
|
||||
|
||||
if(pkm.GenNumber == 3 && !pkm.HasOriginalMetLocation && EncounterMatch !=null)
|
||||
{
|
||||
if (EventGiftMatch?.Count > 1) // Multiple possible Mystery Gifts matched, get the best match too
|
||||
res = parseMovesGetGift(Moves, validLevelMoves, validTMHM, validTutor);
|
||||
else // Everything else
|
||||
res = parseMovesRegular(Moves, validLevelMoves, validTMHM, validTutor, new int[0], GameVersion.Any);
|
||||
if (res.All(r => r.Valid)) // moves is satisfactory
|
||||
return res;
|
||||
}
|
||||
|
||||
// Some games can have different egg movepools. Have to check all situations.
|
||||
GameVersion[] Games = { };
|
||||
switch (pkm.GenNumber)
|
||||
|
||||
@@ -1090,7 +1090,7 @@ private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, E
|
||||
}
|
||||
internal static Tuple<object, int, byte> getEncounter12(PKM pkm, bool gen2)
|
||||
{
|
||||
var g1 = getEncounter12(pkm, GameVersion.RBY);
|
||||
var g1 = pkm.IsEgg ? null :getEncounter12(pkm, GameVersion.RBY);
|
||||
var g2 = gen2 ? getEncounter12(pkm, GameVersion.GSC) : null;
|
||||
|
||||
if (g1 == null || g2 == null)
|
||||
@@ -1139,15 +1139,22 @@ internal static EncounterSlot[] getValidFriendSafari(PKM pkm)
|
||||
|
||||
return slots.Any() ? slots.ToArray() : null;
|
||||
}
|
||||
private static bool getWasEgg23(PKM pkm)
|
||||
internal static bool getWasEgg23(PKM pkm)
|
||||
{
|
||||
if (pkm.IsEgg)
|
||||
return true;
|
||||
if (pkm.Format > 2 && pkm.Ball != 4)
|
||||
return false;
|
||||
if (pkm.Format == 3)
|
||||
return pkm.WasEgg;
|
||||
|
||||
int lvl = pkm.CurrentLevel;
|
||||
if (lvl < 5)
|
||||
return false;
|
||||
|
||||
if(pkm.Format > 3 && pkm.Met_Level <5)
|
||||
return false;
|
||||
|
||||
return getEvolutionValid(pkm);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user