mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
9b178fefe2
Move form-info logic from FormConverter to AltFormInfo; now FormConverter is entirely form=>string[] Add a bunch of xmldoc Make pogo no-end-date cmp agaisnt UTCnow rather than local now.
63 lines
2 KiB
C#
63 lines
2 KiB
C#
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Generation 4 Static Encounter
|
|
/// </summary>
|
|
/// <inheritdoc cref="EncounterStatic"/>
|
|
public class EncounterStatic4 : EncounterStatic
|
|
{
|
|
public sealed override int Generation => 4;
|
|
|
|
protected sealed override bool IsMatchEggLocation(PKM pkm)
|
|
{
|
|
if (pkm.Egg_Location == EggLocation)
|
|
{
|
|
if (EggLocation == 0)
|
|
return true;
|
|
|
|
// Check the inverse scenario for 4->5 eggs
|
|
if (!Locations.IsPtHGSSLocationEgg(EggLocation))
|
|
return true;
|
|
return pkm.Format == 4;
|
|
}
|
|
|
|
if (pkm.IsEgg) // unhatched
|
|
{
|
|
if (EggLocation != pkm.Met_Location)
|
|
return false;
|
|
return pkm.Egg_Location == 0;
|
|
}
|
|
|
|
// Only way to mismatch is to be a Link Traded egg, or traded to Pt/HG/SS and hatched there.
|
|
if (pkm.Egg_Location == Locations.LinkTrade4)
|
|
return true;
|
|
|
|
// check Pt/HGSS data
|
|
if (pkm.Format == 4)
|
|
return false;
|
|
|
|
if (!Locations.IsPtHGSSLocationEgg(EggLocation)) // non-Pt/HG/SS egg gift
|
|
return false;
|
|
|
|
// transferring 4->5 clears Pt/HG/SS location value and keeps Faraway Place
|
|
return pkm.Egg_Location == Locations.Faraway4;
|
|
}
|
|
|
|
protected sealed override bool IsMatchLevel(PKM pkm, DexLevel evo)
|
|
{
|
|
if (pkm.Format != 4) // Met Level lost on PK3=>PK4
|
|
return Level <= evo.Level;
|
|
|
|
return pkm.Met_Level == (EggEncounter ? 0 : Level);
|
|
}
|
|
|
|
protected override bool IsMatchLocation(PKM pkm)
|
|
{
|
|
if (EggEncounter)
|
|
return true;
|
|
if (pkm.Format == 4)
|
|
return Location == pkm.Met_Location;
|
|
return true; // transfer location verified later
|
|
}
|
|
}
|
|
}
|