Fix for mix between event egg moves and base egg moves

This commit is contained in:
javierhimura 2017-03-31 13:15:58 +02:00
parent 4aa6accc7d
commit 780aad4af8

View file

@ -2484,6 +2484,7 @@ namespace PKHeX.Core
CheckResult[] res = new CheckResult[4];
var Gen1MovesLearned = new List<int>();
var EggMovesLearned = new List<int>();
var BaseEggMovesLearned = new List<int>();
var EventEggMovesLearned = new List<int>();
var IsGen2Pkm = pkm.Format == 2 || pkm.VC2;
// Check none moves and relearn moves before generation moves
@ -2555,7 +2556,7 @@ namespace PKHeX.Core
}
else
res[m] = new CheckResult(Severity.Valid, V345, CheckIdentifier.Move);
EggMovesLearned.Add(m);
BaseEggMovesLearned.Add(m);
}
}
@ -2596,10 +2597,11 @@ namespace PKHeX.Core
// A pokemon could have normal egg moves and regular egg moves
// Only if all regular egg moves are event egg moves or all event egg moves are regular egg moves
if (EggMovesLearned.Any() && EventEggMovesLearned.Any())
var RegularEggMovesLearned = EggMovesLearned.Union(BaseEggMovesLearned);
if (RegularEggMovesLearned.Any() && EventEggMovesLearned.Any())
{
// Moves that are egg moves or event egg moves but not both
var IncompatibleEggMoves = EggMovesLearned.Except(EventEggMovesLearned).Union(EventEggMovesLearned.Except(EggMovesLearned)).ToList();
var IncompatibleEggMoves = RegularEggMovesLearned.Except(EventEggMovesLearned).Union(EventEggMovesLearned.Except(RegularEggMovesLearned)).ToList();
if (IncompatibleEggMoves.Any())
{
foreach(int m in IncompatibleEggMoves)
@ -2607,16 +2609,13 @@ namespace PKHeX.Core
if (EventEggMovesLearned.Contains(m) && !EggMovesLearned.Contains(m))
res[m] = new CheckResult(Severity.Invalid, V337, CheckIdentifier.Move);
else if (!EventEggMovesLearned.Contains(m) && EggMovesLearned.Contains(m))
{
if (egg.Contains(moves[m]))
res[m] = new CheckResult(Severity.Invalid, V336, CheckIdentifier.Move);
else // base egg move
else if (!EventEggMovesLearned.Contains(m) && BaseEggMovesLearned.Contains(m))
res[m] = new CheckResult(Severity.Invalid, V358, CheckIdentifier.Move);
}
}
}
}
}
if (3 <= gen && gen <= 4 && pkm.Format > gen)
{