mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Revise pichu volt tackle egg handling
Clean up ParseMovesWasEggPreRelearn as only EncounterEgg call into it, and no EncounterEgg has a special moves interface implemented.
This commit is contained in:
parent
63580a2835
commit
2874f6fc69
8 changed files with 11 additions and 18 deletions
|
@ -20,6 +20,8 @@ namespace PKHeX.Core
|
|||
public GameVersion Version { get; }
|
||||
public bool IsShiny => false;
|
||||
|
||||
public bool CanHaveVoltTackle => Species is (int)Core.Species.Pichu && (Generation > 3 || Version is GameVersion.E);
|
||||
|
||||
public EncounterEgg(int species, int form, int level, int gen, GameVersion game)
|
||||
{
|
||||
Species = species;
|
||||
|
|
|
@ -261,7 +261,7 @@ namespace PKHeX.Core
|
|||
IEnumerable<int> em = MoveEgg.GetEggMoves(pk.PersonalInfo, egg.Species, egg.Form, egg.Version, egg.Generation);
|
||||
if (egg.Generation <= 2)
|
||||
em = em.Concat(MoveLevelUp.GetEncounterMoves(egg.Species, 0, egg.Level, egg.Version));
|
||||
else if (Legal.LightBall.Contains(egg.Species) && needs.Contains((int)Move.VoltTackle))
|
||||
else if (egg.Species is (int)Species.Pichu && needs.Contains((int)Move.VoltTackle) && (egg.Generation > 3 || version is GameVersion.E))
|
||||
em = em.Concat(new[] { (int)Move.VoltTackle });
|
||||
|
||||
if (!needs.Except(em).Any())
|
||||
|
|
|
@ -67,26 +67,23 @@ namespace PKHeX.Core
|
|||
|
||||
private static CheckMoveResult[] ParseMovesWasEggPreRelearn(PKM pkm, IReadOnlyList<int> currentMoves, LegalInfo info, EncounterEgg e)
|
||||
{
|
||||
var EventEggMoves = GetSpecialMoves(info.EncounterMatch);
|
||||
bool notEvent = EventEggMoves.Count == 0;
|
||||
// Level up moves could not be inherited if Ditto is parent,
|
||||
// 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 && Breeding.MixedGenderBreeding.Contains(e.Species));
|
||||
var AllowLevelUp = !pi.Genderless && !(pi.OnlyMale && Breeding.MixedGenderBreeding.Contains(e.Species));
|
||||
int BaseLevel = AllowLevelUp ? 100 : e.LevelMin;
|
||||
var LevelUp = MoveList.GetBaseEggMoves(pkm, e.Species, e.Form, e.Version, BaseLevel);
|
||||
|
||||
var TradebackPreevo = pkm.Format == 2 && info.EncounterMatch.Species > 151;
|
||||
var TradebackPreevo = pkm.Format == 2 && e.Species > 151;
|
||||
var NonTradebackLvlMoves = TradebackPreevo
|
||||
? MoveList.GetExclusivePreEvolutionMoves(pkm, info.EncounterMatch.Species, info.EvoChainsAllGens[2], 2, e.Version).Where(m => m > Legal.MaxMoveID_1).ToArray()
|
||||
? MoveList.GetExclusivePreEvolutionMoves(pkm, e.Species, info.EvoChainsAllGens[2], 2, e.Version).Where(m => m > Legal.MaxMoveID_1).ToArray()
|
||||
: Array.Empty<int>();
|
||||
|
||||
var Egg = MoveEgg.GetEggMoves(pkm.PersonalInfo, e.Species, e.Form, e.Version, e.Generation);
|
||||
if (info.Generation < 3 && pkm.Format >= 7 && pkm.VC1)
|
||||
Egg = Array.FindAll(Egg, m => m <= Legal.MaxMoveID_1);
|
||||
|
||||
bool volt = (info.Generation > 3 || e.Version == GameVersion.E) && Legal.LightBall.Contains(pkm.Species);
|
||||
var specialMoves = volt && notEvent ? new[] { (int)Move.VoltTackle } : Array.Empty<int>(); // Volt Tackle for bred Pichu line
|
||||
var specialMoves = e.CanHaveVoltTackle ? new[] { (int)Move.VoltTackle } : Array.Empty<int>(); // Volt Tackle for bred Pichu line
|
||||
|
||||
var source = new MoveParseSource
|
||||
{
|
||||
|
@ -96,7 +93,6 @@ namespace PKHeX.Core
|
|||
|
||||
EggLevelUpSource = LevelUp,
|
||||
EggMoveSource = Egg,
|
||||
EggEventSource = EventEggMoves,
|
||||
};
|
||||
return ParseMoves(pkm, source, info);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace PKHeX.Core
|
|||
var egg = Legal.EggMovesRS[species].Moves;
|
||||
|
||||
var value = new BreedInfo<EggSource34>(count, learnset, moves, level);
|
||||
if (version == GameVersion.E && moves[count - 1] is (int)Move.VoltTackle)
|
||||
if (species is (int)Species.Pichu && moves[count - 1] is (int)Move.VoltTackle && version == GameVersion.E)
|
||||
value.Actual[--count] = VoltTackle;
|
||||
|
||||
if (count == 0)
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace PKHeX.Core
|
|||
var egg = (version is HG or SS ? Legal.EggMovesHGSS : Legal.EggMovesDPPt)[species].Moves;
|
||||
|
||||
var value = new BreedInfo<EggSource34>(count, learnset, moves, level);
|
||||
if (moves[count - 1] is (int)Move.VoltTackle)
|
||||
if (species is (int)Species.Pichu && moves[count - 1] is (int)Move.VoltTackle)
|
||||
value.Actual[--count] = VoltTackle;
|
||||
|
||||
if (count == 0)
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace PKHeX.Core
|
|||
var egg = Legal.EggMovesBW[species].Moves;
|
||||
|
||||
var value = new BreedInfo<EggSource5>(count, learnset, moves, level);
|
||||
if (moves[count - 1] is (int)Move.VoltTackle)
|
||||
if (species is (int)Species.Pichu && moves[count - 1] is (int)Move.VoltTackle)
|
||||
value.Actual[--count] = VoltTackle;
|
||||
|
||||
if (count == 0)
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace PKHeX.Core
|
|||
var egg = MoveEgg.GetEggMoves(generation, species, form, version);
|
||||
|
||||
var value = new BreedInfo<EggSource6>(count, learnset, moves, level);
|
||||
if (moves[count - 1] is (int)Move.VoltTackle)
|
||||
if (species is (int)Species.Pichu && moves[count - 1] is (int)Move.VoltTackle)
|
||||
value.Actual[--count] = VoltTackle;
|
||||
|
||||
if (count == 0)
|
||||
|
|
|
@ -7,11 +7,6 @@ namespace PKHeX.Core
|
|||
{
|
||||
public static partial class Legal
|
||||
{
|
||||
/// <summary>
|
||||
/// Species that trigger Light Ball yielding Volt Tackle
|
||||
/// </summary>
|
||||
public static readonly HashSet<int> LightBall = new() {(int) Pikachu, (int) Raichu, (int) Pichu};
|
||||
|
||||
/// <summary>
|
||||
/// Species that can change between their forms and get access to form-specific moves.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue