Reject moves introduced by gsc in pk1/vc1 cases

Closes #2005
(no tutor moves are new moves, just beam moves)
This commit is contained in:
Kurt 2018-06-14 18:52:43 -07:00
parent 7a5ce5aa78
commit e8d5252b8c
2 changed files with 15 additions and 6 deletions

View file

@ -42,7 +42,8 @@ namespace PKHeX.Core
switch (generation) switch (generation)
{ {
case 1: return GetIsLevelUp1(species, move, lvl, minlvlG1, version); case 1: return GetIsLevelUp1(species, move, lvl, minlvlG1, version);
case 2: return GetIsLevelUp2(species, move, lvl, minlvlG2, pkm.Korean, version); case 2: if (move > MaxMoveID_1 && pkm.LearnMovesNew2Disallowed()) return LearnNONE;
return GetIsLevelUp2(species, move, lvl, minlvlG2, pkm.Korean, version);
case 3: return GetIsLevelUp3(species, move, lvl, form, version); case 3: return GetIsLevelUp3(species, move, lvl, form, version);
case 4: return GetIsLevelUp4(species, move, lvl, form, version); case 4: return GetIsLevelUp4(species, move, lvl, form, version);
case 5: return GetIsLevelUp5(species, move, lvl, form, version); case 5: return GetIsLevelUp5(species, move, lvl, form, version);
@ -243,7 +244,7 @@ namespace PKHeX.Core
switch (Generation) switch (Generation)
{ {
case 1: return GetMovesLevelUp1(species, lvl, minlvlG1, version); case 1: return GetMovesLevelUp1(species, lvl, minlvlG1, version);
case 2: return GetMovesLevelUp2(species, lvl, minlvlG2, pkm.Korean, pkm.Format, version); case 2: return GetMovesLevelUp2(species, lvl, minlvlG2, pkm.Korean, pkm.LearnMovesNew2Disallowed(), version);
case 3: return GetMovesLevelUp3(species, form, lvl, version); case 3: return GetMovesLevelUp3(species, form, lvl, version);
case 4: return GetMovesLevelUp4(species, form, lvl, version); case 4: return GetMovesLevelUp4(species, form, lvl, version);
case 5: return GetMovesLevelUp5(species, form, lvl, version); case 5: return GetMovesLevelUp5(species, form, lvl, version);
@ -253,14 +254,16 @@ namespace PKHeX.Core
return null; return null;
} }
private static bool LearnMovesNew2Disallowed(this PKM pkm) => pkm.Format == 1 || (pkm.Format >= 7 && pkm.VC);
internal static List<int> GetMovesLevelUp1(int species, int max, int min, GameVersion ver = Any) internal static List<int> GetMovesLevelUp1(int species, int max, int min, GameVersion ver = Any)
{ {
return AddMovesLevelUp1(new List<int>(), ver, species, max, min); return AddMovesLevelUp1(new List<int>(), ver, species, max, min);
} }
private static List<int> GetMovesLevelUp2(int species, int max, int min, bool korean, int format, GameVersion ver = Any) private static List<int> GetMovesLevelUp2(int species, int max, int min, bool korean, bool removeNewGSCMoves, GameVersion ver = Any)
{ {
var moves = AddMovesLevelUp2(new List<int>(), ver, species, max, min, korean); var moves = AddMovesLevelUp2(new List<int>(), ver, species, max, min, korean);
if (format == 1) if (removeNewGSCMoves)
moves.RemoveAll(m => m > MaxMoveID_1); moves.RemoveAll(m => m > MaxMoveID_1);
return moves; return moves;
} }

View file

@ -10,7 +10,10 @@ namespace PKHeX.Core
switch (generation) switch (generation)
{ {
case 1: return GetIsMachine1(species, move); case 1: return GetIsMachine1(species, move);
case 2: return GetIsMachine2(species, move); case 2:
if (pkm.VC1 && move > Legal.MaxMoveID_1)
return Legal.NONE;
return GetIsMachine2(species, move);
case 3: return GetIsMachine3(species, move, pkm.Format, RemoveTransfer); case 3: return GetIsMachine3(species, move, pkm.Format, RemoveTransfer);
case 4: return GetIsMachine4(species, move, pkm.Format, RemoveTransfer, form); case 4: return GetIsMachine4(species, move, pkm.Format, RemoveTransfer, form);
case 5: return GetIsMachine5(species, move, form); case 5: return GetIsMachine5(species, move, form);
@ -175,7 +178,10 @@ namespace PKHeX.Core
switch (generation) switch (generation)
{ {
case 1: AddMachine1(r, species); break; case 1: AddMachine1(r, species); break;
case 2: AddMachine2(r, species); break; case 2: AddMachine2(r, species);
if (pkm.Format >= 7 && pkm.VC1)
r.RemoveAll(z => z > Legal.MaxMoveID_1);
break;
case 3: AddMachine3(r, species, pkm.Format, RemoveTransfer); break; case 3: AddMachine3(r, species, pkm.Format, RemoveTransfer); break;
case 4: AddMachine4(r, species, pkm.Format, RemoveTransfer, form); break; case 4: AddMachine4(r, species, pkm.Format, RemoveTransfer, form); break;
case 5: AddMachine5(r, species, form); break; case 5: AddMachine5(r, species, form); break;