mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Fix dizzy punch egg recognition & gen2 hatch conter verification
Closes #2939 Fixes #2938 Inline some logic where appropriate for egg levels
This commit is contained in:
parent
53e2432818
commit
e04b96a9b3
7 changed files with 42 additions and 15 deletions
|
@ -119,9 +119,6 @@ namespace PKHeX.Core
|
|||
};
|
||||
}
|
||||
|
||||
internal static int GetEggHatchLevel(PKM pkm) => GetEggHatchLevel(pkm.Format);
|
||||
internal static int GetEggHatchLevel(int gen) => gen <= 3 ? 5 : 1;
|
||||
|
||||
internal static ICollection<int> GetSplitBreedGeneration(int generation)
|
||||
{
|
||||
switch (generation)
|
||||
|
|
|
@ -214,13 +214,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
new EncounterStatic { Species = 245, Level = 40, Location = 023, Version = GameVersion.C }, // Suicune @ Tin Tower
|
||||
|
||||
new EncounterStatic { Species = 172, Level = 05, Version = GameVersion.C, Moves = new [] {146}, EggLocation = 256, EggCycles = 20 }, // Pichu Dizzy Punch
|
||||
new EncounterStatic { Species = 173, Level = 05, Version = GameVersion.C, Moves = new [] {146}, EggLocation = 256, EggCycles = 20 }, // Cleffa Dizzy Punch
|
||||
new EncounterStatic { Species = 174, Level = 05, Version = GameVersion.C, Moves = new [] {146}, EggLocation = 256, EggCycles = 20 }, // Igglybuff Dizzy Punch
|
||||
new EncounterStatic { Species = 236, Level = 05, Version = GameVersion.C, Moves = new [] {146}, EggLocation = 256, EggCycles = 20 }, // Tyrogue Dizzy Punch
|
||||
new EncounterStatic { Species = 238, Level = 05, Version = GameVersion.C, Moves = new [] {146}, EggLocation = 256, EggCycles = 20 }, // Smoochum Dizzy Punch
|
||||
new EncounterStatic { Species = 239, Level = 05, Version = GameVersion.C, Moves = new [] {146}, EggLocation = 256, EggCycles = 20 }, // Elekid Dizzy Punch
|
||||
new EncounterStatic { Species = 240, Level = 05, Version = GameVersion.C, Moves = new [] {146}, EggLocation = 256, EggCycles = 20 }, // Magby Dizzy Punch
|
||||
new EncounterStatic2Odd(172), // Pichu Dizzy Punch
|
||||
new EncounterStatic2Odd(173), // Cleffa Dizzy Punch
|
||||
new EncounterStatic2Odd(174), // Igglybuff Dizzy Punch
|
||||
new EncounterStatic2Odd(236), // Tyrogue Dizzy Punch
|
||||
new EncounterStatic2Odd(238), // Smoochum Dizzy Punch
|
||||
new EncounterStatic2Odd(239), // Elekid Dizzy Punch
|
||||
new EncounterStatic2Odd(240), // Magby Dizzy Punch
|
||||
|
||||
new EncounterStatic { Species = 147, Level = 15, Location = 042, Version = GameVersion.C, Moves = new [] {245} }, // Dratini ExtremeSpeed
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
public sealed class EncounterStatic2Odd : EncounterStatic
|
||||
{
|
||||
private const int Dizzy = 146;
|
||||
private static readonly int[] _dizzy = { Dizzy };
|
||||
|
||||
public EncounterStatic2Odd(int species)
|
||||
{
|
||||
Species = species;
|
||||
Level = 5;
|
||||
Version = GameVersion.C;
|
||||
Moves = _dizzy;
|
||||
EggLocation = 256;
|
||||
EggCycles = 20;
|
||||
}
|
||||
|
||||
public override bool IsMatch(PKM pkm, int lvl)
|
||||
{
|
||||
// Let it get picked up as regular EncounterEgg under other conditions.
|
||||
if (pkm.Format > 2)
|
||||
return false;
|
||||
if (pkm.Move1 != Dizzy && pkm.Move2 != Dizzy && pkm.Move3 != Dizzy && pkm.Move4 != Dizzy)
|
||||
return false;
|
||||
if (pkm.IsEgg && pkm.EXP != 125)
|
||||
return false;
|
||||
return base.IsMatch(pkm, lvl);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@ namespace PKHeX.Core
|
|||
|
||||
// version is a true indicator for all generation 3-5 origins
|
||||
var ver = (GameVersion)pkm.Version;
|
||||
int lvl = GetEggHatchLevel(gen);
|
||||
int lvl = gen <= 3 ? 5 : 1;
|
||||
int max = GetMaxSpeciesOrigin(gen);
|
||||
|
||||
var e = EvoBase.GetBaseSpecies(chain, 0);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
if (!pkm.HasOriginalMetLocation)
|
||||
return encounter.IsWithinRange(pkm.CurrentLevel);
|
||||
if (encounter.EggEncounter)
|
||||
return pkm.CurrentLevel == Legal.GetEggHatchLevel(pkm);
|
||||
return pkm.CurrentLevel == encounter.LevelMin;
|
||||
if (encounter is MysteryGift g)
|
||||
return pkm.CurrentLevel == g.Level;
|
||||
return pkm.CurrentLevel == pkm.Met_Level;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (pkm.IsEgg)
|
||||
{
|
||||
int elvl = Legal.GetEggHatchLevel(pkm);
|
||||
int elvl = EncounterMatch.LevelMin;
|
||||
if (elvl != pkm.CurrentLevel)
|
||||
{
|
||||
data.AddLine(GetInvalid(string.Format(LEggFMetLevel_0, elvl)));
|
||||
|
@ -67,7 +67,7 @@ namespace PKHeX.Core
|
|||
var EncounterMatch = data.EncounterOriginal;
|
||||
if (pkm.IsEgg)
|
||||
{
|
||||
int elvl = Legal.GetEggHatchLevel(pkm);
|
||||
const int elvl = 5;
|
||||
if (elvl != pkm.CurrentLevel)
|
||||
data.AddLine(GetInvalid(string.Format(LEggFMetLevel_0, elvl)));
|
||||
return;
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace PKHeX.Core
|
|||
#endregion
|
||||
|
||||
public override bool IsEgg { get; set; }
|
||||
|
||||
public override int OT_Friendship { get => CurrentFriendship; set => CurrentFriendship = value; }
|
||||
public override bool HasOriginalMetLocation => CaughtData != 0;
|
||||
public override int Version { get => (int)GameVersion.GSC; set { } }
|
||||
|
||||
|
|
Loading…
Reference in a new issue