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
|
|
|
|
|
{
|
2018-12-17 19:17:19 +00:00
|
|
|
|
public EggInfoSource(PKM pkm, IReadOnlyList<int> specialMoves, EncounterEgg e)
|
2017-09-02 06:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
// Eggs with special moves cannot inherit levelup moves as the current moves are predefined.
|
2018-12-17 19:17:19 +00:00
|
|
|
|
Special = specialMoves;
|
2017-09-02 06:15:57 +00:00
|
|
|
|
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.
|
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
|
2018-06-10 21:45:25 +00:00
|
|
|
|
? MoveTutor.GetTutorMoves(pkm, pkm.Species, pkm.AltForm, 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
|
2018-06-10 21:45:25 +00:00
|
|
|
|
TMHM = MoveTechnicalMachine.GetTMHM(pkm, pkm.Species, pkm.AltForm, pkm.GenNumber, e.Version).ToList();
|
2017-09-02 06:15:57 +00:00
|
|
|
|
|
|
|
|
|
// Non-Base moves that can magically appear in the regular movepool
|
2018-03-31 04:37:01 +00:00
|
|
|
|
bool volt = notSpecial && (pkm.GenNumber > 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; }
|
|
|
|
|
public IReadOnlyList<int> Special { 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;
|
|
|
|
|
return Special.Contains(m) || Egg.Contains(m) || LevelUp.Contains(m) || TMHM.Contains(m) || Tutor.Contains(m);
|
|
|
|
|
}
|
2017-09-02 06:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|