2017-01-04 04:51:33 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2016-02-23 06:52:48 +00:00
|
|
|
|
using System.Linq;
|
2017-02-11 23:20:44 +00:00
|
|
|
|
using PKHeX.Core.Properties;
|
2017-04-10 22:59:16 +00:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
using static PKHeX.Core.LegalityCheckStrings;
|
2016-02-23 06:52:48 +00:00
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.Core
|
2016-02-23 06:52:48 +00:00
|
|
|
|
{
|
|
|
|
|
public static partial class Legal
|
|
|
|
|
{
|
2017-03-12 23:36:23 +00:00
|
|
|
|
/// <summary>Event Database for a given Generation</summary>
|
|
|
|
|
public static MysteryGift[] MGDB_G4, MGDB_G5, MGDB_G6, MGDB_G7 = new MysteryGift[0];
|
|
|
|
|
|
|
|
|
|
/// <summary>Setting to specify if an analysis should permit data sourced from the physical cartridge era of GameBoy games.</summary>
|
|
|
|
|
public static bool AllowGBCartEra = false;
|
2016-07-03 03:24:17 +00:00
|
|
|
|
|
2017-04-10 23:47:08 +00:00
|
|
|
|
/// <summary>Setting to specify if the e-berry index item is an eningma berry or a e-reader berry and the name of the e-reader berry</summary>
|
|
|
|
|
public static bool EReaderBerryIsEnigma = true;
|
|
|
|
|
public static string EReaderBerryName = string.Empty;
|
|
|
|
|
public static string EReaderBerryDisplayName => string.Format(V372, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(EReaderBerryName.ToLower()));
|
|
|
|
|
public static bool SavegameJapanese = false;
|
|
|
|
|
|
2017-02-11 23:20:44 +00:00
|
|
|
|
// Gen 1
|
2017-02-25 20:37:01 +00:00
|
|
|
|
private static readonly Learnset[] LevelUpRB = Learnset1.getArray(Resources.lvlmove_rb, MaxSpeciesID_1);
|
|
|
|
|
private static readonly Learnset[] LevelUpY = Learnset1.getArray(Resources.lvlmove_y, MaxSpeciesID_1);
|
2017-02-11 23:20:44 +00:00
|
|
|
|
private static readonly EvolutionTree Evolves1;
|
2017-02-12 17:52:26 +00:00
|
|
|
|
private static readonly EncounterArea[] SlotsRBY;
|
|
|
|
|
private static readonly EncounterStatic[] StaticRBY;
|
2017-02-11 23:20:44 +00:00
|
|
|
|
|
2017-02-25 20:37:01 +00:00
|
|
|
|
// Gen 2
|
2017-02-28 04:57:24 +00:00
|
|
|
|
private static readonly EggMoves[] EggMovesGS = EggMoves2.getArray(Resources.eggmove_gs, MaxSpeciesID_2);
|
2017-02-25 20:37:01 +00:00
|
|
|
|
private static readonly Learnset[] LevelUpGS = Learnset1.getArray(Resources.lvlmove_gs, MaxSpeciesID_2);
|
2017-02-28 04:57:24 +00:00
|
|
|
|
private static readonly EggMoves[] EggMovesC = EggMoves2.getArray(Resources.eggmove_c, MaxSpeciesID_2);
|
2017-02-25 20:37:01 +00:00
|
|
|
|
private static readonly Learnset[] LevelUpC = Learnset1.getArray(Resources.lvlmove_c, MaxSpeciesID_2);
|
|
|
|
|
private static readonly EvolutionTree Evolves2;
|
2017-03-21 00:50:35 +00:00
|
|
|
|
private static readonly EncounterArea[] SlotsGSC, SlotsGS, SlotsC;
|
|
|
|
|
private static readonly EncounterStatic[] StaticGSC, StaticGS, StaticC;
|
2017-02-25 20:37:01 +00:00
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
// Gen 3
|
|
|
|
|
private static readonly Learnset[] LevelUpE = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_e, "em"));
|
|
|
|
|
private static readonly Learnset[] LevelUpRS = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_rs, "rs"));
|
|
|
|
|
private static readonly Learnset[] LevelUpFR = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_fr, "fr"));
|
|
|
|
|
private static readonly Learnset[] LevelUpLG = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_lg, "lg"));
|
|
|
|
|
private static readonly EggMoves[] EggMovesRS = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_rs, "rs"));
|
|
|
|
|
private static readonly EvolutionTree Evolves3;
|
|
|
|
|
private static readonly EncounterArea[] SlotsR, SlotsS, SlotsE, SlotsFR, SlotsLG;
|
2017-04-10 23:47:08 +00:00
|
|
|
|
private static readonly EncounterStatic[] StaticR, StaticS, StaticE, StaticFR, StaticLG;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
|
|
|
|
// Gen 4
|
|
|
|
|
private static readonly Learnset[] LevelUpDP = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_dp, "dp"));
|
|
|
|
|
private static readonly Learnset[] LevelUpPt = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_pt, "pt"));
|
|
|
|
|
private static readonly Learnset[] LevelUpHGSS = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_hgss, "hs"));
|
|
|
|
|
private static readonly EggMoves[] EggMovesDPPt = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_dppt, "dp"));
|
|
|
|
|
private static readonly EggMoves[] EggMovesHGSS = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_hgss, "hs"));
|
|
|
|
|
private static readonly EvolutionTree Evolves4;
|
|
|
|
|
private static readonly EncounterArea[] SlotsD, SlotsP, SlotsPt, SlotsHG, SlotsSS;
|
|
|
|
|
private static readonly EncounterStatic[] StaticD, StaticP, StaticPt, StaticHG, StaticSS;
|
|
|
|
|
|
|
|
|
|
// Gen 5
|
|
|
|
|
private static readonly Learnset[] LevelUpBW = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_bw, "51"));
|
|
|
|
|
private static readonly Learnset[] LevelUpB2W2 = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_b2w2, "52"));
|
|
|
|
|
private static readonly EggMoves[] EggMovesBW = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_bw, "bw"));
|
|
|
|
|
private static readonly EvolutionTree Evolves5;
|
|
|
|
|
private static readonly EncounterArea[] SlotsB, SlotsW, SlotsB2, SlotsW2;
|
|
|
|
|
private static readonly EncounterStatic[] StaticB, StaticW, StaticB2, StaticW2;
|
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
// Gen 6
|
2017-02-11 23:20:44 +00:00
|
|
|
|
private static readonly EggMoves[] EggMovesXY = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_xy, "xy"));
|
|
|
|
|
private static readonly Learnset[] LevelUpXY = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_xy, "xy"));
|
|
|
|
|
private static readonly EggMoves[] EggMovesAO = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_ao, "ao"));
|
|
|
|
|
private static readonly Learnset[] LevelUpAO = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_ao, "ao"));
|
2016-11-15 02:25:08 +00:00
|
|
|
|
private static readonly EvolutionTree Evolves6;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
private static readonly EncounterArea[] SlotsX, SlotsY, SlotsA, SlotsO;
|
|
|
|
|
private static readonly EncounterStatic[] StaticX, StaticY, StaticA, StaticO;
|
|
|
|
|
|
|
|
|
|
// Gen 7
|
2017-02-11 23:20:44 +00:00
|
|
|
|
private static readonly EggMoves[] EggMovesSM = EggMoves7.getArray(Data.unpackMini(Resources.eggmove_sm, "sm"));
|
|
|
|
|
private static readonly Learnset[] LevelUpSM = Learnset7.getArray(Data.unpackMini(Resources.lvlmove_sm, "sm"));
|
2016-11-15 02:25:08 +00:00
|
|
|
|
private static readonly EvolutionTree Evolves7;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
private static readonly EncounterArea[] SlotsSN, SlotsMN;
|
|
|
|
|
private static readonly EncounterStatic[] StaticSN, StaticMN;
|
|
|
|
|
|
|
|
|
|
// Setup Help
|
|
|
|
|
private static EncounterStatic[] getStaticEncounters(GameVersion Game)
|
|
|
|
|
{
|
|
|
|
|
EncounterStatic[] table;
|
2016-10-23 19:48:49 +00:00
|
|
|
|
switch (Game)
|
|
|
|
|
{
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.RBY:
|
2017-02-14 02:06:01 +00:00
|
|
|
|
return Encounter_RBY; // GameVersion filtering not possible, return immediately
|
2017-03-21 00:50:35 +00:00
|
|
|
|
case GameVersion.GS:
|
|
|
|
|
return Encounter_GS;
|
|
|
|
|
case GameVersion.C:
|
|
|
|
|
return Encounter_C;
|
2017-02-26 17:36:53 +00:00
|
|
|
|
case GameVersion.GSC:
|
|
|
|
|
return Encounter_GSC;
|
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case GameVersion.R: case GameVersion.S: case GameVersion.E:
|
|
|
|
|
table = Encounter_RSE;
|
|
|
|
|
break;
|
|
|
|
|
case GameVersion.FR: case GameVersion.LG:
|
|
|
|
|
table = Encounter_FRLG;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GameVersion.D: case GameVersion.P: case GameVersion.Pt:
|
|
|
|
|
table = Encounter_DPPt;
|
|
|
|
|
break;
|
|
|
|
|
case GameVersion.HG: case GameVersion.SS:
|
2017-03-25 17:13:02 +00:00
|
|
|
|
table = Encounter_HGSS.Concat(Encounter_PokeWalker).ToArray();
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GameVersion.B: case GameVersion.W:
|
2017-03-25 17:13:02 +00:00
|
|
|
|
table = Encounter_BW.Concat(BW_DreamWorld).ToArray();
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
case GameVersion.B2: case GameVersion.W2:
|
2017-03-25 17:13:02 +00:00
|
|
|
|
table = Encounter_B2W2.Concat(B2W2_DreamWorld).ToArray();
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.X: case GameVersion.Y:
|
2016-10-23 19:48:49 +00:00
|
|
|
|
table = Encounter_XY;
|
|
|
|
|
break;
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.AS: case GameVersion.OR:
|
2016-10-23 19:48:49 +00:00
|
|
|
|
table = Encounter_AO;
|
|
|
|
|
break;
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.SN: case GameVersion.MN:
|
2016-10-23 19:48:49 +00:00
|
|
|
|
table = Encounter_SM;
|
|
|
|
|
break;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
|
|
|
|
default: return null;
|
2016-10-23 19:48:49 +00:00
|
|
|
|
}
|
2017-03-26 09:39:13 +00:00
|
|
|
|
return table?.Where(s => s.Version.Contains(Game)).ToArray();
|
2016-03-23 02:47:13 +00:00
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
private static EncounterArea[] getEncounterTables(GameVersion Game)
|
|
|
|
|
{
|
|
|
|
|
string ident = null;
|
|
|
|
|
byte[] tables = null;
|
|
|
|
|
switch (Game)
|
|
|
|
|
{
|
2017-03-19 12:37:30 +00:00
|
|
|
|
case GameVersion.R: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_r, "ru"));
|
|
|
|
|
case GameVersion.S: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_s, "sa"));
|
|
|
|
|
case GameVersion.E: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_e, "em"));
|
|
|
|
|
case GameVersion.FR: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_fr, "fr"));
|
|
|
|
|
case GameVersion.LG: return EncounterArea.getArray3(Data.unpackMini(Resources.encounter_lg, "lg"));
|
|
|
|
|
case GameVersion.D: return EncounterArea.getArray4DPPt(Data.unpackMini(Resources.encounter_d, "da"));
|
|
|
|
|
case GameVersion.P: return EncounterArea.getArray4DPPt(Data.unpackMini(Resources.encounter_p, "pe"));
|
|
|
|
|
case GameVersion.Pt: return EncounterArea.getArray4DPPt(Data.unpackMini(Resources.encounter_pt, "pt"));
|
|
|
|
|
case GameVersion.HG: return EncounterArea.getArray4HGSS(Data.unpackMini(Resources.encounter_hg, "hg"));
|
|
|
|
|
case GameVersion.SS: return EncounterArea.getArray4HGSS(Data.unpackMini(Resources.encounter_ss, "ss"));
|
2017-03-19 07:00:15 +00:00
|
|
|
|
case GameVersion.B: ident = "51"; tables = Resources.encounter_b; break;
|
|
|
|
|
case GameVersion.W: ident = "51"; tables = Resources.encounter_w; break;
|
|
|
|
|
case GameVersion.B2: ident = "52"; tables = Resources.encounter_b2; break;
|
|
|
|
|
case GameVersion.W2: ident = "52"; tables = Resources.encounter_w2; break;
|
|
|
|
|
case GameVersion.X: ident = "xy"; tables = Resources.encounter_x; break;
|
|
|
|
|
case GameVersion.Y: ident = "xy"; tables = Resources.encounter_y; break;
|
|
|
|
|
case GameVersion.AS: ident = "ao"; tables = Resources.encounter_a; break;
|
|
|
|
|
case GameVersion.OR: ident = "ao"; tables = Resources.encounter_o; break;
|
|
|
|
|
case GameVersion.SN: ident = "sm"; tables = Resources.encounter_sn; break;
|
|
|
|
|
case GameVersion.MN: ident = "sm"; tables = Resources.encounter_mn; break;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
|
|
|
|
if (ident == null)
|
2017-03-18 23:50:34 +00:00
|
|
|
|
return new EncounterArea[0];
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2016-11-23 01:37:18 +00:00
|
|
|
|
return getEncounterTables(tables, ident);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
2016-11-23 01:37:18 +00:00
|
|
|
|
private static EncounterArea[] getEncounterTables(byte[] mini, string ident)
|
|
|
|
|
{
|
|
|
|
|
return EncounterArea.getArray(Data.unpackMini(mini, ident));
|
|
|
|
|
}
|
2017-03-26 08:25:21 +00:00
|
|
|
|
private static EncounterArea[] addExtraTableSlots(params EncounterArea[][] tables)
|
2016-03-18 03:20:34 +00:00
|
|
|
|
{
|
2017-03-26 08:25:21 +00:00
|
|
|
|
return tables.SelectMany(s => s).GroupBy(l => l.Location)
|
|
|
|
|
.Select(t => t.Count() == 1
|
|
|
|
|
? t.First() // only one table, just return the area
|
|
|
|
|
: new EncounterArea {Location = t.First().Location, Slots = t.SelectMany(s => s.Slots).ToArray()})
|
|
|
|
|
.ToArray();
|
2016-03-18 03:20:34 +00:00
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
private static void MarkEncountersGeneration(ref EncounterStatic[] Encounters, int Generation)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterStatic Encounter in Encounters)
|
|
|
|
|
Encounter.Generation = Generation;
|
|
|
|
|
}
|
|
|
|
|
private static void MarkEncountersGeneration(ref EncounterArea[] Areas, int Generation)
|
|
|
|
|
{
|
2017-04-09 02:05:29 +00:00
|
|
|
|
foreach (EncounterArea Area in Areas)
|
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
Slot.Generation = Generation;
|
|
|
|
|
}
|
2017-03-21 07:20:51 +00:00
|
|
|
|
private static void ReduceAreasSize(ref EncounterArea[] Areas)
|
2017-03-19 12:42:59 +00:00
|
|
|
|
{
|
|
|
|
|
// Group areas by location id, the raw data have areas with different slots but the same location id
|
2017-03-21 07:20:51 +00:00
|
|
|
|
Areas = Areas.GroupBy(a => a.Location).Select(a => new EncounterArea
|
2017-03-20 23:00:29 +00:00
|
|
|
|
{
|
|
|
|
|
Location = a.First().Location,
|
|
|
|
|
Slots = a.SelectMany(m => m.Slots).ToArray()
|
|
|
|
|
}).ToArray();
|
2017-03-19 12:42:59 +00:00
|
|
|
|
}
|
2017-03-21 07:20:51 +00:00
|
|
|
|
private static void MarkG2Slots(ref EncounterArea[] Areas)
|
2017-03-19 12:42:59 +00:00
|
|
|
|
{
|
2017-03-21 07:20:51 +00:00
|
|
|
|
ReduceAreasSize(ref Areas);
|
|
|
|
|
}
|
|
|
|
|
private static void MarkG3Slots_FRLG(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
// Remove slots for unown, those slots does not contains alt form info, it will be added manually in SlotsRFLGAlt
|
2017-03-19 12:42:59 +00:00
|
|
|
|
// Group areas by location id, the raw data have areas with different slots but the same location id
|
2017-03-21 07:20:51 +00:00
|
|
|
|
Areas = Areas.Where(a => a.Location < 188 || a.Location > 194).GroupBy(a => a.Location).Select(a => new EncounterArea
|
2017-03-20 23:00:29 +00:00
|
|
|
|
{
|
|
|
|
|
Location = a.First().Location,
|
|
|
|
|
Slots = a.SelectMany(m => m.Slots).ToArray()
|
|
|
|
|
}).ToArray();
|
2017-03-19 12:42:59 +00:00
|
|
|
|
}
|
2017-03-21 07:20:51 +00:00
|
|
|
|
private static void MarkG3Slots_RSE(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
ReduceAreasSize(ref Areas);
|
|
|
|
|
}
|
2017-03-26 20:46:05 +00:00
|
|
|
|
private static void MarkG3SlotsSafariZones(ref EncounterArea[] Areas, int location)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterArea Area in Areas.Where(a => a.Location == location))
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots)
|
|
|
|
|
{
|
|
|
|
|
SlotType t;
|
|
|
|
|
switch (Slot.Type)
|
|
|
|
|
{
|
|
|
|
|
case SlotType.Grass: t = SlotType.Grass_Safari; break;
|
|
|
|
|
case SlotType.Surf: t = SlotType.Surf_Safari; break;
|
|
|
|
|
case SlotType.Old_Rod: t = SlotType.Old_Rod_Safari; break;
|
|
|
|
|
case SlotType.Good_Rod: t = SlotType.Good_Rod_Safari; break;
|
|
|
|
|
case SlotType.Super_Rod: t = SlotType.Super_Rod_Safari; break;
|
|
|
|
|
case SlotType.Rock_Smash: t = SlotType.Rock_Smash_Safari; break;
|
|
|
|
|
default: continue;
|
|
|
|
|
}
|
|
|
|
|
Slot.Type = t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-25 17:13:02 +00:00
|
|
|
|
private static void MarkG4PokeWalker(ref EncounterStatic[] t)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterStatic s in t)
|
|
|
|
|
{
|
|
|
|
|
s.Location = 233; //Pokéwalker
|
|
|
|
|
s.Gift = true; //Pokeball only
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-26 20:46:05 +00:00
|
|
|
|
private static void MarkG4SlotsGreatMarsh(ref EncounterArea[] Areas, int location)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterArea Area in Areas.Where(a => a.Location == location))
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots)
|
|
|
|
|
{
|
|
|
|
|
SlotType t;
|
|
|
|
|
switch (Slot.Type)
|
|
|
|
|
{
|
|
|
|
|
case SlotType.Grass: t = SlotType.Grass_Safari; break;
|
|
|
|
|
case SlotType.Surf: t = SlotType.Surf_Safari; break;
|
|
|
|
|
case SlotType.Old_Rod: t = SlotType.Old_Rod_Safari; break;
|
|
|
|
|
case SlotType.Good_Rod: t = SlotType.Good_Rod_Safari; break;
|
|
|
|
|
case SlotType.Super_Rod: t = SlotType.Super_Rod_Safari; break;
|
|
|
|
|
case SlotType.Pokeradar: t = SlotType.Pokeradar_Safari; break;
|
|
|
|
|
default: continue;
|
|
|
|
|
}
|
|
|
|
|
Slot.Type = t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-20 14:49:05 +00:00
|
|
|
|
private static void MarkG4SwarmSlots(ref EncounterArea[] Areas, EncounterArea[] SwarmAreas)
|
|
|
|
|
{
|
2017-03-27 03:21:44 +00:00
|
|
|
|
// Grass Swarm slots replace slots 0 and 1 from encounters data
|
|
|
|
|
// for surfing only replace slots 0 from encounters data
|
|
|
|
|
// for fishing replace one or several random slots from encounters data, but all slots have the same level, it's ok to only replace the first
|
2017-03-20 14:49:05 +00:00
|
|
|
|
// Species id are not included in encounter tables but levels can be copied from the encounter raw data
|
2017-03-27 03:21:44 +00:00
|
|
|
|
foreach (EncounterArea Area in Areas)
|
2017-03-20 14:49:05 +00:00
|
|
|
|
{
|
2017-03-20 23:00:29 +00:00
|
|
|
|
var SwarmSlots = SwarmAreas.Where(a => a.Location == Area.Location).SelectMany(s => s.Slots);
|
|
|
|
|
var OutputSlots = new List<EncounterSlot>();
|
|
|
|
|
foreach (EncounterSlot SwarmSlot in SwarmSlots)
|
2017-03-20 14:49:05 +00:00
|
|
|
|
{
|
2017-03-27 03:21:44 +00:00
|
|
|
|
int slotsnum = SwarmSlot.Type == SlotType.Grass ? 2 : 1;
|
|
|
|
|
foreach (var swarmSlot in Area.Slots.Where(s => s.Type == SwarmSlot.Type).Take(slotsnum).Select(slot => slot.Clone()))
|
2017-03-20 23:00:29 +00:00
|
|
|
|
{
|
|
|
|
|
swarmSlot.Species = SwarmSlot.Species;
|
|
|
|
|
OutputSlots.Add(swarmSlot);
|
|
|
|
|
}
|
2017-03-20 14:49:05 +00:00
|
|
|
|
}
|
2017-03-20 23:00:29 +00:00
|
|
|
|
Area.Slots = Area.Slots.Concat(OutputSlots).Where(a => a.Species > 0).ToArray();
|
2017-03-20 14:49:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-21 07:20:51 +00:00
|
|
|
|
// Gen 4 raw encounter data does not contains info for alt slots
|
|
|
|
|
// Shellos and Gastrodom East Sea form should be modified
|
|
|
|
|
private static void MarkG4AltFormSlots(ref EncounterArea[] Areas, int Species, int form, int[] Locations)
|
2017-03-19 13:38:30 +00:00
|
|
|
|
{
|
2017-03-21 07:20:51 +00:00
|
|
|
|
foreach(EncounterArea Area in Areas.Where(a => Locations.Contains(a.Location)))
|
2017-03-20 22:50:23 +00:00
|
|
|
|
{
|
2017-03-21 07:20:51 +00:00
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots.Where(s=>s.Species == Species))
|
|
|
|
|
{
|
|
|
|
|
Slot.Form = form;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private static void MarkG4Slots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
ReduceAreasSize(ref Areas);
|
2017-03-19 13:38:30 +00:00
|
|
|
|
}
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
private static EncounterType GetEncounterTypeBySlotDPPt( SlotType Type, EncounterType GrassType)
|
|
|
|
|
{
|
|
|
|
|
switch (Type)
|
|
|
|
|
{
|
|
|
|
|
case SlotType.Pokeradar:
|
|
|
|
|
case SlotType.Grass: return GrassType;
|
|
|
|
|
case SlotType.Surf:
|
|
|
|
|
case SlotType.Old_Rod:
|
|
|
|
|
case SlotType.Good_Rod:
|
|
|
|
|
case SlotType.Super_Rod: return EncounterType.Surfing_Fishing;
|
|
|
|
|
case SlotType.Grass_Safari:
|
|
|
|
|
case SlotType.Surf_Safari:
|
|
|
|
|
case SlotType.Old_Rod_Safari:
|
|
|
|
|
case SlotType.Good_Rod_Safari:
|
|
|
|
|
case SlotType.Super_Rod_Safari: return EncounterType.MarshSafari;
|
|
|
|
|
case SlotType.HoneyTree: return EncounterType.None;
|
|
|
|
|
}
|
|
|
|
|
return EncounterType.None;
|
|
|
|
|
}
|
|
|
|
|
private static EncounterType GetEncounterTypeBySlotHGSS(SlotType Type, EncounterType GrassType)
|
|
|
|
|
{
|
|
|
|
|
switch (Type)
|
|
|
|
|
{
|
|
|
|
|
// HGSS Safari encounters have normal water/grass encounter type, not safari encounter type
|
|
|
|
|
case SlotType.Grass:
|
|
|
|
|
case SlotType.Grass_Safari: return GrassType;
|
|
|
|
|
case SlotType.Surf:
|
|
|
|
|
case SlotType.Old_Rod:
|
|
|
|
|
case SlotType.Good_Rod:
|
|
|
|
|
case SlotType.Super_Rod:
|
|
|
|
|
case SlotType.Surf_Safari:
|
|
|
|
|
case SlotType.Old_Rod_Safari:
|
|
|
|
|
case SlotType.Good_Rod_Safari:
|
|
|
|
|
case SlotType.Super_Rod_Safari: return EncounterType.Surfing_Fishing;
|
|
|
|
|
case SlotType.Rock_Smash:
|
|
|
|
|
case SlotType.Rock_Smash_Safari: return EncounterType.RockSmash;
|
|
|
|
|
case SlotType.Headbutt: return EncounterType.None;
|
|
|
|
|
}
|
|
|
|
|
return EncounterType.None;
|
|
|
|
|
}
|
|
|
|
|
private static void MarkDPPtEncounterTypeSlots_Route209(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
// Route 209 have two different encounter type for grass encounters
|
|
|
|
|
// The first area with location 24 is the proper Route 209 with tall grass encounters
|
|
|
|
|
// The other areas with the same location in the raw file is the lost tower, all encounters inside the tower are buildiing encounter
|
|
|
|
|
bool FirstArea = true;
|
|
|
|
|
foreach (EncounterArea Area in Areas.Where(x => x.Location == 24))
|
|
|
|
|
{
|
|
|
|
|
var GrassType = FirstArea ? EncounterType.TallGrass : EncounterType.Building_EnigmaStone;
|
|
|
|
|
if (FirstArea)
|
|
|
|
|
FirstArea = false;
|
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots)
|
|
|
|
|
{
|
|
|
|
|
Slot.TypeEncounter = GetEncounterTypeBySlotDPPt(Slot.Type, GrassType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private static void MarkHGSSEncounterTypeSlots_RuinsofAlph(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
// Ruins of Alph have two different encounter type for grass encounters
|
|
|
|
|
// The first area with location 209 is the outside area of the ruins with tall grass encounters
|
|
|
|
|
// The other areas with the same location in the raw file is the inside of the ruins, all encounters inside are cave encounters
|
|
|
|
|
bool FirstArea = true;
|
|
|
|
|
foreach (EncounterArea Area in Areas.Where(x => x.Location == 209))
|
|
|
|
|
{
|
|
|
|
|
var GrassType = FirstArea ? EncounterType.TallGrass : EncounterType.Cave_HallOfOrigin;
|
|
|
|
|
if (FirstArea)
|
|
|
|
|
FirstArea = false;
|
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots)
|
|
|
|
|
{
|
|
|
|
|
Slot.TypeEncounter = GetEncounterTypeBySlotHGSS(Slot.Type, GrassType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private static void MarkDPPtEncounterTypeSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
foreach(EncounterArea Area in Areas)
|
|
|
|
|
{
|
|
|
|
|
if (Area.Location == 24)
|
|
|
|
|
continue;
|
|
|
|
|
var GrassType = (Area.Location == 70) ? EncounterType.Building_EnigmaStone :// Old Chateau
|
|
|
|
|
DPPt_CaveLocations.Contains(Area.Location) ? EncounterType.Cave_HallOfOrigin :
|
|
|
|
|
EncounterType.TallGrass;
|
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots)
|
|
|
|
|
{
|
|
|
|
|
Slot.TypeEncounter = GetEncounterTypeBySlotDPPt(Slot.Type, GrassType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private static void MarkHGSSEncounterTypeSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterArea Area in Areas)
|
|
|
|
|
{
|
|
|
|
|
if (Area.Location == 209)
|
|
|
|
|
continue;
|
|
|
|
|
var GrassType = HGSS_CaveLocations.Contains(Area.Location) ? EncounterType.Cave_HallOfOrigin: EncounterType.TallGrass;
|
|
|
|
|
foreach (EncounterSlot Slot in Area.Slots)
|
|
|
|
|
{
|
|
|
|
|
Slot.TypeEncounter = GetEncounterTypeBySlotHGSS(Slot.Type, GrassType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-22 00:57:23 +00:00
|
|
|
|
private static void MarkBWSwarmSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
2017-03-22 01:14:16 +00:00
|
|
|
|
foreach (EncounterSlot s in Areas.SelectMany(area => area.Slots))
|
2017-03-22 00:57:23 +00:00
|
|
|
|
{
|
2017-03-22 01:14:16 +00:00
|
|
|
|
s.LevelMin = 15; s.LevelMax = 55; s.Type = SlotType.Swarm;
|
2017-03-22 00:57:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private static void MarkB2W2SwarmSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
2017-03-22 01:14:16 +00:00
|
|
|
|
foreach (EncounterSlot s in Areas.SelectMany(area => area.Slots))
|
2017-03-22 00:57:23 +00:00
|
|
|
|
{
|
2017-03-22 01:14:16 +00:00
|
|
|
|
s.LevelMin = 40; s.LevelMax = 55; s.Type = SlotType.Swarm;
|
2017-03-22 00:57:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-22 06:22:22 +00:00
|
|
|
|
private static void MarkG5HiddenGrottoSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterSlot s in Areas[0].Slots) //Only 1 area
|
|
|
|
|
s.Type = SlotType.HiddenGrotto;
|
|
|
|
|
}
|
2017-03-24 04:26:57 +00:00
|
|
|
|
private static void MarkG5DreamWorld(ref EncounterStatic[] t)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterStatic s in t)
|
2017-03-24 05:31:49 +00:00
|
|
|
|
{
|
2017-03-30 06:31:02 +00:00
|
|
|
|
s.Location = 75; //Entree Forest
|
|
|
|
|
s.Ability = (PersonalTable.B2W2.getAbilities(s.Species, s.Form)[2] == 0) ? 1 : 4; // Check if has HA
|
2017-03-24 05:31:49 +00:00
|
|
|
|
}
|
2017-03-24 04:26:57 +00:00
|
|
|
|
}
|
2017-03-19 07:00:15 +00:00
|
|
|
|
private static void MarkG5Slots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
foreach (var area in Areas)
|
|
|
|
|
{
|
|
|
|
|
int ctr = 0;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
|
area.Slots[ctr++].Type = SlotType.Grass; // Single
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
|
area.Slots[ctr++].Type = SlotType.Grass; // Double
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 12; i++)
|
|
|
|
|
area.Slots[ctr++].Type = SlotType.Grass; // Shaking
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) // 5
|
|
|
|
|
area.Slots[ctr++].Type = SlotType.Surf; // Surf
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) // 5
|
|
|
|
|
area.Slots[ctr++].Type = SlotType.Surf; // Surf Spot
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) // 5
|
|
|
|
|
area.Slots[ctr++].Type = SlotType.Super_Rod; // Fish
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) // 5
|
|
|
|
|
area.Slots[ctr++].Type = SlotType.Super_Rod; // Fish Spot
|
|
|
|
|
} while (ctr != area.Slots.Length);
|
|
|
|
|
area.Slots = area.Slots.Where(slot => slot.Species != 0).ToArray();
|
|
|
|
|
}
|
2017-03-21 07:20:51 +00:00
|
|
|
|
ReduceAreasSize(ref Areas);
|
2017-03-19 07:00:15 +00:00
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
private static void MarkG6XYSlots(ref EncounterArea[] Areas)
|
2016-02-25 00:36:26 +00:00
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
foreach (var area in Areas)
|
2016-03-23 02:47:13 +00:00
|
|
|
|
{
|
|
|
|
|
int slotct = area.Slots.Length;
|
|
|
|
|
for (int i = slotct - 15; i < slotct; i++)
|
|
|
|
|
area.Slots[i].Type = SlotType.Horde;
|
|
|
|
|
}
|
2017-03-21 07:20:51 +00:00
|
|
|
|
ReduceAreasSize(ref Areas);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
|
|
|
|
private static void MarkG6AOSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
foreach (var area in Areas)
|
2016-03-23 02:47:13 +00:00
|
|
|
|
{
|
|
|
|
|
for (int i = 32; i < 37; i++)
|
|
|
|
|
area.Slots[i].Type = SlotType.Rock_Smash;
|
|
|
|
|
int slotct = area.Slots.Length;
|
|
|
|
|
for (int i = slotct - 15; i < slotct; i++)
|
|
|
|
|
area.Slots[i].Type = SlotType.Horde;
|
2016-04-21 02:47:40 +00:00
|
|
|
|
|
|
|
|
|
for (int i = 0; i < slotct; i++)
|
|
|
|
|
area.Slots[i].AllowDexNav = area.Slots[i].Type != SlotType.Rock_Smash;
|
2016-03-23 02:47:13 +00:00
|
|
|
|
}
|
2017-03-21 07:20:51 +00:00
|
|
|
|
ReduceAreasSize(ref Areas);
|
|
|
|
|
}
|
|
|
|
|
private static void MarkG7REGSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
ReduceAreasSize(ref Areas);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
2016-11-23 01:37:18 +00:00
|
|
|
|
private static void MarkG7SMSlots(ref EncounterArea[] Areas)
|
|
|
|
|
{
|
|
|
|
|
foreach (EncounterSlot s in Areas.SelectMany(area => area.Slots))
|
|
|
|
|
s.Type = SlotType.SOS;
|
2017-03-21 07:20:51 +00:00
|
|
|
|
ReduceAreasSize(ref Areas);
|
2016-11-23 01:37:18 +00:00
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
private static EncounterArea[] getTables1()
|
|
|
|
|
{
|
2017-03-23 21:50:01 +00:00
|
|
|
|
var red_gw = EncounterArea.getArray1_GW(Resources.encounter_red);
|
|
|
|
|
var blu_gw = EncounterArea.getArray1_GW(Resources.encounter_blue);
|
|
|
|
|
var ylw_gw = EncounterArea.getArray1_GW(Resources.encounter_yellow);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
var rb_fish = EncounterArea.getArray1_F(Resources.encounter_rb_f);
|
|
|
|
|
var ylw_fish = EncounterArea.getArray1_FY(Resources.encounter_yellow_f);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2017-03-26 08:25:21 +00:00
|
|
|
|
var table = addExtraTableSlots(red_gw, blu_gw, ylw_gw, rb_fish, ylw_fish);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
Array.Resize(ref table, table.Length + 1);
|
|
|
|
|
table[table.Length - 1] = FishOldGood_RBY;
|
|
|
|
|
|
|
|
|
|
return table;
|
|
|
|
|
}
|
2017-03-21 00:50:35 +00:00
|
|
|
|
private static EncounterArea[] getTables2(GameVersion Version)
|
2017-03-18 23:50:34 +00:00
|
|
|
|
{
|
2017-03-21 00:50:35 +00:00
|
|
|
|
EncounterArea[] Slots = null;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
// Fishing
|
|
|
|
|
var f = EncounterArea.getArray2_F(Resources.encounter_gsc_f);
|
2017-03-22 03:17:21 +00:00
|
|
|
|
if (Version == GameVersion.GS || Version == GameVersion.GSC)
|
2017-03-21 00:50:35 +00:00
|
|
|
|
{
|
|
|
|
|
// Grass/Water
|
|
|
|
|
var g = EncounterArea.getArray2_GW(Resources.encounter_gold);
|
|
|
|
|
var s = EncounterArea.getArray2_GW(Resources.encounter_silver);
|
|
|
|
|
// Headbutt/Rock Smash
|
|
|
|
|
var h_g = EncounterArea.getArray2_H(Resources.encounter_gold_h);
|
|
|
|
|
var h_s = EncounterArea.getArray2_H(Resources.encounter_silver_h);
|
|
|
|
|
|
2017-03-26 08:25:21 +00:00
|
|
|
|
Slots = addExtraTableSlots(g, s, h_g, h_s,f);
|
2017-03-21 00:50:35 +00:00
|
|
|
|
}
|
|
|
|
|
if (Version == GameVersion.C || Version == GameVersion.GSC)
|
|
|
|
|
{
|
|
|
|
|
// Grass/Water
|
|
|
|
|
var c = EncounterArea.getArray2_GW(Resources.encounter_crystal);
|
|
|
|
|
// Headbutt/Rock Smash
|
|
|
|
|
var h_c = EncounterArea.getArray2_H(Resources.encounter_crystal_h);
|
|
|
|
|
|
2017-03-26 08:25:21 +00:00
|
|
|
|
var extra = addExtraTableSlots(c, h_c, f);
|
2017-03-24 01:38:31 +00:00
|
|
|
|
return Version == GameVersion.C ? extra : addExtraTableSlots(Slots, extra);
|
2017-03-21 00:50:35 +00:00
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
2017-03-21 00:50:35 +00:00
|
|
|
|
return Slots;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
}
|
2017-03-21 00:50:35 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
static Legal() // Setup
|
|
|
|
|
{
|
2017-02-11 23:20:44 +00:00
|
|
|
|
// Gen 1
|
|
|
|
|
{
|
2017-03-03 02:24:50 +00:00
|
|
|
|
StaticRBY = getStaticEncounters(GameVersion.RBY);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
SlotsRBY = getTables1();
|
2017-03-21 07:20:51 +00:00
|
|
|
|
// Gen 1 is the only gen where ReduceAreasSize is not needed
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
MarkEncountersGeneration(ref SlotsRBY, 1);
|
|
|
|
|
MarkEncountersGeneration(ref StaticRBY, 1);
|
2017-03-03 02:24:50 +00:00
|
|
|
|
Evolves1 = new EvolutionTree(new[] { Resources.evos_rby }, GameVersion.RBY, PersonalTable.Y, MaxSpeciesID_1);
|
2017-02-11 23:20:44 +00:00
|
|
|
|
}
|
2017-02-25 20:37:01 +00:00
|
|
|
|
// Gen 2
|
|
|
|
|
{
|
2017-03-21 00:50:35 +00:00
|
|
|
|
StaticGS = getStaticEncounters(GameVersion.GS);
|
|
|
|
|
StaticC = getStaticEncounters(GameVersion.C);
|
2017-03-03 02:24:50 +00:00
|
|
|
|
StaticGSC = getStaticEncounters(GameVersion.GSC);
|
2017-03-21 00:50:35 +00:00
|
|
|
|
SlotsGS = getTables2(GameVersion.GS);
|
|
|
|
|
SlotsC = getTables2(GameVersion.C);
|
|
|
|
|
SlotsGSC = getTables2(GameVersion.GSC);
|
2017-03-21 07:20:51 +00:00
|
|
|
|
MarkG2Slots(ref SlotsGS);
|
|
|
|
|
MarkG2Slots(ref SlotsC);
|
|
|
|
|
MarkG2Slots(ref SlotsGSC);
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
MarkEncountersGeneration(ref SlotsGS, 2);
|
|
|
|
|
MarkEncountersGeneration(ref SlotsC, 2);
|
|
|
|
|
MarkEncountersGeneration(ref SlotsGSC, 2);
|
|
|
|
|
MarkEncountersGeneration(ref StaticGS, 2);
|
|
|
|
|
MarkEncountersGeneration(ref StaticC, 2);
|
|
|
|
|
MarkEncountersGeneration(ref StaticGSC, 2);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
Evolves2 = new EvolutionTree(new[] { Resources.evos_gsc }, GameVersion.GSC, PersonalTable.C, MaxSpeciesID_2);
|
|
|
|
|
}
|
|
|
|
|
// Gen3
|
|
|
|
|
{
|
|
|
|
|
StaticR = getStaticEncounters(GameVersion.R);
|
|
|
|
|
StaticS = getStaticEncounters(GameVersion.S);
|
|
|
|
|
StaticE = getStaticEncounters(GameVersion.E);
|
|
|
|
|
StaticFR = getStaticEncounters(GameVersion.FR);
|
|
|
|
|
StaticLG = getStaticEncounters(GameVersion.LG);
|
|
|
|
|
|
2017-03-19 12:42:59 +00:00
|
|
|
|
var R_Slots = getEncounterTables(GameVersion.R);
|
|
|
|
|
var S_Slots = getEncounterTables(GameVersion.S);
|
|
|
|
|
var E_Slots = getEncounterTables(GameVersion.E);
|
|
|
|
|
var FR_Slots = getEncounterTables(GameVersion.FR);
|
|
|
|
|
var LG_Slots = getEncounterTables(GameVersion.LG);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
2017-03-19 12:42:59 +00:00
|
|
|
|
MarkG3Slots_RSE(ref R_Slots);
|
|
|
|
|
MarkG3Slots_RSE(ref S_Slots);
|
|
|
|
|
MarkG3Slots_RSE(ref E_Slots);
|
|
|
|
|
MarkG3Slots_FRLG(ref FR_Slots);
|
|
|
|
|
MarkG3Slots_FRLG(ref LG_Slots);
|
2017-03-26 20:46:05 +00:00
|
|
|
|
MarkG3SlotsSafariZones(ref R_Slots, 57);
|
|
|
|
|
MarkG3SlotsSafariZones(ref S_Slots, 57);
|
|
|
|
|
MarkG3SlotsSafariZones(ref E_Slots, 57);
|
|
|
|
|
MarkG3SlotsSafariZones(ref FR_Slots, 136);
|
|
|
|
|
MarkG3SlotsSafariZones(ref LG_Slots, 136);
|
2017-03-19 12:42:59 +00:00
|
|
|
|
|
2017-03-24 01:38:31 +00:00
|
|
|
|
SlotsR = addExtraTableSlots(R_Slots, SlotsRSEAlt);
|
|
|
|
|
SlotsS = addExtraTableSlots(S_Slots, SlotsRSEAlt);
|
|
|
|
|
SlotsE = addExtraTableSlots(E_Slots, SlotsRSEAlt);
|
|
|
|
|
SlotsFR = addExtraTableSlots(FR_Slots, SlotsFRLGAlt);
|
|
|
|
|
SlotsLG = addExtraTableSlots(LG_Slots, SlotsFRLGAlt);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
2017-03-19 12:33:20 +00:00
|
|
|
|
Evolves3 = new EvolutionTree(new[] { Resources.evos_g3 }, GameVersion.RS, PersonalTable.RS, MaxSpeciesID_3);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
|
|
|
|
// Update Personal Entries with TM/Tutor Data
|
|
|
|
|
var TMHM = Data.unpackMini(Resources.hmtm_g3, "g3");
|
|
|
|
|
for (int i = 0; i <= MaxSpeciesID_3; i++)
|
2017-03-20 22:50:23 +00:00
|
|
|
|
PersonalTable.E[i].AddTMHM(TMHM[i]);
|
2017-03-20 17:53:16 +00:00
|
|
|
|
// Tutors g3 contains tutor compatiblity data extracted from emerald,
|
|
|
|
|
// fire red and leaf green tutors data is a subset of emerald data
|
2017-03-18 23:50:34 +00:00
|
|
|
|
var tutors = Data.unpackMini(Resources.tutors_g3, "g3");
|
|
|
|
|
for (int i = 0; i <= MaxSpeciesID_3; i++)
|
2017-03-20 17:53:16 +00:00
|
|
|
|
PersonalTable.E[i].AddTypeTutors(tutors[i]);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
// Gen 4
|
|
|
|
|
{
|
2017-03-25 17:13:02 +00:00
|
|
|
|
MarkG4PokeWalker(ref Encounter_PokeWalker);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
StaticD = getStaticEncounters(GameVersion.D);
|
|
|
|
|
StaticP = getStaticEncounters(GameVersion.P);
|
|
|
|
|
StaticPt = getStaticEncounters(GameVersion.Pt);
|
|
|
|
|
StaticHG = getStaticEncounters(GameVersion.HG);
|
|
|
|
|
StaticSS = getStaticEncounters(GameVersion.SS);
|
|
|
|
|
|
2017-03-19 13:38:30 +00:00
|
|
|
|
var D_Slots = getEncounterTables(GameVersion.D);
|
|
|
|
|
var P_Slots = getEncounterTables(GameVersion.P);
|
|
|
|
|
var Pt_Slots = getEncounterTables(GameVersion.Pt);
|
|
|
|
|
var HG_Slots = getEncounterTables(GameVersion.HG);
|
|
|
|
|
var SS_Slots = getEncounterTables(GameVersion.SS);
|
2017-03-26 08:25:21 +00:00
|
|
|
|
var DP_Trophy = EncounterArea.getTrophyArea(TrophyDP, new[] {16, 18});
|
|
|
|
|
var Pt_Trophy = EncounterArea.getTrophyArea(TrophyPt, new[] {22, 22});
|
2017-03-19 15:23:46 +00:00
|
|
|
|
var HG_Headbutt_Slots = EncounterArea.getArray4HGSS_Headbutt(Data.unpackMini(Resources.encunters_hb_hg, "hg"));
|
|
|
|
|
var SS_Headbutt_Slots = EncounterArea.getArray4HGSS_Headbutt(Data.unpackMini(Resources.encunters_hb_ss, "ss"));
|
2017-03-19 13:38:30 +00:00
|
|
|
|
|
2017-03-19 15:44:36 +00:00
|
|
|
|
var D_HoneyTrees_Slots = SlotsD_HoneyTree.Clone(HoneyTreesLocation);
|
|
|
|
|
var P_HoneyTrees_Slots = SlotsP_HoneyTree.Clone(HoneyTreesLocation);
|
|
|
|
|
var Pt_HoneyTrees_Slots = SlotsPt_HoneyTree.Clone(HoneyTreesLocation);
|
2017-04-07 04:18:02 +00:00
|
|
|
|
|
2017-03-20 14:49:05 +00:00
|
|
|
|
MarkG4SwarmSlots(ref HG_Slots, SlotsHG_Swarm);
|
|
|
|
|
MarkG4SwarmSlots(ref SS_Slots, SlotsSS_Swarm);
|
|
|
|
|
|
2017-03-21 07:20:51 +00:00
|
|
|
|
MarkG4AltFormSlots(ref D_Slots, 422, 1, Shellos_EastSeaLocation_DP);
|
|
|
|
|
MarkG4AltFormSlots(ref D_Slots, 423, 1, Gastrodon_EastSeaLocation_DP);
|
|
|
|
|
MarkG4AltFormSlots(ref P_Slots, 422, 1, Shellos_EastSeaLocation_DP);
|
|
|
|
|
MarkG4AltFormSlots(ref P_Slots, 423, 1, Gastrodon_EastSeaLocation_DP);
|
|
|
|
|
MarkG4AltFormSlots(ref Pt_Slots, 422, 1, Shellos_EastSeaLocation_Pt);
|
|
|
|
|
MarkG4AltFormSlots(ref Pt_Slots, 423, 1, Gastrodon_EastSeaLocation_Pt);
|
|
|
|
|
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
MarkDPPtEncounterTypeSlots_Route209(ref D_Slots);
|
|
|
|
|
MarkDPPtEncounterTypeSlots_Route209(ref P_Slots);
|
|
|
|
|
MarkDPPtEncounterTypeSlots_Route209(ref Pt_Slots);
|
|
|
|
|
MarkHGSSEncounterTypeSlots_RuinsofAlph(ref HG_Slots);
|
|
|
|
|
MarkHGSSEncounterTypeSlots_RuinsofAlph(ref SS_Slots);
|
|
|
|
|
|
2017-03-19 13:38:30 +00:00
|
|
|
|
MarkG4Slots(ref D_Slots);
|
|
|
|
|
MarkG4Slots(ref P_Slots);
|
|
|
|
|
MarkG4Slots(ref Pt_Slots);
|
|
|
|
|
MarkG4Slots(ref HG_Slots);
|
|
|
|
|
MarkG4Slots(ref SS_Slots);
|
2017-03-19 15:23:46 +00:00
|
|
|
|
MarkG4Slots(ref HG_Headbutt_Slots);
|
|
|
|
|
MarkG4Slots(ref SS_Headbutt_Slots);
|
2017-03-19 13:38:30 +00:00
|
|
|
|
|
2017-03-26 20:46:05 +00:00
|
|
|
|
MarkG4SlotsGreatMarsh(ref D_Slots, 52);
|
|
|
|
|
MarkG4SlotsGreatMarsh(ref P_Slots, 52);
|
|
|
|
|
MarkG4SlotsGreatMarsh(ref Pt_Slots, 52);
|
|
|
|
|
|
2017-03-27 03:23:45 +00:00
|
|
|
|
SlotsD = addExtraTableSlots(D_Slots, D_HoneyTrees_Slots, DP_GreatMarshAlt, SlotsDPPPtAlt, DP_Trophy);
|
|
|
|
|
SlotsP = addExtraTableSlots(P_Slots, P_HoneyTrees_Slots, DP_GreatMarshAlt, SlotsDPPPtAlt, DP_Trophy);
|
|
|
|
|
SlotsPt = addExtraTableSlots(Pt_Slots, Pt_HoneyTrees_Slots, Pt_GreatMarshAlt, SlotsDPPPtAlt, Pt_Trophy);
|
2017-03-26 08:25:21 +00:00
|
|
|
|
SlotsHG = addExtraTableSlots(HG_Slots, HG_Headbutt_Slots, SlotsHGSSAlt);
|
|
|
|
|
SlotsSS = addExtraTableSlots(SS_Slots, SS_Headbutt_Slots, SlotsHGSSAlt);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
MarkDPPtEncounterTypeSlots(ref D_Slots);
|
|
|
|
|
MarkDPPtEncounterTypeSlots(ref P_Slots);
|
|
|
|
|
MarkDPPtEncounterTypeSlots(ref Pt_Slots);
|
|
|
|
|
MarkHGSSEncounterTypeSlots(ref HG_Slots);
|
|
|
|
|
MarkHGSSEncounterTypeSlots(ref SS_Slots);
|
|
|
|
|
|
2017-03-19 12:33:20 +00:00
|
|
|
|
Evolves4 = new EvolutionTree(new[] { Resources.evos_g4 }, GameVersion.DP, PersonalTable.DP, MaxSpeciesID_4);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
|
|
|
|
// Update Personal Entries with Tutor Data
|
|
|
|
|
var tutors = Data.unpackMini(Resources.tutors_g4, "g4");
|
|
|
|
|
for (int i = 0; i <= MaxSpeciesID_4; i++)
|
|
|
|
|
PersonalTable.HGSS[i].AddTypeTutors(tutors[i]);
|
|
|
|
|
}
|
|
|
|
|
// Gen 5
|
|
|
|
|
{
|
2017-03-24 04:26:57 +00:00
|
|
|
|
MarkG5DreamWorld(ref BW_DreamWorld);
|
|
|
|
|
MarkG5DreamWorld(ref B2W2_DreamWorld);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
StaticB = getStaticEncounters(GameVersion.B);
|
|
|
|
|
StaticW = getStaticEncounters(GameVersion.W);
|
|
|
|
|
StaticB2 = getStaticEncounters(GameVersion.B2);
|
|
|
|
|
StaticW2 = getStaticEncounters(GameVersion.W2);
|
2017-02-26 17:36:53 +00:00
|
|
|
|
|
2017-03-22 00:57:23 +00:00
|
|
|
|
var BSlots = getEncounterTables(GameVersion.B);
|
|
|
|
|
var WSlots = getEncounterTables(GameVersion.W);
|
|
|
|
|
MarkG5Slots(ref BSlots);
|
|
|
|
|
MarkG5Slots(ref WSlots);
|
|
|
|
|
MarkBWSwarmSlots(ref SlotsB_Swarm);
|
|
|
|
|
MarkBWSwarmSlots(ref SlotsW_Swarm);
|
2017-03-24 01:38:31 +00:00
|
|
|
|
SlotsB = addExtraTableSlots(BSlots, SlotsB_Swarm);
|
2017-03-30 06:31:02 +00:00
|
|
|
|
SlotsW = addExtraTableSlots(WSlots, SlotsW_Swarm, WhiteForestSlot);
|
2017-03-22 00:57:23 +00:00
|
|
|
|
|
|
|
|
|
var B2Slots = getEncounterTables(GameVersion.B2);
|
|
|
|
|
var W2Slots = getEncounterTables(GameVersion.W2);
|
|
|
|
|
MarkG5Slots(ref B2Slots);
|
|
|
|
|
MarkG5Slots(ref W2Slots);
|
|
|
|
|
MarkB2W2SwarmSlots(ref SlotsB2_Swarm);
|
|
|
|
|
MarkB2W2SwarmSlots(ref SlotsW2_Swarm);
|
2017-03-22 06:22:22 +00:00
|
|
|
|
MarkG5HiddenGrottoSlots(ref SlotsB2_HiddenGrotto);
|
|
|
|
|
MarkG5HiddenGrottoSlots(ref SlotsW2_HiddenGrotto);
|
2017-03-26 08:25:21 +00:00
|
|
|
|
SlotsB2 = addExtraTableSlots(B2Slots, SlotsB2_Swarm, SlotsB2_HiddenGrotto);
|
|
|
|
|
SlotsW2 = addExtraTableSlots(W2Slots, SlotsW2_Swarm, SlotsW2_HiddenGrotto);
|
2017-03-03 02:24:50 +00:00
|
|
|
|
|
2017-03-19 12:33:20 +00:00
|
|
|
|
Evolves5 = new EvolutionTree(new[] { Resources.evos_g5 }, GameVersion.BW, PersonalTable.BW, MaxSpeciesID_5);
|
2017-02-25 20:37:01 +00:00
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
// Gen 6
|
2016-03-23 02:47:13 +00:00
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
StaticX = getStaticEncounters(GameVersion.X);
|
|
|
|
|
StaticY = getStaticEncounters(GameVersion.Y);
|
|
|
|
|
StaticA = getStaticEncounters(GameVersion.AS);
|
|
|
|
|
StaticO = getStaticEncounters(GameVersion.OR);
|
|
|
|
|
|
|
|
|
|
var XSlots = getEncounterTables(GameVersion.X);
|
|
|
|
|
var YSlots = getEncounterTables(GameVersion.Y);
|
|
|
|
|
MarkG6XYSlots(ref XSlots);
|
|
|
|
|
MarkG6XYSlots(ref YSlots);
|
2017-03-24 01:38:31 +00:00
|
|
|
|
SlotsX = addExtraTableSlots(XSlots, SlotsXYAlt);
|
|
|
|
|
SlotsY = addExtraTableSlots(YSlots, SlotsXYAlt);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
|
|
|
|
SlotsA = getEncounterTables(GameVersion.AS);
|
|
|
|
|
SlotsO = getEncounterTables(GameVersion.OR);
|
|
|
|
|
MarkG6AOSlots(ref SlotsA);
|
|
|
|
|
MarkG6AOSlots(ref SlotsO);
|
2016-11-15 02:25:08 +00:00
|
|
|
|
|
2017-02-11 23:20:44 +00:00
|
|
|
|
Evolves6 = new EvolutionTree(Data.unpackMini(Resources.evos_ao, "ao"), GameVersion.ORAS, PersonalTable.AO, MaxSpeciesID_6);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
|
|
|
|
// Gen 7
|
|
|
|
|
{
|
|
|
|
|
StaticSN = getStaticEncounters(GameVersion.SN);
|
|
|
|
|
StaticMN = getStaticEncounters(GameVersion.MN);
|
2016-11-23 01:37:18 +00:00
|
|
|
|
var REG_SN = getEncounterTables(GameVersion.SN);
|
|
|
|
|
var REG_MN = getEncounterTables(GameVersion.MN);
|
2017-02-11 23:20:44 +00:00
|
|
|
|
var SOS_SN = getEncounterTables(Resources.encounter_sn_sos, "sm");
|
|
|
|
|
var SOS_MN = getEncounterTables(Resources.encounter_mn_sos, "sm");
|
2017-03-21 07:20:51 +00:00
|
|
|
|
MarkG7REGSlots(ref REG_SN);
|
|
|
|
|
MarkG7REGSlots(ref REG_MN);
|
2016-11-23 01:37:18 +00:00
|
|
|
|
MarkG7SMSlots(ref SOS_SN);
|
|
|
|
|
MarkG7SMSlots(ref SOS_MN);
|
2017-03-26 08:25:21 +00:00
|
|
|
|
SlotsSN = addExtraTableSlots(REG_SN, SOS_SN, Encounter_Pelago_SM, Encounter_Pelago_SN);
|
|
|
|
|
SlotsMN = addExtraTableSlots(REG_MN, SOS_MN, Encounter_Pelago_SM, Encounter_Pelago_MN);
|
2016-11-15 02:25:08 +00:00
|
|
|
|
|
2017-02-11 23:20:44 +00:00
|
|
|
|
Evolves7 = new EvolutionTree(Data.unpackMini(Resources.evos_sm, "sm"), GameVersion.SM, PersonalTable.SM, MaxSpeciesID_7);
|
2016-04-21 02:47:40 +00:00
|
|
|
|
}
|
2016-02-26 15:52:08 +00:00
|
|
|
|
}
|
2016-03-23 02:47:13 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
// Moves
|
2017-04-09 02:05:29 +00:00
|
|
|
|
internal static int[] getMinLevelLearnMove(int species, int Generation, List<int> moves)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
{
|
|
|
|
|
var r = new int[moves.Count];
|
|
|
|
|
switch (Generation)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.RB.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
var pi_rb = (PersonalInfoG1)PersonalTable.RB[index];
|
|
|
|
|
var pi_y = (PersonalInfoG1)PersonalTable.Y[index];
|
|
|
|
|
|
|
|
|
|
for (int m = 0; m < moves.Count; m++)
|
|
|
|
|
{
|
|
|
|
|
if (pi_rb.Moves.Contains(moves[m]) || pi_y.Moves.Contains(moves[m]))
|
|
|
|
|
r[m] = 1;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var rb_level = LevelUpRB[index].getLevelLearnMove(moves[m]);
|
|
|
|
|
var y_level = LevelUpY[index].getLevelLearnMove(moves[m]);
|
|
|
|
|
// 0 means it is not learned in that game, select the other game
|
|
|
|
|
r[m] = rb_level == 0 ? y_level :
|
|
|
|
|
y_level == 0 ? rb_level :
|
|
|
|
|
Math.Min(rb_level, y_level);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return r;
|
|
|
|
|
}
|
2017-04-09 02:05:29 +00:00
|
|
|
|
internal static int[] getMaxLevelLearnMove(int species, int Generation, List<int> moves)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
{
|
|
|
|
|
var r = new int[moves.Count];
|
|
|
|
|
switch (Generation)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.RB.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
var pi_rb = (PersonalInfoG1)PersonalTable.RB[index];
|
|
|
|
|
var pi_y = (PersonalInfoG1)PersonalTable.Y[index];
|
|
|
|
|
|
|
|
|
|
for (int m = 0; m < moves.Count; m++)
|
|
|
|
|
{
|
|
|
|
|
if (pi_rb.Moves.Contains(moves[m]) && pi_y.Moves.Contains(moves[m]))
|
|
|
|
|
r[m] = 1;
|
|
|
|
|
else
|
|
|
|
|
r[m] = Math.Max(LevelUpRB[index].getLevelLearnMove(moves[m]), LevelUpY[index].getLevelLearnMove(moves[m]));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return r;
|
|
|
|
|
}
|
2017-04-09 02:05:29 +00:00
|
|
|
|
internal static List<int>[] getExclusiveMoves(int species1, int species2, int Generation, List<int> tmhm, int[] moves)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
{
|
|
|
|
|
// Return from two species the exclusive moves that only one could learn and also the current pokemon have it in its current moveset
|
|
|
|
|
var moves1 = getLvlMoves(species1, 0, Generation, 1, 100).Distinct().ToList();
|
|
|
|
|
var moves2 = getLvlMoves(species2, 0, Generation, 1, 100).Distinct().ToList();
|
|
|
|
|
var common = moves1.Intersect(moves2).ToList();
|
|
|
|
|
// Remove common moves, remove not learned moves and remove tmhm
|
|
|
|
|
moves1.RemoveAll(x => !moves.Contains(x) || common.Contains(x) || tmhm.Contains(x));
|
|
|
|
|
moves2.RemoveAll(x => !moves.Contains(x) || common.Contains(x) || tmhm.Contains(x));
|
|
|
|
|
return new[] { moves1, moves2 };
|
|
|
|
|
}
|
|
|
|
|
internal static IEnumerable<int> getLvlMoves(int species, int form, int Generation, int minlvl, int lvl, GameVersion Version = GameVersion.Any)
|
|
|
|
|
{
|
|
|
|
|
var r = new List<int>();
|
|
|
|
|
var ver = Version;
|
|
|
|
|
switch (Generation)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.RB.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
var pi_rb = (PersonalInfoG1)PersonalTable.RB[index];
|
|
|
|
|
var pi_y = (PersonalInfoG1)PersonalTable.Y[index];
|
|
|
|
|
if (minlvl == 1)
|
|
|
|
|
{
|
|
|
|
|
r.AddRange(pi_rb.Moves);
|
|
|
|
|
r.AddRange(pi_y.Moves);
|
|
|
|
|
}
|
2017-04-09 02:05:29 +00:00
|
|
|
|
r.AddRange(LevelUpRB[index].getMoves(lvl, minlvl));
|
|
|
|
|
r.AddRange(LevelUpY[index].getMoves(lvl, minlvl));
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.C.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
r.AddRange(LevelUpGS[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpC[index].getMoves(lvl));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.E.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
if (index == 386)
|
|
|
|
|
{
|
|
|
|
|
switch (form)
|
|
|
|
|
{
|
|
|
|
|
case 0: r.AddRange(LevelUpRS[index].getMoves(lvl)); break;
|
|
|
|
|
case 1: r.AddRange(LevelUpFR[index].getMoves(lvl)); break;
|
|
|
|
|
case 2: r.AddRange(LevelUpLG[index].getMoves(lvl)); break;
|
|
|
|
|
case 3: r.AddRange(LevelUpE[index].getMoves(lvl)); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Emerald level up table are equals to R/S level up tables
|
|
|
|
|
r.AddRange(LevelUpE[index].getMoves(lvl));
|
|
|
|
|
// fire red and leaf green are equals between each other but different than RSE
|
|
|
|
|
// Do not use FR Levelup table. It have 67 moves for charmander but Leaf Green moves table is correct
|
|
|
|
|
r.AddRange(LevelUpLG[index].getMoves(lvl));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.HGSS.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
r.AddRange(LevelUpDP[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpPt[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpHGSS[index].getMoves(lvl));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.B2W2.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
r.AddRange(LevelUpBW[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpB2W2[index].getMoves(lvl));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 6:
|
|
|
|
|
switch (ver)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.Any: // Start at the top, hit every table
|
|
|
|
|
case GameVersion.X:
|
|
|
|
|
case GameVersion.Y:
|
|
|
|
|
case GameVersion.XY:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.XY.getFormeIndex(species, form);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
r.AddRange(LevelUpXY[index].getMoves(lvl));
|
|
|
|
|
if (ver == GameVersion.Any) // Fall Through
|
|
|
|
|
goto case GameVersion.ORAS;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case GameVersion.AS:
|
|
|
|
|
case GameVersion.OR:
|
|
|
|
|
case GameVersion.ORAS:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.AO.getFormeIndex(species, form);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
r.AddRange(LevelUpAO[index].getMoves(lvl));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
switch (ver)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.Any:
|
|
|
|
|
case GameVersion.SN:
|
|
|
|
|
case GameVersion.MN:
|
|
|
|
|
case GameVersion.SM:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.SM.getFormeIndex(species, form);
|
|
|
|
|
r.AddRange(LevelUpSM[index].getMoves(lvl));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
return r;
|
|
|
|
|
}
|
2017-04-09 02:05:29 +00:00
|
|
|
|
internal static void RemoveFutureMoves(PKM pkm, ref List<int>[] validLevelMoves, ref List<int>[] validTMHM, ref List<int>[] validTutor)
|
2017-03-25 15:41:45 +00:00
|
|
|
|
{
|
2017-03-26 13:09:41 +00:00
|
|
|
|
var FutureMoves = new List<int>();
|
|
|
|
|
FutureMoves.AddRange(validLevelMoves[pkm.Format]);
|
|
|
|
|
FutureMoves.AddRange(validTMHM[pkm.Format]);
|
|
|
|
|
FutureMoves.AddRange(validTutor[pkm.Format]);
|
2017-03-25 17:19:38 +00:00
|
|
|
|
if (pkm.Format >= 3)
|
2017-03-25 15:41:45 +00:00
|
|
|
|
{
|
2017-03-25 20:53:33 +00:00
|
|
|
|
if (pkm.VC1)
|
2017-03-25 15:41:45 +00:00
|
|
|
|
{
|
2017-03-25 20:53:33 +00:00
|
|
|
|
validLevelMoves[1]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTMHM[1]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTutor[1]?.RemoveAll(x => FutureMoves.Contains(x));
|
2017-03-25 18:49:34 +00:00
|
|
|
|
}
|
|
|
|
|
else if (pkm.VC2)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 2; i >= 1; i--)
|
|
|
|
|
{
|
2017-03-25 20:53:33 +00:00
|
|
|
|
validLevelMoves[i]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTMHM[i]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTutor[i]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
|
|
|
|
|
if (validLevelMoves[i] == null || validTMHM[i] == null || validTutor[i] == null)
|
|
|
|
|
continue;
|
|
|
|
|
FutureMoves.AddRange(validLevelMoves[i].Concat(validTMHM[i]).Concat(validTutor[i]));
|
2017-03-25 18:49:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (int i = pkm.Format - 1; i >= pkm.GenNumber; i--)
|
|
|
|
|
{
|
2017-03-25 20:53:33 +00:00
|
|
|
|
validLevelMoves[i]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTMHM[i]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTutor[i]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
|
|
|
|
|
if (validLevelMoves[i] == null || validTMHM[i] == null || validTutor[i] == null)
|
|
|
|
|
continue;
|
|
|
|
|
FutureMoves.AddRange(validLevelMoves[i].Concat(validTMHM[i]).Concat(validTutor[i]));
|
2017-03-25 18:49:34 +00:00
|
|
|
|
}
|
2017-03-25 15:41:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-03-25 20:53:33 +00:00
|
|
|
|
int tradeback = pkm.Format == 2 ? 1 : 2;
|
2017-03-26 13:09:41 +00:00
|
|
|
|
validLevelMoves[tradeback]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTMHM[tradeback]?.RemoveAll(x => FutureMoves.Contains(x));
|
|
|
|
|
validTutor[tradeback]?.RemoveAll(x => FutureMoves.Contains(x));
|
2017-03-25 15:41:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
internal static List<int>[] getValidMovesAllGens(PKM pkm, DexLevel[][] evoChains, int minLvLG1 = 1, bool LVL = true, bool Tutor = true, bool Machine = true, bool MoveReminder = true, bool RemoveTransferHM = true)
|
2017-03-25 12:27:42 +00:00
|
|
|
|
{
|
2017-03-25 20:53:33 +00:00
|
|
|
|
List<int>[] Moves = new List<int>[evoChains.Length];
|
2017-03-25 12:27:42 +00:00
|
|
|
|
for (int i = 1; i < evoChains.Length; i++)
|
2017-03-25 17:19:38 +00:00
|
|
|
|
if (evoChains[i].Any())
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
Moves[i] = getValidMoves(pkm, evoChains[i], i, minLvLG1, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM).ToList();
|
2017-03-26 05:23:54 +00:00
|
|
|
|
else
|
|
|
|
|
Moves[i] = new List<int>();
|
2017-03-25 12:27:42 +00:00
|
|
|
|
return Moves;
|
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
internal static IEnumerable<int> getValidMoves(PKM pkm, DexLevel[][] evoChains, int minLvLG1 = 1, bool LVL = true, bool Tutor = true, bool Machine = true, bool MoveReminder = true, bool RemoveTransferHM = true)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
2016-11-09 06:10:32 +00:00
|
|
|
|
GameVersion version = (GameVersion)pkm.Version;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
if (!pkm.IsUntraded)
|
2016-11-09 06:10:32 +00:00
|
|
|
|
version = GameVersion.Any;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return getValidMoves(pkm, version, evoChains, minLvLG1: minLvLG1, LVL: LVL, Relearn: false, Tutor: Tutor, Machine: Machine, MoveReminder: MoveReminder, RemoveTransferHM: RemoveTransferHM);
|
2017-02-15 22:33:59 +00:00
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
internal static IEnumerable<int> getValidMoves(PKM pkm, DexLevel[] evoChain, int generation, int minLvLG1 = 1, bool LVL = true, bool Tutor = true, bool Machine = true, bool MoveReminder = true, bool RemoveTransferHM = true)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
{
|
|
|
|
|
GameVersion version = (GameVersion)pkm.Version;
|
|
|
|
|
if (!pkm.IsUntraded)
|
|
|
|
|
version = GameVersion.Any;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return getValidMoves(pkm, version, evoChain, generation, minLvLG1: minLvLG1, LVL: LVL, Relearn: false, Tutor: Tutor, Machine: Machine, MoveReminder: MoveReminder, RemoveTransferHM: RemoveTransferHM);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
2016-10-23 19:48:49 +00:00
|
|
|
|
internal static IEnumerable<int> getValidRelearn(PKM pkm, int skipOption)
|
2016-02-23 06:52:48 +00:00
|
|
|
|
{
|
2016-03-04 06:12:22 +00:00
|
|
|
|
List<int> r = new List<int> { 0 };
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (pkm.GenNumber < 6 || pkm.VC)
|
2017-02-12 17:52:26 +00:00
|
|
|
|
return r;
|
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
int species = getBaseSpecies(pkm, skipOption);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
r.AddRange(getRelearnLVLMoves(pkm, species, 1, pkm.AltForm));
|
2016-11-12 06:13:40 +00:00
|
|
|
|
|
|
|
|
|
int form = pkm.AltForm;
|
|
|
|
|
if (pkm.Format == 6 && pkm.Species != 678)
|
|
|
|
|
form = 0;
|
|
|
|
|
|
|
|
|
|
r.AddRange(getEggMoves(pkm, species, form));
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
if(pkm.Species != 489)
|
|
|
|
|
r.AddRange(getRelearnLVLMoves(pkm, species, 100, pkm.AltForm));
|
2016-03-12 17:16:41 +00:00
|
|
|
|
return r.Distinct();
|
2016-02-23 06:52:48 +00:00
|
|
|
|
}
|
Shedinja evolution moves and some egg fixes (#1015)
* Add getMoves function with min level and max level, usefull for shedjina evolves moves (min level 20) and generation 1 moves ( no move reminder, min level is min encounter level + 1)
Also for gen1 encounters another function should be created to get by the encounter level the four moves that the pokemon learn by default, the last four in its movepool up until the encounter level
* getShedinjaEvolveMoves, function that return the moves that shedinja could learn from Ninjask move pool at the moment when Nincada evolves, in the same format that getValidMovesAllGens
* Add validation in parse moves for shedinja evolve moves.
Shedinja could have any gen3/4 moves from Ninjas learnset but only one is allowed
* Shedinja evolve moves text resources
* Fix egg moves pre-gen 6 validation:
Add skipoption variable to getEggMoves function from pre-gen6 games, to verify egg moves from split breed species
Flag illegal combinations of base egg moves and special egg moves
Return crystal egg moves for gen2 pokemon that can be tradeback to gen 1 games
* Fix for mix between event egg moves and base egg moves
* Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move
* Revert "Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move"
Revert the last change, i search in bulbapedia an there wasn't any nincada distributed with special moves in generation 3 nor 4, making this complicated validation unnecessary
This reverts commit 57f5ac1bbb75e32e417b575619339cae5e5d1ef2.
* Fix error
2017-04-01 00:40:30 +00:00
|
|
|
|
internal static List<int>[] getShedinjaEvolveMoves(PKM pkm, int lvl = -1, int generation = 0)
|
|
|
|
|
{
|
|
|
|
|
var size = pkm.Format > 3 ? 4 : 3;
|
|
|
|
|
List<int>[] r = new List<int>[size + 1];
|
|
|
|
|
for (int i = 1; i <= size; i++)
|
|
|
|
|
r[i] = new List<int>();
|
|
|
|
|
if (lvl == -1)
|
|
|
|
|
lvl = pkm.CurrentLevel;
|
|
|
|
|
if (pkm.Species != 292 || lvl < 20)
|
|
|
|
|
return r;
|
2017-04-01 01:35:43 +00:00
|
|
|
|
|
Shedinja evolution moves and some egg fixes (#1015)
* Add getMoves function with min level and max level, usefull for shedjina evolves moves (min level 20) and generation 1 moves ( no move reminder, min level is min encounter level + 1)
Also for gen1 encounters another function should be created to get by the encounter level the four moves that the pokemon learn by default, the last four in its movepool up until the encounter level
* getShedinjaEvolveMoves, function that return the moves that shedinja could learn from Ninjask move pool at the moment when Nincada evolves, in the same format that getValidMovesAllGens
* Add validation in parse moves for shedinja evolve moves.
Shedinja could have any gen3/4 moves from Ninjas learnset but only one is allowed
* Shedinja evolve moves text resources
* Fix egg moves pre-gen 6 validation:
Add skipoption variable to getEggMoves function from pre-gen6 games, to verify egg moves from split breed species
Flag illegal combinations of base egg moves and special egg moves
Return crystal egg moves for gen2 pokemon that can be tradeback to gen 1 games
* Fix for mix between event egg moves and base egg moves
* Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move
* Revert "Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move"
Revert the last change, i search in bulbapedia an there wasn't any nincada distributed with special moves in generation 3 nor 4, making this complicated validation unnecessary
This reverts commit 57f5ac1bbb75e32e417b575619339cae5e5d1ef2.
* Fix error
2017-04-01 00:40:30 +00:00
|
|
|
|
// If nincada evolves into Ninjask an learn in the evolution a move from ninjask learnset pool
|
|
|
|
|
// Shedinja would appear with that move learned. Only one move above level 20 allowed, only in generations 3 and 4
|
2017-04-01 01:35:43 +00:00
|
|
|
|
switch (generation)
|
Shedinja evolution moves and some egg fixes (#1015)
* Add getMoves function with min level and max level, usefull for shedjina evolves moves (min level 20) and generation 1 moves ( no move reminder, min level is min encounter level + 1)
Also for gen1 encounters another function should be created to get by the encounter level the four moves that the pokemon learn by default, the last four in its movepool up until the encounter level
* getShedinjaEvolveMoves, function that return the moves that shedinja could learn from Ninjask move pool at the moment when Nincada evolves, in the same format that getValidMovesAllGens
* Add validation in parse moves for shedinja evolve moves.
Shedinja could have any gen3/4 moves from Ninjas learnset but only one is allowed
* Shedinja evolve moves text resources
* Fix egg moves pre-gen 6 validation:
Add skipoption variable to getEggMoves function from pre-gen6 games, to verify egg moves from split breed species
Flag illegal combinations of base egg moves and special egg moves
Return crystal egg moves for gen2 pokemon that can be tradeback to gen 1 games
* Fix for mix between event egg moves and base egg moves
* Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move
* Revert "Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move"
Revert the last change, i search in bulbapedia an there wasn't any nincada distributed with special moves in generation 3 nor 4, making this complicated validation unnecessary
This reverts commit 57f5ac1bbb75e32e417b575619339cae5e5d1ef2.
* Fix error
2017-04-01 00:40:30 +00:00
|
|
|
|
{
|
2017-04-01 01:35:43 +00:00
|
|
|
|
case 0: // Default (both)
|
|
|
|
|
case 3: // Ninjask have the same learnset in every gen 3 games
|
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
2017-04-09 02:05:29 +00:00
|
|
|
|
r[3] = LevelUpE[291].getMoves(lvl, 20).ToList();
|
2017-04-01 01:35:43 +00:00
|
|
|
|
|
|
|
|
|
if (generation == 0)
|
|
|
|
|
goto case 4;
|
|
|
|
|
break;
|
|
|
|
|
case 4: // Ninjask have the same learnset in every gen 4 games
|
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
2017-04-09 02:05:29 +00:00
|
|
|
|
r[4] = LevelUpPt[291].getMoves(lvl, 20).ToList();
|
2017-04-01 01:35:43 +00:00
|
|
|
|
break;
|
Shedinja evolution moves and some egg fixes (#1015)
* Add getMoves function with min level and max level, usefull for shedjina evolves moves (min level 20) and generation 1 moves ( no move reminder, min level is min encounter level + 1)
Also for gen1 encounters another function should be created to get by the encounter level the four moves that the pokemon learn by default, the last four in its movepool up until the encounter level
* getShedinjaEvolveMoves, function that return the moves that shedinja could learn from Ninjask move pool at the moment when Nincada evolves, in the same format that getValidMovesAllGens
* Add validation in parse moves for shedinja evolve moves.
Shedinja could have any gen3/4 moves from Ninjas learnset but only one is allowed
* Shedinja evolve moves text resources
* Fix egg moves pre-gen 6 validation:
Add skipoption variable to getEggMoves function from pre-gen6 games, to verify egg moves from split breed species
Flag illegal combinations of base egg moves and special egg moves
Return crystal egg moves for gen2 pokemon that can be tradeback to gen 1 games
* Fix for mix between event egg moves and base egg moves
* Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move
* Revert "Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move"
Revert the last change, i search in bulbapedia an there wasn't any nincada distributed with special moves in generation 3 nor 4, making this complicated validation unnecessary
This reverts commit 57f5ac1bbb75e32e417b575619339cae5e5d1ef2.
* Fix error
2017-04-01 00:40:30 +00:00
|
|
|
|
}
|
|
|
|
|
return r;
|
|
|
|
|
}
|
2017-03-25 02:24:01 +00:00
|
|
|
|
internal static IEnumerable<int> getBaseEggMoves(PKM pkm, int skipOption, GameVersion gameSource, int lvl)
|
2016-03-06 19:19:09 +00:00
|
|
|
|
{
|
2017-04-13 15:48:13 +00:00
|
|
|
|
int species = getBaseEggSpecies(pkm, skipOption);
|
2016-03-23 05:50:54 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
if (gameSource == GameVersion.Any)
|
|
|
|
|
gameSource = (GameVersion) pkm.Version;
|
2016-03-22 02:53:02 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
switch (gameSource)
|
2016-03-22 02:53:02 +00:00
|
|
|
|
{
|
2017-03-26 02:57:38 +00:00
|
|
|
|
case GameVersion.GS:
|
|
|
|
|
if (pkm.InhabitedGeneration(2))
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
if (pkm.Format == 1)
|
|
|
|
|
return LevelUpGS[species].getMoves(lvl).Where(m => m <= MaxMoveID_1).ToArray();
|
|
|
|
|
else
|
|
|
|
|
return LevelUpGS[species].getMoves(lvl);
|
2017-03-26 02:57:38 +00:00
|
|
|
|
break;
|
|
|
|
|
case GameVersion.C:
|
|
|
|
|
if (pkm.InhabitedGeneration(2))
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
if (pkm.Format == 1)
|
|
|
|
|
return LevelUpC[species].getMoves(lvl).Where(m => m <= MaxMoveID_1).ToArray();
|
|
|
|
|
else
|
|
|
|
|
return LevelUpC[species].getMoves(lvl);
|
2017-03-26 02:57:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case GameVersion.R:
|
|
|
|
|
case GameVersion.S:
|
|
|
|
|
case GameVersion.RS:
|
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpRS[species].getMoves(lvl);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
case GameVersion.E:
|
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpE[species].getMoves(lvl);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
case GameVersion.FR:
|
|
|
|
|
case GameVersion.LG:
|
|
|
|
|
case GameVersion.FRLG:
|
|
|
|
|
// only difference in FR/LG is deoxys which doesn't breed.
|
|
|
|
|
if (pkm.InhabitedGeneration(3))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpFR[species].getMoves(lvl);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GameVersion.D:
|
|
|
|
|
case GameVersion.P:
|
|
|
|
|
case GameVersion.DP:
|
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpDP[species].getMoves(lvl);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
case GameVersion.Pt:
|
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpPt[species].getMoves(lvl);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
case GameVersion.HG:
|
|
|
|
|
case GameVersion.SS:
|
|
|
|
|
case GameVersion.HGSS:
|
|
|
|
|
if (pkm.InhabitedGeneration(4))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpHGSS[species].getMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GameVersion.B:
|
|
|
|
|
case GameVersion.W:
|
|
|
|
|
case GameVersion.BW:
|
|
|
|
|
if (pkm.InhabitedGeneration(5))
|
|
|
|
|
return LevelUpBW[species].getMoves(lvl);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GameVersion.B2:
|
|
|
|
|
case GameVersion.W2:
|
|
|
|
|
case GameVersion.B2W2:
|
|
|
|
|
if (pkm.InhabitedGeneration(5))
|
|
|
|
|
return LevelUpBW[species].getMoves(lvl);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
case GameVersion.X:
|
|
|
|
|
case GameVersion.Y:
|
|
|
|
|
case GameVersion.XY:
|
|
|
|
|
if (pkm.InhabitedGeneration(6))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpXY[species].getMoves(lvl);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
break;
|
2016-03-05 04:43:00 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
case GameVersion.AS:
|
|
|
|
|
case GameVersion.OR:
|
|
|
|
|
case GameVersion.ORAS:
|
|
|
|
|
if (pkm.InhabitedGeneration(6))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpAO[species].getMoves(lvl);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
break;
|
2016-03-22 02:53:02 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
case GameVersion.SN:
|
|
|
|
|
case GameVersion.MN:
|
|
|
|
|
case GameVersion.SM:
|
2016-11-12 14:10:44 +00:00
|
|
|
|
int index = PersonalTable.SM.getFormeIndex(species, pkm.AltForm);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(7))
|
2017-03-25 02:24:01 +00:00
|
|
|
|
return LevelUpSM[index].getMoves(lvl);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
break;
|
2016-03-22 02:53:02 +00:00
|
|
|
|
}
|
2017-04-15 19:24:30 +00:00
|
|
|
|
return new int[0];
|
2016-03-05 04:43:00 +00:00
|
|
|
|
}
|
2017-04-23 14:46:14 +00:00
|
|
|
|
internal static List<int> getValidPostEvolutionMoves(PKM pkm, int Species, DexLevel[][] evoChains, GameVersion Version)
|
2017-04-23 12:54:52 +00:00
|
|
|
|
{
|
|
|
|
|
// Return moves that the pokemon could learn after evolving
|
|
|
|
|
var moves = new List<int>();
|
|
|
|
|
for (int i = 1; i < evoChains.Length; i++)
|
|
|
|
|
if (evoChains[i].Any())
|
2017-04-23 14:46:14 +00:00
|
|
|
|
moves.AddRange(getValidPostEvolutionMoves(pkm, Species, evoChains[i], i, Version));
|
2017-04-23 12:54:52 +00:00
|
|
|
|
if (pkm.GenNumber >= 6)
|
|
|
|
|
moves.AddRange(pkm.RelearnMoves.Where(m => m != 0));
|
|
|
|
|
return moves.Distinct().ToList();
|
|
|
|
|
}
|
2017-04-23 14:46:14 +00:00
|
|
|
|
internal static IEnumerable<int> getValidPostEvolutionMoves(PKM pkm, int Species, DexLevel[] evoChain, int Generation, GameVersion Version)
|
2017-04-23 12:54:52 +00:00
|
|
|
|
{
|
|
|
|
|
var evomoves = new List<int>();
|
|
|
|
|
var index = Array.FindIndex(evoChain, e => e.Species == Species);
|
2017-04-23 14:48:23 +00:00
|
|
|
|
for (int i = 0; i <= index; i++)
|
2017-04-23 12:54:52 +00:00
|
|
|
|
{
|
|
|
|
|
var evo = evoChain[i];
|
|
|
|
|
var moves = getMoves(pkm, evo.Species, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: false, RemoveTransferHM: false, Generation: Generation);
|
2017-04-23 14:48:23 +00:00
|
|
|
|
// Moves from Species or any species after in the evolution phase
|
|
|
|
|
evomoves.AddRange(moves);
|
2017-04-23 12:54:52 +00:00
|
|
|
|
}
|
|
|
|
|
return evomoves;
|
|
|
|
|
}
|
|
|
|
|
internal static List<int>[] getExclusivePreEvolutionMoves(PKM pkm, int Species,DexLevel[][] evoChains, GameVersion Version)
|
Split Breed Egg Moves improvements (#1058)
* Added method getBaseEggSpecies to get the base species when the pokemon was an egg, is needed because for format 1 pokemon with egg origin every time getBaseSpecies is called is returning the gen 1 base species obtaining invalid eggmoves and base egg moves
Also getBaseEggSpecies was using Evolves1 when format = 1 even when asking for a gen2 egg base species, returning Pikachu egg moves (empty list) instead of Pichu egg moves
* Fix ability checking for generation 3 pokemon, likea de Seadra from Issue #1011
pkm.AbilityNumber have a value assuming PID match ability like a generation 4 pokemon but the validation should be ignored if is a generation 3 pokemon with only one ability in generation 3
Also changed the validation for ingame trades with fixed abilities to check only with generation 3 abilities in the case the species has two abilities generation 3, if only one was possible any PID should be valid with the generation 3 ability
Encounter Trades
Also the check for evolution was wrong, the most evolved species is the first in the evochain, not the last
* Fix evoltuion chains for gen 3 pokemon in format 4
* Fix ability for generation 3 trades. Ability could not change if there were 2 abilities in generation 3, that means it is irrelevant if the pokemon evolved in gen 4-5, the ability number must match the encounter
* Added missing skipOption to a call to getBaseEggSpecies
* Functions to obtain moves excluvie to preevolutions, like moves that Azurill/Happiny could learn throught level up or TM but Marill/Chansey could not learn, icompatible with any Marill/Chansey egg moves
Also add functions to return egg moves and base egg moves for both possible species for split breed eggs
* Check both species from split breed egg at the same time to report moves incompatibilities
* Reduced generation 4-5 was egg game check
There is no need to check every possible generation game.
For every egg species HGSS learnset tables y egg moves table contains all the moves from the same species in DP and Pt, without any move exclusive to that games except in legendaries, and they cant breed
In generation 5 is the same with B2W2 except for Exxegutte, it have a exclusive level up move from B1W1, Psychic, but it can learn the move with TM, it wont count as an egg move
* Check incompatible split breed moves in verify relearn egg
* Fix generation 1 incompatibility moves check
SolarBeam removed from Exeggcute/Exeggutor incompatiblity, Exeggutor could learn it with a TM in generation 1
Removed Vaporeon Mist and Eevee Take Down incompatiblity, Vaporeon could learn Take Down with a TM in generation 1
2017-04-14 17:11:50 +00:00
|
|
|
|
{
|
|
|
|
|
// Return moves that the pokemon could only learn throught the preevolution Species
|
|
|
|
|
List<int>[] Moves = new List<int>[evoChains.Length];
|
|
|
|
|
for (int i = 1; i < evoChains.Length; i++)
|
|
|
|
|
if (evoChains[i].Any())
|
2017-04-23 12:54:52 +00:00
|
|
|
|
Moves[i] = getExclusivePreEvolutionMoves(pkm, Species, evoChains[i], i, Version).ToList();
|
Split Breed Egg Moves improvements (#1058)
* Added method getBaseEggSpecies to get the base species when the pokemon was an egg, is needed because for format 1 pokemon with egg origin every time getBaseSpecies is called is returning the gen 1 base species obtaining invalid eggmoves and base egg moves
Also getBaseEggSpecies was using Evolves1 when format = 1 even when asking for a gen2 egg base species, returning Pikachu egg moves (empty list) instead of Pichu egg moves
* Fix ability checking for generation 3 pokemon, likea de Seadra from Issue #1011
pkm.AbilityNumber have a value assuming PID match ability like a generation 4 pokemon but the validation should be ignored if is a generation 3 pokemon with only one ability in generation 3
Also changed the validation for ingame trades with fixed abilities to check only with generation 3 abilities in the case the species has two abilities generation 3, if only one was possible any PID should be valid with the generation 3 ability
Encounter Trades
Also the check for evolution was wrong, the most evolved species is the first in the evochain, not the last
* Fix evoltuion chains for gen 3 pokemon in format 4
* Fix ability for generation 3 trades. Ability could not change if there were 2 abilities in generation 3, that means it is irrelevant if the pokemon evolved in gen 4-5, the ability number must match the encounter
* Added missing skipOption to a call to getBaseEggSpecies
* Functions to obtain moves excluvie to preevolutions, like moves that Azurill/Happiny could learn throught level up or TM but Marill/Chansey could not learn, icompatible with any Marill/Chansey egg moves
Also add functions to return egg moves and base egg moves for both possible species for split breed eggs
* Check both species from split breed egg at the same time to report moves incompatibilities
* Reduced generation 4-5 was egg game check
There is no need to check every possible generation game.
For every egg species HGSS learnset tables y egg moves table contains all the moves from the same species in DP and Pt, without any move exclusive to that games except in legendaries, and they cant breed
In generation 5 is the same with B2W2 except for Exxegutte, it have a exclusive level up move from B1W1, Psychic, but it can learn the move with TM, it wont count as an egg move
* Check incompatible split breed moves in verify relearn egg
* Fix generation 1 incompatibility moves check
SolarBeam removed from Exeggcute/Exeggutor incompatiblity, Exeggutor could learn it with a TM in generation 1
Removed Vaporeon Mist and Eevee Take Down incompatiblity, Vaporeon could learn Take Down with a TM in generation 1
2017-04-14 17:11:50 +00:00
|
|
|
|
else
|
|
|
|
|
Moves[i] = new List<int>();
|
|
|
|
|
return Moves;
|
|
|
|
|
}
|
2017-04-23 12:54:52 +00:00
|
|
|
|
internal static IEnumerable<int> getExclusivePreEvolutionMoves(PKM pkm, int Species, DexLevel[] evoChain, int Generation, GameVersion Version)
|
Split Breed Egg Moves improvements (#1058)
* Added method getBaseEggSpecies to get the base species when the pokemon was an egg, is needed because for format 1 pokemon with egg origin every time getBaseSpecies is called is returning the gen 1 base species obtaining invalid eggmoves and base egg moves
Also getBaseEggSpecies was using Evolves1 when format = 1 even when asking for a gen2 egg base species, returning Pikachu egg moves (empty list) instead of Pichu egg moves
* Fix ability checking for generation 3 pokemon, likea de Seadra from Issue #1011
pkm.AbilityNumber have a value assuming PID match ability like a generation 4 pokemon but the validation should be ignored if is a generation 3 pokemon with only one ability in generation 3
Also changed the validation for ingame trades with fixed abilities to check only with generation 3 abilities in the case the species has two abilities generation 3, if only one was possible any PID should be valid with the generation 3 ability
Encounter Trades
Also the check for evolution was wrong, the most evolved species is the first in the evochain, not the last
* Fix evoltuion chains for gen 3 pokemon in format 4
* Fix ability for generation 3 trades. Ability could not change if there were 2 abilities in generation 3, that means it is irrelevant if the pokemon evolved in gen 4-5, the ability number must match the encounter
* Added missing skipOption to a call to getBaseEggSpecies
* Functions to obtain moves excluvie to preevolutions, like moves that Azurill/Happiny could learn throught level up or TM but Marill/Chansey could not learn, icompatible with any Marill/Chansey egg moves
Also add functions to return egg moves and base egg moves for both possible species for split breed eggs
* Check both species from split breed egg at the same time to report moves incompatibilities
* Reduced generation 4-5 was egg game check
There is no need to check every possible generation game.
For every egg species HGSS learnset tables y egg moves table contains all the moves from the same species in DP and Pt, without any move exclusive to that games except in legendaries, and they cant breed
In generation 5 is the same with B2W2 except for Exxegutte, it have a exclusive level up move from B1W1, Psychic, but it can learn the move with TM, it wont count as an egg move
* Check incompatible split breed moves in verify relearn egg
* Fix generation 1 incompatibility moves check
SolarBeam removed from Exeggcute/Exeggutor incompatiblity, Exeggutor could learn it with a TM in generation 1
Removed Vaporeon Mist and Eevee Take Down incompatiblity, Vaporeon could learn Take Down with a TM in generation 1
2017-04-14 17:11:50 +00:00
|
|
|
|
{
|
|
|
|
|
var preevomoves = new List<int>();
|
|
|
|
|
var evomoves = new List<int>();
|
|
|
|
|
var index = Array.FindIndex(evoChain, e => e.Species == Species);
|
2017-04-15 02:55:40 +00:00
|
|
|
|
for (int i = 0; i < evoChain.Length; i++)
|
Split Breed Egg Moves improvements (#1058)
* Added method getBaseEggSpecies to get the base species when the pokemon was an egg, is needed because for format 1 pokemon with egg origin every time getBaseSpecies is called is returning the gen 1 base species obtaining invalid eggmoves and base egg moves
Also getBaseEggSpecies was using Evolves1 when format = 1 even when asking for a gen2 egg base species, returning Pikachu egg moves (empty list) instead of Pichu egg moves
* Fix ability checking for generation 3 pokemon, likea de Seadra from Issue #1011
pkm.AbilityNumber have a value assuming PID match ability like a generation 4 pokemon but the validation should be ignored if is a generation 3 pokemon with only one ability in generation 3
Also changed the validation for ingame trades with fixed abilities to check only with generation 3 abilities in the case the species has two abilities generation 3, if only one was possible any PID should be valid with the generation 3 ability
Encounter Trades
Also the check for evolution was wrong, the most evolved species is the first in the evochain, not the last
* Fix evoltuion chains for gen 3 pokemon in format 4
* Fix ability for generation 3 trades. Ability could not change if there were 2 abilities in generation 3, that means it is irrelevant if the pokemon evolved in gen 4-5, the ability number must match the encounter
* Added missing skipOption to a call to getBaseEggSpecies
* Functions to obtain moves excluvie to preevolutions, like moves that Azurill/Happiny could learn throught level up or TM but Marill/Chansey could not learn, icompatible with any Marill/Chansey egg moves
Also add functions to return egg moves and base egg moves for both possible species for split breed eggs
* Check both species from split breed egg at the same time to report moves incompatibilities
* Reduced generation 4-5 was egg game check
There is no need to check every possible generation game.
For every egg species HGSS learnset tables y egg moves table contains all the moves from the same species in DP and Pt, without any move exclusive to that games except in legendaries, and they cant breed
In generation 5 is the same with B2W2 except for Exxegutte, it have a exclusive level up move from B1W1, Psychic, but it can learn the move with TM, it wont count as an egg move
* Check incompatible split breed moves in verify relearn egg
* Fix generation 1 incompatibility moves check
SolarBeam removed from Exeggcute/Exeggutor incompatiblity, Exeggutor could learn it with a TM in generation 1
Removed Vaporeon Mist and Eevee Take Down incompatiblity, Vaporeon could learn Take Down with a TM in generation 1
2017-04-14 17:11:50 +00:00
|
|
|
|
{
|
|
|
|
|
var evo = evoChain[i];
|
|
|
|
|
var moves = getMoves(pkm, evo.Species, 1, evo.Level, pkm.AltForm, moveTutor: true, Version: Version, LVL: true, specialTutors: true, Machine: true, MoveReminder: false, RemoveTransferHM: false, Generation: Generation);
|
|
|
|
|
if (i >= index)
|
|
|
|
|
// Moves from Species or any species bellow in the evolution phase
|
|
|
|
|
preevomoves.AddRange(moves);
|
|
|
|
|
else
|
|
|
|
|
// Moves in phase evolutions after the limit species, this moves should be removed
|
|
|
|
|
evomoves.AddRange(moves);
|
|
|
|
|
}
|
|
|
|
|
preevomoves.RemoveAll(x => evomoves.Contains(x));
|
|
|
|
|
return preevomoves.Distinct().ToList();
|
|
|
|
|
}
|
|
|
|
|
internal static List<int>[] getBaseEggMoves(PKM pkm, GameVersion gameSource, int lvl)
|
|
|
|
|
{
|
|
|
|
|
if (SplitBreed.Contains(pkm.Species))
|
|
|
|
|
return new[]
|
|
|
|
|
{
|
|
|
|
|
getBaseEggMoves(pkm, 0, gameSource,lvl).ToList(),
|
|
|
|
|
getBaseEggMoves(pkm, 1, gameSource,lvl).ToList(),
|
|
|
|
|
};
|
|
|
|
|
return new[] { getBaseEggMoves(pkm, 0, gameSource, lvl).ToList(), };
|
|
|
|
|
}
|
|
|
|
|
internal static List<int>[] getEggMoves(PKM pkm, GameVersion Version)
|
|
|
|
|
{
|
|
|
|
|
if (SplitBreed.Contains(pkm.Species))
|
|
|
|
|
return new[]
|
|
|
|
|
{
|
|
|
|
|
getEggMoves(pkm, getBaseEggSpecies(pkm, 0), 0, Version).ToList(),
|
|
|
|
|
getEggMoves(pkm, getBaseEggSpecies(pkm, 1), 0, Version).ToList()
|
|
|
|
|
};
|
|
|
|
|
return new[] { getEggMoves(pkm, getBaseEggSpecies(pkm, 0), 0, Version).ToList() };
|
|
|
|
|
}
|
Shedinja evolution moves and some egg fixes (#1015)
* Add getMoves function with min level and max level, usefull for shedjina evolves moves (min level 20) and generation 1 moves ( no move reminder, min level is min encounter level + 1)
Also for gen1 encounters another function should be created to get by the encounter level the four moves that the pokemon learn by default, the last four in its movepool up until the encounter level
* getShedinjaEvolveMoves, function that return the moves that shedinja could learn from Ninjask move pool at the moment when Nincada evolves, in the same format that getValidMovesAllGens
* Add validation in parse moves for shedinja evolve moves.
Shedinja could have any gen3/4 moves from Ninjas learnset but only one is allowed
* Shedinja evolve moves text resources
* Fix egg moves pre-gen 6 validation:
Add skipoption variable to getEggMoves function from pre-gen6 games, to verify egg moves from split breed species
Flag illegal combinations of base egg moves and special egg moves
Return crystal egg moves for gen2 pokemon that can be tradeback to gen 1 games
* Fix for mix between event egg moves and base egg moves
* Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move
* Revert "Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move"
Revert the last change, i search in bulbapedia an there wasn't any nincada distributed with special moves in generation 3 nor 4, making this complicated validation unnecessary
This reverts commit 57f5ac1bbb75e32e417b575619339cae5e5d1ef2.
* Fix error
2017-04-01 00:40:30 +00:00
|
|
|
|
internal static IEnumerable<int> getEggMoves(PKM pkm, int skipOption, GameVersion Version)
|
2017-02-28 04:57:24 +00:00
|
|
|
|
{
|
2017-04-13 15:48:13 +00:00
|
|
|
|
return getEggMoves(pkm, getBaseEggSpecies(pkm, skipOption), 0, Version);
|
2017-03-25 18:02:33 +00:00
|
|
|
|
}
|
2017-04-07 00:41:25 +00:00
|
|
|
|
internal static IEnumerable<EncounterStatic> getG3SpecialEggEncounter(PKM pkm)
|
2017-03-25 18:02:33 +00:00
|
|
|
|
{
|
2017-04-21 02:51:35 +00:00
|
|
|
|
IEnumerable<DexLevel> dl = getValidPreEvolutions(pkm, MaxSpeciesID_3);
|
2017-04-10 12:11:07 +00:00
|
|
|
|
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));
|
2017-04-07 00:41:25 +00:00
|
|
|
|
foreach (EncounterStatic e in table)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Moves.All(m => !e.Moves.Contains(m))) // No special move
|
|
|
|
|
continue;
|
|
|
|
|
if (e.Nature != Nature.Random && pkm.Nature != (int)e.Nature)
|
|
|
|
|
continue;
|
|
|
|
|
if (e.Gender != -1 && e.Gender != pkm.Gender)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
yield return e;
|
|
|
|
|
}
|
2017-03-25 18:02:33 +00:00
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
|
|
|
|
// Encounter
|
2016-10-23 19:48:49 +00:00
|
|
|
|
internal static EncounterLink getValidLinkGifts(PKM pkm)
|
2016-03-23 05:50:54 +00:00
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
switch (pkm.GenNumber)
|
|
|
|
|
{
|
|
|
|
|
case 6:
|
|
|
|
|
return LinkGifts6.FirstOrDefault(g => g.Species == pkm.Species && g.Level == pkm.Met_Level);
|
|
|
|
|
default:
|
2017-02-12 17:52:26 +00:00
|
|
|
|
return null;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
2016-03-23 05:50:54 +00:00
|
|
|
|
}
|
2017-03-26 20:23:57 +00:00
|
|
|
|
internal static bool IsSafariSlot(SlotType t)
|
|
|
|
|
{
|
2017-03-26 20:46:05 +00:00
|
|
|
|
if (t == SlotType.Grass_Safari || t == SlotType.Surf_Safari ||
|
|
|
|
|
t == SlotType.Rock_Smash_Safari || t == SlotType.Pokeradar_Safari ||
|
|
|
|
|
t == SlotType.Old_Rod_Safari || t == SlotType.Good_Rod_Safari || t == SlotType.Super_Rod_Safari)
|
2017-03-26 20:23:57 +00:00
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2017-02-27 05:46:00 +00:00
|
|
|
|
internal static EncounterSlot[] getValidWildEncounters(PKM pkm, GameVersion gameSource = GameVersion.Any)
|
2016-03-10 05:32:42 +00:00
|
|
|
|
{
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (gameSource == GameVersion.Any)
|
2017-03-27 02:10:31 +00:00
|
|
|
|
gameSource = (GameVersion) pkm.Version;
|
2017-02-27 05:46:00 +00:00
|
|
|
|
|
2016-03-23 02:47:13 +00:00
|
|
|
|
List<EncounterSlot> s = new List<EncounterSlot>();
|
2016-03-19 00:18:01 +00:00
|
|
|
|
|
2017-02-27 05:46:00 +00:00
|
|
|
|
foreach (var area in getEncounterAreas(pkm, gameSource))
|
2017-04-04 02:59:29 +00:00
|
|
|
|
s.AddRange(getValidEncounterSlots(pkm, area, DexNav: pkm.AO, gameSource: gameSource));
|
2017-03-26 20:23:57 +00:00
|
|
|
|
|
2017-04-14 22:10:19 +00:00
|
|
|
|
if (s.Count <= 1 || 3 > pkm.GenNumber || pkm.GenNumber > 4 || (pkm.Gen3 && pkm.HasOriginalMetLocation))
|
2017-03-27 02:10:31 +00:00
|
|
|
|
return s.Any() ? s.ToArray() : null;
|
|
|
|
|
|
2017-04-14 22:10:19 +00:00
|
|
|
|
// If has original met location or there is only one possible slot does not check safari zone
|
2017-03-27 02:10:31 +00:00
|
|
|
|
// defer to ball legality
|
|
|
|
|
var IsSafariBall = pkm.Ball == 5;
|
|
|
|
|
var s_Safari = IsSafariBall
|
|
|
|
|
? s.Where(slot => IsSafariSlot(slot.Type)).ToList()
|
|
|
|
|
: s.Where(slot => !IsSafariSlot(slot.Type)).ToList();
|
|
|
|
|
if (s_Safari.Any())
|
|
|
|
|
// safari ball only in safari zones and non safari ball only outside safari zones
|
|
|
|
|
s = s_Safari.ToList();
|
|
|
|
|
|
|
|
|
|
if (s.Count <= 1 || pkm.GenNumber != 4)
|
|
|
|
|
return s.Any() ? s.ToArray() : null;
|
|
|
|
|
|
2017-04-14 22:10:19 +00:00
|
|
|
|
// BCC should be checked even if the pokemon have original met location, there are encounters of the same species
|
|
|
|
|
// in the national park as both normal wild encounters and contest encounters
|
2017-03-27 02:10:31 +00:00
|
|
|
|
var IsSportsBall = pkm.Ball == 0x18;
|
|
|
|
|
var s_BugContest = IsSportsBall
|
|
|
|
|
? s.Where(slot => slot.Type == SlotType.BugContest).ToList()
|
|
|
|
|
: s.Where(slot => slot.Type != SlotType.BugContest).ToList();
|
|
|
|
|
if (s_BugContest.Any())
|
|
|
|
|
// sport ball only in BCC and non sport balls only outside BCC
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
s = s_BugContest.ToList();
|
|
|
|
|
|
|
|
|
|
// If there is only one valid encounter defer encountertype check to verify encounter type
|
|
|
|
|
if (s.Count <= 1 || pkm.Format == 7)
|
|
|
|
|
return s.Any() ? s.ToArray() : null;
|
|
|
|
|
|
|
|
|
|
var s_EncounterTypes = s.Where(slot => slot.TypeEncounter == (EncounterType)pkm.EncounterType).ToList();
|
|
|
|
|
if (s_EncounterTypes.Any())
|
|
|
|
|
return s_EncounterTypes.ToArray();
|
2017-03-26 20:23:57 +00:00
|
|
|
|
|
2016-03-23 02:47:13 +00:00
|
|
|
|
return s.Any() ? s.ToArray() : null;
|
2016-03-10 05:32:42 +00:00
|
|
|
|
}
|
2017-04-04 02:59:29 +00:00
|
|
|
|
internal static List<EncounterStatic> getValidStaticEncounter(PKM pkm, GameVersion gameSource = GameVersion.Any)
|
2016-03-13 21:56:23 +00:00
|
|
|
|
{
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (gameSource == GameVersion.Any)
|
|
|
|
|
gameSource = (GameVersion)pkm.Version;
|
|
|
|
|
|
2016-03-13 21:56:23 +00:00
|
|
|
|
// Get possible encounters
|
2017-02-27 05:46:00 +00:00
|
|
|
|
IEnumerable<EncounterStatic> poss = getStaticEncounters(pkm, gameSource: gameSource);
|
2017-02-16 09:35:14 +00:00
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
int lvl = getMinLevelEncounter(pkm);
|
2017-02-16 11:13:06 +00:00
|
|
|
|
if (lvl <= 0)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return null;
|
2017-04-22 20:04:12 +00:00
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
// Back Check against pkm
|
2017-04-22 20:04:12 +00:00
|
|
|
|
var enc = getMatchingStaticEncounters(pkm, poss, lvl);
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
|
2017-04-22 20:04:12 +00:00
|
|
|
|
// Filter for encounter types
|
|
|
|
|
if (pkm.Gen4 && pkm.Format < 7) // type is cleared on 6->7
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
{
|
2017-04-22 20:04:12 +00:00
|
|
|
|
int type = pkm.EncounterType;
|
|
|
|
|
enc = type == 0
|
|
|
|
|
? enc.Where(z => !(z is EncounterStaticTyped)) // no typed encounters
|
|
|
|
|
: enc.Where(z => z is EncounterStaticTyped && (int) ((EncounterStaticTyped)z).TypeEncounter == type);
|
Special Eggs improvement and Generation 4 Encounter Type legal analysis (#1083)
* Ignore relearn level 2-100 moves from Phione
* Cave encounter types DPPt
* Generation 4 EncounterType filter and validation
Not every generation 4 static encounter have yet their encounter type defined, i temporally included Any to those encounters
Generation 4 roaaming static encounters have been splitted in two, grass and surf
* Added new legality texts
* Added unreleased event DP Darkai, added check for surf in jhoto route 45, is impossible
Moved unreleased DP locations to valid Platinum locations only
* Improved generation 3 special egg check.
Only check special egg if pokemon knows any of the special egg moves, also in that case do check for normal egg before special egg
because special eggs will explicitly check for normal egg moves but normal eggs will not check special egg moves, it will improve the error output
* Clean up
* Fix gen 5 pokemon from issue #1011
Those pokemon have generation 4 static gift encounters and also wild encounters, the analysis was selecting the static encounter, but if there is a valid wild encounter and the static encounter does not match the pokemon ball the willd encounter should be selected instead
Also move the transfer legality to check it before the static encounters and make that check to work like generation 3 transfer legality
* Another fix for Issue 1011, suppress temporally OT and pokemon name analysis for generations 3 to 5 instead of format 3 to 5, there is no data stored yet to make those analysis
* Do not make wild encounters prevail static encounter if the pokemon was an egg
* Changed type of WildEncounter variable to EncounterSlot[]
* Fix Jhoto Route 45 to avoid return error with fishing encounters
2017-04-22 18:49:49 +00:00
|
|
|
|
}
|
2017-04-22 20:04:12 +00:00
|
|
|
|
var result = enc.ToList();
|
|
|
|
|
return result.Count == 0 ? null : result;
|
2017-04-04 03:43:13 +00:00
|
|
|
|
}
|
|
|
|
|
private static IEnumerable<EncounterStatic> getMatchingStaticEncounters(PKM pkm, IEnumerable<EncounterStatic> poss, int lvl)
|
|
|
|
|
{
|
2016-03-13 21:56:23 +00:00
|
|
|
|
foreach (EncounterStatic e in poss)
|
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (e.Nature != Nature.Random && pkm.Nature != (int)e.Nature)
|
2016-03-13 21:56:23 +00:00
|
|
|
|
continue;
|
2017-04-04 03:43:13 +00:00
|
|
|
|
if (pkm.Gen3 && e.EggLocation != 0)
|
|
|
|
|
{
|
|
|
|
|
// Hatched gen 3 gift egg can not be differentiated from normal eggs
|
2017-03-20 11:45:28 +00:00
|
|
|
|
if (!pkm.IsEgg || pkm.Format > 3)
|
|
|
|
|
continue;
|
|
|
|
|
if (e.EggLocation != pkm.Met_Location)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if (e.EggLocation != pkm.Egg_Location)
|
2016-03-13 21:56:23 +00:00
|
|
|
|
continue;
|
2017-02-13 01:00:03 +00:00
|
|
|
|
if (pkm.HasOriginalMetLocation)
|
|
|
|
|
{
|
|
|
|
|
if (e.Location != 0 && e.Location != pkm.Met_Location)
|
|
|
|
|
continue;
|
2017-02-16 09:35:14 +00:00
|
|
|
|
if (e.Level != lvl)
|
2017-02-13 01:00:03 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
else if (e.Level > lvl)
|
|
|
|
|
continue;
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (e.Gender != -1 && e.Gender != pkm.Gender)
|
2016-03-13 21:56:23 +00:00
|
|
|
|
continue;
|
2017-02-21 05:19:25 +00:00
|
|
|
|
if (e.Form != pkm.AltForm && !e.SkipFormCheck && !getCanFormChange(pkm, e.Species))
|
2016-12-31 01:09:59 +00:00
|
|
|
|
continue;
|
2016-06-20 04:22:43 +00:00
|
|
|
|
|
|
|
|
|
// Defer to EC/PID check
|
2016-10-23 19:48:49 +00:00
|
|
|
|
// if (e.Shiny != null && e.Shiny != pkm.IsShiny)
|
2016-06-20 04:22:43 +00:00
|
|
|
|
// continue;
|
2016-04-21 03:46:18 +00:00
|
|
|
|
|
|
|
|
|
// Defer ball check to later
|
2016-10-23 19:48:49 +00:00
|
|
|
|
// if (e.Gift && pkm.Ball != 4) // PokéBall
|
2016-04-21 03:46:18 +00:00
|
|
|
|
// continue;
|
2016-03-13 21:56:23 +00:00
|
|
|
|
|
2017-04-02 15:16:53 +00:00
|
|
|
|
if (!AllowGBCartEra && GameVersion.GBCartEraOnly.Contains(e.Version))
|
2017-04-01 01:49:13 +00:00
|
|
|
|
continue; // disallow gb cart era encounters (as they aren't obtainable by Main/VC series)
|
|
|
|
|
|
2017-04-04 03:43:13 +00:00
|
|
|
|
yield return e;
|
2016-03-13 21:56:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-27 05:46:00 +00:00
|
|
|
|
internal static EncounterTrade getValidIngameTrade(PKM pkm, GameVersion gameSource = GameVersion.Any)
|
2016-03-17 06:29:28 +00:00
|
|
|
|
{
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (gameSource == GameVersion.Any)
|
|
|
|
|
gameSource = (GameVersion) pkm.Version;
|
2017-02-23 05:19:29 +00:00
|
|
|
|
if (pkm.VC || pkm.Format <= 2)
|
2017-02-27 05:46:00 +00:00
|
|
|
|
return getValidEncounterTradeVC(pkm, gameSource);
|
2017-02-23 05:19:29 +00:00
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
int lang = pkm.Language;
|
2016-11-11 03:29:00 +00:00
|
|
|
|
if (lang == 0 || lang == 6)
|
2016-03-17 06:29:28 +00:00
|
|
|
|
return null;
|
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
int lvl = getMinLevelEncounter(pkm);
|
2017-02-16 11:13:06 +00:00
|
|
|
|
if (lvl <= 0)
|
2017-02-16 11:14:10 +00:00
|
|
|
|
return null;
|
2016-03-17 06:29:28 +00:00
|
|
|
|
// Get valid pre-evolutions
|
2016-10-23 19:48:49 +00:00
|
|
|
|
IEnumerable<DexLevel> p = getValidPreEvolutions(pkm);
|
2016-11-11 03:29:00 +00:00
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
EncounterTrade[] table = getEncounterTradeTable(pkm);
|
2017-03-31 07:04:29 +00:00
|
|
|
|
var poss = table?.Where(f => p.Any(r => r.Species == f.Species) && f.Version.Contains((GameVersion)pkm.Version));
|
|
|
|
|
return poss?.FirstOrDefault(z => getEncounterTradeValid(pkm, z, lvl));
|
|
|
|
|
}
|
|
|
|
|
private static bool getEncounterTradeValid(PKM pkm, EncounterTrade z, int lvl)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 6; i++)
|
|
|
|
|
if (z.IVs[i] != -1 && z.IVs[i] != pkm.IVs[i])
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (z.Shiny ^ pkm.IsShiny) // Are PIDs static?
|
|
|
|
|
return false;
|
|
|
|
|
if (z.TID != pkm.TID)
|
|
|
|
|
return false;
|
|
|
|
|
if (z.SID != pkm.SID)
|
|
|
|
|
return false;
|
|
|
|
|
if (pkm.HasOriginalMetLocation)
|
2017-03-18 23:50:34 +00:00
|
|
|
|
{
|
2017-04-05 05:01:48 +00:00
|
|
|
|
z.Location = z.Location > 0 ? z.Location : EncounterTrade.DefaultMetLocation[pkm.GenNumber - 3];
|
2017-03-31 07:04:29 +00:00
|
|
|
|
if (z.Location != pkm.Met_Location)
|
|
|
|
|
return false;
|
|
|
|
|
if (pkm.Format < 5)
|
2017-03-20 01:13:21 +00:00
|
|
|
|
{
|
|
|
|
|
if (z.Level > lvl)
|
2017-03-31 07:04:29 +00:00
|
|
|
|
return false;
|
2017-03-20 01:13:21 +00:00
|
|
|
|
}
|
2017-03-31 07:04:29 +00:00
|
|
|
|
else if (z.Level != lvl)
|
|
|
|
|
return false;
|
2017-03-29 07:48:32 +00:00
|
|
|
|
}
|
2017-03-31 07:04:29 +00:00
|
|
|
|
else if (z.Level > lvl)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (z.Nature != Nature.Random && (int)z.Nature != pkm.Nature)
|
|
|
|
|
return false;
|
|
|
|
|
if (z.Gender != -1 && z.Gender != pkm.Gender)
|
|
|
|
|
return false;
|
|
|
|
|
if (z.OTGender != -1 && z.OTGender != pkm.OT_Gender)
|
|
|
|
|
return false;
|
|
|
|
|
// if (z.Ability == 4 ^ pkm.AbilityNumber == 4) // defer to Ability
|
|
|
|
|
// countinue;
|
|
|
|
|
|
|
|
|
|
return true;
|
2016-03-17 06:29:28 +00:00
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
internal static GameVersion[] getGen1GameEncounter(PKM pk)
|
|
|
|
|
{
|
|
|
|
|
if (pk.Format != 2 || AllowGBCartEra)
|
|
|
|
|
return new[] { GameVersion.RD, GameVersion.YW };
|
|
|
|
|
if (25 <= pk.Species && pk.Species <= 26)
|
|
|
|
|
// Yellow Pikachu detected by its special catch rate
|
|
|
|
|
return new[] { (((PK1)pk).Catch_Rate == 163) ? GameVersion.YW : GameVersion.RD };
|
|
|
|
|
if (64 <= pk.Species && pk.Species <= 65)
|
|
|
|
|
// Yellow Kadabra detected by its special catch rate
|
|
|
|
|
return new[] { (((PK1)pk).Catch_Rate == 96) ? GameVersion.YW : GameVersion.RD };
|
|
|
|
|
return new[] { GameVersion.RD, GameVersion.YW };
|
|
|
|
|
}
|
|
|
|
|
internal static IEnumerable<int> getInitialMovesGBEncounter(int species, int lvl, GameVersion ver)
|
|
|
|
|
{
|
2017-04-09 02:05:29 +00:00
|
|
|
|
int[] InitialMoves;
|
|
|
|
|
int[] LevelUpMoves;
|
|
|
|
|
int diff;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
switch (ver)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.YW:
|
|
|
|
|
case GameVersion.RD:
|
|
|
|
|
case GameVersion.BU:
|
|
|
|
|
case GameVersion.GN:
|
|
|
|
|
{
|
|
|
|
|
var LevelTable = ver == GameVersion.YW ? LevelUpY : LevelUpRB;
|
|
|
|
|
int index = PersonalTable.RB.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return new int[0];
|
|
|
|
|
LevelUpMoves = LevelTable[species].getEncounterMoves(lvl);
|
2017-04-09 02:05:29 +00:00
|
|
|
|
diff = 4 - LevelUpMoves.Length;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
if (diff == 0)
|
|
|
|
|
return LevelUpMoves.ToArray();
|
|
|
|
|
InitialMoves = ver == GameVersion.YW ? ((PersonalInfoG1)PersonalTable.Y[index]).Moves : ((PersonalInfoG1)PersonalTable.RB[index]).Moves;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GameVersion.C:
|
|
|
|
|
case GameVersion.GS:
|
|
|
|
|
{
|
|
|
|
|
if (species == 235)
|
|
|
|
|
return new[] { 166 }; // Smeargle only learns Sketch, is duplicated in the level up tables
|
|
|
|
|
var LevelTable = ver == GameVersion.C ? LevelUpC : LevelUpGS;
|
|
|
|
|
int index = PersonalTable.C.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return new int[0];
|
|
|
|
|
LevelUpMoves = LevelTable[species].getEncounterMoves(2, lvl);
|
2017-04-09 02:05:29 +00:00
|
|
|
|
diff = 4 - LevelUpMoves.Length;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
if (diff == 0)
|
|
|
|
|
return LevelUpMoves.ToArray();
|
|
|
|
|
// Level Up 1 moves are initial moves, it can be duplicated in levels 2-100
|
|
|
|
|
InitialMoves = LevelTable[species].getEncounterMoves(1, 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return new int[0];
|
|
|
|
|
}
|
|
|
|
|
// Initial Moves could be duplicated in the level up table
|
|
|
|
|
// level up table moves have preferences
|
2017-04-09 02:05:29 +00:00
|
|
|
|
var moves = InitialMoves.Where(p => p != 0 && !LevelUpMoves.Any(m => m == p)).ToList();
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
// If not all the personal table move cant be included the last moves have preference
|
2017-04-09 02:05:29 +00:00
|
|
|
|
int pop = moves.Count - diff;
|
|
|
|
|
if (pop > 0)
|
|
|
|
|
moves.RemoveRange(0, pop);
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
// The order for the pokemon default moves are first moves from personal table and then moves from level up table
|
2017-04-09 02:05:29 +00:00
|
|
|
|
return moves.Union(LevelUpMoves).ToArray();
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
}
|
|
|
|
|
internal static int getMoveMinLevelGBEncounter(int species, int lvl, GameVersion[] versions)
|
|
|
|
|
{
|
|
|
|
|
int movelvl = 100;
|
|
|
|
|
foreach(GameVersion ver in versions)
|
|
|
|
|
{
|
|
|
|
|
movelvl = Math.Min(movelvl, getMoveMinLevelGBEncounter(species, lvl, ver));
|
|
|
|
|
}
|
|
|
|
|
return movelvl;
|
|
|
|
|
}
|
|
|
|
|
internal static int getMoveMinLevelGBEncounter(int species, int lvl, GameVersion ver = GameVersion.Any)
|
|
|
|
|
{
|
|
|
|
|
int movelvl = 100;
|
|
|
|
|
switch (ver)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.RD:
|
|
|
|
|
case GameVersion.BU:
|
|
|
|
|
case GameVersion.GN:
|
|
|
|
|
case GameVersion.RBY:
|
|
|
|
|
{
|
|
|
|
|
movelvl = LevelUpRB[species].getMinMoveLevel(lvl);
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (ver.Contains(GameVersion.YW))
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
goto case GameVersion.YW;
|
|
|
|
|
return movelvl;
|
|
|
|
|
}
|
|
|
|
|
case GameVersion.YW:
|
|
|
|
|
{
|
|
|
|
|
movelvl = Math.Min(movelvl, LevelUpY[species].getMinMoveLevel(lvl));
|
|
|
|
|
if (ver.Contains(GameVersion.GS))
|
|
|
|
|
goto case GameVersion.GS;
|
|
|
|
|
return movelvl;
|
|
|
|
|
}
|
|
|
|
|
case GameVersion.GS:
|
|
|
|
|
case GameVersion.GSC:
|
|
|
|
|
{
|
|
|
|
|
movelvl = Math.Min(movelvl, LevelUpGS[species].getMinMoveLevel(lvl));
|
|
|
|
|
if (ver.Contains(GameVersion.C))
|
|
|
|
|
goto case GameVersion.C;
|
|
|
|
|
return movelvl;
|
|
|
|
|
}
|
|
|
|
|
case GameVersion.C:
|
|
|
|
|
{
|
|
|
|
|
return Math.Min(movelvl, LevelUpC[species].getMinMoveLevel(lvl));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return movelvl;
|
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
private static EncounterTrade[] getEncounterTradeTable(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
switch (pkm.GenNumber)
|
|
|
|
|
{
|
|
|
|
|
case 3:
|
|
|
|
|
return pkm.FRLG ? TradeGift_FRLG : TradeGift_RSE;
|
|
|
|
|
case 4:
|
|
|
|
|
return pkm.HGSS ? TradeGift_HGSS : TradeGift_DPPt;
|
|
|
|
|
case 5:
|
|
|
|
|
return pkm.B2W2 ? TradeGift_B2W2 : TradeGift_BW;
|
|
|
|
|
case 6:
|
|
|
|
|
return pkm.XY ? TradeGift_XY : TradeGift_AO;
|
|
|
|
|
case 7:
|
|
|
|
|
return pkm.SM ? TradeGift_SM : null;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2017-04-10 00:43:05 +00:00
|
|
|
|
internal static int getRequiredMoveCount(PKM pk, int[] moves, List<int>[] learn, List<int>[] tmhm, List<int>[] tutor, int[] initialmoves)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
{
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (pk.Format != 1 || AllowGBCartEra) // No MoveDeleter
|
|
|
|
|
return 1; // Move deleter exits, slots from 2 onwards can allways be empty
|
|
|
|
|
|
|
|
|
|
int required = getRequiredMoveCount(pk, moves, learn, initialmoves);
|
|
|
|
|
if (required >= 4)
|
|
|
|
|
return 4;
|
|
|
|
|
|
|
|
|
|
// tm, hm and tutor moves replace a free slots if the pokemon have less than 4 moves
|
|
|
|
|
// Ignore tm, hm and tutor moves already in the learnset table
|
|
|
|
|
required += moves.Where(m => m != 0 && initialmoves.Union(learn[1]).All(l => l != m) && (tmhm[1].Any(t => t == m) || tutor[1].Any(t => t == m))).Count();
|
|
|
|
|
|
|
|
|
|
return Math.Min(4, required);
|
|
|
|
|
}
|
|
|
|
|
private static int getRequiredMoveCount(PKM pk, int[] moves, List<int>[] learn, int[] initialmoves)
|
|
|
|
|
{
|
|
|
|
|
if (SpecialMinMoveSlots.Contains(pk.Species))
|
|
|
|
|
return getRequiredMoveCountSpecial(pk, moves, learn);
|
|
|
|
|
|
|
|
|
|
// A pokemon is captured with initial moves and can't forget any until have all 4 slots used
|
|
|
|
|
// If it has learn a move before having 4 it will be in one of the free slots
|
|
|
|
|
int required = getRequiredMoveSlotsRegular(pk, moves, learn, initialmoves);
|
|
|
|
|
return required != 0 ? required : getRequiredMoveCountDecrement(pk, moves, learn, initialmoves);
|
|
|
|
|
}
|
|
|
|
|
private static int getRequiredMoveSlotsRegular(PKM pk, int[] moves, List<int>[] learn, int[] initialmoves)
|
|
|
|
|
{
|
|
|
|
|
int species = pk.Species;
|
|
|
|
|
// Caterpie and Metapod evolution lines have different count of possible slots available if captured in different evolutionary phases
|
|
|
|
|
// 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)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
{
|
2017-04-10 12:11:07 +00:00
|
|
|
|
if (!moves.Any(m => G1MetapodMoves.Contains(m))) // Captured as Metapod without Caterpie moves
|
2017-04-10 00:43:05 +00:00
|
|
|
|
return initialmoves.Union(learn[1]).Distinct().Count(lm => lm != 0 && !G1MetapodMoves.Contains(lm));
|
|
|
|
|
}
|
|
|
|
|
if (species == 014 || species == 015)
|
|
|
|
|
{
|
|
|
|
|
if (species == 15 && !moves.Any(m => G1KakunaMoves.Contains(m))) // Captured as Beedril without Weedle and Kakuna moves
|
|
|
|
|
return initialmoves.Union(learn[1]).Distinct().Count(lm => lm != 0 && !G1KakunaMoves.Contains(lm));
|
2017-04-09 23:41:01 +00:00
|
|
|
|
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (!moves.Any(m => G1WeedleMoves.Contains(m))) // Captured as Kakuna without Weedle moves
|
|
|
|
|
return initialmoves.Union(learn[1]).Distinct().Count(lm => lm != 0 && !G1WeedleMoves.Contains(lm));
|
|
|
|
|
}
|
2017-04-09 23:41:01 +00:00
|
|
|
|
|
2017-04-10 00:43:05 +00:00
|
|
|
|
return getRequiredMoveCountSpecies3(species, pk.CurrentLevel, moves) ? 3 : 0; // no match
|
|
|
|
|
}
|
|
|
|
|
private static bool getRequiredMoveCountSpecies3(int species, int level, int[] moves)
|
|
|
|
|
{
|
|
|
|
|
// Species that evolve and learn the 4th move as evolved species at a greather level than base species
|
|
|
|
|
// The 4th move is included in the level up table set as a preevolution move,
|
|
|
|
|
// it should be removed from the used slots count if is not the learn move
|
|
|
|
|
switch (species)
|
|
|
|
|
{
|
|
|
|
|
case 017: return level < 21 && !moves.Contains(018); // Pidgeotto without Whirlwind
|
|
|
|
|
case 028: return level < 27 && !moves.Contains(040); // Sandslash without Poison Sting
|
|
|
|
|
case 047: return level < 30 && !moves.Contains(147); // Parasect without Spore
|
|
|
|
|
case 055: return level < 39 && !moves.Contains(093); // Golduck without Confusion
|
|
|
|
|
case 087: return level < 44 && !moves.Contains(156); // Dewgong without Rest
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
private static int getRequiredMoveCountDecrement(PKM pk, int[] moves, List<int>[] learn, int[] initialmoves)
|
|
|
|
|
{
|
|
|
|
|
int usedslots = initialmoves.Union(learn[1]).Where(m => m != 0).Distinct().Count();
|
|
|
|
|
// Yellow optional moves, reduce usedslots if the yellow move is not present
|
|
|
|
|
// The count wont go bellow 1 because the yellow moves were already counted and are not the only initial or level up moves
|
|
|
|
|
if (pk.Species == 031) //Venonat
|
|
|
|
|
{
|
|
|
|
|
// ignore Venomoth, by the time Venonat evolved it will always have 4 moves
|
|
|
|
|
if (pk.CurrentLevel >= 11 && !moves.Contains(48)) // Supersonic
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
usedslots--;
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (pk.CurrentLevel >= 19 && !moves.Contains(93)) // Confusion
|
|
|
|
|
usedslots--;
|
|
|
|
|
}
|
|
|
|
|
if (pk.Species == 056 && pk.CurrentLevel >= 9 && !moves.Contains(67)) // Mankey Yellow Low Kick, Primeape will always have 4 moves
|
|
|
|
|
usedslots--;
|
2017-04-09 23:41:01 +00:00
|
|
|
|
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (064 == pk.Species || pk.Species == 065)
|
|
|
|
|
{
|
|
|
|
|
if (!moves.Contains(134))// Initial Yellow Kadabra Kinesis
|
|
|
|
|
usedslots--;
|
|
|
|
|
if (pk.CurrentLevel < 10 && !moves.Contains(50)) // Kadabra Disable, not learned until 20 if captured as Abra
|
|
|
|
|
usedslots--;
|
|
|
|
|
}
|
|
|
|
|
if (104 == pk.Species || pk.Species == 105) // Cubone and Marowak
|
|
|
|
|
{
|
|
|
|
|
if (!moves.Contains(39)) // Initial Yellow Tail Whip
|
|
|
|
|
usedslots--;
|
|
|
|
|
if (!moves.Contains(125)) // Initial Yellow Bone Club
|
|
|
|
|
usedslots--;
|
|
|
|
|
if (pk.Species == 105 && pk.CurrentLevel < 33 && !moves.Contains(116)) // Marowak evolved without Focus Energy
|
|
|
|
|
usedslots--;
|
|
|
|
|
}
|
|
|
|
|
if (pk.Species == 113) // Chansey
|
|
|
|
|
{
|
|
|
|
|
if (!moves.Contains(39)) // Yellow Initial Tail Whip
|
|
|
|
|
usedslots--;
|
|
|
|
|
if (!moves.Contains(3)) // Yellow Lvl 12 and Initial Red/Blue Double Slap
|
|
|
|
|
usedslots--;
|
|
|
|
|
}
|
2017-04-10 12:11:07 +00:00
|
|
|
|
if (pk.Species == 130 && pk.CurrentLevel < 32) // Wild Gyarados from yellow do not learn splash, evolved gyarados do not learn tackle
|
|
|
|
|
usedslots--;
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (pk.Species == 127 && pk.CurrentLevel >= 21 && !moves.Contains(20)) // Pinsir Yellow Bind
|
|
|
|
|
usedslots--;
|
|
|
|
|
return usedslots;
|
|
|
|
|
}
|
2017-04-09 02:05:29 +00:00
|
|
|
|
|
2017-04-10 00:43:05 +00:00
|
|
|
|
private static int getRequiredMoveCountSpecial(PKM pk, int[] moves, List<int>[] learn)
|
|
|
|
|
{
|
|
|
|
|
// Species with few mandatory slots, species with stone evolutions that could evolve at lower level and do not learn any more moves
|
|
|
|
|
// and Pikachu and Nidoran family, those only have mandatory the initial moves and a few have one level up moves,
|
|
|
|
|
// every other move could be avoided switching game or evolving
|
|
|
|
|
var basespecies = getBaseSpecies(pk);
|
|
|
|
|
var maxlevel = 1;
|
|
|
|
|
var minlevel = 1;
|
|
|
|
|
if (029 <= pk.Species && pk.Species <= 034 && pk.CurrentLevel >= 8)
|
|
|
|
|
maxlevel = 8; // Always lean a third move at level 8
|
|
|
|
|
if (pk.Species == 114)
|
|
|
|
|
{
|
|
|
|
|
//Tangela moves before level 32 are different in red/blue and yellow
|
|
|
|
|
minlevel = 32;
|
|
|
|
|
maxlevel = pk.CurrentLevel;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
}
|
2017-04-10 00:43:05 +00:00
|
|
|
|
var mandatory = minlevel <= pk.CurrentLevel ? getLvlMoves(basespecies, 0, 1, minlevel, maxlevel).Where(m => m != 0).Distinct().ToList() : new List<int>();
|
|
|
|
|
if (pk.Species == 103 && pk.CurrentLevel >= 28) // Exeggutor
|
|
|
|
|
{
|
|
|
|
|
// At level 28 learn different move if is a Exeggute or Exeggutor
|
|
|
|
|
if (moves.Contains(73))
|
|
|
|
|
mandatory.Add(73); // Leech Seed level 28 Exeggute
|
|
|
|
|
if (moves.Contains(23))
|
|
|
|
|
mandatory.Add(23); // Stomp level 28 Exeggutor
|
|
|
|
|
}
|
|
|
|
|
if (pk.Species == 25 && pk.CurrentLevel >= 33)
|
|
|
|
|
mandatory.Add(97); // Pikachu always learn Agility
|
|
|
|
|
if (pk.Species == 114)
|
|
|
|
|
mandatory.Add(132); // Tangela always learn Constrict as Initial Move
|
|
|
|
|
|
|
|
|
|
// Add to used slots the non-mandatory moves from the learnset table that the pokemon have learned
|
|
|
|
|
return mandatory.Count + moves.Where(m => m != 0 && mandatory.All(l => l != m) && learn[1].Any(t => t == m)).Count();
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
}
|
2017-04-10 00:43:05 +00:00
|
|
|
|
|
2017-02-27 05:46:00 +00:00
|
|
|
|
private static EncounterTrade getValidEncounterTradeVC(PKM pkm, GameVersion gameSource)
|
2017-02-23 05:19:29 +00:00
|
|
|
|
{
|
|
|
|
|
var p = getValidPreEvolutions(pkm).ToArray();
|
2017-02-27 05:46:00 +00:00
|
|
|
|
|
|
|
|
|
switch (gameSource)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.RBY:
|
2017-03-05 05:45:08 +00:00
|
|
|
|
return getValidEncounterTradeVC1(pkm, p, TradeGift_RBY);
|
2017-02-27 05:46:00 +00:00
|
|
|
|
case GameVersion.GSC:
|
|
|
|
|
return getValidEncounterTradeVC2(pkm, p);
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2017-02-23 05:19:29 +00:00
|
|
|
|
}
|
|
|
|
|
private static EncounterTrade getValidEncounterTradeVC2(PKM pkm, DexLevel[] p)
|
|
|
|
|
{
|
2017-03-05 05:45:08 +00:00
|
|
|
|
// Check RBY trades with loosened level criteria.
|
|
|
|
|
var z = getValidEncounterTradeVC1(pkm, p, TradeGift_RBY_2);
|
|
|
|
|
if (z != null)
|
|
|
|
|
return z;
|
2017-02-23 05:19:29 +00:00
|
|
|
|
|
2017-03-05 05:45:08 +00:00
|
|
|
|
// Check GSC trades. Reuse generic table fetch-match
|
|
|
|
|
z = getValidEncounterTradeVC1(pkm, p, TradeGift_GSC);
|
2017-02-23 05:19:29 +00:00
|
|
|
|
|
2017-03-05 05:45:08 +00:00
|
|
|
|
// Filter Criteria
|
|
|
|
|
if (z?.Gender != pkm.Gender)
|
|
|
|
|
return null;
|
2017-02-23 05:19:29 +00:00
|
|
|
|
if (z.TID != pkm.TID)
|
|
|
|
|
return null;
|
2017-03-05 05:45:08 +00:00
|
|
|
|
if (!z.IVs.SequenceEqual(pkm.IVs))
|
|
|
|
|
return null;
|
|
|
|
|
if (pkm.Met_Location != 0 && pkm.Format == 2 && pkm.Met_Location != z.Location)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
int index = Array.IndexOf(TradeGift_GSC, z);
|
|
|
|
|
if (TradeGift_GSC_OTs[index].All(ot => ot != pkm.OT_Name))
|
|
|
|
|
return null;
|
|
|
|
|
|
2017-02-23 05:19:29 +00:00
|
|
|
|
return z;
|
|
|
|
|
}
|
2017-03-05 05:45:08 +00:00
|
|
|
|
private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, EncounterTrade[] table)
|
2017-02-23 05:19:29 +00:00
|
|
|
|
{
|
2017-03-05 05:45:08 +00:00
|
|
|
|
var z = table.FirstOrDefault(f => p.Any(r => r.Species == f.Species));
|
|
|
|
|
if (z == null)
|
|
|
|
|
return null;
|
|
|
|
|
if (z.Level > pkm.CurrentLevel) // minimum required level
|
2017-02-23 05:19:29 +00:00
|
|
|
|
return null;
|
|
|
|
|
return z;
|
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
private static GBEncounterData getEncounter12(PKM pkm, GameVersion game)
|
2017-02-27 05:46:00 +00:00
|
|
|
|
{
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
var gen = game == GameVersion.GSC ? 2 : 1;
|
2017-02-28 04:57:24 +00:00
|
|
|
|
bool WasEgg = game == GameVersion.GSC && getWasEgg23(pkm) && !NoHatchFromEgg.Contains(pkm.Species);
|
|
|
|
|
if (WasEgg)
|
|
|
|
|
{
|
|
|
|
|
// Further Filtering
|
|
|
|
|
if (pkm.Format < 3)
|
|
|
|
|
{
|
|
|
|
|
WasEgg &= pkm.Met_Location == 0 || pkm.Met_Level == 1; // 2->1->2 clears met info
|
2017-03-08 07:13:46 +00:00
|
|
|
|
WasEgg &= pkm.CurrentLevel >= 5;
|
2017-02-28 04:57:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-27 05:46:00 +00:00
|
|
|
|
// Since encounter matching is super weak due to limited stored data in the structure
|
|
|
|
|
// Calculate all 3 at the same time and pick the best result (by species).
|
|
|
|
|
// Favor special event move gifts as Static Encounters when applicable
|
2017-04-04 02:59:29 +00:00
|
|
|
|
var maxspeciesorigin = game == GameVersion.GSC ? MaxSpeciesID_2 : MaxSpeciesID_1;
|
|
|
|
|
DexLevel[] vs = getValidPreEvolutions(pkm, maxspeciesorigin: maxspeciesorigin).ToArray();
|
|
|
|
|
|
2017-02-27 05:46:00 +00:00
|
|
|
|
var s = getValidStaticEncounter(pkm, game);
|
|
|
|
|
var e = getValidWildEncounters(pkm, game);
|
|
|
|
|
var t = getValidIngameTrade(pkm, game);
|
|
|
|
|
|
2017-02-28 04:57:24 +00:00
|
|
|
|
if (s == null && e == null && t == null && !WasEgg)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
const byte invalid = 255;
|
2017-04-04 02:59:29 +00:00
|
|
|
|
var sm = s != null ? vs.Reverse().First(evo => s.Any(slot => slot.Species == evo.Species)).Species : invalid;
|
|
|
|
|
var em = e != null ? vs.Reverse().First(evo => e.Any(slot => slot.Species == evo.Species)).Species : invalid;
|
2017-02-27 05:46:00 +00:00
|
|
|
|
var tm = t?.Species ?? invalid;
|
|
|
|
|
|
2017-04-04 03:28:04 +00:00
|
|
|
|
// check for special move static encounter
|
2017-04-08 00:45:22 +00:00
|
|
|
|
var special = s?.FirstOrDefault(m => m.Moves != null && m.Moves[0] != 0 && pkm.Moves.Contains(m.Moves[0]));
|
2017-04-04 03:28:04 +00:00
|
|
|
|
if (special != null) // return with high priority
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return new GBEncounterData(pkm, gen, special);
|
|
|
|
|
|
2017-03-08 07:13:46 +00:00
|
|
|
|
if (game == GameVersion.GSC)
|
|
|
|
|
{
|
2017-03-12 23:36:23 +00:00
|
|
|
|
if (t != null && t.TID != 0)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return new GBEncounterData(pkm, 2, t); // gen2 trade
|
2017-03-08 07:13:46 +00:00
|
|
|
|
if (WasEgg && new[] { sm, em, tm }.Min(a => a) >= 5)
|
2017-04-13 15:48:13 +00:00
|
|
|
|
return new GBEncounterData(getBaseEggSpecies(pkm)); // gen2 egg
|
2017-03-08 07:13:46 +00:00
|
|
|
|
}
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (em <= sm && em <= tm)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return new GBEncounterData(pkm, gen, e.Where(slot => slot.Species == em).OrderBy(slot => slot.LevelMin).First());
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (sm <= em && sm <= tm)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return new GBEncounterData(pkm, gen, s.Where(slot => slot.Species == sm).OrderBy(slot => slot.Level).First());
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (tm <= sm && tm <= em)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return new GBEncounterData(pkm, gen, t);
|
2017-02-27 05:46:00 +00:00
|
|
|
|
return null;
|
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
internal static List<GBEncounterData> getEncounter12(PKM pkm, bool gen2)
|
2017-02-27 05:46:00 +00:00
|
|
|
|
{
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
var g1 = pkm.IsEgg || pkm.HasOriginalMetLocation ? null : getEncounter12(pkm, GameVersion.RBY);
|
2017-02-27 05:46:00 +00:00
|
|
|
|
var g2 = gen2 ? getEncounter12(pkm, GameVersion.GSC) : null;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
if (g1 == null && g2 == null)
|
|
|
|
|
return null;
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (g1 == null || g2 == null)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return new List<GBEncounterData> { g1 ?? g2 };
|
|
|
|
|
|
|
|
|
|
var t = g1.Encounter as EncounterTrade;
|
2017-03-12 23:36:23 +00:00
|
|
|
|
if (t != null && getEncounterTrade1Valid(pkm))
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
return new List<GBEncounterData> { g1 };
|
2017-03-08 07:13:46 +00:00
|
|
|
|
|
|
|
|
|
// Both generations can provide an encounter. Return highest preference
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
g1.MoveLevel = getMoveMinLevelGBEncounter(g1.Species, g1.Level, getGen1GameEncounter(pkm));
|
|
|
|
|
if (g1.Type > g2.Type)
|
|
|
|
|
return new List<GBEncounterData> { g1 };
|
|
|
|
|
if (g1.Type <= g2.Type ||
|
|
|
|
|
// Return lowest level encounter
|
|
|
|
|
g2.MoveLevel < g1.MoveLevel)
|
|
|
|
|
{
|
|
|
|
|
// Return also generation 1 moves, it could have different encounter moves
|
|
|
|
|
return new List<GBEncounterData> { g2, g1 };
|
|
|
|
|
}
|
|
|
|
|
return new List<GBEncounterData> { g1 };
|
2017-02-27 05:46:00 +00:00
|
|
|
|
}
|
2017-03-12 23:36:23 +00:00
|
|
|
|
internal static bool getEncounterTrade1Valid(PKM pkm)
|
2017-03-08 07:13:46 +00:00
|
|
|
|
{
|
|
|
|
|
string ot = pkm.OT_Name;
|
|
|
|
|
string tr = pkm.Format <= 2 ? "TRAINER" : "Trainer"; // decaps on transfer
|
|
|
|
|
return ot == "トレーナー" || ot == tr;
|
|
|
|
|
}
|
2016-10-23 19:48:49 +00:00
|
|
|
|
internal static EncounterSlot[] getValidFriendSafari(PKM pkm)
|
2016-03-23 02:47:13 +00:00
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (!pkm.XY)
|
2016-03-23 05:31:30 +00:00
|
|
|
|
return null;
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (pkm.Met_Location != 148) // Friend Safari
|
2016-03-23 05:31:30 +00:00
|
|
|
|
return null;
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (pkm.Met_Level != 30)
|
2016-03-23 05:31:30 +00:00
|
|
|
|
return null;
|
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
IEnumerable<DexLevel> vs = getValidPreEvolutions(pkm);
|
2016-03-23 05:31:30 +00:00
|
|
|
|
List<EncounterSlot> slots = new List<EncounterSlot>();
|
2016-03-23 02:47:13 +00:00
|
|
|
|
foreach (DexLevel d in vs.Where(d => FriendSafari.Contains(d.Species) && d.Level >= 30))
|
2016-03-23 05:31:30 +00:00
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
slots.Add(new EncounterSlot
|
2016-03-23 05:31:30 +00:00
|
|
|
|
{
|
|
|
|
|
Species = d.Species,
|
|
|
|
|
LevelMin = 30,
|
|
|
|
|
LevelMax = 30,
|
|
|
|
|
Form = 0,
|
|
|
|
|
Type = SlotType.FriendSafari,
|
2016-10-23 19:48:49 +00:00
|
|
|
|
});
|
2016-03-23 05:31:30 +00:00
|
|
|
|
}
|
2016-03-23 02:47:13 +00:00
|
|
|
|
|
2016-03-23 05:31:30 +00:00
|
|
|
|
return slots.Any() ? slots.ToArray() : null;
|
2016-03-23 02:47:13 +00:00
|
|
|
|
}
|
2017-03-26 22:11:09 +00:00
|
|
|
|
internal static bool getWasEgg23(PKM pkm)
|
2017-02-28 04:57:24 +00:00
|
|
|
|
{
|
2017-03-26 22:11:09 +00:00
|
|
|
|
if (pkm.IsEgg)
|
|
|
|
|
return true;
|
2017-02-28 04:57:24 +00:00
|
|
|
|
if (pkm.Format > 2 && pkm.Ball != 4)
|
|
|
|
|
return false;
|
2017-03-26 22:11:09 +00:00
|
|
|
|
if (pkm.Format == 3)
|
|
|
|
|
return pkm.WasEgg;
|
2017-02-28 04:57:24 +00:00
|
|
|
|
|
|
|
|
|
int lvl = pkm.CurrentLevel;
|
|
|
|
|
if (lvl < 5)
|
|
|
|
|
return false;
|
|
|
|
|
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (pkm.Format > 3 && pkm.Met_Level <5)
|
2017-03-26 22:11:09 +00:00
|
|
|
|
return false;
|
2017-03-27 19:10:30 +00:00
|
|
|
|
if (pkm.Format > 3 && pkm.FatefulEncounter)
|
|
|
|
|
return false;
|
2017-03-26 22:11:09 +00:00
|
|
|
|
|
2017-02-28 04:57:24 +00:00
|
|
|
|
return getEvolutionValid(pkm);
|
|
|
|
|
}
|
2016-03-23 05:50:54 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
// Generation Specific Fetching
|
2016-11-08 16:43:57 +00:00
|
|
|
|
private static EvolutionTree getEvolutionTable(PKM pkm)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
2017-04-13 15:48:13 +00:00
|
|
|
|
return getEvolutionTable(pkm.Format);
|
|
|
|
|
}
|
|
|
|
|
private static EvolutionTree getEvolutionTable(int generation)
|
|
|
|
|
{
|
|
|
|
|
switch (generation)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case 1:
|
|
|
|
|
return Evolves1;
|
2017-02-25 20:37:01 +00:00
|
|
|
|
case 2:
|
|
|
|
|
return Evolves2;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 3:
|
|
|
|
|
return Evolves3;
|
|
|
|
|
case 4:
|
|
|
|
|
return Evolves4;
|
|
|
|
|
case 5:
|
|
|
|
|
return Evolves5;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
case 6:
|
|
|
|
|
return Evolves6;
|
|
|
|
|
default:
|
2017-02-12 17:52:26 +00:00
|
|
|
|
return Evolves7;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-01-29 17:11:48 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
internal static IEnumerable<MysteryGift> getValidGifts(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
switch (pkm.GenNumber)
|
|
|
|
|
{
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 4:
|
2017-03-19 23:19:59 +00:00
|
|
|
|
return getMatchingPCD(pkm, MGDB_G4);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 5:
|
|
|
|
|
return getMatchingPGF(pkm, MGDB_G5);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
case 6:
|
2016-11-13 17:37:28 +00:00
|
|
|
|
return getMatchingWC6(pkm, MGDB_G6);
|
2016-11-13 21:11:53 +00:00
|
|
|
|
case 7:
|
|
|
|
|
return getMatchingWC7(pkm, MGDB_G7);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
default:
|
2016-11-13 21:11:53 +00:00
|
|
|
|
return new List<MysteryGift>();
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-19 23:19:59 +00:00
|
|
|
|
private static IEnumerable<MysteryGift> getMatchingPCD(PKM pkm, IEnumerable<MysteryGift> DB)
|
2017-03-18 23:50:34 +00:00
|
|
|
|
{
|
2017-03-19 23:19:59 +00:00
|
|
|
|
var validPCD = new List<MysteryGift>();
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (DB == null)
|
2017-03-19 23:19:59 +00:00
|
|
|
|
return validPCD;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
2017-03-24 06:15:49 +00:00
|
|
|
|
if (pkm.Species == 490 && (pkm.WasEgg || pkm.IsEgg)) // Manaphy
|
|
|
|
|
{
|
|
|
|
|
int loc = pkm.IsEgg ? pkm.Met_Location : pkm.Egg_Location;
|
2017-03-30 18:58:30 +00:00
|
|
|
|
bool valid = loc == 2002; // Link Trade Egg
|
2017-03-24 06:15:49 +00:00
|
|
|
|
valid |= loc == 3001 && !pkm.IsShiny; // Ranger & notShiny
|
2017-04-05 05:01:48 +00:00
|
|
|
|
if (pkm.IsEgg && !pkm.IsNative) // transferred
|
|
|
|
|
valid = false;
|
2017-03-24 06:15:49 +00:00
|
|
|
|
if (valid)
|
|
|
|
|
validPCD.Add(new PGT { Data = { [0] = 7, [8] = 1 } });
|
|
|
|
|
return validPCD;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
var vs = getValidPreEvolutions(pkm).ToArray();
|
2017-03-19 23:19:59 +00:00
|
|
|
|
foreach (PCD mg in DB.OfType<PCD>().Where(wc => vs.Any(dl => dl.Species == wc.Species)))
|
2017-03-18 23:50:34 +00:00
|
|
|
|
{
|
2017-03-19 23:19:59 +00:00
|
|
|
|
var wc = mg.Gift.PK;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (pkm.Egg_Location == 0) // Not Egg
|
|
|
|
|
{
|
|
|
|
|
if (wc.SID != pkm.SID) continue;
|
|
|
|
|
if (wc.TID != pkm.TID) continue;
|
|
|
|
|
if (wc.OT_Name != pkm.OT_Name) continue;
|
|
|
|
|
if (wc.OT_Gender != pkm.OT_Gender) continue;
|
|
|
|
|
if (wc.Version != 0 && wc.Version != pkm.Version) continue;
|
|
|
|
|
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
|
|
|
|
|
}
|
|
|
|
|
if (wc.AltForm != pkm.AltForm && vs.All(dl => !getCanFormChange(pkm, dl.Species))) continue;
|
2017-03-24 06:15:49 +00:00
|
|
|
|
|
|
|
|
|
if (wc.IsEgg)
|
|
|
|
|
{
|
2017-04-01 20:54:04 +00:00
|
|
|
|
if (wc.Egg_Location + 3000 != pkm.Egg_Location && pkm.Egg_Location != 2002) // traded
|
|
|
|
|
continue;
|
2017-03-25 19:26:14 +00:00
|
|
|
|
if (wc.CurrentLevel != pkm.Met_Level) continue;
|
2017-04-05 05:01:48 +00:00
|
|
|
|
if (!pkm.IsNative)
|
|
|
|
|
continue;
|
2017-03-24 06:15:49 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-03-25 05:41:45 +00:00
|
|
|
|
if (pkm.Format != 4) // transferred
|
|
|
|
|
{
|
2017-04-01 21:38:50 +00:00
|
|
|
|
// met location: deferred to general transfer check
|
2017-03-25 19:26:14 +00:00
|
|
|
|
if (wc.CurrentLevel > pkm.Met_Level) continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (wc.Egg_Location + 3000 != pkm.Met_Location) continue;
|
|
|
|
|
if (wc.CurrentLevel != pkm.Met_Level) continue;
|
2017-03-25 05:41:45 +00:00
|
|
|
|
}
|
2017-03-24 06:15:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (wc.Ball != pkm.Ball) continue;
|
|
|
|
|
if (wc.OT_Gender < 3 && wc.OT_Gender != pkm.OT_Gender) continue;
|
2017-03-25 05:41:45 +00:00
|
|
|
|
if (wc.PID == 1 && pkm.IsShiny) continue;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (wc.Gender != 3 && wc.Gender != pkm.Gender) continue;
|
|
|
|
|
|
|
|
|
|
if (wc.CNT_Cool > pkm.CNT_Cool) continue;
|
|
|
|
|
if (wc.CNT_Beauty > pkm.CNT_Beauty) continue;
|
|
|
|
|
if (wc.CNT_Cute > pkm.CNT_Cute) continue;
|
|
|
|
|
if (wc.CNT_Smart > pkm.CNT_Smart) continue;
|
|
|
|
|
if (wc.CNT_Tough > pkm.CNT_Tough) continue;
|
|
|
|
|
if (wc.CNT_Sheen > pkm.CNT_Sheen) continue;
|
|
|
|
|
|
|
|
|
|
// Some checks are best performed separately as they are caused by users screwing up valid data.
|
|
|
|
|
// if (wc.Level > pkm.CurrentLevel) continue; // Defer to level legality
|
|
|
|
|
// RIBBONS: Defer to ribbon legality
|
|
|
|
|
|
2017-03-19 23:19:59 +00:00
|
|
|
|
validPCD.Add(mg);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
}
|
2017-03-19 23:19:59 +00:00
|
|
|
|
return validPCD;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
private static IEnumerable<MysteryGift> getMatchingPGF(PKM pkm, IEnumerable<MysteryGift> DB)
|
|
|
|
|
{
|
|
|
|
|
var validPGF = new List<MysteryGift>();
|
|
|
|
|
if (DB == null)
|
|
|
|
|
return validPGF;
|
|
|
|
|
|
|
|
|
|
// todo
|
|
|
|
|
var vs = getValidPreEvolutions(pkm).ToArray();
|
|
|
|
|
foreach (PGF wc in DB.OfType<PGF>().Where(wc => vs.Any(dl => dl.Species == wc.Species)))
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Egg_Location == 0) // Not Egg
|
|
|
|
|
{
|
2017-03-24 04:42:33 +00:00
|
|
|
|
if (wc.SID != pkm.SID) continue;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (wc.TID != pkm.TID) continue;
|
|
|
|
|
if (wc.OT != pkm.OT_Name) continue;
|
2017-03-24 04:42:33 +00:00
|
|
|
|
if (wc.PID != 0 && pkm.PID != wc.PID) continue;
|
|
|
|
|
if (wc.PIDType == 0 && pkm.IsShiny) continue;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (wc.PIDType == 2 && !pkm.IsShiny) continue;
|
|
|
|
|
if (wc.OriginGame != 0 && wc.OriginGame != pkm.Version) continue;
|
|
|
|
|
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
|
|
|
|
|
}
|
|
|
|
|
if (wc.Form != pkm.AltForm && vs.All(dl => !getCanFormChange(pkm, dl.Species))) continue;
|
2017-04-01 20:54:04 +00:00
|
|
|
|
|
|
|
|
|
if (wc.IsEgg)
|
|
|
|
|
{
|
|
|
|
|
if (wc.EggLocation != pkm.Egg_Location && pkm.Egg_Location != 30002) // traded
|
|
|
|
|
continue;
|
2017-04-05 05:01:48 +00:00
|
|
|
|
if (!pkm.IsNative)
|
|
|
|
|
continue;
|
2017-04-01 20:54:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (wc.EggLocation != pkm.Egg_Location) continue;
|
|
|
|
|
if (wc.MetLocation != pkm.Met_Location) continue;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (wc.Level != pkm.Met_Level) continue;
|
|
|
|
|
if (wc.Ball != pkm.Ball) continue;
|
|
|
|
|
if (wc.OTGender < 3 && wc.OTGender != pkm.OT_Gender) continue;
|
|
|
|
|
if (wc.Nature != 0xFF && wc.Nature != pkm.Nature) continue;
|
2017-04-01 20:54:04 +00:00
|
|
|
|
if (wc.Gender != 2 && wc.Gender != pkm.Gender) continue;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
|
|
|
|
if (wc.CNT_Cool > pkm.CNT_Cool) continue;
|
|
|
|
|
if (wc.CNT_Beauty > pkm.CNT_Beauty) continue;
|
|
|
|
|
if (wc.CNT_Cute > pkm.CNT_Cute) continue;
|
|
|
|
|
if (wc.CNT_Smart > pkm.CNT_Smart) continue;
|
|
|
|
|
if (wc.CNT_Tough > pkm.CNT_Tough) continue;
|
|
|
|
|
if (wc.CNT_Sheen > pkm.CNT_Sheen) continue;
|
|
|
|
|
|
|
|
|
|
// Some checks are best performed separately as they are caused by users screwing up valid data.
|
|
|
|
|
// if (wc.Level > pkm.CurrentLevel) continue; // Defer to level legality
|
|
|
|
|
// RIBBONS: Defer to ribbon legality
|
|
|
|
|
|
|
|
|
|
validPGF.Add(wc);
|
|
|
|
|
}
|
|
|
|
|
return validPGF;
|
|
|
|
|
}
|
2016-11-13 17:37:28 +00:00
|
|
|
|
private static IEnumerable<MysteryGift> getMatchingWC6(PKM pkm, IEnumerable<MysteryGift> DB)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
|
|
|
|
List<MysteryGift> validWC6 = new List<MysteryGift>();
|
2016-11-13 17:37:28 +00:00
|
|
|
|
if (DB == null)
|
|
|
|
|
return validWC6;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
var vs = getValidPreEvolutions(pkm).ToArray();
|
2016-11-13 17:37:28 +00:00
|
|
|
|
foreach (WC6 wc in DB.OfType<WC6>().Where(wc => vs.Any(dl => dl.Species == wc.Species)))
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
|
|
|
|
if (pkm.Egg_Location == 0) // Not Egg
|
|
|
|
|
{
|
|
|
|
|
if (wc.CardID != pkm.SID) continue;
|
|
|
|
|
if (wc.TID != pkm.TID) continue;
|
|
|
|
|
if (wc.OT != pkm.OT_Name) continue;
|
|
|
|
|
if (wc.OTGender != pkm.OT_Gender) continue;
|
|
|
|
|
if (wc.PIDType == 0 && pkm.PID != wc.PID) continue;
|
|
|
|
|
if (wc.PIDType == 2 && !pkm.IsShiny) continue;
|
|
|
|
|
if (wc.PIDType == 3 && pkm.IsShiny) continue;
|
|
|
|
|
if (wc.OriginGame != 0 && wc.OriginGame != pkm.Version) continue;
|
|
|
|
|
if (wc.EncryptionConstant != 0 && wc.EncryptionConstant != pkm.EncryptionConstant) continue;
|
|
|
|
|
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
|
|
|
|
|
}
|
2017-02-21 05:19:25 +00:00
|
|
|
|
if (wc.Form != pkm.AltForm && vs.All(dl => !getCanFormChange(pkm, dl.Species))) continue;
|
2017-04-01 20:54:04 +00:00
|
|
|
|
|
|
|
|
|
if (wc.IsEgg)
|
|
|
|
|
{
|
|
|
|
|
if (wc.EggLocation != pkm.Egg_Location && pkm.Egg_Location != 30002) // traded
|
|
|
|
|
continue;
|
2017-04-05 05:01:48 +00:00
|
|
|
|
if (!pkm.IsNative)
|
|
|
|
|
continue;
|
2017-04-01 20:54:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (wc.EggLocation != pkm.Egg_Location) continue;
|
|
|
|
|
if (wc.MetLocation != pkm.Met_Location) continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
if (wc.Level != pkm.Met_Level) continue;
|
|
|
|
|
if (wc.Ball != pkm.Ball) continue;
|
|
|
|
|
if (wc.OTGender < 3 && wc.OTGender != pkm.OT_Gender) continue;
|
|
|
|
|
if (wc.Nature != 0xFF && wc.Nature != pkm.Nature) continue;
|
|
|
|
|
if (wc.Gender != 3 && wc.Gender != pkm.Gender) continue;
|
|
|
|
|
|
|
|
|
|
if (wc.CNT_Cool > pkm.CNT_Cool) continue;
|
|
|
|
|
if (wc.CNT_Beauty > pkm.CNT_Beauty) continue;
|
|
|
|
|
if (wc.CNT_Cute > pkm.CNT_Cute) continue;
|
|
|
|
|
if (wc.CNT_Smart > pkm.CNT_Smart) continue;
|
|
|
|
|
if (wc.CNT_Tough > pkm.CNT_Tough) continue;
|
|
|
|
|
if (wc.CNT_Sheen > pkm.CNT_Sheen) continue;
|
|
|
|
|
|
|
|
|
|
// Some checks are best performed separately as they are caused by users screwing up valid data.
|
|
|
|
|
// if (!wc.RelearnMoves.SequenceEqual(pkm.RelearnMoves)) continue; // Defer to relearn legality
|
|
|
|
|
// if (wc.OT.Length > 0 && pkm.CurrentHandler != 1) continue; // Defer to ownership legality
|
|
|
|
|
// if (wc.OT.Length > 0 && pkm.OT_Friendship != PKX.getBaseFriendship(pkm.Species)) continue; // Friendship
|
|
|
|
|
// if (wc.Level > pkm.CurrentLevel) continue; // Defer to level legality
|
|
|
|
|
// RIBBONS: Defer to ribbon legality
|
|
|
|
|
|
|
|
|
|
validWC6.Add(wc);
|
|
|
|
|
}
|
|
|
|
|
return validWC6;
|
|
|
|
|
}
|
2016-11-13 21:11:53 +00:00
|
|
|
|
private static IEnumerable<MysteryGift> getMatchingWC7(PKM pkm, IEnumerable<MysteryGift> DB)
|
|
|
|
|
{
|
|
|
|
|
List<MysteryGift> validWC7 = new List<MysteryGift>();
|
|
|
|
|
if (DB == null)
|
|
|
|
|
return validWC7;
|
|
|
|
|
var vs = getValidPreEvolutions(pkm).ToArray();
|
|
|
|
|
foreach (WC7 wc in DB.OfType<WC7>().Where(wc => vs.Any(dl => dl.Species == wc.Species)))
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Egg_Location == 0) // Not Egg
|
|
|
|
|
{
|
2016-11-18 04:08:42 +00:00
|
|
|
|
if (wc.OTGender != 3)
|
|
|
|
|
{
|
|
|
|
|
if (wc.SID != pkm.SID) continue;
|
|
|
|
|
if (wc.TID != pkm.TID) continue;
|
|
|
|
|
if (wc.OTGender != pkm.OT_Gender) continue;
|
|
|
|
|
}
|
2016-11-17 17:12:17 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(wc.OT) && wc.OT != pkm.OT_Name) continue;
|
2016-11-13 21:11:53 +00:00
|
|
|
|
if (wc.OriginGame != 0 && wc.OriginGame != pkm.Version) continue;
|
|
|
|
|
if (wc.EncryptionConstant != 0 && wc.EncryptionConstant != pkm.EncryptionConstant) continue;
|
|
|
|
|
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
|
|
|
|
|
}
|
2017-02-21 05:19:25 +00:00
|
|
|
|
if (wc.Form != pkm.AltForm && vs.All(dl => !getCanFormChange(pkm, dl.Species))) continue;
|
2017-04-01 20:54:04 +00:00
|
|
|
|
|
|
|
|
|
if (wc.IsEgg)
|
|
|
|
|
{
|
|
|
|
|
if (wc.EggLocation != pkm.Egg_Location && pkm.Egg_Location != 30002) // traded
|
|
|
|
|
continue;
|
2017-04-05 05:01:48 +00:00
|
|
|
|
if (!pkm.IsNative)
|
|
|
|
|
continue;
|
2017-04-01 20:54:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (wc.EggLocation != pkm.Egg_Location) continue;
|
|
|
|
|
if (wc.MetLocation != pkm.Met_Location) continue;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-13 23:40:34 +00:00
|
|
|
|
if (wc.MetLevel != pkm.Met_Level) continue;
|
2016-11-13 21:11:53 +00:00
|
|
|
|
if (wc.Ball != pkm.Ball) continue;
|
|
|
|
|
if (wc.OTGender < 3 && wc.OTGender != pkm.OT_Gender) continue;
|
|
|
|
|
if (wc.Nature != 0xFF && wc.Nature != pkm.Nature) continue;
|
|
|
|
|
if (wc.Gender != 3 && wc.Gender != pkm.Gender) continue;
|
|
|
|
|
|
|
|
|
|
if (wc.CNT_Cool > pkm.CNT_Cool) continue;
|
|
|
|
|
if (wc.CNT_Beauty > pkm.CNT_Beauty) continue;
|
|
|
|
|
if (wc.CNT_Cute > pkm.CNT_Cute) continue;
|
|
|
|
|
if (wc.CNT_Smart > pkm.CNT_Smart) continue;
|
|
|
|
|
if (wc.CNT_Tough > pkm.CNT_Tough) continue;
|
|
|
|
|
if (wc.CNT_Sheen > pkm.CNT_Sheen) continue;
|
|
|
|
|
|
2016-12-12 01:13:59 +00:00
|
|
|
|
if (wc.PIDType == 2 && !pkm.IsShiny) continue;
|
|
|
|
|
if (wc.PIDType == 3 && pkm.IsShiny) continue;
|
|
|
|
|
|
|
|
|
|
if ((pkm.SID << 16 | pkm.TID) == 0x79F57B49) // Greninja WC has variant PID and can arrive @ 36 or 37
|
|
|
|
|
{
|
|
|
|
|
if (!pkm.IsShiny)
|
|
|
|
|
validWC7.Add(wc);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (wc.PIDType == 0 && pkm.PID != wc.PID) continue;
|
|
|
|
|
|
2016-11-13 21:11:53 +00:00
|
|
|
|
// Some checks are best performed separately as they are caused by users screwing up valid data.
|
|
|
|
|
// if (!wc.RelearnMoves.SequenceEqual(pkm.RelearnMoves)) continue; // Defer to relearn legality
|
|
|
|
|
// if (wc.OT.Length > 0 && pkm.CurrentHandler != 1) continue; // Defer to ownership legality
|
|
|
|
|
// if (wc.OT.Length > 0 && pkm.OT_Friendship != PKX.getBaseFriendship(pkm.Species)) continue; // Friendship
|
|
|
|
|
// if (wc.Level > pkm.CurrentLevel) continue; // Defer to level legality
|
|
|
|
|
// RIBBONS: Defer to ribbon legality
|
|
|
|
|
|
|
|
|
|
validWC7.Add(wc);
|
|
|
|
|
}
|
|
|
|
|
return validWC7;
|
|
|
|
|
}
|
2016-11-08 16:43:57 +00:00
|
|
|
|
internal static IEnumerable<int> getLineage(PKM pkm)
|
|
|
|
|
{
|
2017-02-05 21:08:25 +00:00
|
|
|
|
if (pkm.IsEgg)
|
|
|
|
|
return new[] {pkm.Species};
|
|
|
|
|
|
2016-11-08 16:43:57 +00:00
|
|
|
|
var table = getEvolutionTable(pkm);
|
|
|
|
|
var lineage = table.getValidPreEvolutions(pkm, pkm.CurrentLevel);
|
|
|
|
|
return lineage.Select(evolution => evolution.Species);
|
|
|
|
|
}
|
2017-03-21 07:18:38 +00:00
|
|
|
|
internal static int[] getWildBalls(PKM pkm)
|
2016-11-08 16:43:57 +00:00
|
|
|
|
{
|
|
|
|
|
switch (pkm.GenNumber)
|
|
|
|
|
{
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case 1:
|
|
|
|
|
return WildPokeBalls1;
|
|
|
|
|
case 2:
|
|
|
|
|
return WildPokeBalls2;
|
|
|
|
|
case 3:
|
|
|
|
|
return WildPokeBalls3;
|
|
|
|
|
case 4:
|
|
|
|
|
return pkm.HGSS ? WildPokeBalls4_HGSS : WildPokeBalls4_DPPt;
|
|
|
|
|
case 5:
|
|
|
|
|
return WildPokeBalls5;
|
|
|
|
|
case 6:
|
|
|
|
|
return WildPokeballs6;
|
2016-11-08 16:43:57 +00:00
|
|
|
|
case 7:
|
|
|
|
|
return WildPokeballs7;
|
2017-02-12 17:52:26 +00:00
|
|
|
|
|
2016-11-08 16:43:57 +00:00
|
|
|
|
default:
|
2017-02-12 17:52:26 +00:00
|
|
|
|
return null;
|
2016-11-08 16:43:57 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
}
|
2017-03-26 13:39:09 +00:00
|
|
|
|
|
|
|
|
|
internal static int[] getSplitBreedGeneration(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
return getSplitBreedGeneration(pkm.GenNumber);
|
|
|
|
|
}
|
|
|
|
|
internal static int[] getSplitBreedGeneration(int generation)
|
|
|
|
|
{
|
|
|
|
|
switch (generation)
|
|
|
|
|
{
|
|
|
|
|
case 1: return new int[0];
|
|
|
|
|
case 2: return new int[0];
|
|
|
|
|
case 3: return SplitBreed_3;
|
|
|
|
|
case 4: return SplitBreed;
|
|
|
|
|
case 5: return SplitBreed;
|
|
|
|
|
case 6: return SplitBreed;
|
|
|
|
|
case 7: return SplitBreed;
|
|
|
|
|
default: return new int[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static int getMaxSpeciesOrigin(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Format == 1 || pkm.VC1) // Gen1 VC could not trade with gen 2 yet
|
|
|
|
|
return getMaxSpeciesOrigin(1);
|
|
|
|
|
if (pkm.Format == 2 || pkm.VC2)
|
|
|
|
|
return getMaxSpeciesOrigin(2);
|
|
|
|
|
return getMaxSpeciesOrigin(pkm.GenNumber);
|
|
|
|
|
}
|
|
|
|
|
internal static int getMaxSpeciesOrigin(int generation)
|
|
|
|
|
{
|
|
|
|
|
switch (generation)
|
|
|
|
|
{
|
|
|
|
|
case 1: return MaxSpeciesID_1;
|
|
|
|
|
case 2: return MaxSpeciesID_2;
|
|
|
|
|
case 3: return MaxSpeciesID_3;
|
|
|
|
|
case 4: return MaxSpeciesID_4;
|
|
|
|
|
case 5: return MaxSpeciesID_5;
|
|
|
|
|
case 6: return MaxSpeciesID_6;
|
|
|
|
|
case 7: return MaxSpeciesID_7;
|
|
|
|
|
default: return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
internal static IEnumerable<int> getFutureGenEvolutions(int generation)
|
|
|
|
|
{
|
|
|
|
|
switch (generation)
|
|
|
|
|
{
|
|
|
|
|
case 1: return FutureEvolutionsGen1;
|
|
|
|
|
case 2: return FutureEvolutionsGen2;
|
|
|
|
|
case 3: return FutureEvolutionsGen3;
|
|
|
|
|
case 4: return FutureEvolutionsGen4;
|
|
|
|
|
case 5: return FutureEvolutionsGen5;
|
|
|
|
|
default: return new int[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2017-02-26 19:43:26 +00:00
|
|
|
|
internal static bool[] getReleasedHeldItems(int generation)
|
|
|
|
|
{
|
|
|
|
|
switch (generation)
|
|
|
|
|
{
|
|
|
|
|
case 2: return ReleasedHeldItems_2;
|
|
|
|
|
case 3: return ReleasedHeldItems_3;
|
|
|
|
|
case 4: return ReleasedHeldItems_4;
|
|
|
|
|
case 5: return ReleasedHeldItems_5;
|
|
|
|
|
case 6: return ReleasedHeldItems_6;
|
|
|
|
|
case 7: return ReleasedHeldItems_7;
|
|
|
|
|
default: return new bool[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
internal static bool getHeldItemAllowed(int generation, int item)
|
|
|
|
|
{
|
|
|
|
|
if (item < 0)
|
|
|
|
|
return false;
|
|
|
|
|
if (item == 0)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
var items = getReleasedHeldItems(generation);
|
|
|
|
|
return items.Length > item && items[item];
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
internal static bool getDexNavValid(PKM pkm)
|
2016-03-23 02:47:13 +00:00
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
if (!pkm.AO || !pkm.InhabitedGeneration(6))
|
|
|
|
|
return false;
|
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
IEnumerable<EncounterArea> locs = getDexNavAreas(pkm);
|
|
|
|
|
return locs.Select(loc => getValidEncounterSlots(pkm, loc, DexNav: true)).Any(slots => slots.Any(slot => slot.AllowDexNav && slot.DexNav));
|
2016-03-23 05:50:54 +00:00
|
|
|
|
}
|
2016-10-23 19:48:49 +00:00
|
|
|
|
internal static bool getHasEvolved(PKM pkm)
|
2016-03-23 05:50:54 +00:00
|
|
|
|
{
|
2017-02-05 21:08:25 +00:00
|
|
|
|
if (pkm.IsEgg)
|
|
|
|
|
return false;
|
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
return getValidPreEvolutions(pkm).Count() > 1;
|
2016-03-23 05:50:54 +00:00
|
|
|
|
}
|
2017-02-02 05:59:39 +00:00
|
|
|
|
internal static bool getHasEvolvedFormChange(PKM pkm)
|
|
|
|
|
{
|
2017-02-05 21:08:25 +00:00
|
|
|
|
if (pkm.IsEgg)
|
|
|
|
|
return false;
|
|
|
|
|
|
2017-02-02 05:59:39 +00:00
|
|
|
|
if (pkm.Format >= 7 && EvolveToAlolanForms.Contains(pkm.Species))
|
|
|
|
|
return pkm.AltForm == 1;
|
|
|
|
|
if (pkm.Species == 678 && pkm.Gender == 1)
|
|
|
|
|
return pkm.AltForm == 1;
|
2017-03-03 02:28:43 +00:00
|
|
|
|
if (pkm.Species == 773)
|
|
|
|
|
return true;
|
2017-02-02 05:59:39 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-10-23 19:48:49 +00:00
|
|
|
|
internal static bool getHasTradeEvolved(PKM pkm)
|
2016-03-23 05:50:54 +00:00
|
|
|
|
{
|
2017-02-05 21:08:25 +00:00
|
|
|
|
if (pkm.IsEgg)
|
|
|
|
|
return false;
|
|
|
|
|
|
2016-11-08 16:43:57 +00:00
|
|
|
|
var table = getEvolutionTable(pkm);
|
2016-12-03 04:26:35 +00:00
|
|
|
|
var lineage = table.getValidPreEvolutions(pkm, 100, skipChecks:true);
|
2016-11-08 16:43:57 +00:00
|
|
|
|
return lineage.Any(evolution => EvolutionMethod.TradeMethods.Any(method => method == evolution.Flag)); // Trade Evolutions
|
2016-03-23 05:50:54 +00:00
|
|
|
|
}
|
2016-10-23 19:48:49 +00:00
|
|
|
|
internal static bool getEvolutionValid(PKM pkm)
|
2016-04-08 01:19:21 +00:00
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
var curr = getValidPreEvolutions(pkm);
|
2017-04-21 02:51:35 +00:00
|
|
|
|
var poss = getValidPreEvolutions(pkm, lvl: 100, skipChecks: true);
|
2016-04-08 01:19:21 +00:00
|
|
|
|
|
2017-03-26 13:39:09 +00:00
|
|
|
|
if (getSplitBreedGeneration(pkm).Contains(getBaseSpecies(pkm, 1)))
|
2016-04-08 01:19:21 +00:00
|
|
|
|
return curr.Count() >= poss.Count() - 1;
|
|
|
|
|
return curr.Count() >= poss.Count();
|
|
|
|
|
}
|
2017-02-21 05:19:25 +00:00
|
|
|
|
internal static bool getCanFormChange(PKM pkm, int species)
|
|
|
|
|
{
|
|
|
|
|
if (FormChange.Contains(species))
|
|
|
|
|
return true;
|
|
|
|
|
if (getHasEvolvedFormChange(pkm))
|
|
|
|
|
return true;
|
2017-03-10 22:45:09 +00:00
|
|
|
|
if (pkm.Species == 718 && pkm.InhabitedGeneration(7) && pkm.AltForm == 3)
|
2017-02-21 05:19:25 +00:00
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-03-23 02:47:13 +00:00
|
|
|
|
|
2016-11-27 07:23:45 +00:00
|
|
|
|
internal static EncounterArea getCaptureLocation(PKM pkm)
|
|
|
|
|
{
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return (from area in getEncounterSlots(pkm, 100)
|
|
|
|
|
let slots = getValidEncounterSlots(pkm, area, pkm.AO, ignoreLevel:true).ToArray()
|
2016-11-27 07:23:45 +00:00
|
|
|
|
where slots.Any()
|
|
|
|
|
select new EncounterArea
|
|
|
|
|
{
|
|
|
|
|
Location = area.Location, Slots = slots,
|
2017-02-15 01:33:57 +00:00
|
|
|
|
}).OrderBy(area => area.Slots.Min(x => x.LevelMin)).FirstOrDefault();
|
2016-11-27 07:23:45 +00:00
|
|
|
|
}
|
2017-03-10 04:27:03 +00:00
|
|
|
|
internal static EncounterStatic getRBYStaticTransfer(int species)
|
2016-11-27 07:23:45 +00:00
|
|
|
|
{
|
2017-03-10 04:27:03 +00:00
|
|
|
|
return new EncounterStatic
|
|
|
|
|
{
|
|
|
|
|
Species = species,
|
|
|
|
|
Gift = true, // Forces Poké Ball
|
|
|
|
|
Ability = TransferSpeciesDefaultAbility_1.Contains(species) ? 1 : 4, // Hidden by default, else first
|
|
|
|
|
Shiny = species == 151 ? (bool?)false : null,
|
|
|
|
|
Fateful = species == 151,
|
|
|
|
|
Location = 30013,
|
|
|
|
|
EggLocation = 0,
|
|
|
|
|
IV3 = true,
|
|
|
|
|
Version = GameVersion.RBY
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
internal static EncounterStatic getStaticLocation(PKM pkm, int species = -1)
|
|
|
|
|
{
|
|
|
|
|
switch (pkm.GenNumber)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
return getRBYStaticTransfer(species);
|
|
|
|
|
default:
|
|
|
|
|
return getStaticEncounters(pkm, 100).OrderBy(s => s.Level).FirstOrDefault();
|
|
|
|
|
}
|
2016-11-27 07:23:45 +00:00
|
|
|
|
}
|
2017-01-08 07:54:09 +00:00
|
|
|
|
|
|
|
|
|
public static int getLowestLevel(PKM pkm, int refSpecies = -1)
|
2016-12-01 06:06:41 +00:00
|
|
|
|
{
|
|
|
|
|
if (refSpecies == -1)
|
2016-12-03 04:26:35 +00:00
|
|
|
|
refSpecies = getBaseSpecies(pkm);
|
2016-12-01 06:06:41 +00:00
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
|
{
|
|
|
|
|
var table = getEvolutionTable(pkm);
|
2016-12-03 04:26:35 +00:00
|
|
|
|
var evos = table.getValidPreEvolutions(pkm, i, skipChecks:true).ToArray();
|
2016-12-01 06:06:41 +00:00
|
|
|
|
if (evos.Any(evo => evo.Species == refSpecies))
|
|
|
|
|
return evos.OrderByDescending(evo => evo.Level).First().Level;
|
|
|
|
|
}
|
|
|
|
|
return 100;
|
|
|
|
|
}
|
2016-11-09 06:10:32 +00:00
|
|
|
|
internal static bool getCanBeCaptured(int species, int gen, GameVersion version = GameVersion.Any)
|
2016-05-06 03:35:18 +00:00
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
switch (gen)
|
2016-05-06 03:35:18 +00:00
|
|
|
|
{
|
2017-03-18 23:50:34 +00:00
|
|
|
|
// Capture Memory only obtainable via Gen 6.
|
2016-10-24 05:03:19 +00:00
|
|
|
|
case 6:
|
|
|
|
|
switch (version)
|
|
|
|
|
{
|
2016-11-09 06:10:32 +00:00
|
|
|
|
case GameVersion.Any:
|
2016-10-24 05:03:19 +00:00
|
|
|
|
return getCanBeCaptured(species, SlotsX, StaticX, XY:true)
|
|
|
|
|
|| getCanBeCaptured(species, SlotsY, StaticY, XY:true)
|
|
|
|
|
|| getCanBeCaptured(species, SlotsA, StaticA)
|
|
|
|
|
|| getCanBeCaptured(species, SlotsO, StaticO);
|
2016-11-09 06:10:32 +00:00
|
|
|
|
case GameVersion.X:
|
2016-10-24 05:03:19 +00:00
|
|
|
|
return getCanBeCaptured(species, SlotsX, StaticX, XY:true);
|
2016-11-09 06:10:32 +00:00
|
|
|
|
case GameVersion.Y:
|
2016-10-24 05:03:19 +00:00
|
|
|
|
return getCanBeCaptured(species, SlotsY, StaticY, XY:true);
|
2016-11-09 06:10:32 +00:00
|
|
|
|
case GameVersion.AS:
|
2016-10-24 05:03:19 +00:00
|
|
|
|
return getCanBeCaptured(species, SlotsA, StaticA);
|
2016-11-09 06:10:32 +00:00
|
|
|
|
case GameVersion.OR:
|
2016-10-24 05:03:19 +00:00
|
|
|
|
return getCanBeCaptured(species, SlotsO, StaticO);
|
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
2016-05-06 03:35:18 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
private static bool getCanBeCaptured(int species, IEnumerable<EncounterArea> area, IEnumerable<EncounterStatic> statics, bool XY = false)
|
|
|
|
|
{
|
|
|
|
|
if (XY && FriendSafari.Contains(species))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (area.Any(loc => loc.Slots.Any(slot => slot.Species == species)))
|
|
|
|
|
return true;
|
|
|
|
|
if (statics.Any(enc => enc.Species == species && !enc.Gift))
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static bool getCanLearnMachineMove(PKM pkm, int move, IEnumerable<int> generations, GameVersion version = GameVersion.Any)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
{
|
2017-03-20 07:03:31 +00:00
|
|
|
|
return generations.Any(generation => getCanLearnMachineMove(pkm, move, generation, version));
|
2017-02-15 22:33:59 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static bool getCanRelearnMove(PKM pkm, int move, IEnumerable<int> generations, GameVersion version = GameVersion.Any)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return generations.Any(generation => getCanRelearnMove(pkm, move, generation, version));
|
2017-02-15 22:33:59 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static bool getCanLearnMove(PKM pkm, int move, IEnumerable<int> generations, GameVersion version = GameVersion.Any)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return generations.Any(generation => getCanLearnMove(pkm, move, generation, version));
|
2017-02-15 22:33:59 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static bool getCanKnowMove(PKM pkm, int move, IEnumerable<int> generations, GameVersion version = GameVersion.Any)
|
2016-05-10 01:19:31 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return generations.Any(generation => getCanKnowMove(pkm, move, generation, version));
|
2016-05-10 02:24:52 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static bool getCanLearnMachineMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
2016-05-10 02:24:52 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return getValidMoves(pkm, version, getValidPreEvolutions(pkm).ToArray(), generation, Machine: true).Contains(move);
|
2016-05-10 02:24:52 +00:00
|
|
|
|
}
|
2017-02-15 22:33:59 +00:00
|
|
|
|
internal static bool getCanRelearnMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
2016-05-10 02:24:52 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return getValidMoves(pkm, version, getValidPreEvolutions(pkm).ToArray(), generation, LVL: true, Relearn: true).Contains(move);
|
2016-05-10 02:24:52 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static bool getCanLearnMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return getValidMoves(pkm, version, getValidPreEvolutions(pkm).ToArray(), generation, Tutor: true, Machine: true).Contains(move);
|
2017-02-15 22:33:59 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static bool getCanKnowMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
2016-05-10 02:24:52 +00:00
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (pkm.Species == 235 && !InvalidSketch.Contains(move))
|
2016-05-10 16:03:51 +00:00
|
|
|
|
return true;
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return getValidMoves(pkm, version, getValidPreEvolutions(pkm).ToArray(), generation, LVL: true, Relearn: true, Tutor: true, Machine: true).Contains(move);
|
2016-05-10 01:19:31 +00:00
|
|
|
|
}
|
2017-04-13 15:48:13 +00:00
|
|
|
|
internal static int getBaseEggSpecies(PKM pkm, int skipOption = 0)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Format == 1)
|
|
|
|
|
return getBaseSpecies(pkm, skipOption : skipOption, generation : 2);
|
|
|
|
|
return getBaseSpecies(pkm, skipOption);
|
|
|
|
|
}
|
|
|
|
|
internal static int getBaseSpecies(PKM pkm, int skipOption = 0, int generation = -1)
|
2016-02-23 06:52:48 +00:00
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (pkm.Species == 292)
|
2016-03-18 02:37:06 +00:00
|
|
|
|
return 290;
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (pkm.Species == 242 && pkm.CurrentLevel < 3) // Never Cleffa
|
2016-05-10 04:09:38 +00:00
|
|
|
|
return 113;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2017-04-13 15:48:13 +00:00
|
|
|
|
var table = generation != -1 ? getEvolutionTable(generation): getEvolutionTable(pkm);
|
|
|
|
|
int maxSpeciesOrigin = generation != -1 ? getMaxSpeciesOrigin(generation) : - 1;
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
var evos = table.getValidPreEvolutions(pkm, 100, maxSpeciesOrigin: maxSpeciesOrigin, skipChecks:true).ToArray();
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2016-02-26 15:52:08 +00:00
|
|
|
|
switch (skipOption)
|
2016-02-23 06:52:48 +00:00
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
case -1: return pkm.Species;
|
|
|
|
|
case 1: return evos.Length <= 1 ? pkm.Species : evos[evos.Length - 2].Species;
|
|
|
|
|
default: return evos.Length <= 0 ? pkm.Species : evos.Last().Species;
|
2016-02-23 06:52:48 +00:00
|
|
|
|
}
|
2016-02-26 15:52:08 +00:00
|
|
|
|
}
|
2017-02-16 10:59:07 +00:00
|
|
|
|
internal static int getMaxLevelGeneration(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
return getMaxLevelGeneration(pkm, pkm.GenNumber);
|
|
|
|
|
}
|
|
|
|
|
internal static int getMaxLevelGeneration(PKM pkm, int generation)
|
|
|
|
|
{
|
|
|
|
|
if (!pkm.InhabitedGeneration(generation))
|
2017-03-30 18:58:30 +00:00
|
|
|
|
return -1;
|
2017-02-16 10:59:07 +00:00
|
|
|
|
|
|
|
|
|
if (pkm.Format <= 2)
|
|
|
|
|
{
|
|
|
|
|
if (generation == 1 && FutureEvolutionsGen1_Gen2LevelUp.Contains(pkm.Species))
|
|
|
|
|
return pkm.CurrentLevel - 1;
|
|
|
|
|
return pkm.CurrentLevel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pkm.Species == 700 && generation == 5)
|
|
|
|
|
return pkm.CurrentLevel - 1;
|
|
|
|
|
|
2017-03-26 16:45:01 +00:00
|
|
|
|
if (pkm.Gen3 && pkm.Format > 4 && pkm.Met_Level == pkm.CurrentLevel && FutureEvolutionsGen3_LevelUpGen4.Contains(pkm.Species))
|
2017-02-16 10:59:07 +00:00
|
|
|
|
return pkm.Met_Level - 1;
|
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (!pkm.HasOriginalMetLocation)
|
|
|
|
|
return pkm.Met_Level;
|
|
|
|
|
|
|
|
|
|
return pkm.CurrentLevel;
|
|
|
|
|
}
|
|
|
|
|
internal static int getMinLevelEncounter(PKM pkm)
|
|
|
|
|
{
|
2017-03-26 16:05:58 +00:00
|
|
|
|
if (pkm.Format == 3 && pkm.WasEgg)
|
2017-03-30 18:58:30 +00:00
|
|
|
|
// Only for gen 3 pokemon in format 3, after transfer to gen 4 it should return transfer level
|
2017-03-26 16:05:58 +00:00
|
|
|
|
return 5;
|
2017-03-30 18:58:30 +00:00
|
|
|
|
if (pkm.Format == 4 && pkm.GenNumber == 4 && pkm.WasEgg)
|
|
|
|
|
// Only for gen 4 pokemon in format 4, after transfer to gen 5 it should return transfer level
|
|
|
|
|
return 1;
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return pkm.HasOriginalMetLocation ? pkm.Met_Level : getMaxLevelGeneration(pkm);
|
2017-02-16 10:59:07 +00:00
|
|
|
|
}
|
|
|
|
|
internal static int getMinLevelGeneration(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
return getMinLevelGeneration(pkm, pkm.GenNumber);
|
|
|
|
|
}
|
|
|
|
|
internal static int getMinLevelGeneration(PKM pkm, int generation)
|
|
|
|
|
{
|
|
|
|
|
if (!pkm.InhabitedGeneration(generation))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (pkm.Format <= 2)
|
|
|
|
|
return 2;
|
|
|
|
|
|
2017-04-13 15:48:13 +00:00
|
|
|
|
if (!pkm.HasOriginalMetLocation && generation != pkm.GenNumber)
|
2017-02-16 10:59:07 +00:00
|
|
|
|
return pkm.Met_Level;
|
|
|
|
|
|
|
|
|
|
if (pkm.GenNumber <= 3)
|
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
|
2017-02-15 22:10:20 +00:00
|
|
|
|
internal static DexLevel[][] getEvolutionChainsAllGens(PKM pkm, object Encounter)
|
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
var CompleteEvoChain = getEvolutionChain(pkm, Encounter).ToArray();
|
2017-02-21 04:25:15 +00:00
|
|
|
|
int size = Math.Max(pkm.Format, 2);
|
|
|
|
|
DexLevel[][] GensEvoChains = new DexLevel[size + 1][];
|
|
|
|
|
for (int i = 0; i <= size; i++)
|
|
|
|
|
GensEvoChains[i] = new DexLevel[0];
|
2017-02-15 22:10:20 +00:00
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (pkm.Species == 0 || pkm.Format > 2 && pkm.GenU) // Illegal origin or empty pokemon, return only chain for current format
|
2017-02-15 22:10:20 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
GensEvoChains[pkm.Format] = CompleteEvoChain;
|
2017-02-15 22:10:20 +00:00
|
|
|
|
return GensEvoChains;
|
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
// If is egg skip the other checks and just return the evo chain for GenNumber, that will contains only the pokemon inside the egg
|
|
|
|
|
// Empty list returned if is an impossible egg (like a gen 3 infernape inside an egg)
|
|
|
|
|
if (pkm.IsEgg)
|
2017-02-16 09:35:14 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (getMaxSpeciesOrigin(pkm.GenNumber) >= pkm.Species)
|
|
|
|
|
GensEvoChains[pkm.GenNumber] = CompleteEvoChain;
|
2017-02-16 09:35:14 +00:00
|
|
|
|
return GensEvoChains;
|
|
|
|
|
}
|
2017-02-15 22:10:20 +00:00
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
int lvl = pkm.CurrentLevel;
|
|
|
|
|
int maxgen = pkm.Format <= 2 ? 2 : pkm.Format;
|
|
|
|
|
int mingen = pkm.VC2 || pkm.Format <= 2 ? 1 : pkm.GenNumber;
|
|
|
|
|
|
|
|
|
|
// Iterate generations backwards because level will be decreased from current level in each generation
|
2017-02-15 22:10:20 +00:00
|
|
|
|
for (int gen = maxgen; gen >= mingen; gen--)
|
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if ((pkm.Gen1 || pkm.VC1) && pkm.Format > 2 && 2 <= gen && gen <= 6)
|
2017-02-15 22:10:20 +00:00
|
|
|
|
continue;
|
|
|
|
|
if ((pkm.Gen2 || pkm.VC2) && 3 <= gen && gen <= 6)
|
|
|
|
|
continue;
|
2017-04-13 15:48:13 +00:00
|
|
|
|
if (!pkm.HasOriginalMetLocation && pkm.Format > 2 && gen < pkm.Format && gen <= 4 && lvl > pkm.Met_Level)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
{
|
|
|
|
|
// Met location was lost at this point but it also means the pokemon existed in generations 1 to 4 with maximum level equals to met level
|
|
|
|
|
lvl = pkm.Met_Level;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-16 09:35:14 +00:00
|
|
|
|
int maxspeciesgen = getMaxSpeciesOrigin(gen);
|
2017-02-21 03:40:50 +00:00
|
|
|
|
|
|
|
|
|
// Remove future gen evolutions after a few special considerations,
|
|
|
|
|
// it the pokemon origin is illegal like a "gen 3" Infernape the list will be emptied, it didnt existed in gen 3 in any evolution phase
|
2017-02-16 09:35:14 +00:00
|
|
|
|
while (CompleteEvoChain.Any() && CompleteEvoChain.First().Species > maxspeciesgen)
|
2017-02-15 22:10:20 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
// Eevee requires to level one time to be Sylveon, it can be deduced in gen 5 and before it existed with maximum one level bellow current
|
2017-02-15 22:10:20 +00:00
|
|
|
|
if (CompleteEvoChain.First().Species == 700 && gen == 5)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
lvl--;
|
|
|
|
|
// This is a gen 3 pokemon in a gen 4 phase evolution that requieres level up and then transfered to gen 5+
|
|
|
|
|
// We can deduce that it existed in gen 4 until met level,
|
|
|
|
|
// but if current level is met level we can also deduce it existed in gen 3 until maximum met level -1
|
|
|
|
|
if (gen == 3 && pkm.Format > 4 && lvl == pkm.CurrentLevel && CompleteEvoChain.First().Species > MaxSpeciesID_3 && CompleteEvoChain.First().RequiresLvlUp)
|
|
|
|
|
lvl--;
|
|
|
|
|
// The same condition for gen2 evolution of gen 1 pokemon, level of the pokemon in gen 1 games would be CurrentLevel -1 one level bellow gen 2 level
|
|
|
|
|
if (gen == 1 && pkm.Format == 2 && lvl == pkm.CurrentLevel && CompleteEvoChain.First().Species > MaxSpeciesID_1 && CompleteEvoChain.First().RequiresLvlUp)
|
|
|
|
|
lvl--;
|
|
|
|
|
CompleteEvoChain = CompleteEvoChain.Skip(1).ToArray();
|
2017-02-15 22:10:20 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
|
|
|
|
|
// Alolan form evolutions, remove from gens 1-6 chains
|
|
|
|
|
if (gen < 7 && pkm.Format >= 7 && CompleteEvoChain.Any() && CompleteEvoChain.First().Form > 0 && EvolveToAlolanForms.Contains(CompleteEvoChain.First().Species))
|
|
|
|
|
CompleteEvoChain = CompleteEvoChain.Skip(1).ToArray();
|
|
|
|
|
|
|
|
|
|
if (!CompleteEvoChain.Any())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
GensEvoChains[gen] = getEvolutionChain(pkm, Encounter, CompleteEvoChain.First().Species, lvl);
|
2017-03-10 04:27:03 +00:00
|
|
|
|
if (gen > 2 && !pkm.HasOriginalMetLocation && gen >= pkm.GenNumber)
|
2017-02-21 03:40:50 +00:00
|
|
|
|
//Remove previous evolutions bellow transfer level
|
|
|
|
|
//For example a gen3 charizar in format 7 with current level 36 and met level 36
|
|
|
|
|
//chain level for charmander is 35, is bellow met level
|
2017-04-13 15:48:13 +00:00
|
|
|
|
GensEvoChains[gen] = GensEvoChains[gen].Where(e => e.Level >= getMinLevelGeneration(pkm,gen)).ToArray();
|
2017-02-15 22:10:20 +00:00
|
|
|
|
}
|
|
|
|
|
return GensEvoChains;
|
|
|
|
|
}
|
2017-01-04 04:51:33 +00:00
|
|
|
|
internal static DexLevel[] getEvolutionChain(PKM pkm, object Encounter)
|
2017-02-15 21:12:06 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
return getEvolutionChain(pkm, Encounter, pkm.Species, 100);
|
2017-02-15 21:12:06 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
internal static DexLevel[] getEvolutionChain(PKM pkm, object Encounter, int maxspec, int maxlevel)
|
2017-01-04 04:51:33 +00:00
|
|
|
|
{
|
|
|
|
|
int minspec;
|
2017-02-15 21:12:06 +00:00
|
|
|
|
DexLevel[] vs = getValidPreEvolutions(pkm).ToArray();
|
2017-01-04 04:51:33 +00:00
|
|
|
|
|
|
|
|
|
// Evolution chain is in reverse order (devolution)
|
|
|
|
|
|
2017-04-14 23:24:41 +00:00
|
|
|
|
if (Encounter is IEncounterable[])
|
2017-01-05 06:25:45 +00:00
|
|
|
|
minspec = vs.Reverse().First(s => ((IEncounterable[]) Encounter).Any(slot => slot.Species == s.Species)).Species;
|
|
|
|
|
else if (Encounter is IEncounterable)
|
|
|
|
|
minspec = vs.Reverse().First(s => ((IEncounterable) Encounter).Species == s.Species).Species;
|
2017-01-04 04:51:33 +00:00
|
|
|
|
else
|
|
|
|
|
minspec = vs.Last().Species;
|
|
|
|
|
|
2017-02-15 21:12:06 +00:00
|
|
|
|
int minindex = Math.Max(0, Array.FindIndex(vs, p => p.Species == minspec));
|
|
|
|
|
Array.Resize(ref vs, minindex + 1);
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (vs.Last().MinLevel > 1) // Last entry from vs is removed, turn next entry into the wild/hatched pokemon
|
2017-02-15 21:12:06 +00:00
|
|
|
|
{
|
|
|
|
|
vs.Last().MinLevel = 1;
|
|
|
|
|
vs.Last().RequiresLvlUp = false;
|
|
|
|
|
if (vs.First().MinLevel == 2 && !vs.First().RequiresLvlUp)
|
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
// Example Raichu in gen 2 or later,
|
|
|
|
|
// because Pichu requires level up Minimum level of Raichu would be 2
|
|
|
|
|
// but after removing Pichu because the origin species is Pikachu, Raichu min level should be 1
|
2017-02-15 21:12:06 +00:00
|
|
|
|
vs.First().MinLevel = 1;
|
|
|
|
|
vs.First().RequiresLvlUp = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
// Maxspec is used to remove future gen evolutions, to gather evolution chain of a pokemon in previous generations
|
2017-02-15 21:12:06 +00:00
|
|
|
|
int skip = Math.Max(0, Array.FindIndex(vs, p => p.Species == maxspec));
|
2017-02-21 03:40:50 +00:00
|
|
|
|
// Maxlevel is also used for previous generations, it removes evolutions imposible before the transfer level
|
|
|
|
|
// For example a fire red charizard whose current level in XY is 50 but met level is 20, it couldnt be a Charizard in gen 3 and 4 games
|
|
|
|
|
vs = vs.Skip(skip).Where(e => e.MinLevel <= maxlevel).ToArray();
|
|
|
|
|
// Reduce the evolution chain levels to max level, because met level is the last one when the pokemon could be and learn moves in that generation
|
2017-02-15 21:12:06 +00:00
|
|
|
|
foreach (DexLevel d in vs)
|
|
|
|
|
d.Level = Math.Min(d.Level, maxlevel);
|
2017-01-04 04:51:33 +00:00
|
|
|
|
return vs;
|
|
|
|
|
}
|
|
|
|
|
internal static string getEncounterTypeName(PKM pkm, object Encounter)
|
|
|
|
|
{
|
|
|
|
|
var t = Encounter;
|
|
|
|
|
if (pkm.WasEgg)
|
|
|
|
|
return "Egg";
|
2017-01-05 06:25:45 +00:00
|
|
|
|
if (t is IEncounterable)
|
|
|
|
|
return ((IEncounterable)t).Name;
|
|
|
|
|
if (t is IEncounterable[])
|
2017-01-04 04:51:33 +00:00
|
|
|
|
{
|
2017-01-05 06:25:45 +00:00
|
|
|
|
var arr = (IEncounterable[])t;
|
2017-01-04 04:51:33 +00:00
|
|
|
|
if (arr.Any())
|
|
|
|
|
return arr.First().Name;
|
|
|
|
|
}
|
|
|
|
|
if (t is int)
|
|
|
|
|
return "Unknown";
|
2017-02-13 01:00:03 +00:00
|
|
|
|
return t?.GetType().Name ?? "Unknown";
|
2017-01-04 04:51:33 +00:00
|
|
|
|
}
|
2016-10-23 19:48:49 +00:00
|
|
|
|
private static IEnumerable<EncounterArea> getDexNavAreas(PKM pkm)
|
2016-03-23 02:47:13 +00:00
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
switch (pkm.Version)
|
|
|
|
|
{
|
|
|
|
|
case (int)GameVersion.AS:
|
|
|
|
|
return SlotsA.Where(l => l.Location == pkm.Met_Location);
|
|
|
|
|
case (int)GameVersion.OR:
|
|
|
|
|
return SlotsO.Where(l => l.Location == pkm.Met_Location);
|
|
|
|
|
default:
|
|
|
|
|
return new EncounterArea[0];
|
|
|
|
|
}
|
2016-03-23 02:47:13 +00:00
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
private static IEnumerable<int> getRelearnLVLMoves(PKM pkm, int species, int lvl, int formnum)
|
2016-03-12 03:43:40 +00:00
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
List<int> moves = new List<int>();
|
2017-03-18 23:50:34 +00:00
|
|
|
|
switch (pkm.GenNumber)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 6:
|
|
|
|
|
if (pkm.InhabitedGeneration(6))
|
|
|
|
|
{
|
|
|
|
|
int ind_XY = PersonalTable.XY.getFormeIndex(species, formnum);
|
|
|
|
|
moves.AddRange(LevelUpXY[ind_XY].getMoves(lvl));
|
|
|
|
|
int ind_AO = PersonalTable.AO.getFormeIndex(species, formnum);
|
|
|
|
|
moves.AddRange(LevelUpAO[ind_AO].getMoves(lvl));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
if (pkm.InhabitedGeneration(7))
|
|
|
|
|
{
|
|
|
|
|
int ind_SM = PersonalTable.SM.getFormeIndex(species, formnum);
|
|
|
|
|
moves.AddRange(LevelUpSM[ind_SM].getMoves(lvl));
|
|
|
|
|
}
|
|
|
|
|
break;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
|
|
|
|
return moves;
|
2016-03-12 03:43:40 +00:00
|
|
|
|
}
|
2017-02-27 05:46:00 +00:00
|
|
|
|
private static IEnumerable<EncounterArea> getEncounterSlots(PKM pkm, int lvl = -1, GameVersion gameSource = GameVersion.Any)
|
2016-03-12 17:16:41 +00:00
|
|
|
|
{
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (gameSource == GameVersion.Any)
|
|
|
|
|
gameSource = (GameVersion)pkm.Version;
|
|
|
|
|
|
|
|
|
|
switch (gameSource)
|
2016-03-12 17:16:41 +00:00
|
|
|
|
{
|
2017-02-13 01:00:03 +00:00
|
|
|
|
case GameVersion.RBY:
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.RD: case GameVersion.BU:
|
|
|
|
|
case GameVersion.GN: case GameVersion.YW:
|
|
|
|
|
return getSlots(pkm, SlotsRBY, lvl);
|
|
|
|
|
|
2017-02-26 17:36:53 +00:00
|
|
|
|
case GameVersion.GSC:
|
|
|
|
|
case GameVersion.GD: case GameVersion.SV:
|
|
|
|
|
case GameVersion.C:
|
2017-03-21 00:50:35 +00:00
|
|
|
|
return getSlots(pkm, getSlotsTableGen2(pkm), lvl);
|
2017-02-26 17:36:53 +00:00
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case GameVersion.R:
|
|
|
|
|
return getSlots(pkm, SlotsR, lvl);
|
|
|
|
|
case GameVersion.S:
|
|
|
|
|
return getSlots(pkm, SlotsS, lvl);
|
|
|
|
|
case GameVersion.E:
|
|
|
|
|
return getSlots(pkm, SlotsE, lvl);
|
|
|
|
|
case GameVersion.FR:
|
|
|
|
|
return getSlots(pkm, SlotsFR, lvl);
|
|
|
|
|
case GameVersion.LG:
|
|
|
|
|
return getSlots(pkm, SlotsLG, lvl);
|
|
|
|
|
|
|
|
|
|
case GameVersion.D:
|
|
|
|
|
return getSlots(pkm, SlotsD, lvl);
|
|
|
|
|
case GameVersion.P:
|
|
|
|
|
return getSlots(pkm, SlotsP, lvl);
|
|
|
|
|
case GameVersion.Pt:
|
|
|
|
|
return getSlots(pkm, SlotsPt, lvl);
|
|
|
|
|
case GameVersion.HG:
|
|
|
|
|
return getSlots(pkm, SlotsHG, lvl);
|
|
|
|
|
case GameVersion.SS:
|
|
|
|
|
return getSlots(pkm, SlotsSS, lvl);
|
|
|
|
|
|
|
|
|
|
case GameVersion.B:
|
|
|
|
|
return getSlots(pkm, SlotsB, lvl);
|
|
|
|
|
case GameVersion.W:
|
|
|
|
|
return getSlots(pkm, SlotsW, lvl);
|
|
|
|
|
case GameVersion.B2:
|
|
|
|
|
return getSlots(pkm, SlotsB2, lvl);
|
|
|
|
|
case GameVersion.W2:
|
|
|
|
|
return getSlots(pkm, SlotsW2, lvl);
|
|
|
|
|
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.X:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getSlots(pkm, SlotsX, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.Y:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getSlots(pkm, SlotsY, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.AS:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getSlots(pkm, SlotsA, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.OR:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getSlots(pkm, SlotsO, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
|
|
|
|
|
case GameVersion.SN:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getSlots(pkm, SlotsSN, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.MN:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getSlots(pkm, SlotsMN, lvl);
|
2016-03-12 17:16:41 +00:00
|
|
|
|
default: return new List<EncounterArea>();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-27 05:46:00 +00:00
|
|
|
|
private static IEnumerable<EncounterStatic> getStaticEncounters(PKM pkm, int lvl = -1, GameVersion gameSource = GameVersion.Any)
|
2016-03-13 21:56:23 +00:00
|
|
|
|
{
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (gameSource == GameVersion.Any)
|
|
|
|
|
gameSource = (GameVersion) pkm.Version;
|
|
|
|
|
|
|
|
|
|
switch (gameSource)
|
2016-03-13 21:56:23 +00:00
|
|
|
|
{
|
2017-02-13 01:00:03 +00:00
|
|
|
|
case GameVersion.RBY:
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.RD: case GameVersion.BU:
|
|
|
|
|
case GameVersion.GN: case GameVersion.YW:
|
2017-04-04 02:59:29 +00:00
|
|
|
|
return getStatic(pkm, StaticRBY, maxspeciesorigin:MaxSpeciesID_1, lvl: lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
|
2017-02-26 17:36:53 +00:00
|
|
|
|
case GameVersion.GSC:
|
|
|
|
|
case GameVersion.GD: case GameVersion.SV:
|
|
|
|
|
case GameVersion.C:
|
2017-04-04 02:59:29 +00:00
|
|
|
|
return getStatic(pkm, getStaticTableGen2(pkm), maxspeciesorigin: MaxSpeciesID_2, lvl: lvl);
|
2017-02-26 17:36:53 +00:00
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case GameVersion.R:
|
|
|
|
|
return getStatic(pkm, StaticR, lvl);
|
|
|
|
|
case GameVersion.S:
|
|
|
|
|
return getStatic(pkm, StaticS, lvl);
|
|
|
|
|
case GameVersion.E:
|
|
|
|
|
return getStatic(pkm, StaticE, lvl);
|
|
|
|
|
case GameVersion.FR:
|
|
|
|
|
return getStatic(pkm, StaticFR, lvl);
|
|
|
|
|
case GameVersion.LG:
|
|
|
|
|
return getStatic(pkm, StaticLG, lvl);
|
|
|
|
|
|
|
|
|
|
case GameVersion.D:
|
|
|
|
|
return getStatic(pkm, StaticD, lvl);
|
|
|
|
|
case GameVersion.P:
|
|
|
|
|
return getStatic(pkm, StaticP, lvl);
|
|
|
|
|
case GameVersion.Pt:
|
|
|
|
|
return getStatic(pkm, StaticPt, lvl);
|
|
|
|
|
case GameVersion.HG:
|
|
|
|
|
return getStatic(pkm, StaticHG, lvl);
|
|
|
|
|
case GameVersion.SS:
|
|
|
|
|
return getStatic(pkm, StaticSS, lvl);
|
|
|
|
|
|
|
|
|
|
case GameVersion.B:
|
|
|
|
|
return getStatic(pkm, StaticB, lvl);
|
|
|
|
|
case GameVersion.W:
|
|
|
|
|
return getStatic(pkm, StaticW, lvl);
|
|
|
|
|
case GameVersion.B2:
|
|
|
|
|
return getStatic(pkm, StaticB2, lvl);
|
|
|
|
|
case GameVersion.W2:
|
|
|
|
|
return getStatic(pkm, StaticW2, lvl);
|
|
|
|
|
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.X:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getStatic(pkm, StaticX, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.Y:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getStatic(pkm, StaticY, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.AS:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getStatic(pkm, StaticA, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.OR:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getStatic(pkm, StaticO, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
|
|
|
|
|
case GameVersion.SN:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getStatic(pkm, StaticSN, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
case GameVersion.MN:
|
2016-12-01 06:06:41 +00:00
|
|
|
|
return getStatic(pkm, StaticMN, lvl);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
|
2016-03-13 21:56:23 +00:00
|
|
|
|
default: return new List<EncounterStatic>();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-27 05:46:00 +00:00
|
|
|
|
private static IEnumerable<EncounterArea> getEncounterAreas(PKM pkm, GameVersion gameSource = GameVersion.Any)
|
2016-03-12 03:43:40 +00:00
|
|
|
|
{
|
2017-02-27 05:46:00 +00:00
|
|
|
|
if (gameSource == GameVersion.Any)
|
|
|
|
|
gameSource = (GameVersion)pkm.Version;
|
|
|
|
|
|
|
|
|
|
var slots = getEncounterSlots(pkm, gameSource: gameSource);
|
2017-02-12 17:52:26 +00:00
|
|
|
|
bool noMet = !pkm.HasOriginalMetLocation;
|
|
|
|
|
return noMet ? slots : slots.Where(area => area.Location == pkm.Met_Location);
|
2016-03-12 03:43:40 +00:00
|
|
|
|
}
|
2017-04-04 02:59:29 +00:00
|
|
|
|
private static IEnumerable<EncounterSlot> getValidEncounterSlots(PKM pkm, EncounterArea loc, bool DexNav, bool ignoreLevel = false, GameVersion gameSource = GameVersion.Any)
|
2016-02-26 15:52:08 +00:00
|
|
|
|
{
|
2017-02-12 17:52:26 +00:00
|
|
|
|
int fluteBoost = pkm.Format < 3 ? 0 : 4;
|
2016-04-21 02:47:40 +00:00
|
|
|
|
const int dexnavBoost = 30;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2016-04-21 02:47:40 +00:00
|
|
|
|
int df = DexNav ? fluteBoost : 0;
|
|
|
|
|
int dn = DexNav ? fluteBoost + dexnavBoost : 0;
|
|
|
|
|
List<EncounterSlot> slotdata = new List<EncounterSlot>();
|
|
|
|
|
|
2017-04-04 02:59:29 +00:00
|
|
|
|
var maxspeciesorigin = -1;
|
|
|
|
|
if (gameSource == GameVersion.RBY) maxspeciesorigin = MaxSpeciesID_1;
|
|
|
|
|
if (gameSource == GameVersion.GSC) maxspeciesorigin = MaxSpeciesID_2;
|
|
|
|
|
|
2016-03-04 06:12:22 +00:00
|
|
|
|
// Get Valid levels
|
2017-04-04 02:59:29 +00:00
|
|
|
|
IEnumerable<DexLevel> vs = getValidPreEvolutions(pkm, maxspeciesorigin: maxspeciesorigin, lvl: ignoreLevel ? 100 : -1, skipChecks:ignoreLevel);
|
2017-02-13 01:00:03 +00:00
|
|
|
|
|
2016-03-04 06:12:22 +00:00
|
|
|
|
// Get slots where pokemon can exist
|
2017-02-13 01:00:03 +00:00
|
|
|
|
bool ignoreSlotLevel = ignoreLevel;
|
|
|
|
|
IEnumerable<EncounterSlot> slots = loc.Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species && (ignoreSlotLevel || evo.Level >= slot.LevelMin - df)));
|
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
int lvl = getMinLevelEncounter(pkm);
|
2017-02-16 11:13:06 +00:00
|
|
|
|
if (lvl <= 0)
|
|
|
|
|
return slotdata;
|
2017-02-13 01:00:03 +00:00
|
|
|
|
int gen = pkm.GenNumber;
|
2017-02-15 23:47:44 +00:00
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
List<EncounterSlot> encounterSlots;
|
|
|
|
|
if (ignoreLevel)
|
|
|
|
|
encounterSlots = slots.ToList();
|
|
|
|
|
else if (pkm.HasOriginalMetLocation)
|
|
|
|
|
encounterSlots = slots.Where(slot => slot.LevelMin - df <= lvl && lvl <= slot.LevelMax + (slot.AllowDexNav ? dn : df)).ToList();
|
|
|
|
|
else // check for any less than current level
|
|
|
|
|
encounterSlots = slots.Where(slot => slot.LevelMin <= lvl).ToList();
|
|
|
|
|
|
|
|
|
|
if (gen <= 2)
|
2017-02-15 23:47:44 +00:00
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
// For gen 1 and 2 return Minimum level slot
|
|
|
|
|
// Minimum level is needed to check available moves, because there is no move reminder in gen 1,
|
|
|
|
|
// There are moves in the level up table that cant be legally obtained
|
2017-02-15 23:47:44 +00:00
|
|
|
|
EncounterSlot slotMin = encounterSlots.OrderBy(slot => slot.LevelMin).FirstOrDefault();
|
|
|
|
|
if (slotMin != null)
|
|
|
|
|
slotdata.Add(slotMin);
|
|
|
|
|
return slotdata;
|
|
|
|
|
}
|
2016-04-21 02:47:40 +00:00
|
|
|
|
|
|
|
|
|
// Pressure Slot
|
|
|
|
|
EncounterSlot slotMax = encounterSlots.OrderByDescending(slot => slot.LevelMax).FirstOrDefault();
|
2016-04-23 19:31:12 +00:00
|
|
|
|
if (slotMax != null)
|
2017-02-27 02:23:29 +00:00
|
|
|
|
{
|
|
|
|
|
slotMax = slotMax.Clone();
|
|
|
|
|
slotMax.Pressure = true;
|
|
|
|
|
slotMax.Form = pkm.AltForm;
|
2017-02-28 02:22:28 +00:00
|
|
|
|
}
|
2016-04-21 02:47:40 +00:00
|
|
|
|
|
2017-02-16 02:03:29 +00:00
|
|
|
|
if (gen >= 6 && !DexNav)
|
2016-04-21 02:47:40 +00:00
|
|
|
|
{
|
|
|
|
|
// Filter for Form Specific
|
2016-10-23 19:48:49 +00:00
|
|
|
|
slotdata.AddRange(WildForms.Contains(pkm.Species)
|
|
|
|
|
? encounterSlots.Where(slot => slot.Form == pkm.AltForm)
|
2016-04-21 02:47:40 +00:00
|
|
|
|
: encounterSlots);
|
|
|
|
|
if (slotMax != null)
|
2016-04-23 19:31:12 +00:00
|
|
|
|
slotdata.Add(slotMax);
|
2016-04-21 02:47:40 +00:00
|
|
|
|
return slotdata;
|
|
|
|
|
}
|
2016-04-23 19:31:12 +00:00
|
|
|
|
|
2016-10-23 19:48:49 +00:00
|
|
|
|
List<EncounterSlot> eslots = encounterSlots.Where(slot => !WildForms.Contains(pkm.Species) || slot.Form == pkm.AltForm).ToList();
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (gen <= 5)
|
2017-02-15 23:47:44 +00:00
|
|
|
|
{
|
|
|
|
|
slotdata.AddRange(eslots);
|
|
|
|
|
return slotdata;
|
|
|
|
|
}
|
2016-04-21 02:47:40 +00:00
|
|
|
|
if (slotMax != null)
|
2016-04-23 19:31:12 +00:00
|
|
|
|
eslots.Add(slotMax);
|
|
|
|
|
foreach (EncounterSlot s in eslots)
|
2016-04-21 02:47:40 +00:00
|
|
|
|
{
|
2016-10-23 19:48:49 +00:00
|
|
|
|
bool nav = s.AllowDexNav && (pkm.RelearnMove1 != 0 || pkm.AbilityNumber == 4);
|
2017-02-27 02:23:29 +00:00
|
|
|
|
EncounterSlot slot = s.Clone();
|
|
|
|
|
slot.DexNav = nav;
|
2016-04-21 02:47:40 +00:00
|
|
|
|
|
2016-04-23 19:31:12 +00:00
|
|
|
|
if (slot.LevelMin > lvl)
|
2016-04-21 02:47:40 +00:00
|
|
|
|
slot.WhiteFlute = true;
|
2016-04-23 19:31:12 +00:00
|
|
|
|
if (slot.LevelMax + 1 <= lvl && lvl <= slot.LevelMax + fluteBoost)
|
2016-04-21 02:47:40 +00:00
|
|
|
|
slot.BlackFlute = true;
|
2016-04-23 19:31:12 +00:00
|
|
|
|
if (slot.LevelMax != lvl && slot.AllowDexNav)
|
2016-04-21 02:47:40 +00:00
|
|
|
|
slot.DexNav = true;
|
|
|
|
|
slotdata.Add(slot);
|
|
|
|
|
}
|
|
|
|
|
return slotdata;
|
2016-02-26 15:52:08 +00:00
|
|
|
|
}
|
2017-03-21 00:50:35 +00:00
|
|
|
|
private static IEnumerable<EncounterArea> getSlotsTableGen2(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Format != 2)
|
|
|
|
|
// Gen 2 met location is lost outside gen 2 games
|
|
|
|
|
return SlotsGSC;
|
2017-03-22 03:17:21 +00:00
|
|
|
|
|
|
|
|
|
if (pkm.HasOriginalMetLocation)
|
|
|
|
|
// Format 2 with met location, encounter should be from crystal
|
|
|
|
|
return SlotsC;
|
|
|
|
|
|
|
|
|
|
if (pkm.Species > 151 && !FutureEvolutionsGen1.Contains(pkm.Species))
|
|
|
|
|
// Format 2 without met location but pokemon could not be tradeback to gen 1,
|
|
|
|
|
// encounter should be from gold or silver
|
|
|
|
|
return SlotsGS;
|
|
|
|
|
|
|
|
|
|
// Encounter could be any gen 2 game, it can have empty met location for have a g/s origin
|
|
|
|
|
// or it can be a crystal pokemon that lost met location after being tradeback to gen 1 games
|
|
|
|
|
return SlotsGSC;
|
2017-03-21 00:50:35 +00:00
|
|
|
|
}
|
|
|
|
|
private static IEnumerable<EncounterStatic> getStaticTableGen2(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Format != 2)
|
|
|
|
|
return StaticGSC;
|
2017-03-22 03:17:21 +00:00
|
|
|
|
|
|
|
|
|
if (pkm.HasOriginalMetLocation)
|
|
|
|
|
return StaticC;
|
|
|
|
|
if (pkm.Species > 151 && !FutureEvolutionsGen1.Contains(pkm.Species))
|
|
|
|
|
return StaticGS;
|
|
|
|
|
|
|
|
|
|
return StaticGSC;
|
2017-03-21 00:50:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-01 06:06:41 +00:00
|
|
|
|
private static IEnumerable<EncounterArea> getSlots(PKM pkm, IEnumerable<EncounterArea> tables, int lvl = -1)
|
2016-03-10 05:32:42 +00:00
|
|
|
|
{
|
2017-04-21 02:51:35 +00:00
|
|
|
|
IEnumerable<DexLevel> vs = getValidPreEvolutions(pkm, lvl: lvl);
|
2016-03-10 05:32:42 +00:00
|
|
|
|
List<EncounterArea> slotLocations = new List<EncounterArea>();
|
|
|
|
|
foreach (var loc in tables)
|
|
|
|
|
{
|
2016-04-21 02:47:40 +00:00
|
|
|
|
IEnumerable<EncounterSlot> slots = loc.Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species));
|
2016-03-10 05:32:42 +00:00
|
|
|
|
|
|
|
|
|
EncounterSlot[] es = slots.ToArray();
|
|
|
|
|
if (es.Length > 0)
|
|
|
|
|
slotLocations.Add(new EncounterArea { Location = loc.Location, Slots = es });
|
|
|
|
|
}
|
|
|
|
|
return slotLocations;
|
|
|
|
|
}
|
2017-04-21 02:51:35 +00:00
|
|
|
|
private static IEnumerable<DexLevel> getValidPreEvolutions(PKM pkm, int maxspeciesorigin = -1, int lvl = -1, bool skipChecks = false)
|
2016-02-26 15:52:08 +00:00
|
|
|
|
{
|
2016-04-08 01:19:21 +00:00
|
|
|
|
if (lvl < 0)
|
2016-10-23 19:48:49 +00:00
|
|
|
|
lvl = pkm.CurrentLevel;
|
2017-02-05 21:08:25 +00:00
|
|
|
|
if (lvl == 1 && pkm.IsEgg)
|
|
|
|
|
return new List<DexLevel>
|
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
new DexLevel { Species = pkm.Species, Level = 1, MinLevel = 1 },
|
2017-02-05 21:08:25 +00:00
|
|
|
|
};
|
2017-02-15 22:33:59 +00:00
|
|
|
|
if (pkm.Species == 292 && lvl >= 20 && (!pkm.HasOriginalMetLocation || pkm.Met_Level + 1 <= lvl))
|
2016-03-18 02:37:06 +00:00
|
|
|
|
return new List<DexLevel>
|
|
|
|
|
{
|
2017-04-10 00:43:05 +00:00
|
|
|
|
new DexLevel { Species = 292, Level = lvl, MinLevel = 20 },
|
2017-02-15 23:47:44 +00:00
|
|
|
|
new DexLevel { Species = 290, Level = lvl-1, MinLevel = 1 }
|
2016-03-18 02:37:06 +00:00
|
|
|
|
};
|
2016-11-08 16:43:57 +00:00
|
|
|
|
|
|
|
|
|
var et = getEvolutionTable(pkm);
|
2017-04-04 02:59:29 +00:00
|
|
|
|
return et.getValidPreEvolutions(pkm, lvl: lvl, maxSpeciesOrigin: maxspeciesorigin, skipChecks: skipChecks);
|
2016-02-23 06:52:48 +00:00
|
|
|
|
}
|
2017-04-04 02:59:29 +00:00
|
|
|
|
private static IEnumerable<EncounterStatic> getStatic(PKM pkm, IEnumerable<EncounterStatic> table, int maxspeciesorigin =-1, int lvl = -1)
|
2016-03-13 21:56:23 +00:00
|
|
|
|
{
|
2017-04-04 02:59:29 +00:00
|
|
|
|
IEnumerable<DexLevel> dl = getValidPreEvolutions(pkm, maxspeciesorigin: maxspeciesorigin, lvl: lvl);
|
2016-03-13 21:56:23 +00:00
|
|
|
|
return table.Where(e => dl.Any(d => d.Species == e.Species));
|
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
private static IEnumerable<int> getValidMoves(PKM pkm, GameVersion Version, IReadOnlyList<DexLevel[]> vs, int minLvLG1 = 1, bool LVL = false, bool Relearn = false, bool Tutor = false, bool Machine = false, bool MoveReminder = true, bool RemoveTransferHM = true)
|
2016-05-10 02:03:58 +00:00
|
|
|
|
{
|
|
|
|
|
List<int> r = new List<int> { 0 };
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (Relearn && pkm.Format >= 6)
|
|
|
|
|
r.AddRange(pkm.RelearnMoves);
|
|
|
|
|
|
|
|
|
|
for (int gen = pkm.GenNumber; gen <= pkm.Format; gen++)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
if (vs[gen].Any())
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
r.AddRange(getValidMoves(pkm, Version, vs[gen], gen, minLvLG1:minLvLG1, LVL: LVL, Relearn: false, Tutor: Tutor, Machine: Machine, MoveReminder: MoveReminder, RemoveTransferHM: RemoveTransferHM));
|
2017-02-21 03:40:50 +00:00
|
|
|
|
|
2017-02-15 22:33:59 +00:00
|
|
|
|
return r.Distinct().ToArray();
|
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
private static IEnumerable<int> getValidMoves(PKM pkm, GameVersion Version, DexLevel[] vs, int Generation, int minLvLG1 = 1, bool LVL = false, bool Relearn = false, bool Tutor = false, bool Machine = false, bool MoveReminder = true, bool RemoveTransferHM = true)
|
2017-02-15 22:33:59 +00:00
|
|
|
|
{
|
|
|
|
|
List<int> r = new List<int> { 0 };
|
|
|
|
|
if (!vs.Any())
|
|
|
|
|
return r;
|
2016-10-23 19:48:49 +00:00
|
|
|
|
int species = pkm.Species;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2016-11-12 13:56:22 +00:00
|
|
|
|
// Special Type Tutors Availability
|
2016-11-27 04:02:44 +00:00
|
|
|
|
bool moveTutor = Tutor || MoveReminder; // Usually true, except when called for move suggestions (no tutored moves)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2016-05-10 02:03:58 +00:00
|
|
|
|
if (FormChangeMoves.Contains(species)) // Deoxys & Shaymin & Giratina (others don't have extra but whatever)
|
|
|
|
|
{
|
2016-10-24 05:03:19 +00:00
|
|
|
|
int formcount = pkm.PersonalInfo.FormeCount;
|
2017-03-30 19:34:48 +00:00
|
|
|
|
if (species == 386 && pkm.Format == 3)
|
|
|
|
|
// In gen 3 deoxys has different forms depending on the current game, in personal info there is no alter form info
|
|
|
|
|
formcount = 4;
|
2016-05-10 02:03:58 +00:00
|
|
|
|
for (int i = 0; i < formcount; i++)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
r.AddRange(getMoves(pkm, species, minLvLG1, vs.First().Level, i, moveTutor, Version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation));
|
2016-10-23 19:48:49 +00:00
|
|
|
|
if (Relearn) r.AddRange(pkm.RelearnMoves);
|
2017-03-17 04:20:06 +00:00
|
|
|
|
return r.Distinct();
|
2016-05-10 02:03:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (DexLevel evo in vs)
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
{
|
|
|
|
|
var minlvlevo = 1;
|
|
|
|
|
if (Generation == 1)
|
|
|
|
|
{
|
|
|
|
|
// Return moves from minLvLG1 if species if the species encounters
|
|
|
|
|
// For evolutions return moves using evolution min level as min level
|
|
|
|
|
minlvlevo = minLvLG1;
|
|
|
|
|
if (evo.MinLevel > 1)
|
|
|
|
|
minlvlevo = Math.Min(pkm.CurrentLevel, evo.MinLevel);
|
|
|
|
|
}
|
|
|
|
|
r.AddRange(getMoves(pkm, evo.Species, minlvlevo, evo.Level, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder, RemoveTransferHM, Generation));
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2017-02-14 06:49:32 +00:00
|
|
|
|
if (pkm.Format <= 3)
|
2017-03-17 04:20:06 +00:00
|
|
|
|
return r.Distinct();
|
2017-02-15 23:56:54 +00:00
|
|
|
|
if (LVL)
|
|
|
|
|
{
|
|
|
|
|
if (species == 479 && Generation >= 4) // Rotom
|
|
|
|
|
r.Add(RotomMoves[pkm.AltForm]);
|
2017-02-21 03:40:50 +00:00
|
|
|
|
|
|
|
|
|
if (species == 718 && Generation == 7) // Zygarde
|
|
|
|
|
r.AddRange(ZygardeMoves);
|
|
|
|
|
}
|
|
|
|
|
if (Tutor)
|
|
|
|
|
{
|
|
|
|
|
if (species == 647) // Keldeo
|
|
|
|
|
r.Add(548); // Secret Sword
|
|
|
|
|
if (species == 648) // Meloetta
|
2017-02-15 23:56:54 +00:00
|
|
|
|
r.Add(547); // Relic Song
|
|
|
|
|
|
|
|
|
|
if (species == 25 && pkm.Format == 6 && Generation == 6) // Pikachu
|
|
|
|
|
r.Add(PikachuMoves[pkm.AltForm]);
|
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if ((species == 25 || species == 26) && Generation == 7) // Pikachu/Raichu Tutor
|
|
|
|
|
r.Add(344); // Volt Tackle
|
2017-02-15 23:56:54 +00:00
|
|
|
|
}
|
2017-02-21 03:40:50 +00:00
|
|
|
|
if (Relearn && Generation >= 6)
|
|
|
|
|
r.AddRange(pkm.RelearnMoves);
|
2017-03-17 04:20:06 +00:00
|
|
|
|
return r.Distinct();
|
2016-05-10 02:03:58 +00:00
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
private static IEnumerable<int> getMoves(PKM pkm, int species, int minlvlG1, int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool specialTutors, bool Machine, bool MoveReminder, bool RemoveTransferHM)
|
2016-05-10 02:03:58 +00:00
|
|
|
|
{
|
|
|
|
|
List<int> r = new List<int> { 0 };
|
2017-02-13 01:00:03 +00:00
|
|
|
|
int gen = pkm.GenNumber;
|
2017-02-15 08:11:12 +00:00
|
|
|
|
if (pkm.GenNumber < 3)
|
|
|
|
|
{
|
|
|
|
|
int max = pkm.Format < 3 ? 2 : 1;
|
|
|
|
|
for (; gen <= max; gen++)
|
|
|
|
|
if (pkm.InhabitedGeneration(gen, species))
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
r.AddRange(getMoves(pkm, species, minlvlG1, lvl, form, moveTutor, Version, LVL, specialTutors, Machine, MoveReminder, RemoveTransferHM, gen));
|
2017-02-15 08:11:12 +00:00
|
|
|
|
gen = 7;
|
|
|
|
|
}
|
2017-02-13 01:00:03 +00:00
|
|
|
|
|
|
|
|
|
for (; gen <= pkm.Format; gen++)
|
2017-02-15 08:11:12 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(gen))
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
r.AddRange(getMoves(pkm, species, minlvlG1, lvl, form, moveTutor, Version, LVL, specialTutors, Machine, MoveReminder, RemoveTransferHM, gen));
|
2016-10-24 05:03:19 +00:00
|
|
|
|
return r.Distinct();
|
|
|
|
|
}
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
private static IEnumerable<int> getMoves(PKM pkm, int species, int minlvlG1,int lvl, int form, bool moveTutor, GameVersion Version, bool LVL, bool specialTutors, bool Machine, bool MoveReminder, bool RemoveTransferHM, int Generation)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
|
|
|
|
List<int> r = new List<int>();
|
2016-05-10 02:03:58 +00:00
|
|
|
|
|
2016-11-09 06:10:32 +00:00
|
|
|
|
var ver = Version;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
switch (Generation)
|
2016-05-10 02:03:58 +00:00
|
|
|
|
{
|
2017-02-13 01:00:03 +00:00
|
|
|
|
case 1:
|
|
|
|
|
{
|
2017-02-21 03:40:50 +00:00
|
|
|
|
int index = PersonalTable.RB.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
2017-02-16 10:59:07 +00:00
|
|
|
|
return r;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
|
2017-02-21 03:40:50 +00:00
|
|
|
|
var pi_rb = (PersonalInfoG1)PersonalTable.RB[index];
|
|
|
|
|
var pi_y = (PersonalInfoG1)PersonalTable.Y[index];
|
2017-02-13 01:00:03 +00:00
|
|
|
|
if (LVL)
|
|
|
|
|
{
|
Gen 1 move analysis improvement. Adapted the valid moves to take into account that move deleter and move reminder do not exits in generation 1 (#1037)
* Fix getMoves with min level, when SkipWhile and TakeWhile is used together the index i in TakeWhile is calculated from the enumerator that results of the SkipWhile function, not the index of the initial array, those giving an incorrect index to check Levels array in the TakeWhile
* Fix getMoves when levelmin or levelmax is above max level in the levels array, TakeWhile and SkipWhile return empty list if the while goes beyond the last element of the array
* Include player hatched egg in the list of possible encounters for parseMoves only if the pokemon was an egg
Also change the valur of WasEgg for gen1,2,3 pokemon if the encounter analyzed is not an egg
add the non egg encounters to the list instead of checking the non-egg encounter inside parseMovesWasEggPreRelearn
* Fix for gen3 egg encounters
Remove non-egg encounters without special moves if there is an egg encounter because egg encounter already cover every possible move combination
Do not add daycare egg encounter for gen3 unhatched egg if there is another encounter, that means is an event or gift egg, not a daycare egg
Remove duplicate encounters
* Gift egg should not allow inherited moves even it they dont have special moves
Those gift eggs are hatched only with the species base moves
* Added getEncounterMoves functions, to be used for generation 1 encounters to find what moves have a pokemon at the moment of being caught because there is no move reminder in generation 1
* Added GBEncounterData, structure for refactor the tuples used in generation 1 and 2 encounters
* Add LevelMin and LevelMax to IEncounterable to get the encounter moves by the min level of the generation 1 EncounterLink
Add iGeneration to difference generation 1 and generation 2 encounters for GB Era pokemon
* Mark generation in gen 1 and 2 encounters
There is no need to mark the generation in gen 3 to 7 encounters because in that generations it match the pokemon generation number
* Add min level for generation 1 moves in getMoves functions
Add function to return the default moves for a GB encounters, for generation 1 games that included both moves from level up table and level 1 moves from personal table
Fix getMoves with min level when the moves list is empty, like Raichu generation 1
* Add maxSpecies to getBaseSpecies function for gen1 pokemon with a gen2 egg encounter
Refactor VC Encounter changing Tuples for GBData class
* Fixed for gen 2 Checks
Also do not search for generation1 encounter if the gen2 pokemon have met location from crystal
* Fix VC wild encounters, should be stored as array or else other verifyEncounter functions wont work
* Add generation 1 parse moves function including default moves
* Clean-up get encounters
* Verify empty moves for generation 1 encounters, in generation 1 does not exits move deleter
That means when a move slot have been used by a level up move or a TM/HM/Tutor move it cant be empty again
Does not apply if generation 2 tradeback is allowed, in generation 2 there is a move deleter
* Added two edge cases for pokemon that learn in red/blue and yellow different moves at the same level, this combinations can not exits until a later level when they learn again one of the levels in the other game, only happen for flareon and vaporeon
* Check incompatible moves between evolution species, it is for species that learn a move in a level as an evolved species and a move at a upper level as a preevolution
Also added most edge cases for the min slots used for generation 1 games, i think every weird combination is already covered
* Fix gen 1 eevee and evolutions move checks
* Cleanup
* Move the code to change valid moves for generation 1 to a function
* Fix getMoveMinLevelGBEncounter
* getUsedMoveSlots, removed wild Butterfree edge case, it is not possible
* Filter the min level of the encounter by the possible games the pokemon could be originated, yellow pikachu and kadabra can be detected
2017-04-09 00:17:20 +00:00
|
|
|
|
if (minlvlG1 == 1)
|
|
|
|
|
{
|
|
|
|
|
r.AddRange(pi_rb.Moves);
|
|
|
|
|
r.AddRange(pi_y.Moves);
|
|
|
|
|
}
|
2017-04-09 02:05:29 +00:00
|
|
|
|
r.AddRange(LevelUpRB[index].getMoves(lvl, minlvlG1));
|
|
|
|
|
r.AddRange(LevelUpY[index].getMoves(lvl, minlvlG1));
|
2017-02-13 06:31:31 +00:00
|
|
|
|
}
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
|
|
|
|
r.AddRange(TMHM_RBY.Where((t, m) => pi_rb.TMHM[m]));
|
|
|
|
|
r.AddRange(TMHM_RBY.Where((t, m) => pi_y.TMHM[m]));
|
2017-02-13 01:00:03 +00:00
|
|
|
|
}
|
2017-02-14 06:49:32 +00:00
|
|
|
|
if (moveTutor)
|
2017-02-27 18:41:15 +00:00
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
2017-02-13 01:00:03 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2017-02-26 17:36:53 +00:00
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.C.getFormeIndex(species, 0);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
2017-02-26 17:36:53 +00:00
|
|
|
|
if (LVL)
|
|
|
|
|
{
|
|
|
|
|
r.AddRange(LevelUpGS[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpC[index].getMoves(lvl));
|
|
|
|
|
}
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
2017-03-18 23:50:34 +00:00
|
|
|
|
var pi_c = (PersonalInfoG2)PersonalTable.C[index];
|
2017-02-26 17:36:53 +00:00
|
|
|
|
r.AddRange(TMHM_GSC.Where((t, m) => pi_c.TMHM[m]));
|
|
|
|
|
}
|
|
|
|
|
if (moveTutor)
|
2017-02-27 18:41:15 +00:00
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
2017-02-27 18:50:16 +00:00
|
|
|
|
if (pkm.Format == 1) //tradeback gen 2 -> gen 1
|
|
|
|
|
r = r.Where(m => m <= MaxMoveID_1).ToList();
|
2017-02-26 17:36:53 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 3:
|
|
|
|
|
{
|
2017-03-20 22:50:23 +00:00
|
|
|
|
int index = PersonalTable.E.getFormeIndex(species, 0);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
if (LVL)
|
|
|
|
|
{
|
2017-04-10 00:43:05 +00:00
|
|
|
|
if (index == 386)
|
2017-03-20 17:53:16 +00:00
|
|
|
|
{
|
|
|
|
|
switch(form)
|
|
|
|
|
{
|
2017-03-20 18:01:38 +00:00
|
|
|
|
case 0: r.AddRange(LevelUpRS[index].getMoves(lvl)); break;
|
2017-03-20 17:53:16 +00:00
|
|
|
|
case 1: r.AddRange(LevelUpFR[index].getMoves(lvl)); break;
|
|
|
|
|
case 2: r.AddRange(LevelUpLG[index].getMoves(lvl)); break;
|
|
|
|
|
case 3: r.AddRange(LevelUpE[index].getMoves(lvl)); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-27 21:11:16 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Emerald level up table are equals to R/S level up tables
|
2017-03-20 17:53:16 +00:00
|
|
|
|
r.AddRange(LevelUpE[index].getMoves(lvl));
|
2017-03-27 21:11:16 +00:00
|
|
|
|
// fire red and leaf green are equals between each other but different than RSE
|
|
|
|
|
// Do not use FR Levelup table. It have 67 moves for charmander but Leaf Green moves table is correct
|
|
|
|
|
r.AddRange(LevelUpLG[index].getMoves(lvl));
|
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
2017-03-20 22:50:23 +00:00
|
|
|
|
var pi_c = PersonalTable.E[index];
|
2017-03-18 23:50:34 +00:00
|
|
|
|
r.AddRange(TM_3.Where((t, m) => pi_c.TMHM[m]));
|
2017-03-25 12:26:33 +00:00
|
|
|
|
if (!RemoveTransferHM || pkm.Format == 3) // HM moves must be removed for 3->4, only give if current format.
|
2017-03-18 23:50:34 +00:00
|
|
|
|
r.AddRange(HM_3.Where((t, m) => pi_c.TMHM[m+50]));
|
|
|
|
|
}
|
|
|
|
|
if (moveTutor)
|
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
2017-03-25 12:26:33 +00:00
|
|
|
|
if (RemoveTransferHM && pkm.Format > 3) //Remove HM
|
2017-03-20 17:53:16 +00:00
|
|
|
|
r = r.Except(HM_3).ToList();
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.HGSS.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
if (LVL)
|
|
|
|
|
{
|
|
|
|
|
r.AddRange(LevelUpDP[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpPt[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpHGSS[index].getMoves(lvl));
|
|
|
|
|
}
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
2017-03-20 17:53:16 +00:00
|
|
|
|
var pi_hgss = PersonalTable.HGSS[index];
|
|
|
|
|
var pi_dppt = PersonalTable.Pt[index];
|
2017-03-20 18:10:50 +00:00
|
|
|
|
r.AddRange(TM_4.Where((t, m) => pi_hgss.TMHM[m]));
|
2017-03-25 12:26:33 +00:00
|
|
|
|
if (RemoveTransferHM && pkm.Format > 4)
|
2017-03-20 18:10:50 +00:00
|
|
|
|
{
|
|
|
|
|
// The combination of both these moves is illegal, it should be checked that the pokemon only learn one
|
|
|
|
|
// except if it can learn any of these moves in gen 5 or later
|
|
|
|
|
if (pi_hgss.TMHM[96])
|
|
|
|
|
r.Add(250); // Whirlpool
|
|
|
|
|
if (pi_dppt.TMHM[96])
|
|
|
|
|
r.Add(432); // Defog
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
r.AddRange(HM_DPPt.Where((t, m) => pi_dppt.TMHM[m + 92]));
|
|
|
|
|
r.AddRange(HM_HGSS.Where((t, m) => pi_hgss.TMHM[m + 92]));
|
|
|
|
|
}
|
2017-03-18 23:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
if (moveTutor)
|
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
2017-03-25 12:26:33 +00:00
|
|
|
|
if (RemoveTransferHM && pkm.Format > 4) //Remove HM
|
2017-03-20 17:53:16 +00:00
|
|
|
|
r = r.Except(HM_4_RemovePokeTransfer).ToList();
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.B2W2.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
if (LVL)
|
|
|
|
|
{
|
|
|
|
|
r.AddRange(LevelUpBW[index].getMoves(lvl));
|
|
|
|
|
r.AddRange(LevelUpB2W2[index].getMoves(lvl));
|
|
|
|
|
}
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
|
|
|
|
var pi_c = PersonalTable.B2W2[index];
|
2017-03-19 07:00:15 +00:00
|
|
|
|
r.AddRange(TMHM_BW.Where((t, m) => pi_c.TMHM[m]));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
}
|
|
|
|
|
if (moveTutor)
|
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
case 6:
|
|
|
|
|
switch (ver)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.Any: // Start at the top, hit every table
|
|
|
|
|
case GameVersion.X: case GameVersion.Y: case GameVersion.XY:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.XY.getFormeIndex(species, form);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
if (LVL)
|
|
|
|
|
r.AddRange(LevelUpXY[index].getMoves(lvl));
|
|
|
|
|
if (moveTutor)
|
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
|
|
|
|
PersonalInfo pi = PersonalTable.XY[index];
|
|
|
|
|
r.AddRange(TMHM_XY.Where((t, m) => pi.TMHM[m]));
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
|
|
|
|
if (ver == GameVersion.Any) // Fall Through
|
|
|
|
|
goto case GameVersion.ORAS;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case GameVersion.AS: case GameVersion.OR: case GameVersion.ORAS:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.AO.getFormeIndex(species, form);
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
if (LVL)
|
|
|
|
|
r.AddRange(LevelUpAO[index].getMoves(lvl));
|
|
|
|
|
if (moveTutor)
|
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
|
|
|
|
PersonalInfo pi = PersonalTable.AO[index];
|
|
|
|
|
r.AddRange(TMHM_AO.Where((t, m) => pi.TMHM[m]));
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
switch (ver)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.Any:
|
|
|
|
|
case GameVersion.SN: case GameVersion.MN: case GameVersion.SM:
|
|
|
|
|
{
|
|
|
|
|
int index = PersonalTable.SM.getFormeIndex(species, form);
|
2016-11-27 04:02:44 +00:00
|
|
|
|
if (MoveReminder)
|
|
|
|
|
lvl = 100; // Move reminder can teach any level in movepool now!
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2017-03-18 23:50:34 +00:00
|
|
|
|
if (LVL)
|
|
|
|
|
r.AddRange(LevelUpSM[index].getMoves(lvl));
|
|
|
|
|
if (moveTutor)
|
|
|
|
|
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));
|
|
|
|
|
if (Machine)
|
|
|
|
|
{
|
|
|
|
|
PersonalInfo pi = PersonalTable.SM.getFormeEntry(species, form);
|
|
|
|
|
r.AddRange(TMHM_SM.Where((t, m) => pi.TMHM[m]));
|
|
|
|
|
}
|
2016-10-24 05:03:19 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2016-05-10 02:03:58 +00:00
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
default:
|
|
|
|
|
return r;
|
2016-05-10 02:03:58 +00:00
|
|
|
|
}
|
|
|
|
|
return r;
|
|
|
|
|
}
|
2017-02-28 04:57:24 +00:00
|
|
|
|
private static IEnumerable<int> getEggMoves(PKM pkm, int species, int formnum, GameVersion Version = GameVersion.Any)
|
2016-02-23 06:52:48 +00:00
|
|
|
|
{
|
2017-02-15 08:11:12 +00:00
|
|
|
|
if (!pkm.InhabitedGeneration(pkm.GenNumber, species))
|
|
|
|
|
return new List<int>();
|
|
|
|
|
|
2016-10-24 05:03:19 +00:00
|
|
|
|
switch (pkm.GenNumber)
|
|
|
|
|
{
|
2017-02-28 04:57:24 +00:00
|
|
|
|
case 1:
|
|
|
|
|
case 2:
|
2017-03-25 17:14:57 +00:00
|
|
|
|
if (pkm.Format != 2)
|
|
|
|
|
return EggMovesC[species].Moves;
|
|
|
|
|
if (pkm.HasOriginalMetLocation)
|
|
|
|
|
return EggMovesC[species].Moves;
|
|
|
|
|
if (pkm.Species > 151 && !FutureEvolutionsGen1.Contains(pkm.Species))
|
|
|
|
|
return EggMovesGS[species].Moves;
|
Shedinja evolution moves and some egg fixes (#1015)
* Add getMoves function with min level and max level, usefull for shedjina evolves moves (min level 20) and generation 1 moves ( no move reminder, min level is min encounter level + 1)
Also for gen1 encounters another function should be created to get by the encounter level the four moves that the pokemon learn by default, the last four in its movepool up until the encounter level
* getShedinjaEvolveMoves, function that return the moves that shedinja could learn from Ninjask move pool at the moment when Nincada evolves, in the same format that getValidMovesAllGens
* Add validation in parse moves for shedinja evolve moves.
Shedinja could have any gen3/4 moves from Ninjas learnset but only one is allowed
* Shedinja evolve moves text resources
* Fix egg moves pre-gen 6 validation:
Add skipoption variable to getEggMoves function from pre-gen6 games, to verify egg moves from split breed species
Flag illegal combinations of base egg moves and special egg moves
Return crystal egg moves for gen2 pokemon that can be tradeback to gen 1 games
* Fix for mix between event egg moves and base egg moves
* Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move
* Revert "Changes just to make if there is only shedinja evolve move that is also the only base egg move change it from base egg move to evolve move, to avoid flag illegal if also the pokemon have a special egg move"
Revert the last change, i search in bulbapedia an there wasn't any nincada distributed with special moves in generation 3 nor 4, making this complicated validation unnecessary
This reverts commit 57f5ac1bbb75e32e417b575619339cae5e5d1ef2.
* Fix error
2017-04-01 00:40:30 +00:00
|
|
|
|
return EggMovesC[species].Moves;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 3:
|
|
|
|
|
return EggMovesRS[species].Moves;
|
|
|
|
|
case 4:
|
|
|
|
|
switch (Version)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.DP:
|
|
|
|
|
case GameVersion.Pt:
|
|
|
|
|
return EggMovesDPPt[species].Moves;
|
|
|
|
|
case GameVersion.HGSS:
|
|
|
|
|
return EggMovesHGSS[species].Moves;
|
|
|
|
|
default:
|
|
|
|
|
return new List<int>();
|
|
|
|
|
}
|
|
|
|
|
case 5:
|
|
|
|
|
return EggMovesBW[species].Moves;
|
2016-12-03 17:38:24 +00:00
|
|
|
|
case 6: // entries per species
|
|
|
|
|
return EggMovesAO[species].Moves.Concat(EggMovesXY[species].Moves);
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
2017-01-30 03:03:50 +00:00
|
|
|
|
case 7: // entries per form if required
|
2016-11-08 16:43:57 +00:00
|
|
|
|
var entry = EggMovesSM[species];
|
2017-01-31 01:49:28 +00:00
|
|
|
|
if (formnum > 0 && AlolanOriginForms.Contains(species))
|
2016-11-08 16:43:57 +00:00
|
|
|
|
entry = EggMovesSM[entry.FormTableIndex + formnum - 1];
|
|
|
|
|
return entry.Moves;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return new List<int>();
|
|
|
|
|
}
|
2016-02-23 06:52:48 +00:00
|
|
|
|
}
|
2017-03-26 15:07:36 +00:00
|
|
|
|
internal static IEnumerable<int> getTMHM(PKM pkm, int species, int form, int generation, GameVersion Version = GameVersion.Any, bool RemoveTransferHM = true)
|
|
|
|
|
{
|
|
|
|
|
List<int> moves = new List<int>();
|
|
|
|
|
int index;
|
|
|
|
|
switch (generation)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
index = PersonalTable.RB.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return moves;
|
|
|
|
|
var pi_rb = (PersonalInfoG1)PersonalTable.RB[index];
|
|
|
|
|
var pi_y = (PersonalInfoG1)PersonalTable.Y[index];
|
|
|
|
|
moves.AddRange(TMHM_RBY.Where((t, m) => pi_rb.TMHM[m]));
|
|
|
|
|
moves.AddRange(TMHM_RBY.Where((t, m) => pi_y.TMHM[m]));
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
index = PersonalTable.C.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return moves;
|
|
|
|
|
var pi_c = (PersonalInfoG2)PersonalTable.C[index];
|
|
|
|
|
moves.AddRange(TMHM_GSC.Where((t, m) => pi_c.TMHM[m]));
|
|
|
|
|
if (Version == GameVersion.Any)
|
2017-04-08 18:08:16 +00:00
|
|
|
|
goto case 1; // rby
|
2017-03-26 15:07:36 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
index = PersonalTable.E.getFormeIndex(species, 0);
|
|
|
|
|
var pi_e = PersonalTable.E[index];
|
|
|
|
|
moves.AddRange(TM_3.Where((t, m) => pi_e.TMHM[m]));
|
|
|
|
|
if (!RemoveTransferHM || pkm.Format == 3) // HM moves must be removed for 3->4, only give if current format.
|
|
|
|
|
moves.AddRange(HM_3.Where((t, m) => pi_e.TMHM[m + 50]));
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
index = PersonalTable.HGSS.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return moves;
|
|
|
|
|
var pi_hgss = PersonalTable.HGSS[index];
|
|
|
|
|
var pi_dppt = PersonalTable.Pt[index];
|
|
|
|
|
moves.AddRange(TM_4.Where((t, m) => pi_hgss.TMHM[m]));
|
|
|
|
|
// The combination of both these moves is illegal, it should be checked that the pokemon only learn one
|
|
|
|
|
// except if it can learn any of these moves in gen 5 or later
|
|
|
|
|
if (Version == GameVersion.Any || Version == GameVersion.DP || Version == GameVersion.D || Version == GameVersion.P || Version == GameVersion.Pt)
|
|
|
|
|
{
|
|
|
|
|
if (RemoveTransferHM && pkm.Format > 4)
|
|
|
|
|
{
|
|
|
|
|
if (pi_dppt.TMHM[96])
|
|
|
|
|
moves.Add(432); // Defog
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
moves.AddRange(HM_DPPt.Where((t, m) => pi_dppt.TMHM[m + 92]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (Version == GameVersion.Any || Version == GameVersion.HGSS || Version == GameVersion.HG || Version == GameVersion.SS)
|
|
|
|
|
{
|
|
|
|
|
if (RemoveTransferHM && pkm.Format > 4)
|
|
|
|
|
{
|
|
|
|
|
if (pi_hgss.TMHM[96])
|
|
|
|
|
moves.Add(432); // Defog
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
moves.AddRange(HM_HGSS.Where((t, m) => pi_dppt.TMHM[m + 92]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
index = PersonalTable.B2W2.getFormeIndex(species, 0);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return moves;
|
|
|
|
|
|
|
|
|
|
var pi_bw = PersonalTable.B2W2[index];
|
|
|
|
|
moves.AddRange(TMHM_BW.Where((t, m) => pi_bw.TMHM[m]));
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
switch (Version)
|
|
|
|
|
{
|
|
|
|
|
case GameVersion.Any: // Start at the top, hit every table
|
|
|
|
|
case GameVersion.X:
|
|
|
|
|
case GameVersion.Y:
|
|
|
|
|
case GameVersion.XY:
|
|
|
|
|
{
|
|
|
|
|
index = PersonalTable.XY.getFormeIndex(species, form);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return moves;
|
|
|
|
|
|
|
|
|
|
PersonalInfo pi_xy = PersonalTable.XY[index];
|
|
|
|
|
moves.AddRange(TMHM_XY.Where((t, m) => pi_xy.TMHM[m]));
|
|
|
|
|
|
|
|
|
|
if (Version == GameVersion.Any) // Fall Through
|
|
|
|
|
goto case GameVersion.ORAS;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GameVersion.AS:
|
|
|
|
|
case GameVersion.OR:
|
|
|
|
|
case GameVersion.ORAS:
|
|
|
|
|
{
|
|
|
|
|
index = PersonalTable.AO.getFormeIndex(species, form);
|
|
|
|
|
if (index == 0)
|
|
|
|
|
return moves;
|
2017-04-08 18:08:16 +00:00
|
|
|
|
|
|
|
|
|
PersonalInfo pi_ao = PersonalTable.AO[index];
|
|
|
|
|
moves.AddRange(TMHM_AO.Where((t, m) => pi_ao.TMHM[m]));
|
2017-03-26 15:07:36 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
index = PersonalTable.SM.getFormeIndex(species, form);
|
2017-04-08 18:08:16 +00:00
|
|
|
|
if (index == 0)
|
|
|
|
|
return moves;
|
|
|
|
|
|
|
|
|
|
PersonalInfo pi_sm = PersonalTable.SM[index];
|
2017-03-26 15:07:36 +00:00
|
|
|
|
moves.AddRange(TMHM_SM.Where((t, m) => pi_sm.TMHM[m]));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return moves.Distinct();
|
|
|
|
|
}
|
|
|
|
|
internal static IEnumerable<int> getTutorMoves(PKM pkm, int species, int form, bool specialTutors, int generation)
|
2016-02-23 06:52:48 +00:00
|
|
|
|
{
|
2016-11-23 02:49:23 +00:00
|
|
|
|
List<int> moves = new List<int>();
|
2017-02-28 02:22:28 +00:00
|
|
|
|
PersonalInfo info;
|
2017-02-27 18:41:15 +00:00
|
|
|
|
switch (generation)
|
2016-10-24 05:03:19 +00:00
|
|
|
|
{
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 1:
|
|
|
|
|
if (AllowGBCartEra && pkm.Format < 3 && (pkm.Species == 25 || pkm.Species == 26)) // Surf Pikachu via Stadium
|
|
|
|
|
moves.Add(57);
|
|
|
|
|
break;
|
2017-02-27 18:41:15 +00:00
|
|
|
|
case 2:
|
2017-03-20 22:50:23 +00:00
|
|
|
|
info = PersonalTable.C[species];
|
|
|
|
|
moves.AddRange(Tutors_GSC.Where((t, i) => info.TMHM[57 + i]));
|
2017-03-08 07:13:46 +00:00
|
|
|
|
goto case 1;
|
2017-03-18 23:50:34 +00:00
|
|
|
|
case 3:
|
|
|
|
|
// E Tutors (Free)
|
|
|
|
|
// E Tutors (BP)
|
2017-03-20 22:50:23 +00:00
|
|
|
|
info = PersonalTable.E[species];
|
|
|
|
|
moves.AddRange(Tutor_E.Where((t, i) => info.TypeTutors[i]));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
// FRLG Tutors
|
2017-03-20 17:53:16 +00:00
|
|
|
|
// Only special tutor moves, normal tutor moves are already included in Emerald data
|
2017-03-20 22:50:23 +00:00
|
|
|
|
moves.AddRange(SpecialTutors_FRLG.Where((t, i) => SpecialTutors_Compatibility_FRLG[i].Any(e => e == species)));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
// XD
|
2017-03-20 22:50:23 +00:00
|
|
|
|
moves.AddRange(SpecialTutors_XD_Exclusive.Where((t, i) => SpecialTutors_Compatibility_XD_Exclusive[i].Any(e => e == species)));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
// XD (Mew)
|
|
|
|
|
if (species == 151)
|
|
|
|
|
moves.AddRange(Tutor_3Mew);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
info = PersonalTable.HGSS[species];
|
|
|
|
|
moves.AddRange(Tutors_4.Where((t, i) => info.TypeTutors[i]));
|
2017-03-20 22:50:23 +00:00
|
|
|
|
moves.AddRange(SpecialTutors_4.Where((t, i) => SpecialTutors_Compatibility_4[i].Any(e => e == species)));
|
2017-03-18 23:50:34 +00:00
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
info = PersonalTable.B2W2[species];
|
|
|
|
|
moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i]));
|
|
|
|
|
if (pkm.InhabitedGeneration(5) && specialTutors)
|
|
|
|
|
{
|
|
|
|
|
PersonalInfo pi = PersonalTable.B2W2.getFormeEntry(species, form);
|
|
|
|
|
for (int i = 0; i < Tutors_B2W2.Length; i++)
|
|
|
|
|
for (int b = 0; b < Tutors_B2W2[i].Length; b++)
|
|
|
|
|
if (pi.SpecialTutors[i][b])
|
|
|
|
|
moves.Add(Tutors_B2W2[i][b]);
|
|
|
|
|
}
|
2017-02-27 18:41:15 +00:00
|
|
|
|
break;
|
|
|
|
|
case 6:
|
2017-02-28 02:22:28 +00:00
|
|
|
|
info = PersonalTable.AO[species];
|
2017-02-27 18:41:15 +00:00
|
|
|
|
moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i]));
|
2017-04-15 02:55:40 +00:00
|
|
|
|
if (pkm.InhabitedGeneration(6) && specialTutors && (pkm.AO || !pkm.IsUntraded))
|
2017-02-27 18:41:15 +00:00
|
|
|
|
{
|
|
|
|
|
PersonalInfo pi = PersonalTable.AO.getFormeEntry(species, form);
|
|
|
|
|
for (int i = 0; i < Tutors_AO.Length; i++)
|
|
|
|
|
for (int b = 0; b < Tutors_AO[i].Length; b++)
|
|
|
|
|
if (pi.SpecialTutors[i][b])
|
|
|
|
|
moves.Add(Tutors_AO[i][b]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
2017-03-22 03:19:58 +00:00
|
|
|
|
info = PersonalTable.SM.getFormeEntry(species, form);
|
2017-03-15 07:04:16 +00:00
|
|
|
|
moves.AddRange(TypeTutor6.Where((t, i) => info.TypeTutors[i]));
|
2017-02-27 18:41:15 +00:00
|
|
|
|
// No special tutors in G7
|
|
|
|
|
break;
|
2016-10-24 05:03:19 +00:00
|
|
|
|
}
|
|
|
|
|
return moves.Distinct();
|
2016-02-23 06:52:48 +00:00
|
|
|
|
}
|
Split Breed Egg Moves improvements (#1058)
* Added method getBaseEggSpecies to get the base species when the pokemon was an egg, is needed because for format 1 pokemon with egg origin every time getBaseSpecies is called is returning the gen 1 base species obtaining invalid eggmoves and base egg moves
Also getBaseEggSpecies was using Evolves1 when format = 1 even when asking for a gen2 egg base species, returning Pikachu egg moves (empty list) instead of Pichu egg moves
* Fix ability checking for generation 3 pokemon, likea de Seadra from Issue #1011
pkm.AbilityNumber have a value assuming PID match ability like a generation 4 pokemon but the validation should be ignored if is a generation 3 pokemon with only one ability in generation 3
Also changed the validation for ingame trades with fixed abilities to check only with generation 3 abilities in the case the species has two abilities generation 3, if only one was possible any PID should be valid with the generation 3 ability
Encounter Trades
Also the check for evolution was wrong, the most evolved species is the first in the evochain, not the last
* Fix evoltuion chains for gen 3 pokemon in format 4
* Fix ability for generation 3 trades. Ability could not change if there were 2 abilities in generation 3, that means it is irrelevant if the pokemon evolved in gen 4-5, the ability number must match the encounter
* Added missing skipOption to a call to getBaseEggSpecies
* Functions to obtain moves excluvie to preevolutions, like moves that Azurill/Happiny could learn throught level up or TM but Marill/Chansey could not learn, icompatible with any Marill/Chansey egg moves
Also add functions to return egg moves and base egg moves for both possible species for split breed eggs
* Check both species from split breed egg at the same time to report moves incompatibilities
* Reduced generation 4-5 was egg game check
There is no need to check every possible generation game.
For every egg species HGSS learnset tables y egg moves table contains all the moves from the same species in DP and Pt, without any move exclusive to that games except in legendaries, and they cant breed
In generation 5 is the same with B2W2 except for Exxegutte, it have a exclusive level up move from B1W1, Psychic, but it can learn the move with TM, it wont count as an egg move
* Check incompatible split breed moves in verify relearn egg
* Fix generation 1 incompatibility moves check
SolarBeam removed from Exeggcute/Exeggutor incompatiblity, Exeggutor could learn it with a TM in generation 1
Removed Vaporeon Mist and Eevee Take Down incompatiblity, Vaporeon could learn Take Down with a TM in generation 1
2017-04-14 17:11:50 +00:00
|
|
|
|
internal static List<int>[] GetEmptyMovesList(DexLevel[][] EvoChainsAllGens)
|
|
|
|
|
{
|
|
|
|
|
var empty = new List<int>[EvoChainsAllGens.Length];
|
|
|
|
|
for (int i = 0; i < empty.Length; i++)
|
|
|
|
|
empty[i] = new List<int>();
|
|
|
|
|
return empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static List<int>[] GetEmptyEggMovesList()
|
|
|
|
|
{
|
|
|
|
|
var emptyegg = new List<int>[1];
|
|
|
|
|
emptyegg[0] = new List<int>();
|
|
|
|
|
return emptyegg;
|
|
|
|
|
}
|
2016-02-23 06:52:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|