2018-12-17 19:17:19 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2017-09-02 06:15:57 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
|
|
|
|
internal class EggInfoSource
|
|
|
|
|
{
|
2020-05-31 19:12:07 +00:00
|
|
|
|
public EggInfoSource(PKM pkm, EncounterEgg e)
|
2017-09-02 06:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
// Eggs with special moves cannot inherit levelup moves as the current moves are predefined.
|
2020-05-31 19:12:07 +00:00
|
|
|
|
AllowInherited = e.Species != 489 && e.Species != 490;
|
2017-09-02 06:15:57 +00:00
|
|
|
|
|
|
|
|
|
// Level up moves can only be inherited if ditto is not the mother.
|
2018-06-19 04:56:30 +00:00
|
|
|
|
bool AllowLevelUp = Legal.GetCanInheritMoves(e.Species);
|
2019-11-19 06:20:55 +00:00
|
|
|
|
Base = Legal.GetBaseEggMoves(pkm, e.Species, e.Form, e.Version, e.Level);
|
2017-09-02 06:15:57 +00:00
|
|
|
|
|
2019-11-19 06:20:55 +00:00
|
|
|
|
Egg = MoveEgg.GetEggMoves(pkm, e.Species, e.Form, e.Version);
|
2017-09-02 06:15:57 +00:00
|
|
|
|
LevelUp = AllowLevelUp
|
2019-11-19 06:20:55 +00:00
|
|
|
|
? Legal.GetBaseEggMoves(pkm, e.Species, e.Form, e.Version, 100).Except(Base).ToList()
|
2018-12-17 19:17:19 +00:00
|
|
|
|
: (IReadOnlyList<int>)Array.Empty<int>();
|
2018-03-31 04:37:01 +00:00
|
|
|
|
Tutor = e.Version == GameVersion.C
|
2020-05-31 19:12:07 +00:00
|
|
|
|
? MoveTutor.GetTutorMoves(pkm, e.Species, 0, false, 2).ToList()
|
2018-12-17 19:17:19 +00:00
|
|
|
|
: (IReadOnlyList<int>)Array.Empty<int>();
|
2017-09-02 06:15:57 +00:00
|
|
|
|
|
|
|
|
|
// Only TM/HM moves from the source game of the egg, not any other games from the same generation
|
2020-05-31 19:12:07 +00:00
|
|
|
|
TMHM = MoveTechnicalMachine.GetTMHM(pkm, pkm.Species, pkm.AltForm, e.Generation, e.Version).ToList();
|
2017-09-02 06:15:57 +00:00
|
|
|
|
|
|
|
|
|
// Non-Base moves that can magically appear in the regular movepool
|
2020-05-31 19:12:07 +00:00
|
|
|
|
bool volt = (e.Generation > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
|
2017-09-02 06:15:57 +00:00
|
|
|
|
if (volt)
|
2018-06-11 02:07:55 +00:00
|
|
|
|
{
|
|
|
|
|
Egg = Egg.ToList(); // array->list
|
2017-09-02 06:15:57 +00:00
|
|
|
|
Egg.Add(344); // Volt Tackle
|
2018-06-11 02:07:55 +00:00
|
|
|
|
}
|
2017-09-02 06:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool AllowInherited { get; }
|
2018-06-11 02:07:55 +00:00
|
|
|
|
public IReadOnlyList<int> Base { get; }
|
2018-06-09 23:04:06 +00:00
|
|
|
|
public IList<int> Egg { get; }
|
2018-06-11 02:07:55 +00:00
|
|
|
|
public IReadOnlyList<int> Tutor { get; }
|
|
|
|
|
public IReadOnlyList<int> TMHM { get; }
|
|
|
|
|
public IReadOnlyList<int> LevelUp { get; }
|
2017-09-04 20:48:10 +00:00
|
|
|
|
|
2018-06-11 03:26:59 +00:00
|
|
|
|
public bool IsInherited(int m)
|
|
|
|
|
{
|
2018-12-17 19:17:19 +00:00
|
|
|
|
if (m == 0)
|
|
|
|
|
return false;
|
2018-06-11 03:26:59 +00:00
|
|
|
|
if (Base.Contains(m))
|
|
|
|
|
return false;
|
2020-05-31 19:12:07 +00:00
|
|
|
|
return Egg.Contains(m) || LevelUp.Contains(m) || TMHM.Contains(m) || Tutor.Contains(m);
|
2018-06-11 03:26:59 +00:00
|
|
|
|
}
|
2017-09-02 06:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|