mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Add manaphy egg PIDIV check
slightly different from hatched in that it can't be shiny as an egg as the ID/SID doesn't change until hatched. move Ranger check to utility
This commit is contained in:
parent
e71d9af13e
commit
0c23881f65
2 changed files with 28 additions and 18 deletions
|
@ -901,18 +901,6 @@ namespace PKHeX.Core
|
|||
foreach (var z in validWC3)
|
||||
yield return z;
|
||||
}
|
||||
private static bool IsRangerManaphy(PKM pkm)
|
||||
{
|
||||
var egg = pkm.Egg_Location;
|
||||
const int ranger = 3001;
|
||||
const int linkegg = 2002;
|
||||
if (!pkm.IsEgg) // Link Trade Egg or Ranger
|
||||
return egg == linkegg || egg == ranger;
|
||||
if (egg != ranger)
|
||||
return false;
|
||||
var met = pkm.Met_Location;
|
||||
return met == linkegg || met == 0;
|
||||
}
|
||||
private static IEnumerable<MysteryGift> GetMatchingPCD(PKM pkm, IEnumerable<MysteryGift> DB)
|
||||
{
|
||||
if (DB == null)
|
||||
|
@ -1204,6 +1192,18 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
// Utility
|
||||
private static bool IsRangerManaphy(PKM pkm)
|
||||
{
|
||||
var egg = pkm.Egg_Location;
|
||||
const int ranger = 3001;
|
||||
const int linkegg = 2002;
|
||||
if (!pkm.IsEgg) // Link Trade Egg or Ranger
|
||||
return egg == linkegg || egg == ranger;
|
||||
if (egg != ranger)
|
||||
return false;
|
||||
var met = pkm.Met_Location;
|
||||
return met == linkegg || met == 0;
|
||||
}
|
||||
private static bool IsHiddenAbilitySlot(EncounterSlot slot)
|
||||
{
|
||||
return slot.Permissions.DexNav || slot.Type == SlotType.FriendSafari || slot.Type == SlotType.Horde || slot.Type == SlotType.SOS;
|
||||
|
|
|
@ -607,14 +607,24 @@ namespace PKHeX.Core
|
|||
}
|
||||
private static bool IsG4ManaphyPIDValid(PIDType val, PKM pkm)
|
||||
{
|
||||
if (pkm.IsEgg)
|
||||
{
|
||||
if (pkm.IsShiny)
|
||||
return false;
|
||||
if (val == PIDType.Method_1)
|
||||
return true;
|
||||
return val == PIDType.G4MGAntiShiny && IsAntiShinyARNG();
|
||||
}
|
||||
|
||||
if (val == PIDType.Method_1)
|
||||
return pkm.WasTradedEgg || !pkm.IsShiny; // can't be shiny on received game
|
||||
if (val != PIDType.G4MGAntiShiny)
|
||||
return false;
|
||||
if (pkm.WasTradedEgg)
|
||||
return true;
|
||||
var shinyPID = RNG.ARNG.Prev(pkm.PID);
|
||||
return (pkm.TID ^ pkm.SID ^ (shinyPID & 0xFFFF) ^ (shinyPID >> 16)) < 8; // shiny proc
|
||||
return val == PIDType.G4MGAntiShiny && (pkm.WasTradedEgg || IsAntiShinyARNG());
|
||||
|
||||
bool IsAntiShinyARNG()
|
||||
{
|
||||
var shinyPID = RNG.ARNG.Prev(pkm.PID);
|
||||
return (pkm.TID ^ pkm.SID ^ (shinyPID & 0xFFFF) ^ (shinyPID >> 16)) < 8; // shiny proc
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly PIDType[] MethodH = { PIDType.Method_1, PIDType.Method_2, PIDType.Method_4 };
|
||||
|
|
Loading…
Reference in a new issue