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
|
|
|
|
|
{
|
2020-09-07 20:51:13 +00:00
|
|
|
|
internal sealed class EggInfoSource
|
2017-09-02 06:15:57 +00:00
|
|
|
|
{
|
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.
|
2020-12-08 04:54:55 +00:00
|
|
|
|
bool AllowLevelUp = Breeding.GetCanInheritMoves(e.Species);
|
2020-06-21 00:44:05 +00:00
|
|
|
|
Base = MoveList.GetBaseEggMoves(pkm, e.Species, e.Form, e.Version, e.Level);
|
2017-09-02 06:15:57 +00:00
|
|
|
|
|
2021-01-01 23:01:22 +00:00
|
|
|
|
Egg = MoveEgg.GetEggMoves(pkm.PersonalInfo, e.Species, e.Form, e.Version, e.Generation);
|
2017-09-02 06:15:57 +00:00
|
|
|
|
LevelUp = AllowLevelUp
|
2020-06-21 00:44:05 +00:00
|
|
|
|
? MoveList.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-12-11 04:42:30 +00:00
|
|
|
|
TMHM = MoveTechnicalMachine.GetTMHM(pkm, pkm.Species, pkm.Form, 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
|
|
|
|
}
|
|
|
|
|
}
|