2017-09-02 06:15:57 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
|
|
|
|
internal class EggInfoSource
|
|
|
|
|
{
|
|
|
|
|
public EggInfoSource(PKM pkm, IEnumerable<int> specialMoves, EncounterEgg e)
|
|
|
|
|
{
|
|
|
|
|
// Eggs with special moves cannot inherit levelup moves as the current moves are predefined.
|
|
|
|
|
Special = specialMoves.Where(m => m != 0).ToList();
|
|
|
|
|
bool notSpecial = Special.Count == 0;
|
|
|
|
|
AllowInherited = notSpecial && !pkm.WasGiftEgg && pkm.Species != 489 && pkm.Species != 490;
|
|
|
|
|
|
|
|
|
|
// Level up moves can only be inherited if ditto is not the mother.
|
2017-09-15 01:52:31 +00:00
|
|
|
|
bool AllowLevelUp = Legal.GetCanInheritMoves(pkm, e);
|
2018-01-31 04:36:22 +00:00
|
|
|
|
Base = Legal.GetBaseEggMoves(pkm, e.Species, e.Game, e.Level).ToList();
|
2017-09-02 06:15:57 +00:00
|
|
|
|
|
2017-10-20 04:20:47 +00:00
|
|
|
|
Egg = Legal.GetEggMoves(pkm, e.Species, pkm.AltForm, e.Game).ToList();
|
2017-09-02 06:15:57 +00:00
|
|
|
|
LevelUp = AllowLevelUp
|
|
|
|
|
? Legal.GetBaseEggMoves(pkm, e.Species, e.Game, 100).Where(x => !Base.Contains(x)).ToList()
|
|
|
|
|
: new List<int>();
|
|
|
|
|
Tutor = e.Game == GameVersion.C
|
|
|
|
|
? Legal.GetTutorMoves(pkm, pkm.Species, pkm.AltForm, false, 2).ToList()
|
|
|
|
|
: new List<int>();
|
|
|
|
|
|
|
|
|
|
// Only TM/HM moves from the source game of the egg, not any other games from the same generation
|
|
|
|
|
TMHM = Legal.GetTMHM(pkm, pkm.Species, pkm.AltForm, pkm.GenNumber, e.Game, false).ToList();
|
|
|
|
|
|
|
|
|
|
// Non-Base moves that can magically appear in the regular movepool
|
|
|
|
|
bool volt = notSpecial && (pkm.GenNumber > 3 || e.Game == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
|
|
|
|
|
if (volt)
|
|
|
|
|
Egg.Add(344); // Volt Tackle
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool AllowInherited { get; }
|
|
|
|
|
public List<int> Base { get; }
|
|
|
|
|
public List<int> Special { get; }
|
|
|
|
|
public List<int> Egg { get; }
|
|
|
|
|
public List<int> Tutor { get; }
|
|
|
|
|
public List<int> TMHM { get; }
|
|
|
|
|
public List<int> LevelUp { get; }
|
2017-09-04 20:48:10 +00:00
|
|
|
|
|
|
|
|
|
public bool IsInherited(int m) => !Base.Contains(m) || Special.Contains(m) ||
|
|
|
|
|
Egg.Contains(m) || LevelUp.Contains(m) ||
|
|
|
|
|
TMHM.Contains(m) || Tutor.Contains(m);
|
2017-09-02 06:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|