2018-06-24 05:00:01 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-03-12 17:16:41 +00:00
|
|
|
|
using System.Linq;
|
2017-03-25 17:24:56 +00:00
|
|
|
|
using static PKHeX.Core.LegalityCheckStrings;
|
2016-03-11 04:36:32 +00:00
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.Core
|
2016-03-11 04:36:32 +00:00
|
|
|
|
{
|
2016-03-14 03:19:04 +00:00
|
|
|
|
public partial class LegalityAnalysis
|
|
|
|
|
{
|
2018-06-24 05:00:01 +00:00
|
|
|
|
private static readonly Verifier Language = new LanguageVerifier();
|
|
|
|
|
private static readonly Verifier Nickname = new NicknameVerifier();
|
|
|
|
|
private static readonly Verifier EffortValues = new EffortValueVerifier();
|
|
|
|
|
private static readonly Verifier IndividualValues = new IndividualValueVerifier();
|
|
|
|
|
private static readonly Verifier Ball = new BallVerifier();
|
|
|
|
|
private static readonly Verifier Form = new FormVerifier();
|
|
|
|
|
private static readonly Verifier ConsoleRegion = new ConsoleRegionVerifier();
|
|
|
|
|
private static readonly Verifier Ability = new AbilityVerifier();
|
|
|
|
|
private static readonly Verifier Medal = new MedalVerifier();
|
|
|
|
|
private static readonly Verifier Ribbon = new RibbonVerifier();
|
|
|
|
|
private static readonly Verifier Item = new ItemVerifier();
|
|
|
|
|
private static readonly Verifier EncounterType = new EncounterTypeVerifier();
|
|
|
|
|
private static readonly Verifier HyperTraining = new HyperTrainingVerifier();
|
|
|
|
|
private static readonly Verifier Gender = new GenderVerifier();
|
|
|
|
|
private static readonly Verifier PIDEC = new PIDVerifier();
|
|
|
|
|
private static readonly Verifier NHarmonia = new NHarmoniaVerifier();
|
|
|
|
|
private static readonly Verifier CXD = new CXDVerifier();
|
|
|
|
|
|
|
|
|
|
private static readonly TrainerNameVerifier Trainer = new TrainerNameVerifier();
|
|
|
|
|
private static readonly MemoryVerifier Memory = new MemoryVerifier();
|
|
|
|
|
private static readonly LevelVerifier Level = new LevelVerifier();
|
|
|
|
|
private static readonly MiscVerifier Misc = new MiscVerifier();
|
|
|
|
|
private static readonly TransferVerifier Transfer = new TransferVerifier();
|
|
|
|
|
|
|
|
|
|
private void VerifyBall() => Ball.Verify(this);
|
|
|
|
|
private void VerifyForm() => Form.Verify(this);
|
|
|
|
|
private void VerifyEVs() => EffortValues.Verify(this);
|
|
|
|
|
private void VerifyIVs() => IndividualValues.Verify(this);
|
|
|
|
|
private void VerifyHistory() => Memory.Verify(this);
|
|
|
|
|
private void VerifyConsoleRegion() => ConsoleRegion.Verify(this);
|
|
|
|
|
private void VerifyAbility() => Ability.Verify(this);
|
|
|
|
|
private void VerifyRibbons() => Ribbon.Verify(this);
|
|
|
|
|
private void VerifyItem() => Item.Verify(this);
|
|
|
|
|
private void VerifyLevel() => Level.Verify(this);
|
|
|
|
|
private void VerifyLevelG1() => Level.VerifyG1(this);
|
|
|
|
|
private void VerifyEncounterType() => EncounterType.Verify(this);
|
|
|
|
|
private void VerifyOT() => Trainer.Verify(this);
|
|
|
|
|
private void VerifyHyperTraining() => HyperTraining.Verify(this);
|
|
|
|
|
private void VerifyGender() => Gender.Verify(this);
|
|
|
|
|
private void VerifyECPID() => PIDEC.Verify(this);
|
|
|
|
|
private void VerifyCXD() => CXD.Verify(this);
|
|
|
|
|
private void VerifyMedals()
|
2016-03-11 04:36:32 +00:00
|
|
|
|
{
|
2017-04-11 02:00:58 +00:00
|
|
|
|
if (pkm.Format >= 6)
|
2018-06-24 05:00:01 +00:00
|
|
|
|
Medal.Verify(this);
|
2017-08-13 07:21:42 +00:00
|
|
|
|
}
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void VerifyNickname()
|
2016-03-11 04:36:32 +00:00
|
|
|
|
{
|
2018-06-24 05:00:01 +00:00
|
|
|
|
Nickname.Verify(this);
|
|
|
|
|
if (pkm.Format >= 3)
|
|
|
|
|
Language.Verify(this);
|
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
|
|
|
|
}
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void VerifyMisc()
|
2016-04-22 02:32:22 +00:00
|
|
|
|
{
|
2017-09-06 03:32:07 +00:00
|
|
|
|
if (Info.Generation == 5)
|
2018-06-24 05:00:01 +00:00
|
|
|
|
NHarmonia.Verify(this);
|
|
|
|
|
Misc.Verify(this);
|
2017-10-19 01:18:23 +00:00
|
|
|
|
}
|
2017-07-04 20:24:12 +00:00
|
|
|
|
|
2017-09-04 02:51:29 +00:00
|
|
|
|
public static string[] MoveStrings { internal get; set; } = Util.GetMovesList("en");
|
|
|
|
|
public static string[] SpeciesStrings { internal get; set; } = Util.GetSpeciesList("en");
|
2018-05-12 15:41:23 +00:00
|
|
|
|
internal static IEnumerable<string> GetMoveNames(IEnumerable<int> moves) => moves.Select(m => m >= MoveStrings.Length ? V190 : MoveStrings[m]);
|
2016-03-11 04:36:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|