Add egg move sharing checks

Was referencing wild caught mons that are given a single egg move; this
logic handles shared egg moves too via daycare.

Probably need to rework SplitBreed into a dictionary; this might not
catch Mime/etc split breeds if they have different tables.
This commit is contained in:
Kurt 2019-11-17 17:14:21 -08:00
parent c2dce518c2
commit 4bcf60746b
4 changed files with 22 additions and 1 deletions

View file

@ -346,6 +346,8 @@ namespace PKHeX.Core
res[m] = new CheckMoveResult(Tutor, gen, Valid, native ? LMoveSourceTutor : string.Format(LMoveFTutor_0, gen), Move);
else if (gen == info.Generation && learnInfo.Source.SpecialSource.Contains(move))
res[m] = new CheckMoveResult(Special, gen, Valid, LMoveSourceSpecial, Move);
else if (gen >= 8 && GetIsSharedEggMove(pkm, gen, move))
res[m] = new CheckMoveResult(Shared, gen, Valid, native ? LMoveSourceShared : string.Format(LMoveSourceSharedF, gen), Move);
if (gen >= 3 || !IsCheckValid(res[m]))
continue;
@ -367,6 +369,18 @@ namespace PKHeX.Core
}
}
private static bool GetIsSharedEggMove(PKM pkm, int gen, int move)
{
if (gen < 8 || pkm.IsEgg)
return false;
var table = PersonalTable.SWSH;
var entry = (PersonalInfoSWSH)table.GetFormeEntry(pkm.Species, pkm.AltForm);
var baseSpecies = entry.BaseSpecies;
var baseForm = entry.BaseSpeciesForm;
var egg = MoveEgg.GetEggMoves(pkm, baseSpecies, baseForm, GameVersion.SW);
return egg.Contains(move);
}
private static void ParseMovesByGeneration12(PKM pkm, CheckMoveResult[] res, int[] moves, int gen, LegalInfo info, LearnInfo learnInfo)
{
// Mark the gen 1 exclusive moves as illegal because the pokemon also have Non tradeback egg moves.

View file

@ -352,6 +352,8 @@ namespace PKHeX.Core
public static string LMoveNincada { get; set; } = "Only one Ninjask move allowed.";
public static string LMoveNincadaEvo { get; set; } = "Learned by evolving Nincada into Ninjask.";
public static string LMoveNincadaEvoF_0 { get; set; } = "Learned by evolving Nincada into Ninjask in Generation {0}.";
public static string LMoveSourceShared { get; set; } = "Shared Non-Relearn Move.";
public static string LMoveSourceSharedF { get; set; } = "Shared Non-Relearn Move in Generation {0}.";
public static string LMoveRelearnDexNav { get; set; } = "Not an expected DexNav move.";
public static string LMoveRelearnEgg { get; set; } = "Base Egg move.";

View file

@ -18,6 +18,7 @@
SpecialEgg,
ShedinjaEvo,
Sketch,
Shared,
}
/// <summary>

View file

@ -101,7 +101,11 @@ namespace PKHeX.Core
}
}
public int BaseSpecies { get => BitConverter.ToUInt16(Data, 0x4C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); }
public int Species { get => BitConverter.ToUInt16(Data, 0x4C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); }
public int BaseSpecies { get => BitConverter.ToUInt16(Data, 0x56); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x56); }
public int BaseSpeciesForm { get => BitConverter.ToUInt16(Data, 0x58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x58); }
public int Flags { get => BitConverter.ToUInt16(Data, 0x58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } // not sure
public int PokeDexIndex { get => BitConverter.ToUInt16(Data, 0x5C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); }
}
}