Various legallity checks added and fixed (#1049)

* Fix required move count for Butterfree and Gyarados

* Ruby Sapphire Southern Island legendaries do not have fateful encounter

* Added missing event egg for generation 3
Filter generation 3 event egg by game origin, an egg pokemon remains with the original game no matter in what game it hached

* Filter the event egg static table better than individual pokemon from the table

* Generation 4 do not allow to EV train at level 100, for level 100 encounter pokemon (like events) EV only can be trained with vitamins, with a maximum value of 100

* Fix incorrect string

* Generation 2 eggs can not be infected with Pokérus

* Fix gyarados count slots
This commit is contained in:
javierhimura 2017-04-10 14:11:07 +02:00 committed by Kurt
parent ea65d39f69
commit d6c6eb1063
6 changed files with 77 additions and 36 deletions

View File

@ -376,6 +376,12 @@ private void verifyEVs()
AddLine(Severity.Invalid, V26, CheckIdentifier.EVs);
else if (evs.All(ev => pkm.EVs[0] == ev) && evs[0] != 0)
AddLine(Severity.Fishy, V27, CheckIdentifier.EVs);
if (pkm.Format == 4 && pkm.Gen4 && (EncounterMatch as IEncounterable)?.LevelMin == 100)
{
// Generation 4 do not allow to EV train at level 100, for level 100 encounter pokemon (like events) EV only can be trained with vitamins, with a maximum value of 100
if (evs.Any(ev => ev > 100))
AddLine(Severity.Invalid, V367, CheckIdentifier.EVs);
}
}
private void verifyIVs()
{
@ -2220,6 +2226,8 @@ private void verifyMisc()
{ AddLine(Severity.Invalid, V319, CheckIdentifier.Misc); return; }
if (pkm.CNTs.Any(stat => stat > 0))
{ AddLine(Severity.Invalid, V320, CheckIdentifier.Misc); return; }
if( pkm.Format == 2 && (pkm.PKRS_Cured || pkm.PKRS_Infected))
{ AddLine(Severity.Invalid, V368, CheckIdentifier.Misc); return; }
}
if (Encounter.Valid)

View File

@ -1046,7 +1046,8 @@ internal static IEnumerable<int> getEggMoves(PKM pkm, int skipOption, GameVersio
internal static IEnumerable<EncounterStatic> getG3SpecialEggEncounter(PKM pkm)
{
IEnumerable<DexLevel> dl = getValidPreEvolutions(pkm,MaxSpeciesID_3);
var table = EventEgg_G3.Where(e => dl.Any(d => d.Species == e.Species));
var sttctable = pkm.E ? EventEgg_G3_Common : pkm.FRLG ? EventEgg_FRLG : EventEgg_RS;
var table = sttctable.Where(e => dl.Any(d => d.Species == e.Species));
foreach (EncounterStatic e in table)
{
if (pkm.Moves.All(m => !e.Moves.Contains(m))) // No special move
@ -1394,7 +1395,7 @@ private static int getRequiredMoveSlotsRegular(PKM pk, int[] moves, List<int>[]
// Example: a level 7 caterpie evolved into metapod will have 3 learned moves, a captured metapod will have only 1 move
if (010 == species || species == 011)
{
if (species == 11 && !moves.Any(m => G1MetapodMoves.Contains(m))) // Captured as Metapod without Caterpie moves
if (!moves.Any(m => G1MetapodMoves.Contains(m))) // Captured as Metapod without Caterpie moves
return initialmoves.Union(learn[1]).Distinct().Count(lm => lm != 0 && !G1MetapodMoves.Contains(lm));
}
if (species == 014 || species == 015)
@ -1423,7 +1424,6 @@ private static bool getRequiredMoveCountSpecies3(int species, int level, int[] m
case 093:
case 094: return level < 29 && !moves.Contains(095); // Haunter/Gengar without Hypnosis
case 110: return level < 39 && !moves.Contains(108); // Weezing without Smoke Screen
case 130: return level < 32; // Wild Gyarados from yellow do not learn splash, evolved gyarados do not learn tackle
}
return false;
}
@ -1466,6 +1466,8 @@ private static int getRequiredMoveCountDecrement(PKM pk, int[] moves, List<int>[
if (!moves.Contains(3)) // Yellow Lvl 12 and Initial Red/Blue Double Slap
usedslots--;
}
if (pk.Species == 130 && pk.CurrentLevel < 32) // Wild Gyarados from yellow do not learn splash, evolved gyarados do not learn tackle
usedslots--;
if (pk.Species == 127 && pk.CurrentLevel >= 21 && !moves.Contains(20)) // Pinsir Yellow Bind
usedslots--;
return usedslots;

View File

@ -358,6 +358,8 @@ public static class LegalityCheckStrings
public static string V363 {get; set;} = "Incompatible moves. Learned at the same level in Red/Blue and Yellow.";
public static string V365 {get; set;} = "Incompatible evolution moves. {0} Move learned at a lower level than other {1} moves.";
public static string V366 {get; set;} = "Incompatible evolution moves. {1} Move learned at a higher level than other {0} moves.";
public static string V367 {get; set;} = "Individual EV for a level 100 encounter in generation 4 cannot be greater than 100.";
public static string V368 {get; set;} = "Eggs can not be infected with Pokérus."; // Invalid
#endregion
}

View File

@ -210,37 +210,63 @@ public static partial class Legal
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49,
};
internal static readonly EncounterStatic[] Encounter_Box =
internal static readonly EncounterStatic[] EventEgg_FRLG_Exclusive = new[]
{
new EncounterStatic { Species = 333, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{206} }, // Swablu Egg with False Swipe
new EncounterStatic { Species = 263, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{245} }, // Zigzagoon Egg with Extreme Speed
new EncounterStatic { Species = 300, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{6} }, // Skitty Egg with Pay Day
new EncounterStatic { Species = 172, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{57} }, // Pichu Egg with Surf
};
internal static readonly EncounterStatic[] EventEgg_G3 = Encounter_Box.Concat(new[]
{
// PokePark Eggs
new EncounterStatic { Species = 054, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{300} }, // Psyduck with Mud Sport
new EncounterStatic { Species = 172, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{266} }, // Pichu with Follow me
new EncounterStatic { Species = 174, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{321} }, // Igglybuff with Tickle
new EncounterStatic { Species = 222, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{300} }, // Corsola with Mud Sport
new EncounterStatic { Species = 276, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{294} }, // Taillow with Feather Dance
new EncounterStatic { Species = 283, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{300} }, // Surskit with Mud Sport
new EncounterStatic { Species = 293, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{298} }, // Whismur with Teeter Dance
new EncounterStatic { Species = 300, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{205} }, // Skitty with Rollout
new EncounterStatic { Species = 311, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{346} }, // Plusle with Water Sport
new EncounterStatic { Species = 312, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{300} }, // Minun with Mud Sport
new EncounterStatic { Species = 325, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{253} }, // Spoink with Uproar
new EncounterStatic { Species = 327, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{047} }, // Spinda with Sing
new EncounterStatic { Species = 331, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{227} }, // Cacnea with Encore
new EncounterStatic { Species = 341, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{346} }, // Corphish with Water Sport
new EncounterStatic { Species = 360, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{321} }, // Wynaut with Tickle
// Egg Pokémon Present Eggs
new EncounterStatic { Species = 043, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{073} }, // Oddish with Leech Seed
new EncounterStatic { Species = 052, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{080} }, // Meowth with Petal Dance
new EncounterStatic { Species = 060, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{186} }, // Poliwag with Sweet Kiss
new EncounterStatic { Species = 069, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{298} }, // Bellsprout with Teeter Dance
}).ToArray();
// Wish Egg
new EncounterStatic { Species = 083, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{273} }, // Farfetch'd with Wish
new EncounterStatic { Species = 096, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{273} }, // Drowzee with Wish
new EncounterStatic { Species = 102, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{273} }, // Exeggcute with Wish
new EncounterStatic { Species = 108, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{273} }, // Lickitung with Wish
new EncounterStatic { Species = 113, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{273} }, // Chansey with Wish
new EncounterStatic { Species = 115, Level = 05, EggLocation = 255, Version = GameVersion.FRLG, Moves = new[]{273} }, // Kangaskhan with Wish
};
internal static readonly EncounterStatic[] EventEgg_RS_Exclusive = new[]
{
// Pokémon Center 5th Anniversary Eggs
new EncounterStatic { Species = 172, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{298} }, // Pichu with Teeter Dance
new EncounterStatic { Species = 172, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{273} }, // Pichu with Wish
new EncounterStatic { Species = 280, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{204} }, // Ralts with Charm
new EncounterStatic { Species = 280, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{273} }, // Ralts with Wish
new EncounterStatic { Species = 359, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{180} }, // Absol with Spite
new EncounterStatic { Species = 359, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{273} }, // Absol with Wish
new EncounterStatic { Species = 371, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{334} }, // Bagon with Iron Defense
new EncounterStatic { Species = 371, Level = 05, EggLocation = 255, Version = GameVersion.RS, Moves = new[]{273} }, // Bagon with Wish
};
internal static readonly EncounterStatic[] EventEgg_G3_Common = new[]
{
// Pokémon Box
new EncounterStatic { Species = 333, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{206} }, // Swablu Egg with False Swipe
new EncounterStatic { Species = 263, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{245} }, // Zigzagoon Egg with Extreme Speed
new EncounterStatic { Species = 300, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{6} }, // Skitty Egg with Pay Day
new EncounterStatic { Species = 172, Level = 05, EggLocation = 255, Version = GameVersion.RSBOX, Moves = new[]{57} }, // Pichu Egg with Surf
// PokePark Eggs
new EncounterStatic { Species = 054, Level = 05, EggLocation = 255, Moves = new[]{300} }, // Psyduck with Mud Sport
new EncounterStatic { Species = 172, Level = 05, EggLocation = 255, Moves = new[]{266} }, // Pichu with Follow me
new EncounterStatic { Species = 174, Level = 05, EggLocation = 255, Moves = new[]{321} }, // Igglybuff with Tickle
new EncounterStatic { Species = 222, Level = 05, EggLocation = 255, Moves = new[]{300} }, // Corsola with Mud Sport
new EncounterStatic { Species = 276, Level = 05, EggLocation = 255, Moves = new[]{294} }, // Taillow with Feather Dance
new EncounterStatic { Species = 283, Level = 05, EggLocation = 255, Moves = new[]{300} }, // Surskit with Mud Sport
new EncounterStatic { Species = 293, Level = 05, EggLocation = 255, Moves = new[]{298} }, // Whismur with Teeter Dance
new EncounterStatic { Species = 300, Level = 05, EggLocation = 255, Moves = new[]{205} }, // Skitty with Rollout
new EncounterStatic { Species = 311, Level = 05, EggLocation = 255, Moves = new[]{346} }, // Plusle with Water Sport
new EncounterStatic { Species = 312, Level = 05, EggLocation = 255, Moves = new[]{300} }, // Minun with Mud Sport
new EncounterStatic { Species = 325, Level = 05, EggLocation = 255, Moves = new[]{253} }, // Spoink with Uproar
new EncounterStatic { Species = 327, Level = 05, EggLocation = 255, Moves = new[]{047} }, // Spinda with Sing
new EncounterStatic { Species = 331, Level = 05, EggLocation = 255, Moves = new[]{227} }, // Cacnea with Encore
new EncounterStatic { Species = 341, Level = 05, EggLocation = 255, Moves = new[]{346} }, // Corphish with Water Sport
new EncounterStatic { Species = 360, Level = 05, EggLocation = 255, Moves = new[]{321} }, // Wynaut with Tickle
};
internal static readonly EncounterStatic[] EventEgg_FRLG = EventEgg_FRLG_Exclusive.Concat(EventEgg_G3_Common).ToArray();
internal static readonly EncounterStatic[] EventEgg_RS = EventEgg_RS_Exclusive.Concat(EventEgg_G3_Common).ToArray();
internal static readonly EncounterStatic[] Encounter_RSE_Roam =
{
@ -279,9 +305,9 @@ public static partial class Legal
new EncounterStatic { Species = 377, Level = 40, Location = 082, }, // Regirock @ Desert Ruins
new EncounterStatic { Species = 378, Level = 40, Location = 081, }, // Regice @ Island Cave
new EncounterStatic { Species = 379, Level = 40, Location = 083, }, // Registeel @ Ancient Tomb
new EncounterStatic { Species = 380, Level = 50, Location = 073, Version = GameVersion.R, Fateful = true }, // Latias @ Southern Island
new EncounterStatic { Species = 380, Level = 50, Location = 073, Version = GameVersion.R }, // Latias @ Southern Island
new EncounterStatic { Species = 380, Level = 50, Location = 073, Version = GameVersion.E, Fateful = true }, // Latias @ Southern Island
new EncounterStatic { Species = 381, Level = 50, Location = 073, Version = GameVersion.S, Fateful = true }, // Latios @ Southern Island
new EncounterStatic { Species = 381, Level = 50, Location = 073, Version = GameVersion.S }, // Latios @ Southern Island
new EncounterStatic { Species = 381, Level = 50, Location = 073, Version = GameVersion.E, Fateful = true }, // Latios @ Southern Island
new EncounterStatic { Species = 382, Level = 45, Location = 072, Version = GameVersion.S, }, // Kyogre @ Cave of Origin
new EncounterStatic { Species = 382, Level = 70, Location = 203, Version = GameVersion.E, }, // Kyogre @ Marine Cave
@ -296,7 +322,6 @@ public static partial class Legal
new EncounterStatic { Species = 386, Level = 30, Location = 200, Version = GameVersion.E, Fateful = true, Form = 3 }, // Deoxys @ Birth Island
};
internal static readonly EncounterStatic[] Encounter_FRLG_Roam =
{
new EncounterStatic { Species = 243, Level = 50, Roaming = true, }, // Raikou
@ -355,8 +380,8 @@ public static partial class Legal
new EncounterStatic { Species = 386, Level = 30, Location = 187, Version = GameVersion.LG, Form = 2, Fateful = true }, // Deoxys @ Birth Island
};
internal static readonly EncounterStatic[] Encounter_RSE = Encounter_RSE_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_RSE)).Concat(Encounter_RSE_Regular).Concat(EventEgg_G3).ToArray();
internal static readonly EncounterStatic[] Encounter_FRLG = Encounter_FRLG_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_FRLG)).Concat(Encounter_FRLG_Stationary).Concat(EventEgg_G3).ToArray();
internal static readonly EncounterStatic[] Encounter_RSE = Encounter_RSE_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_RSE)).Concat(Encounter_RSE_Regular).Concat(EventEgg_RS).ToArray();
internal static readonly EncounterStatic[] Encounter_FRLG = Encounter_FRLG_Roam.SelectMany(e => e.Clone(Roaming_MetLocation_FRLG)).Concat(Encounter_FRLG_Stationary).Concat(EventEgg_FRLG).ToArray();
private static readonly int[] TradeContest_Cool = {30, 05, 05, 05, 05, 10};
private static readonly int[] TradeContest_Beauty = {05, 30, 05, 05, 05, 10};

View File

@ -283,7 +283,7 @@ V339 = Generation {0} HM. Should have been removed before transfered to generati
V340 = Not an expected egg move.
V341 = Egg Move.Not expected in an event egg.
V342 = Event egg move missing.
V343 = Expected the following Moves: { 0}
V343 = Expected the following Moves: {0}
V347 = Inherited move learned by Level-up.Not expected in an event egg.
V348 = Inherited tutor move. Not expected in an event egg.
V350 = Inherited TM/HM move. Not expected in an event egg.
@ -297,4 +297,6 @@ V359 = Unable to match a gift egg encounter from origin game.
V360 = Unable to match an event egg encounter from origin game.
V363 = Incompatible moves. Learned at the same level in Red/Blue and Yellow.
V365 = Incompatible evolution moves. {0} Move learned at a lower level than other {1} moves.
V366 = Incompatible evolution moves. {1} Move learned at a higher level than other {0} moves.
V366 = Incompatible evolution moves. {1} Move learned at a higher level than other {0} moves.
V367 = Individual EV for a level 100 encounter in generation 4 cannot be greater than 100.public static string
V368 = Eggs can not be infected with Pokérus.

View File

@ -297,4 +297,6 @@ V359 = 无法在来源版本中匹配到相应的礼物蛋。
V360 = 无法在来源版本中匹配到相应的配信蛋。
V363 = 不共存招式。 在四色中同一等级的升级招式。
V365 = 不共存进化招式。招式 {0} 比其他招式 {1} 习得等级低。
V366 = 不共存进化招式。招式 {1} 比其他招式 {0} 习得等级高。
V366 = 不共存进化招式。招式 {1} 比其他招式 {0} 习得等级高。
V367 = Individual EV for a level 100 encounter in generation 4 cannot be greater than 100.
V368 = Eggs can not be infected with Pokérus.