mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-13 13:45:34 -05:00
Simplify and enhance expression
cache fetch of PersonalInfo (avoid re-fetching) If event, the pkm wasn't bred with ditto If genderless or male-only (except nido/volb), assume ditto
This commit is contained in:
@@ -97,9 +97,11 @@ private static CheckMoveResult[] ParseMovesIsEggPreRelearn(PKM pkm, int[] Moves,
|
||||
private static CheckMoveResult[] ParseMovesWasEggPreRelearn(PKM pkm, int[] Moves, LegalInfo info, EncounterEgg e)
|
||||
{
|
||||
var EventEggMoves = GetSpecialMoves(info.EncounterMatch);
|
||||
bool notEvent = EventEggMoves.Length == 0;
|
||||
// Level up moves could not be inherited if Ditto is parent,
|
||||
// that means genderless species and male only species except Nidoran and Volbeat (they breed with female nidoran and illumise) could not have level up moves as an egg
|
||||
var AllowLevelUp = (pkm.PersonalInfo.Gender > 0 && pkm.PersonalInfo.Gender < 255) || Legal.MixedGenderBreeding.Contains(e.Species);
|
||||
// that means genderless species and male only species (except Nidoran-M and Volbeat; they breed with Nidoran-F and Illumise) could not have level up moves as an egg
|
||||
var pi = pkm.PersonalInfo;
|
||||
var AllowLevelUp = notEvent && !pi.Genderless && !(pi.OnlyMale && Legal.MixedGenderBreeding.Contains(e.Species));
|
||||
int BaseLevel = AllowLevelUp ? 100 : e.LevelMin;
|
||||
var LevelUp = Legal.GetBaseEggMoves(pkm, e.Species, e.Version, BaseLevel);
|
||||
|
||||
@@ -113,7 +115,7 @@ private static CheckMoveResult[] ParseMovesWasEggPreRelearn(PKM pkm, int[] Moves
|
||||
Egg = Egg.Where(m => m <= Legal.MaxMoveID_1).ToArray();
|
||||
|
||||
bool volt = (info.Generation > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
|
||||
var Special = volt && EventEggMoves.Length == 0 ? new[] { 344 } : Array.Empty<int>(); // Volt Tackle for bred Pichu line
|
||||
var Special = volt && notEvent ? new[] { 344 } : Array.Empty<int>(); // Volt Tackle for bred Pichu line
|
||||
|
||||
var source = new MoveParseSource
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user