PKHeX/PKHeX.Core/PersonalInfo/PersonalTable.cs

382 lines
15 KiB
C#
Raw Normal View History

using System;
using System.Diagnostics;
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
using System.Linq;
namespace PKHeX.Core
{
/// <summary>
/// <see cref="PersonalInfo"/> table (array).
/// </summary>
/// <remarks>
/// Serves as the main object that is accessed for stat data in a particular generation/game format.
/// </remarks>
public class PersonalTable
{
/// <summary>
/// Personal Table used in <see cref="GameVersion.SWSH"/>.
/// </summary>
2019-11-16 01:34:18 +00:00
public static readonly PersonalTable SWSH = GetTable("swsh", GameVersion.SWSH); // todo
2018-11-11 21:11:07 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.GG"/>.
/// </summary>
public static readonly PersonalTable GG = GetTable("gg", GameVersion.GG);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.USUM"/>.
/// </summary>
public static readonly PersonalTable USUM = GetTable("uu", GameVersion.USUM);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.SM"/>.
/// </summary>
public static readonly PersonalTable SM = GetTable("sm", GameVersion.SM);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.ORAS"/>.
/// </summary>
public static readonly PersonalTable AO = GetTable("ao", GameVersion.ORAS);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.XY"/>.
/// </summary>
public static readonly PersonalTable XY = GetTable("xy", GameVersion.XY);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.B2W2"/>.
/// </summary>
public static readonly PersonalTable B2W2 = GetTable("b2w2", GameVersion.B2W2);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.BW"/>.
/// </summary>
public static readonly PersonalTable BW = GetTable("bw", GameVersion.BW);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.HGSS"/>.
/// </summary>
public static readonly PersonalTable HGSS = GetTable("hgss", GameVersion.HGSS);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.Pt"/>.
/// </summary>
public static readonly PersonalTable Pt = GetTable("pt", GameVersion.Pt);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.DP"/>.
/// </summary>
public static readonly PersonalTable DP = GetTable("dp", GameVersion.DP);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.LG"/>.
/// </summary>
public static readonly PersonalTable LG = GetTable("lg", GameVersion.LG);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.FR"/>.
/// </summary>
public static readonly PersonalTable FR = GetTable("fr", GameVersion.FR);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.E"/>.
/// </summary>
public static readonly PersonalTable E = GetTable("e", GameVersion.E);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.RS"/>.
/// </summary>
public static readonly PersonalTable RS = GetTable("rs", GameVersion.RS);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.C"/>.
/// </summary>
public static readonly PersonalTable C = GetTable("c", GameVersion.C);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.GS"/>.
/// </summary>
public static readonly PersonalTable GS = GetTable("c", GameVersion.GS);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.RB"/>.
/// </summary>
public static readonly PersonalTable RB = GetTable("rb", GameVersion.RB);
2017-11-07 06:44:51 +00:00
/// <summary>
/// Personal Table used in <see cref="GameVersion.YW"/>.
/// </summary>
public static readonly PersonalTable Y = GetTable("y", GameVersion.YW);
private static PersonalTable GetTable(string game, GameVersion format)
{
return new PersonalTable(Util.GetBinaryResource($"personal_{game}"), format);
}
private static Func<byte[], PersonalInfo> GetConstructor(GameVersion format)
{
switch (format)
{
case GameVersion.RB: case GameVersion.YW: case GameVersion.RBY:
return z => new PersonalInfoG1(z);
case GameVersion.GS: case GameVersion.C:
return z => new PersonalInfoG2(z);
2018-05-12 15:13:39 +00:00
case GameVersion.RS: case GameVersion.E: case GameVersion.FR: case GameVersion.LG:
return z => new PersonalInfoG3(z);
case GameVersion.DP: case GameVersion.Pt: case GameVersion.HGSS:
return z => new PersonalInfoG4(z);
case GameVersion.BW:
return z => new PersonalInfoBW(z);
case GameVersion.B2W2:
return z => new PersonalInfoB2W2(z);
case GameVersion.XY:
return z => new PersonalInfoXY(z);
case GameVersion.ORAS:
return z => new PersonalInfoORAS(z);
case GameVersion.SM: case GameVersion.USUM:
return z => new PersonalInfoSM(z);
2018-11-11 21:11:07 +00:00
case GameVersion.GG:
return z => new PersonalInfoGG(z);
default:
return z => new PersonalInfoSWSH(z);
}
}
private static int GetEntrySize(GameVersion format)
{
switch (format)
{
case GameVersion.RB:
case GameVersion.YW:
case GameVersion.RBY: return PersonalInfoG1.SIZE;
case GameVersion.GS:
case GameVersion.C: return PersonalInfoG2.SIZE;
case GameVersion.RS:
case GameVersion.E:
case GameVersion.FR:
case GameVersion.LG: return PersonalInfoG3.SIZE;
case GameVersion.DP:
case GameVersion.Pt:
case GameVersion.HGSS: return PersonalInfoG4.SIZE;
case GameVersion.BW: return PersonalInfoBW.SIZE;
case GameVersion.B2W2: return PersonalInfoB2W2.SIZE;
case GameVersion.XY: return PersonalInfoXY.SIZE;
case GameVersion.ORAS: return PersonalInfoORAS.SIZE;
case GameVersion.SM:
2018-11-11 21:11:07 +00:00
case GameVersion.USUM:
case GameVersion.GG: return PersonalInfoSM.SIZE;
2019-11-16 01:34:18 +00:00
case GameVersion.SWSH: return PersonalInfoSWSH.SIZE;
default: return -1;
}
}
static PersonalTable() // Finish Setup
{
FixPersonalTableG1();
PopulateGen3Tutors();
PopulateGen4Tutors();
2019-11-16 01:34:18 +00:00
CopyDexitGenders();
}
private static void FixPersonalTableG1()
{
// Update Yellow's catch rates; currently matches Red/Blue's values.
Y[25].CatchRate = 163; // Pikachu
Y[64].CatchRate = 96; // Kadabra
// Load Gen2 Gender Ratios into Gen1
2017-09-24 05:44:54 +00:00
for (int i = 0; i <= Legal.MaxSpeciesID_1; i++)
RB[i].Gender = Y[i].Gender = GS[i].Gender;
}
private static void PopulateGen3Tutors()
{
// Update Gen3 data with Emerald's data, FR/LG is a subset of Emerald's compatibility.
var TMHM = Data.UnpackMini(Util.GetBinaryResource("hmtm_g3.pkl"), "g3");
var tutors = Data.UnpackMini(Util.GetBinaryResource("tutors_g3.pkl"), "g3");
for (int i = 0; i <= Legal.MaxSpeciesID_3; i++)
{
E[i].AddTMHM(TMHM[i]);
E[i].AddTypeTutors(tutors[i]);
}
}
private static void PopulateGen4Tutors()
{
var tutors = Data.UnpackMini(Util.GetBinaryResource("tutors_g4.pkl"), "g4");
for (int i = 0; i < tutors.Length; i++)
HGSS[i].AddTypeTutors(tutors[i]);
}
2019-11-16 01:34:18 +00:00
/// <summary>
/// Sword/Shield do not contain personal data (stubbed) for all species that are not allowed to visit the game.
/// Copy all the genders from <see cref="USUM"/>'s table for all past species, since we need it for <see cref="PKX.Personal"/> gender lookups for all generations.
/// </summary>
private static void CopyDexitGenders()
{
for (int i = 1; i <= 807; i++)
{
var ss = SWSH[i];
if (ss.HP == 0)
ss.Gender = USUM[i].Gender;
}
}
public PersonalTable(byte[] data, GameVersion format)
{
var get = GetConstructor(format);
int size = GetEntrySize(format);
byte[][] entries = data.Split(size);
Table = new PersonalInfo[entries.Length];
for (int i = 0; i < Table.Length; i++)
Table[i] = get(entries[i]);
MaxSpeciesID = format.GetMaxSpeciesID();
Game = format;
}
private readonly PersonalInfo[] Table;
2017-11-07 06:44:51 +00:00
/// <summary>
/// Gets an index from the inner <see cref="Table"/> array.
/// </summary>
/// <remarks>Has built in length checks; returns empty (0) entry if out of range.</remarks>
/// <param name="index">Index to retrieve</param>
/// <returns>Requested index entry</returns>
public PersonalInfo this[int index]
{
2016-10-24 04:57:43 +00:00
get
{
Refactor encounter matching exercise in deferred execution/state machine, only calculate possible matches until a sufficiently valid match is obtained. Previous setup would try to calculate the 'best match' and had band-aid workarounds in cases where a subsequent check may determine it to be a false match. There's still more ways to improve speed: - precalculate relationships for Encounter Slots rather than iterating over every area - yielding individual slots instead of an entire area - group non-egg wondercards by ID in a dict/hashtable for faster retrieval reworked some internals: - EncounterMatch is always an IEncounterable instead of an object, for easy pattern matching. - Splitbreed checking is done per encounter and is stored in the EncounterEgg result - Encounter validation uses Encounter/Move/RelearnMove/Evolution to whittle to the final encounter. As a part of the encounter matching, a lazy peek is used to check if an invalid encounter should be retained instead of discarded; if another encounter has not been checked, it'll stop the invalid checks and move on. If it is the last encounter, no other valid encounters exist so it will keep the parse for the invalid encounter. If no encounters are yielded, then there is no encountermatch. An EncounterInvalid is created to store basic details, and the parse is carried out. Breaks some legality checking features for flagging invalid moves in more detail, but those can be re-added in a separate check (if splitbreed & any move invalid -> check for other split moves). Should now be easier to follow the flow & maintain :smile:
2017-05-28 04:17:53 +00:00
if (0 <= index && index < Table.Length)
2016-10-24 04:57:43 +00:00
return Table[index];
return Table[0];
}
set
{
Refactor encounter matching exercise in deferred execution/state machine, only calculate possible matches until a sufficiently valid match is obtained. Previous setup would try to calculate the 'best match' and had band-aid workarounds in cases where a subsequent check may determine it to be a false match. There's still more ways to improve speed: - precalculate relationships for Encounter Slots rather than iterating over every area - yielding individual slots instead of an entire area - group non-egg wondercards by ID in a dict/hashtable for faster retrieval reworked some internals: - EncounterMatch is always an IEncounterable instead of an object, for easy pattern matching. - Splitbreed checking is done per encounter and is stored in the EncounterEgg result - Encounter validation uses Encounter/Move/RelearnMove/Evolution to whittle to the final encounter. As a part of the encounter matching, a lazy peek is used to check if an invalid encounter should be retained instead of discarded; if another encounter has not been checked, it'll stop the invalid checks and move on. If it is the last encounter, no other valid encounters exist so it will keep the parse for the invalid encounter. If no encounters are yielded, then there is no encountermatch. An EncounterInvalid is created to store basic details, and the parse is carried out. Breaks some legality checking features for flagging invalid moves in more detail, but those can be re-added in a separate check (if splitbreed & any move invalid -> check for other split moves). Should now be easier to follow the flow & maintain :smile:
2017-05-28 04:17:53 +00:00
if (index < 0 || index >= Table.Length)
2016-10-24 04:57:43 +00:00
return;
2018-05-12 15:13:39 +00:00
Table[index] = value;
2016-10-24 04:57:43 +00:00
}
}
2016-07-18 06:04:39 +00:00
2017-11-07 06:44:51 +00:00
/// <summary>
/// Gets the abilities possible for a given <see cref="PKM.Species"/> and <see cref="PKM.AltForm"/>.
/// </summary>
/// <param name="species"><see cref="PKM.Species"/></param>
/// <param name="forme"><see cref="PKM.AltForm"/></param>
/// <returns>Array of possible abilities</returns>
public int[] GetAbilities(int species, int forme)
2016-07-18 06:04:39 +00:00
{
return GetFormeEntry(species, forme).Abilities;
2016-07-18 06:04:39 +00:00
}
2017-11-07 06:44:51 +00:00
/// <summary>
/// Gets the <see cref="PersonalInfo"/> entry index for a given <see cref="PKM.Species"/> and <see cref="PKM.AltForm"/>.
/// </summary>
/// <param name="species"><see cref="PKM.Species"/></param>
/// <param name="forme"><see cref="PKM.AltForm"/></param>
/// <returns>Entry index for the input criteria</returns>
public int GetFormeIndex(int species, int forme)
2016-07-18 06:04:39 +00:00
{
if (species > MaxSpeciesID)
{ Debug.WriteLine($"Requested out of bounds {nameof(species)}: {species} (max={MaxSpeciesID})"); species = 0; }
2016-07-18 06:04:39 +00:00
return this[species].FormeIndex(species, forme);
}
2017-11-07 06:44:51 +00:00
/// <summary>
/// Gets the <see cref="PersonalInfo"/> entry for a given <see cref="PKM.Species"/> and <see cref="PKM.AltForm"/>.
/// </summary>
/// <param name="species"><see cref="PKM.Species"/></param>
/// <param name="forme"><see cref="PKM.AltForm"/></param>
/// <returns>Entry for the input criteria</returns>
public PersonalInfo GetFormeEntry(int species, int forme)
2016-07-18 06:04:39 +00:00
{
return this[GetFormeIndex(species, forme)];
2016-07-18 06:04:39 +00:00
}
2017-11-07 06:44:51 +00:00
/// <summary>
/// Count of entries in the table, which includes default species entries and their separate <see cref="PKM.AltForm"/> entreis.
/// </summary>
public int TableLength => Table.Length;
2017-11-07 06:44:51 +00:00
/// <summary>
/// Maximum Species ID for the Table.
/// </summary>
public readonly int MaxSpeciesID;
/// <summary>
/// Game(s) the <see cref="Table"/> originated from.
/// </summary>
public readonly GameVersion Game;
2017-11-07 06:44:51 +00:00
/// <summary>
/// Gets form names for every species.
/// </summary>
/// <param name="species">Raw string resource (Species) for the corresponding table.</param>
/// <param name="MaxSpecies">Max Species ID (<see cref="PKM.Species"/>)</param>
/// <returns>Array of species containing an array of form names for that species.</returns>
public string[][] GetFormList(string[] species, int MaxSpecies)
{
string[][] FormList = new string[MaxSpecies+1][];
for (int i = 0; i < FormList.Length; i++)
{
int FormCount = this[i].FormeCount;
FormList[i] = new string[FormCount];
if (FormCount <= 0)
continue;
FormList[i][0] = species[i];
for (int j = 1; j < FormCount; j++)
FormList[i][j] = $"{species[i]} {j}";
}
return FormList;
}
2017-11-07 06:44:51 +00:00
/// <summary>
/// Gets an arranged list of Form names and indexes for use with the individual <see cref="PersonalInfo"/> <see cref="PKM.AltForm"/> values.
/// </summary>
/// <param name="AltForms">Raw string resource (Forms) for the corresponding table.</param>
/// <param name="species">Raw string resource (Species) for the corresponding table.</param>
/// <param name="MaxSpecies">Max Species ID (<see cref="PKM.Species"/>)</param>
/// <param name="baseForm">Pointers for base form IDs</param>
/// <param name="formVal">Pointers for table indexes for each form</param>
/// <returns>Sanitized list of species names, and outputs indexes for various lookup purposes.</returns>
public string[] GetPersonalEntryList(string[][] AltForms, string[] species, int MaxSpecies, out int[] baseForm, out int[] formVal)
{
string[] result = new string[Table.Length];
baseForm = new int[result.Length];
formVal = new int[result.Length];
for (int i = 0; i <= MaxSpecies; i++)
{
result[i] = species[i];
2019-10-04 05:21:33 +00:00
if (AltForms[i].Length == 0)
continue;
int altformpointer = this[i].FormStatsIndex;
2019-10-04 05:21:33 +00:00
if (altformpointer <= 0)
continue;
for (int j = 1; j < AltForms[i].Length; j++)
{
int ptr = altformpointer + j - 1;
baseForm[ptr] = i;
formVal[ptr] = j;
result[ptr] = AltForms[i][j];
}
}
return result;
}
2017-11-07 06:44:51 +00:00
/// <summary>
/// Checks to see if either of the input type combinations exist in the table.
/// </summary>
/// <remarks>Only useful for checking Generation 1 <see cref="PK1.Type_A"/> and <see cref="PK1.Type_B"/> properties.</remarks>
/// <param name="Type1">First type</param>
/// <param name="Type2">Second type</param>
/// <returns>Indication that the combination exists in the table.</returns>
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
public bool IsValidTypeCombination(int Type1, int Type2)
{
return Table.Any(p => p.IsValidTypeCombination(Type1, Type2));
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
}
}
}