2016-03-12 17:16:41 +00:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
2017-03-25 17:24:56 +00:00
using static PKHeX . Core . LegalityCheckStrings ;
2016-03-11 04:36:32 +00:00
2017-01-08 07:54:09 +00:00
namespace PKHeX.Core
2016-03-11 04:36:32 +00:00
{
public enum Severity
{
Indeterminate = - 2 ,
Invalid = - 1 ,
Fishy = 0 ,
Valid = 1 ,
NotImplemented = 2 ,
}
2017-01-08 07:54:09 +00:00
internal enum CheckIdentifier
2016-10-23 19:48:49 +00:00
{
Move ,
RelearnMove ,
Encounter ,
History ,
ECPID ,
Shiny ,
EC ,
PID ,
Gender ,
EVs ,
Language ,
2017-02-15 01:33:57 +00:00
Nickname ,
2016-10-23 19:48:49 +00:00
Trainer ,
IVs ,
None ,
Level ,
Ball ,
Memory ,
Geography ,
Form ,
Egg ,
Misc ,
Fateful ,
Ribbon ,
Training ,
2016-12-01 03:37:53 +00:00
Ability ,
2016-12-02 02:48:38 +00:00
Evolution ,
2017-03-25 17:24:56 +00:00
Special ,
Nature
2016-10-23 19:48:49 +00:00
}
public class CheckResult
2016-03-11 04:36:32 +00:00
{
2017-01-08 07:54:09 +00:00
internal readonly Severity Judgement = Severity . Valid ;
2017-03-21 07:18:38 +00:00
internal string Comment = V ;
2016-03-11 04:36:32 +00:00
public bool Valid = > Judgement > = Severity . Fishy ;
2016-03-25 07:10:11 +00:00
public bool Flag ;
2017-03-18 23:17:42 +00:00
internal readonly CheckIdentifier Identifier ;
2016-03-11 04:36:32 +00:00
2017-02-15 06:06:15 +00:00
internal CheckResult ( CheckIdentifier i ) { Identifier = i ; }
2017-01-08 07:54:09 +00:00
internal CheckResult ( Severity s , string c , CheckIdentifier i )
2016-03-11 04:36:32 +00:00
{
Judgement = s ;
Comment = c ;
2016-10-23 19:48:49 +00:00
Identifier = i ;
2016-03-11 04:36:32 +00:00
}
2016-03-14 03:19:04 +00:00
}
public partial class LegalityAnalysis
{
2016-10-23 19:48:49 +00:00
private void verifyGender ( )
2016-07-04 01:36:04 +00:00
{
2016-10-29 06:41:22 +00:00
if ( pkm . PersonalInfo . Gender = = 255 & & pkm . Gender ! = 2 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V203 , CheckIdentifier . Gender ) ;
2017-03-25 17:24:56 +00:00
// Check for PID relationship to Gender & Nature if applicable
int gen = pkm . GenNumber ;
bool PIDGender = 3 < = gen & & gen < = 5 ;
if ( ! PIDGender )
return ;
bool genderValid = pkm . getGenderIsValid ( ) ;
if ( ! genderValid & & pkm . Format > 5 & & ( pkm . Species = = 183 | | pkm . Species = = 184 ) )
{
var gv = pkm . PID & 0xFF ;
if ( gv > 63 & & pkm . Gender = = 1 ) // evolved from azurill after transferring to keep gender
genderValid = true ;
2016-10-23 19:48:49 +00:00
}
2017-03-25 17:24:56 +00:00
if ( genderValid )
AddLine ( Severity . Valid , V250 , CheckIdentifier . Gender ) ;
else
AddLine ( Severity . Invalid , V251 , CheckIdentifier . Gender ) ;
bool PIDNature = gen ! = 5 ;
if ( ! PIDNature )
return ;
if ( pkm . PID % 25 = = pkm . Nature )
AddLine ( Severity . Valid , V252 , CheckIdentifier . Nature ) ;
else
AddLine ( Severity . Invalid , V253 , CheckIdentifier . Nature ) ;
2016-07-04 01:36:04 +00:00
}
2017-02-26 15:55:22 +00:00
private void verifyItem ( )
{
2017-02-26 19:43:26 +00:00
if ( ! Legal . getHeldItemAllowed ( pkm . Format , pkm . HeldItem ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V204 , CheckIdentifier . Form ) ;
2017-04-10 22:59:16 +00:00
if ( pkm . Format = = 3 & & pkm . HeldItem = = 175 )
verifyEReaderBerry ( ) ;
}
private void verifyEReaderBerry ( )
{
2017-04-11 02:00:58 +00:00
if ( Legal . EReaderBerryIsEnigma ) // no E-Reader berry data provided, can't hold berry.
2017-04-10 22:59:16 +00:00
{
AddLine ( Severity . Invalid , V204 , CheckIdentifier . Form ) ;
return ;
}
2017-04-11 02:00:58 +00:00
2017-04-10 22:59:16 +00:00
var matchUSA = Legal . EReaderBerriesNames_USA . Contains ( Legal . EReaderBerryName ) ;
var matchJP = Legal . EReaderBerriesNames_JP . Contains ( Legal . EReaderBerryName ) ;
2017-04-11 02:00:58 +00:00
if ( ! matchJP & & ! matchUSA ) // Does not match any released E-Reader berry
2017-04-10 22:59:16 +00:00
AddLine ( Severity . Invalid , V369 , CheckIdentifier . Form ) ;
2017-04-11 02:00:58 +00:00
else if ( matchJP & & ! Legal . SavegameJapanese ) // E-Reader is region locked
2017-04-10 22:59:16 +00:00
AddLine ( Severity . Invalid , V370 , CheckIdentifier . Form ) ;
2017-04-11 02:00:58 +00:00
else if ( matchUSA & & Legal . SavegameJapanese ) // E-Reader is region locked
2017-04-10 22:59:16 +00:00
AddLine ( Severity . Invalid , V371 , CheckIdentifier . Form ) ;
2017-02-26 15:55:22 +00:00
}
2016-10-23 19:48:49 +00:00
private void verifyECPID ( )
2016-03-11 04:36:32 +00:00
{
2017-04-11 02:00:58 +00:00
if ( pkm . Format > = 6 )
verifyEC ( ) ;
if ( 265 < = pkm . Species & & pkm . Species < = 269 )
verifyECPIDWurmple ( ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . PID = = 0 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V207 , CheckIdentifier . PID ) ;
2016-03-11 04:36:32 +00:00
2016-10-23 19:48:49 +00:00
if ( pkm . GenNumber > = 6 & & pkm . PID = = pkm . EncryptionConstant )
2017-04-11 02:00:58 +00:00
AddLine ( Severity . Invalid , V208 , CheckIdentifier . PID ) ; // better to flag than 1:2^32 odds since RNG is not feasible to yield match
2016-03-11 04:36:32 +00:00
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( EncounterStatic ) )
2016-06-20 04:22:43 +00:00
{
2017-04-11 02:00:58 +00:00
var enc = ( EncounterStatic ) EncounterMatch ;
2016-10-23 19:48:49 +00:00
if ( enc . Shiny ! = null & & ( bool ) enc . Shiny ^ pkm . IsShiny )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V209 , CheckIdentifier . Shiny ) ;
2016-06-20 04:22:43 +00:00
}
2017-04-22 20:04:12 +00:00
else if ( Type = = typeof ( EncounterSlot [ ] ) )
2017-04-02 13:39:39 +00:00
{
2017-04-11 02:00:58 +00:00
var slots = ( EncounterSlot [ ] ) EncounterMatch ;
if ( pkm . IsShiny & & slots . All ( slot = > slot . Type = = SlotType . HiddenGrotto ) )
2017-04-02 13:39:39 +00:00
AddLine ( Severity . Invalid , V221 , CheckIdentifier . Shiny ) ;
}
2017-04-11 02:00:58 +00:00
}
private void verifyECPIDWurmple ( )
{
uint evoVal ;
switch ( pkm . GenNumber )
{
case 3 : evoVal = pkm . PID & 0xFFFF ; break ;
case 4 :
case 5 : evoVal = pkm . PID > > 16 ; break ;
default : evoVal = pkm . EncryptionConstant > > 16 ; break ;
}
2017-04-13 04:38:53 +00:00
evoVal = evoVal % 10 / 5 ;
2016-06-20 04:22:43 +00:00
2017-04-11 02:00:58 +00:00
if ( pkm . Species = = 265 )
{
AddLine ( Severity . Valid , string . Format ( V212 , evoVal = = 0 ? specieslist [ 267 ] : specieslist [ 269 ] ) , CheckIdentifier . EC ) ;
return ;
}
// Check if Wurmple was the origin (only Egg and Wild Encounter)
2017-05-02 06:41:19 +00:00
bool wasWurmple = pkm . WasEgg | | ( Type = = typeof ( EncounterSlot [ ] ) & & ( ( EncounterSlot [ ] ) EncounterMatch ) . All ( slot = > slot . Species = = 265 ) ) ;
2017-04-11 02:00:58 +00:00
if ( ! wasWurmple )
return ;
int wIndex = Array . IndexOf ( Legal . WurmpleEvolutions , pkm . Species ) / 2 ;
if ( evoVal ! = wIndex )
AddLine ( Severity . Invalid , V210 , CheckIdentifier . EC ) ;
}
private void verifyEC ( )
{
if ( pkm . EncryptionConstant = = 0 )
AddLine ( Severity . Fishy , V201 , CheckIdentifier . EC ) ;
if ( 3 < = pkm . GenNumber & & pkm . GenNumber < = 5 )
verifyTransferEC ( ) ;
else
2016-04-08 00:56:39 +00:00
{
2016-10-23 19:48:49 +00:00
int xor = pkm . TSV ^ pkm . PSV ;
if ( xor < 16 & & xor > = 8 & & ( pkm . PID ^ 0x80000000 ) = = pkm . EncryptionConstant )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V211 , CheckIdentifier . EC ) ;
2016-04-08 00:56:39 +00:00
}
2017-04-11 02:00:58 +00:00
}
private void verifyTransferEC ( )
{
2016-03-11 04:36:32 +00:00
// When transferred to Generation 6, the Encryption Constant is copied from the PID.
// The PID is then checked to see if it becomes shiny with the new Shiny rules (>>4 instead of >>3)
// If the PID is nonshiny->shiny, the top bit is flipped.
// Check to see if the PID and EC are properly configured.
2016-12-23 02:18:35 +00:00
bool xorPID = ( ( pkm . TID ^ pkm . SID ^ ( int ) ( pkm . PID & 0xFFFF ) ^ ( int ) ( pkm . PID > > 16 ) ) & ~ 0x7 ) = = 8 ;
2016-03-11 04:36:32 +00:00
bool valid = xorPID
2016-10-23 19:48:49 +00:00
? pkm . EncryptionConstant = = ( pkm . PID ^ 0x8000000 )
: pkm . EncryptionConstant = = pkm . PID ;
2016-03-11 04:36:32 +00:00
if ( ! valid )
2017-04-11 02:00:58 +00:00
AddLine ( Severity . Invalid , xorPID ? V215 : V216 , CheckIdentifier . ECPID ) ;
2016-03-11 04:36:32 +00:00
}
2017-04-07 00:41:25 +00:00
#region verifyNickname
2016-10-23 19:48:49 +00:00
private void verifyNickname ( )
2016-03-11 04:36:32 +00:00
{
// If the Pokémon is not nicknamed, it should match one of the language strings.
2016-10-23 19:48:49 +00:00
if ( pkm . Nickname . Length = = 0 )
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V2 , CheckIdentifier . Nickname ) ;
2016-10-23 19:48:49 +00:00
return ;
}
if ( pkm . Species > PKX . SpeciesLang [ 0 ] . Length )
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Indeterminate , V3 , CheckIdentifier . Nickname ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-01-27 05:35:26 +00:00
if ( pkm . VC )
{
string pk = pkm . Nickname ;
var langset = PKX . SpeciesLang . FirstOrDefault ( s = > s . Contains ( pk ) ) ? ? PKX . SpeciesLang [ 2 ] ;
int lang = Array . IndexOf ( PKX . SpeciesLang , langset ) ;
if ( pk . Length > ( lang = = 2 ? 10 : 5 ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V1 , CheckIdentifier . Nickname ) ;
2017-04-09 23:38:29 +00:00
}
2017-04-24 00:53:22 +00:00
else if ( Type = = typeof ( MysteryGift ) )
2017-04-09 23:38:29 +00:00
{
if ( pkm . IsNicknamed & & ( ! ( EncounterMatch as MysteryGift ) ? . IsEgg ? ? false ) )
AddLine ( Severity . Fishy , V0 , CheckIdentifier . Nickname ) ;
2017-01-27 05:35:26 +00:00
}
2016-03-20 01:06:02 +00:00
if ( ! Encounter . Valid )
2016-10-23 19:48:49 +00:00
return ;
if ( pkm . Format < = 6 & & pkm . Language > 8 )
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Indeterminate , V4 , CheckIdentifier . Language ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2016-11-09 16:23:47 +00:00
if ( pkm . Format < = 7 & & pkm . Language > 10 )
2016-10-23 19:48:49 +00:00
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Indeterminate , V5 , CheckIdentifier . Language ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterTrade ) )
2016-03-27 00:23:53 +00:00
{
2017-03-25 17:24:56 +00:00
verifyNicknameTrade ( ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-03-27 00:23:53 +00:00
}
2016-03-20 01:06:02 +00:00
2016-10-23 19:48:49 +00:00
if ( pkm . IsEgg )
2016-03-16 04:15:40 +00:00
{
2017-03-25 17:24:56 +00:00
verifyNicknameEgg ( ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-03-16 04:15:40 +00:00
}
2016-10-23 19:48:49 +00:00
string nickname = pkm . Nickname . Replace ( "'" , "’ " ) ;
if ( pkm . IsNicknamed )
2016-03-11 04:36:32 +00:00
{
2016-03-20 01:06:02 +00:00
for ( int i = 0 ; i < PKX . SpeciesLang . Length ; i + + )
{
string [ ] lang = PKX . SpeciesLang [ i ] ;
int index = Array . IndexOf ( lang , nickname ) ;
if ( index < 0 )
continue ;
2016-10-23 19:48:49 +00:00
AddLine ( Severity . Fishy , index = = pkm . Species & & i ! = pkm . Language
2017-03-21 07:18:38 +00:00
? V15
: V16 , CheckIdentifier . Nickname ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-03-20 01:06:02 +00:00
}
2017-04-04 03:02:40 +00:00
if ( nickname . Any ( c = > 0x4E00 < = c & & c < = 0x9FFF ) ) // East Asian Scripts
{
AddLine ( Severity . Invalid , V222 , CheckIdentifier . Nickname ) ;
return ;
}
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V17 , CheckIdentifier . Nickname ) ;
2016-03-16 01:56:18 +00:00
}
2017-02-13 01:00:03 +00:00
else if ( pkm . Format < 3 )
{
// pk1/pk2 IsNicknamed getter checks for match, logic should only reach here if matches.
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V18 , CheckIdentifier . Nickname ) ;
2017-02-13 01:00:03 +00:00
}
else
2016-03-16 01:56:18 +00:00
{
2016-07-11 05:22:55 +00:00
// Can't have another language name if it hasn't evolved or wasn't a language-traded egg.
2017-04-10 01:28:22 +00:00
bool evolved = Legal . getHasEvolved ( pkm ) ;
2017-03-19 22:40:49 +00:00
bool match = PKX . getSpeciesNameGeneration ( pkm . Species , pkm . Language , pkm . Format ) = = nickname ;
2017-04-10 01:28:22 +00:00
if ( pkm . WasTradedEgg | | evolved )
2017-03-25 17:24:56 +00:00
match | = ! PKX . getIsNicknamedAnyLanguage ( pkm . Species , nickname , pkm . Format ) ;
2017-04-10 01:28:22 +00:00
if ( ! match & & pkm . Format = = 5 & & ! pkm . IsNative ) // transfer
{
if ( evolved )
match | = ! PKX . getIsNicknamedAnyLanguage ( pkm . Species , nickname , 4 ) ;
else
match | = PKX . getSpeciesNameGeneration ( pkm . Species , pkm . Language , 4 ) = = nickname ;
}
2016-10-23 19:48:49 +00:00
if ( ! match )
2017-02-21 06:03:07 +00:00
{
if ( ( EncounterMatch as MysteryGift ) ? . CardID = = 2046 & & ( pkm . SID < < 16 | pkm . TID ) = = 0x79F57B49 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V19 , CheckIdentifier . Nickname ) ;
2017-02-21 06:03:07 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V20 , CheckIdentifier . Nickname ) ;
2017-02-21 06:03:07 +00:00
}
2016-10-23 19:48:49 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V18 , CheckIdentifier . Nickname ) ;
2016-03-11 04:36:32 +00:00
}
}
2017-03-25 17:24:56 +00:00
private void verifyNicknameEgg ( )
{
if ( ! pkm . IsNicknamed & & ( pkm . Format ! = 7 ) )
AddLine ( Severity . Invalid , V12 , CheckIdentifier . Egg ) ;
2017-04-05 06:11:47 +00:00
else if ( PKX . getSpeciesNameGeneration ( 0 , pkm . Language , pkm . GenNumber ) ! = pkm . Nickname )
2017-03-25 17:24:56 +00:00
AddLine ( Severity . Invalid , V13 , CheckIdentifier . Egg ) ;
else
AddLine ( Severity . Valid , V14 , CheckIdentifier . Egg ) ;
}
private void verifyNicknameTrade ( )
{
string [ ] validOT = new string [ 0 ] ;
int index = - 1 ;
if ( pkm . XY )
{
validOT = Legal . TradeXY [ pkm . Language ] ;
index = Array . IndexOf ( Legal . TradeGift_XY , EncounterMatch ) ;
}
else if ( pkm . AO )
{
validOT = Legal . TradeAO [ pkm . Language ] ;
index = Array . IndexOf ( Legal . TradeGift_AO , EncounterMatch ) ;
}
else if ( pkm . SM )
{
// TODO
AddLine ( Severity . Valid , V194 , CheckIdentifier . Nickname ) ;
return ;
}
else if ( pkm . Format < = 2 | | pkm . VC )
{
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 et = EncounterOriginalGB as EncounterTrade ;
2017-03-25 17:24:56 +00:00
if ( et ? . TID = = 0 ) // Gen1 Trade
{
if ( ! Legal . getEncounterTrade1Valid ( pkm ) )
AddLine ( Severity . Invalid , V10 , CheckIdentifier . Trainer ) ;
}
else // Gen2
{
return ; // already checked all relevant properties when fetching with getValidEncounterTradeVC2
}
return ;
}
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
else if ( 3 < = pkm . GenNumber & & pkm . GenNumber < = 5 )
2017-03-30 06:31:02 +00:00
{
// Suppressing temporarily
2017-03-28 09:02:46 +00:00
return ;
}
2017-03-25 17:24:56 +00:00
if ( validOT . Length = = 0 )
{
AddLine ( Severity . Indeterminate , V7 , CheckIdentifier . Trainer ) ;
return ;
}
if ( index = = - 1 | | validOT . Length < index * 2 )
{
AddLine ( Severity . Indeterminate , V8 , CheckIdentifier . Trainer ) ;
return ;
}
string nick = validOT [ index ] ;
string OT = validOT [ validOT . Length / 2 + index ] ;
if ( nick ! = pkm . Nickname )
AddLine ( Severity . Fishy , V9 , CheckIdentifier . Nickname ) ;
else if ( OT ! = pkm . OT_Name )
AddLine ( Severity . Invalid , V10 , CheckIdentifier . Trainer ) ;
else
AddLine ( Severity . Valid , V11 , CheckIdentifier . Nickname ) ;
}
2017-04-07 00:41:25 +00:00
#endregion
2016-10-23 19:48:49 +00:00
private void verifyEVs ( )
2016-03-11 04:36:32 +00:00
{
2016-10-23 19:48:49 +00:00
var evs = pkm . EVs ;
2016-03-14 03:19:04 +00:00
int sum = evs . Sum ( ) ;
2017-04-12 03:55:34 +00:00
if ( sum > 0 & & pkm . IsEgg )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V22 , CheckIdentifier . EVs ) ;
2017-04-12 03:55:34 +00:00
if ( sum > 510 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V25 , CheckIdentifier . EVs ) ;
2017-04-12 03:55:34 +00:00
if ( pkm . Format > = 6 & & evs . Any ( ev = > ev > 252 ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V26 , CheckIdentifier . EVs ) ;
2017-04-10 12:11:07 +00:00
if ( pkm . Format = = 4 & & pkm . Gen4 & & ( EncounterMatch as IEncounterable ) ? . LevelMin = = 100 )
{
2017-04-12 03:55:34 +00:00
// Cannot EV train at level 100 -- Certain events are distributed at level 100.
if ( evs . Any ( ev = > ev > 100 ) ) // EVs can only be increased by vitamins to a max of 100.
2017-04-10 12:11:07 +00:00
AddLine ( Severity . Invalid , V367 , CheckIdentifier . EVs ) ;
}
2017-04-12 03:55:34 +00:00
// Only one of the following can be true: 0, 508, and x%6!=0
if ( sum = = 0 & & pkm . CurrentLevel - Math . Max ( 1 , pkm . Met_Level ) > 0 )
AddLine ( Severity . Fishy , V23 , CheckIdentifier . EVs ) ;
else if ( sum = = 508 )
AddLine ( Severity . Fishy , V24 , CheckIdentifier . EVs ) ;
else if ( evs [ 0 ] ! = 0 & & evs . All ( ev = > evs [ 0 ] = = ev ) )
AddLine ( Severity . Fishy , V27 , CheckIdentifier . EVs ) ;
2016-03-11 04:36:32 +00:00
}
2016-10-23 19:48:49 +00:00
private void verifyIVs ( )
2016-03-11 04:36:32 +00:00
{
2017-03-10 04:27:03 +00:00
var e = EncounterMatch as EncounterStatic ;
2017-01-01 01:20:13 +00:00
if ( ( EncounterMatch as EncounterStatic ) ? . IV3 = = true )
2016-10-23 19:48:49 +00:00
{
2017-03-10 04:27:03 +00:00
int IVCount = 3 ;
if ( e . Version = = GameVersion . RBY & & pkm . Species = = 151 )
IVCount = 5 ; // VC Mew
if ( pkm . IVs . Count ( iv = > iv = = 31 ) < IVCount )
2016-10-23 19:48:49 +00:00
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V28 , IVCount ) , CheckIdentifier . IVs ) ;
2016-10-23 19:48:49 +00:00
return ;
}
}
2017-01-01 01:20:13 +00:00
if ( ( EncounterMatch as EncounterSlot [ ] ) ? . All ( slot = > slot . Type = = SlotType . FriendSafari ) = = true )
{
if ( pkm . IVs . Count ( iv = > iv = = 31 ) < 2 )
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V29 , CheckIdentifier . IVs ) ;
2017-01-01 01:20:13 +00:00
return ;
}
}
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( MysteryGift ) )
2017-02-02 05:27:14 +00:00
{
int [ ] IVs ;
switch ( ( ( MysteryGift ) EncounterMatch ) . Format )
{
case 7 : IVs = ( ( WC7 ) EncounterMatch ) . IVs ; break ;
2017-03-10 04:27:03 +00:00
case 6 : IVs = ( ( WC6 ) EncounterMatch ) . IVs ; break ;
case 5 : IVs = ( ( PGF ) EncounterMatch ) . IVs ; break ;
2017-02-02 05:27:14 +00:00
default : IVs = null ; break ;
}
if ( IVs ! = null )
{
var pkIVs = pkm . IVs ;
bool valid = true ;
for ( int i = 0 ; i < 6 ; i + + )
if ( IVs [ i ] < = 31 & & IVs [ i ] ! = pkIVs [ i ] )
valid = false ;
if ( ! valid )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V30 , CheckIdentifier . IVs ) ;
2017-04-10 04:59:44 +00:00
bool IV3 = IVs [ 0 ] = = 0xFE ;
if ( IV3 & & pkm . IVs . Count ( iv = > iv = = 31 ) < 3 )
AddLine ( Severity . Invalid , string . Format ( V28 , 3 ) , CheckIdentifier . IVs ) ;
2017-02-02 05:27:14 +00:00
}
}
2016-10-23 19:48:49 +00:00
if ( pkm . IVs . Sum ( ) = = 0 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V31 , CheckIdentifier . IVs ) ;
2016-10-23 19:48:49 +00:00
else if ( pkm . IVs [ 0 ] < 30 & & pkm . IVs . All ( iv = > pkm . IVs [ 0 ] = = iv ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V32 , CheckIdentifier . IVs ) ;
2016-03-11 04:36:32 +00:00
}
2017-02-13 01:00:03 +00:00
private void verifyDVs ( )
{
// todo
}
2017-04-07 00:41:25 +00:00
#region verifyOT
2017-01-27 05:35:26 +00:00
private void verifyOT ( )
2016-03-11 04:36:32 +00:00
{
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterTrade ) )
2016-10-23 19:48:49 +00:00
return ; // Already matches Encounter Trade information
if ( pkm . TID = = 0 & & pkm . SID = = 0 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V33 , CheckIdentifier . Trainer ) ;
2017-01-27 05:35:26 +00:00
else if ( pkm . VC )
{
if ( pkm . SID ! = 0 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V34 , CheckIdentifier . Trainer ) ;
2017-01-27 05:35:26 +00:00
}
2016-10-23 19:48:49 +00:00
else if ( pkm . TID = = pkm . SID )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V35 , CheckIdentifier . Trainer ) ;
2016-10-23 19:48:49 +00:00
else if ( pkm . TID = = 0 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V36 , CheckIdentifier . Trainer ) ;
2016-10-23 19:48:49 +00:00
else if ( pkm . SID = = 0 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V37 , CheckIdentifier . Trainer ) ;
2017-01-27 05:35:26 +00:00
if ( pkm . VC )
2017-02-13 01:00:03 +00:00
verifyG1OT ( ) ;
}
private void verifyG1OT ( )
{
string tr = pkm . OT_Name ;
string pk = pkm . Nickname ;
var langset = PKX . SpeciesLang . FirstOrDefault ( s = > s . Contains ( pk ) ) ? ? PKX . SpeciesLang [ 2 ] ;
int lang = Array . IndexOf ( PKX . SpeciesLang , langset ) ;
2017-01-27 05:35:26 +00:00
2017-02-13 01:00:03 +00:00
if ( tr . Length > ( lang = = 2 ? 7 : 5 ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V38 , CheckIdentifier . Trainer ) ;
2017-02-13 01:00:03 +00:00
if ( pkm . Species = = 151 )
{
if ( tr ! = "GF" & & tr ! = "ゲーフリ" ) // if there are more events with special OTs, may be worth refactoring
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V39 , CheckIdentifier . Trainer ) ;
2017-01-27 05:35:26 +00:00
}
2017-05-01 15:25:20 +00:00
if ( ( EncounterMatch as EncounterStatic ) ? . Version = = GameVersion . Stadium )
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
{
2017-05-01 15:25:20 +00:00
if ( tr = = "STADIUM" & & pkm . TID = = 2000 )
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
AddLine ( Severity . Valid , V403 , CheckIdentifier . Trainer ) ;
else if ( tr = = "スタジアム" & & pkm . TID = = 1999 )
AddLine ( Severity . Valid , V404 , CheckIdentifier . Trainer ) ;
else
AddLine ( Severity . Invalid , V402 , CheckIdentifier . Trainer ) ;
}
2016-03-11 04:36:32 +00:00
}
2017-04-07 00:41:25 +00:00
#endregion
2016-11-11 10:31:50 +00:00
private void verifyHyperTraining ( )
{
if ( pkm . Format < 7 )
return ; // No Hyper Training before Gen VII
var IVs = new [ ] { pkm . IV_HP , pkm . IV_ATK , pkm . IV_DEF , pkm . IV_SPA , pkm . IV_SPD , pkm . IV_SPE } ;
var HTs = new [ ] { pkm . HT_HP , pkm . HT_ATK , pkm . HT_DEF , pkm . HT_SPA , pkm . HT_SPD , pkm . HT_SPE } ;
2016-11-11 11:23:38 +00:00
if ( HTs . Any ( ht = > ht ) & & pkm . CurrentLevel ! = 100 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V40 , CheckIdentifier . IVs ) ;
2016-11-11 11:23:38 +00:00
2016-11-11 10:31:50 +00:00
if ( IVs . All ( iv = > iv = = 31 ) & & HTs . Any ( ht = > ht ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V41 , CheckIdentifier . IVs ) ;
2016-11-11 10:31:50 +00:00
else
{
for ( int i = 0 ; i < 6 ; i + + ) // Check individual IVs
{
if ( ( IVs [ i ] = = 31 ) & & HTs [ i ] )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V42 , CheckIdentifier . IVs ) ;
2016-11-11 10:31:50 +00:00
}
}
}
2017-04-07 00:41:25 +00:00
#region verifyEncounter
2017-02-13 01:00:03 +00:00
private CheckResult verifyEncounterLink ( )
2016-03-12 03:43:40 +00:00
{
2017-02-13 01:00:03 +00:00
// Should NOT be Fateful, and should be in Database
EncounterLink enc = EncounterMatch as EncounterLink ;
if ( enc = = null )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V43 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
if ( pkm . XY & & ! enc . XY )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V44 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
if ( pkm . AO & & ! enc . ORAS )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V45 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
if ( enc . Shiny ! = null & & ( bool ) enc . Shiny ^ pkm . IsShiny )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V47 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
return pkm . FatefulEncounter
2017-03-21 07:18:38 +00:00
? new CheckResult ( Severity . Invalid , V48 , CheckIdentifier . Encounter )
: new CheckResult ( Severity . Valid , V49 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
private CheckResult verifyEncounterEvent ( )
{
MysteryGift MatchedGift = EncounterMatch as MysteryGift ;
2017-03-25 17:24:56 +00:00
if ( MatchedGift = = null )
return null ;
return new CheckResult ( Severity . Valid , string . Format ( V21 , MatchedGift . CardID . ToString ( "0000" ) , MatchedGift . CardTitle ) , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
2017-03-20 04:36:03 +00:00
2017-02-13 01:00:03 +00:00
private CheckResult verifyEncounterEgg ( )
{
2017-03-20 04:36:03 +00:00
// Check Species
2017-04-01 01:35:43 +00:00
if ( Legal . NoHatchFromEgg . Contains ( pkm . Species ) & & EncounterMatch = = null )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V50 , CheckIdentifier . Encounter ) ;
2017-04-01 16:45:13 +00:00
if ( pkm . WasGiftEgg & & EncounterMatch = = null )
return new CheckResult ( Severity . Invalid , V359 , CheckIdentifier . Encounter ) ;
if ( pkm . WasEventEgg & & EncounterMatch = = null )
return new CheckResult ( Severity . Invalid , V360 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
switch ( pkm . GenNumber )
2017-01-27 05:35:26 +00:00
{
2017-03-20 04:36:03 +00:00
case 1 :
case 2 : return new CheckResult ( CheckIdentifier . Encounter ) ; // no met location info
case 3 : return verifyEncounterEgg3 ( ) ;
case 4 : return pkm . IsEgg ? verifyUnhatchedEgg ( 2002 ) : verifyEncounterEgg4 ( ) ;
case 5 : return pkm . IsEgg ? verifyUnhatchedEgg ( 30002 ) : verifyEncounterEgg5 ( ) ;
case 6 : return pkm . IsEgg ? verifyUnhatchedEgg ( 30002 ) : verifyEncounterEgg6 ( ) ;
case 7 : return pkm . IsEgg ? verifyUnhatchedEgg ( 30002 ) : verifyEncounterEgg7 ( ) ;
default : // none of the above
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V51 , CheckIdentifier . Encounter ) ;
2017-01-27 05:35:26 +00:00
}
2017-03-20 04:36:03 +00:00
}
private CheckResult verifyEncounterEgg3 ( )
{
2017-03-25 17:24:56 +00:00
return pkm . Format = = 3 ? verifyEncounterEgg3Native ( ) : verifyEncounterEgg3Transfer ( ) ;
}
private CheckResult verifyEncounterEgg3Native ( )
{
if ( pkm . Met_Level ! = 0 )
return new CheckResult ( Severity . Invalid , string . Format ( V52 , 0 ) , CheckIdentifier . Encounter ) ;
if ( pkm . IsEgg )
2017-02-13 01:00:03 +00:00
{
2017-03-25 18:02:33 +00:00
var loc = pkm . FRLG ? Legal . ValidEggMet_FRLG : Legal . ValidEggMet_RSE ;
if ( ! loc . Contains ( pkm . Met_Location ) )
2017-03-25 17:24:56 +00:00
return new CheckResult ( Severity . Invalid , V55 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
2017-03-20 04:36:03 +00:00
else
2017-02-13 01:00:03 +00:00
{
2017-03-25 17:24:56 +00:00
var locs = pkm . FRLG ? Legal . ValidMet_FRLG : pkm . E ? Legal . ValidMet_E : Legal . ValidMet_RS ;
if ( locs . Contains ( pkm . Met_Location ) )
return new CheckResult ( Severity . Valid , V53 , CheckIdentifier . Encounter ) ;
if ( Legal . ValidMet_FRLG . Contains ( pkm . Met_Location ) | | Legal . ValidMet_E . Contains ( pkm . Met_Location ) | | Legal . ValidMet_RS . Contains ( pkm . Met_Location ) )
return new CheckResult ( Severity . Valid , V56 , CheckIdentifier . Encounter ) ;
return new CheckResult ( Severity . Invalid , V54 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V53 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
}
2017-03-25 17:24:56 +00:00
private CheckResult verifyEncounterEgg3Transfer ( )
{
if ( pkm . IsEgg )
return new CheckResult ( Severity . Invalid , V57 , CheckIdentifier . Encounter ) ;
if ( pkm . Met_Level < 5 )
return new CheckResult ( Severity . Invalid , V58 , CheckIdentifier . Encounter ) ;
if ( pkm . Egg_Location ! = 0 )
return new CheckResult ( Severity . Invalid , V59 , CheckIdentifier . Encounter ) ;
if ( pkm . Format = = 4 & & pkm . Met_Location ! = 0x37 ) // Pal Park
return new CheckResult ( Severity . Invalid , V60 , CheckIdentifier . Encounter ) ;
if ( pkm . Format ! = 4 & & pkm . Met_Location ! = 30001 )
return new CheckResult ( Severity . Invalid , V61 , CheckIdentifier . Encounter ) ;
return new CheckResult ( Severity . Valid , V53 , CheckIdentifier . Encounter ) ;
}
2017-03-20 04:36:03 +00:00
private CheckResult verifyEncounterEgg4 ( )
{
if ( pkm . Format = = 4 )
return verifyEncounterEggLevelLoc ( 0 , pkm . HGSS ? Legal . ValidMet_HGSS : pkm . Pt ? Legal . ValidMet_Pt : Legal . ValidMet_DP ) ;
2017-03-21 07:18:38 +00:00
if ( pkm . IsEgg )
return new CheckResult ( Severity . Invalid , V57 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
// transferred
if ( pkm . Met_Level < 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V58 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
if ( pkm . Met_Location ! = 30001 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V61 , CheckIdentifier . Encounter ) ;
2017-04-20 04:39:05 +00:00
return new CheckResult ( Severity . Valid , V53 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
}
private CheckResult verifyEncounterEgg5 ( )
{
return verifyEncounterEggLevelLoc ( 1 , pkm . B2W2 ? Legal . ValidMet_B2W2 : Legal . ValidMet_BW ) ;
}
private CheckResult verifyEncounterEgg6 ( )
{
if ( pkm . AO )
return verifyEncounterEggLevelLoc ( 1 , Legal . ValidMet_AO ) ;
if ( pkm . Egg_Location = = 318 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V55 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
return verifyEncounterEggLevelLoc ( 1 , Legal . ValidMet_XY ) ;
}
private CheckResult verifyEncounterEgg7 ( )
{
2017-02-13 01:00:03 +00:00
if ( pkm . SM )
2017-03-20 04:36:03 +00:00
return verifyEncounterEggLevelLoc ( 1 , Legal . ValidMet_SM ) ;
// no other games
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V51 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
2017-03-20 04:36:03 +00:00
private CheckResult verifyEncounterEggLevelLoc ( int eggLevel , int [ ] MetLocations )
{
if ( pkm . Met_Level ! = eggLevel )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , string . Format ( V52 , eggLevel ) , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
return MetLocations . Contains ( pkm . Met_Location )
2017-03-21 07:18:38 +00:00
? new CheckResult ( Severity . Valid , V53 , CheckIdentifier . Encounter )
: new CheckResult ( Severity . Invalid , V54 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
}
private CheckResult verifyUnhatchedEgg ( int tradeLoc )
{
if ( pkm . Egg_Location = = tradeLoc )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V62 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
if ( pkm . Met_Location = = tradeLoc )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V56 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
return pkm . Met_Location = = 0
2017-03-21 07:18:38 +00:00
? new CheckResult ( Severity . Valid , V63 , CheckIdentifier . Encounter )
: new CheckResult ( Severity . Invalid , V59 , CheckIdentifier . Encounter ) ;
2017-03-20 04:36:03 +00:00
}
2017-02-13 01:00:03 +00:00
private CheckResult verifyEncounterSafari ( )
{
2017-03-20 07:03:31 +00:00
switch ( pkm . Species )
{
case 670 : // Floette
case 671 : // Florges
if ( ! new [ ] { 0 , 1 , 3 } . Contains ( pkm . AltForm ) ) // 0/1/3 - RBY
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V64 , CheckIdentifier . Encounter ) ;
2017-03-20 07:03:31 +00:00
break ;
case 710 : // Pumpkaboo
case 711 : // Goregeist
2017-03-25 17:24:56 +00:00
if ( pkm . AltForm ! = 0 ) // Average
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V6 , CheckIdentifier . Encounter ) ;
2017-03-20 07:03:31 +00:00
break ;
case 586 : // Sawsbuck
if ( pkm . AltForm ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V65 , CheckIdentifier . Encounter ) ;
2017-03-20 07:03:31 +00:00
break ;
}
2017-02-13 01:00:03 +00:00
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V66 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
private CheckResult verifyEncounterWild ( )
{
EncounterSlot [ ] enc = ( EncounterSlot [ ] ) EncounterMatch ;
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
// Check for Unreleased Encounters / Collisions
switch ( pkm . GenNumber )
{
case 4 :
2017-04-23 04:00:06 +00:00
if ( pkm . HasOriginalMetLocation & & pkm . Met_Location = = 193 & & enc . All ( t = > t . Type = = SlotType . Surf ) )
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-23 04:00:06 +00:00
// Pokemon surfing in Johto Route 45
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
return new CheckResult ( Severity . Invalid , V384 , CheckIdentifier . Encounter ) ;
}
break ;
}
2017-02-13 01:00:03 +00:00
if ( enc . Any ( slot = > slot . Normal ) )
return enc . All ( slot = > slot . Pressure )
2017-03-21 07:18:38 +00:00
? new CheckResult ( Severity . Valid , V67 , CheckIdentifier . Encounter )
: new CheckResult ( Severity . Valid , V68 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
// Decreased Level Encounters
if ( enc . Any ( slot = > slot . WhiteFlute ) )
return enc . All ( slot = > slot . Pressure )
2017-03-21 07:18:38 +00:00
? new CheckResult ( Severity . Valid , V69 , CheckIdentifier . Encounter )
: new CheckResult ( Severity . Valid , V70 , CheckIdentifier . Encounter ) ;
2017-01-27 05:35:26 +00:00
2017-02-13 01:00:03 +00:00
// Increased Level Encounters
if ( enc . Any ( slot = > slot . BlackFlute ) )
return enc . All ( slot = > slot . Pressure )
2017-03-21 07:18:38 +00:00
? new CheckResult ( Severity . Valid , V71 , CheckIdentifier . Encounter )
: new CheckResult ( Severity . Valid , V72 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
if ( enc . Any ( slot = > slot . Pressure ) )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V67 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V73 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
private CheckResult verifyEncounterStatic ( )
{
var s = ( EncounterStatic ) EncounterMatch ;
2017-02-14 02:06:01 +00:00
2017-03-31 07:04:29 +00:00
// Check for Unreleased Encounters / Collisions
switch ( pkm . GenNumber )
2017-03-26 23:51:19 +00:00
{
2017-03-31 07:04:29 +00:00
case 3 :
2017-05-01 15:25:20 +00:00
if ( ( ( EncounterMatch as EncounterStaticShadow ) ? . EReader ? ? false ) & & pkm . Language ! = 1 ) // Non-JP E-reader Pokemon
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
return new CheckResult ( Severity . Invalid , V406 , CheckIdentifier . Encounter ) ;
2017-03-31 07:04:29 +00:00
if ( pkm . Species = = 151 & & s . Location = = 201 & & pkm . Language ! = 1 ) // Non-JP Mew (Old Sea Map)
return new CheckResult ( Severity . Invalid , V353 , CheckIdentifier . Encounter ) ;
break ;
case 4 :
if ( pkm . Species = = 493 & & s . Location = = 086 ) // Azure Flute Arceus
return new CheckResult ( Severity . Invalid , V352 , CheckIdentifier . Encounter ) ;
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 = = 491 & & s . Location = = 079 & & ! pkm . Pt ) // DP Darkrai
return new CheckResult ( Severity . Invalid , V383 , CheckIdentifier . Encounter ) ;
2017-03-31 07:04:29 +00:00
if ( pkm . Species = = 492 & & s . Location = = 063 & & ! pkm . Pt ) // DP Shaymin
return new CheckResult ( Severity . Invalid , V354 , CheckIdentifier . Encounter ) ;
2017-04-23 04:00:06 +00:00
if ( s . Location = = 193 & & ( s as EncounterStaticTyped ) ? . TypeEncounter = = EncounterType . Surfing_Fishing ) // Roaming pokemon surfin in Johto Route 45
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
return new CheckResult ( Severity . Invalid , V384 , CheckIdentifier . Encounter ) ;
2017-03-31 07:04:29 +00:00
break ;
case 7 :
if ( s . EggLocation = = 60002 & & vRelearn . All ( rl = > rl . Valid ) )
return null ; // not gift egg
break ;
2017-03-26 23:51:19 +00:00
}
2017-02-14 02:06:01 +00:00
// Re-parse relearn moves
2017-03-31 07:04:29 +00:00
if ( pkm . Format > = 6 )
for ( int i = 0 ; i < 4 ; i + + )
vRelearn [ i ] = pkm . RelearnMoves [ i ] ! = s . Relearn [ i ]
? new CheckResult ( Severity . Invalid , V74 , CheckIdentifier . RelearnMove )
: new CheckResult ( CheckIdentifier . RelearnMove ) ;
return new CheckResult ( Severity . Valid , V75 , CheckIdentifier . Encounter ) ;
2017-02-13 01:00:03 +00:00
}
2017-02-14 02:06:01 +00:00
private CheckResult verifyEncounterTrade ( )
{
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
var trade = ( EncounterTrade ) EncounterMatch ;
if ( trade . Species = = pkm . Species & & trade . EvolveOnTrade )
{
// Pokemon that evolve on trade can not be in the phase evolution after the trade
// If the trade holds an everstone EvolveOnTrade will be false for the encounter
var species = specieslist ;
var unevolved = species [ pkm . Species ] ;
var evolved = species [ pkm . Species + 1 ] ;
return new CheckResult ( Severity . Invalid , string . Format ( V401 , unevolved , evolved ) , CheckIdentifier . Encounter ) ;
}
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V76 , CheckIdentifier . Encounter ) ;
2017-02-14 02:06:01 +00:00
}
2017-02-27 05:46:00 +00:00
private CheckResult verifyEncounterG12 ( )
2017-02-13 05:02:24 +00:00
{
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
EncountersGBMatch = Legal . getEncounter12 ( 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
if ( EncountersGBMatch = = null )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V80 , CheckIdentifier . Encounter ) ;
2017-02-13 05:02:24 +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
if ( EncountersGBMatch . First ( ) . Type = = GBEncounterType . EggEncounter )
2017-02-28 04:57:24 +00:00
{
pkm . WasEgg = true ;
return verifyEncounterEgg ( ) ;
}
2017-05-01 15:25:20 +00:00
EncounterMatch = EncounterOriginalGB = EncountersGBMatch . FirstOrDefault ( ) ? . Encounter ;
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 ( EncounterMatch is EncounterSlot )
2017-04-10 04:59:44 +00:00
return new CheckResult ( Severity . Valid , V68 , CheckIdentifier . Encounter ) ;
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 ( EncounterMatch is EncounterStatic )
2017-02-25 07:15:16 +00:00
return verifyEncounterStatic ( ) ;
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-02-27 05:46:00 +00:00
if ( EncounterMatch is EncounterTrade )
2017-02-23 05:19:29 +00:00
return verifyEncounterTrade ( ) ;
2017-02-27 05:46:00 +00:00
2017-02-25 07:15:16 +00:00
// shouldn't ever hit, above 3*invalid check should abort
Console . WriteLine ( $"Gen1 encounter fallthrough: {pkm.FileName}" ) ;
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V80 , CheckIdentifier . Encounter ) ;
2017-02-13 05:02:24 +00:00
}
2017-03-25 17:24:56 +00:00
private CheckResult verifyEncounterVC ( )
2017-02-13 01:00:03 +00:00
{
2017-03-25 17:24:56 +00:00
int baseSpecies = Legal . getBaseSpecies ( pkm ) ;
bool g1 = pkm . VC1 | | pkm . Format = = 1 ;
2017-02-14 02:06:01 +00:00
2017-03-25 17:24:56 +00:00
if ( ( g1 & & baseSpecies > Legal . MaxSpeciesID_1 ) | | ( baseSpecies > Legal . MaxSpeciesID_2 ) )
return new CheckResult ( Severity . Invalid , V77 , CheckIdentifier . Encounter ) ;
2016-03-24 00:57:22 +00:00
2017-03-25 17:24:56 +00:00
// Get EncounterMatch prior to parsing transporter legality
var result = verifyEncounterG12 ( ) ;
if ( pkm . Format > 2 ) // transported to 7+
AddLine ( verifyVCEncounter ( baseSpecies ) ) ;
return result ;
}
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 void verifyEncounterType ( )
{
2017-04-23 04:00:06 +00:00
if ( pkm . Format > = 7 )
return ;
2017-04-24 00:53:22 +00:00
if ( ! Encounter . Valid )
return ;
2017-04-22 20:04:12 +00:00
EncounterType type = EncounterType . None ;
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
// Encounter type data is only stored for gen 4 encounters
// Gen 6 -> 7 transfer delete encounter type data
// All eggs have encounter type none, even if they are from static encounters
2017-04-23 04:00:06 +00:00
if ( pkm . Gen4 & & ! pkm . WasEgg )
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
if ( EncounterMatch is EncounterSlot [ ] )
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 there is more than one slot, the get wild encounter have filter for the pkm type encounter like safari/sports ball
2017-04-22 20:04:12 +00:00
type = ( ( EncounterSlot [ ] ) EncounterMatch ) . First ( ) . TypeEncounter ;
if ( EncounterMatch is EncounterStaticTyped )
type = ( ( EncounterStaticTyped ) EncounterMatch ) . TypeEncounter ;
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-23 04:00:06 +00:00
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
if ( ! type . Contains ( pkm . EncounterType ) )
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
AddLine ( Severity . Invalid , V381 , CheckIdentifier . Encounter ) ;
2017-04-23 04:00:06 +00:00
else
AddLine ( Severity . Valid , V380 , CheckIdentifier . Encounter ) ;
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-03-25 17:24:56 +00:00
private CheckResult verifyEncounter ( )
{
2017-03-31 07:04:29 +00:00
// Special considerations have to be applied when encounter info is lost on transfer.
// Generation 1/2 PKM do not reliably store met location or original version.
2017-03-25 17:24:56 +00:00
if ( pkm . VC | | pkm . Format < 3 )
return verifyEncounterVC ( ) ;
2017-02-13 05:02:24 +00:00
2017-03-31 07:04:29 +00:00
// Generation 3/4 PKM do not retain met location when transferred.
if ( ! pkm . HasOriginalMetLocation )
2017-03-26 22:48:50 +00:00
{
2017-03-31 07:04:29 +00:00
if ( pkm . Gen3 )
return verifyEncounterG3Transfer ( ) ;
if ( pkm . Gen4 )
return verifyEncounterG4Transfer ( ) ;
2017-03-26 22:48:50 +00:00
}
2017-03-31 07:04:29 +00:00
if ( pkm . WasLink )
return verifyEncounterLink ( ) ;
2017-03-26 23:15:24 +00:00
2017-02-14 02:06:01 +00:00
bool wasEvent = pkm . WasEvent | | pkm . WasEventEgg ;
if ( wasEvent )
2016-03-12 03:43:40 +00:00
{
2017-02-13 01:00:03 +00:00
var result = verifyEncounterEvent ( ) ;
if ( result ! = null )
return result ;
2016-03-12 03:43:40 +00:00
}
2017-03-26 22:37:56 +00:00
2017-04-04 02:59:29 +00:00
if ( null ! = ( EncounterStaticMatch = Legal . getValidStaticEncounter ( pkm ) ) )
2016-11-11 01:39:38 +00:00
{
2017-04-04 02:59:29 +00:00
EncounterMatch = EncounterStaticMatch . First ( ) ;
2017-02-13 01:00:03 +00:00
var result = verifyEncounterStatic ( ) ;
if ( result ! = null )
return result ;
2016-11-11 01:39:38 +00:00
2017-04-07 00:41:25 +00:00
EncounterStaticMatch = null ; // Mark as no satisfying static result
2017-02-14 02:06:01 +00:00
EncounterMatch = null ; // Reset Encounter Object, test for remaining encounters
}
2017-03-26 22:11:09 +00:00
2017-03-26 22:37:56 +00:00
if ( pkm . WasEgg )
2017-02-13 01:00:03 +00:00
return verifyEncounterEgg ( ) ;
2017-02-14 02:06:01 +00:00
if ( null ! = ( EncounterMatch = Legal . getValidFriendSafari ( pkm ) ) )
2017-02-13 01:00:03 +00:00
return verifyEncounterSafari ( ) ;
2017-02-14 02:06:01 +00:00
if ( null ! = ( EncounterMatch = Legal . getValidWildEncounters ( pkm ) ) )
2017-02-13 01:00:03 +00:00
return verifyEncounterWild ( ) ;
2017-02-14 02:06:01 +00:00
if ( null ! = ( EncounterMatch = Legal . getValidIngameTrade ( pkm ) ) )
return verifyEncounterTrade ( ) ;
2016-04-21 02:47:40 +00:00
2017-04-09 02:05:29 +00:00
return new CheckResult ( Severity . Invalid , wasEvent ? V78 : V80 , CheckIdentifier . Encounter ) ;
2016-03-12 03:43:40 +00:00
}
2017-03-26 22:37:56 +00:00
private CheckResult verifyEncounterG3Transfer ( )
{
2017-03-27 19:10:30 +00:00
// WasEventEgg is not possible in gen 3 pal park pokemon, are indistinguible from normal eggs
bool wasEvent = pkm . WasEvent ;
2017-03-26 22:37:56 +00:00
CheckResult EggResult = null ;
2017-03-27 19:10:30 +00:00
CheckResult G3Result = null ;
2017-03-30 19:13:38 +00:00
object G3Encounter = null ;
2017-03-26 22:37:56 +00:00
bool WasEgg = Legal . getWasEgg23 ( pkm ) & & ! Legal . NoHatchFromEgg . Contains ( pkm . Species ) ;
if ( WasEgg )
{
pkm . WasEgg = true ;
EggResult = verifyEncounterEgg3Transfer ( ) ;
2017-03-26 22:48:50 +00:00
if ( pkm . IsEgg )
return EggResult ;
2017-03-26 22:37:56 +00:00
}
2017-03-27 19:10:30 +00:00
2017-03-31 07:04:29 +00:00
EncounterMatch = null ;
2017-04-01 01:35:43 +00:00
if ( null ! = ( EncounterMatch = Legal . getValidIngameTrade ( pkm ) ) )
2017-03-26 22:37:56 +00:00
{
2017-04-01 01:35:43 +00:00
if ( ( G3Result = verifyEncounterTrade ( ) ) ? . Valid ? ? false )
2017-03-30 19:13:38 +00:00
G3Encounter = EncounterMatch ;
2017-03-26 22:37:56 +00:00
}
2017-04-01 01:35:43 +00:00
else if ( null ! = ( EncounterMatch = Legal . getValidWildEncounters ( pkm ) ) )
2017-03-26 22:37:56 +00:00
{
2017-04-01 01:35:43 +00:00
if ( ( G3Result = verifyEncounterWild ( ) ) ? . Valid ? ? false )
2017-03-31 07:04:29 +00:00
G3Encounter = EncounterMatch ;
}
2017-04-04 02:59:29 +00:00
else if ( null ! = ( EncounterStaticMatch = Legal . getValidStaticEncounter ( pkm ) ) )
2017-03-31 07:04:29 +00:00
{
2017-04-10 05:20:07 +00:00
if ( new [ ] { 380 , 381 } . Contains ( pkm . Species ) )
EncounterStaticMatch = EncounterStaticMatch . Where ( z = > z . Fateful = = pkm . FatefulEncounter ) . ToList ( ) ;
if ( null ! = EncounterStaticMatch & & EncounterStaticMatch . Any ( ) )
{
EncounterMatch = EncounterStaticMatch . First ( ) ;
if ( ( G3Result = verifyEncounterStatic ( ) ) ? . Valid ? ? false )
G3Encounter = EncounterMatch ;
}
2017-03-26 22:37:56 +00:00
}
2017-03-27 19:10:30 +00:00
// Check events after static, to match Mew/Deoxys static encounters
if ( wasEvent & & G3Result = = null & & pkm . Species ! = 151 & & pkm . Species ! = 386 )
{
G3Result = verifyEncounterEvent ( ) ? ? new CheckResult ( Severity . Invalid , V78 , CheckIdentifier . Encounter ) ;
}
2017-03-27 19:20:54 +00:00
// Now check Mew and Deoxys, they can be event or static encounters both with fatefull encounter
if ( pkm . Species = = 151 | | pkm . Species = = 386 )
2017-03-27 19:10:30 +00:00
{
var EventResult = verifyEncounterEvent ( ) ;
2017-03-27 19:20:54 +00:00
// Only return event if is valid, if not return result from static encounter
2017-03-27 19:10:30 +00:00
if ( EventResult ? . Valid ? ? false )
G3Result = EventResult ;
}
2017-03-26 23:00:52 +00:00
2017-03-26 22:37:56 +00:00
// Even if EggResult is not returned WasEgg is keep true to check in verifymoves first the
// non egg encounter moves and after that egg encounter moves, because there is no way to tell
// what of the two encounters was the real origin
2017-03-30 19:13:38 +00:00
if ( EggResult ! = null & & G3Result ! = null )
2017-03-26 22:37:56 +00:00
{
2017-03-27 19:10:30 +00:00
// keep the valid encounter, also if both are valid returns non egg information, because
2017-03-26 22:37:56 +00:00
// there is more data in the pokemon to found normal encounter
2017-03-27 19:10:30 +00:00
if ( EggResult . Valid & & ! G3Result . Valid )
2017-03-30 19:13:38 +00:00
{
2017-03-27 19:10:30 +00:00
G3Result = EggResult ;
2017-03-30 19:13:38 +00:00
G3Encounter = null ;
}
2017-03-26 22:37:56 +00:00
}
2017-03-30 19:13:38 +00:00
if ( G3Result ? . Valid ? ? false )
EncounterMatch = G3Encounter ;
2017-03-31 07:04:29 +00:00
if ( pkm . Format = = 4 & & pkm . Met_Location ! = 0x37 ) // Pal Park
AddLine ( Severity . Invalid , V60 , CheckIdentifier . Encounter ) ;
if ( pkm . Format ! = 4 & & pkm . Met_Location ! = 30001 )
AddLine ( Severity . Invalid , V61 , CheckIdentifier . Encounter ) ;
2017-03-27 19:10:30 +00:00
2017-04-07 00:41:25 +00:00
return G3Result ? ? EggResult ? ? new CheckResult ( Severity . Invalid , V80 , CheckIdentifier . Encounter ) ;
2017-03-26 22:37:56 +00:00
}
2017-04-25 00:42:15 +00:00
private void verifyTransferLegalityG4 ( )
{
// Transfer Legality
int loc = pkm . Met_Location ;
if ( loc ! = 30001 ) // PokéTransfer
{
// Crown
switch ( pkm . Species )
{
case 251 : // Celebi
if ( loc ! = 30010 & & loc ! = 30011 ) // unused || used
AddLine ( Severity . Invalid , V351 , CheckIdentifier . Encounter ) ;
break ;
case 243 : // Raikou
case 244 : // Entei
case 245 : // Suicune
if ( loc ! = 30012 & & loc ! = 30013 ) // unused || used
AddLine ( Severity . Invalid , V351 , CheckIdentifier . Encounter ) ;
break ;
default :
AddLine ( Severity . Invalid , V61 , CheckIdentifier . Encounter ) ;
break ;
}
}
}
2017-03-26 23:15:24 +00:00
private CheckResult verifyEncounterG4Transfer ( )
{
CheckResult Gen4Result = null ;
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
CheckResult Gen4WildResult = null ;
EncounterSlot [ ] WildEncounter = null ;
2017-03-26 23:15:24 +00:00
bool wasEvent = pkm . WasEvent | | pkm . WasEventEgg ;
if ( wasEvent )
{
var result = verifyEncounterEvent ( ) ;
if ( result ! = null )
Gen4Result = result ;
}
2017-04-25 20:40:10 +00:00
if ( Gen4Result = = null & & ! pkm . WasEgg & & null ! = ( EncounterMatch = Legal . getValidWildEncounters ( pkm ) ) )
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
{
Gen4WildResult = verifyEncounterWild ( ) ;
WildEncounter = ( EncounterSlot [ ] ) EncounterMatch ;
}
2017-04-25 00:55:56 +00:00
if ( Gen4Result = = null & & pkm . Ball ! = 5 & & pkm . Ball ! = 0x18 & & null ! = ( EncounterStaticMatch = Legal . getValidStaticEncounter ( pkm ) ) )
2017-03-26 23:15:24 +00:00
{
2017-04-04 02:59:29 +00:00
EncounterMatch = EncounterStaticMatch . First ( ) ;
2017-03-26 23:15:24 +00:00
var result = verifyEncounterStatic ( ) ;
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
// A pokemon could match a static encounter and a wild encounter at the same time, by default static encounter have preferences
// But if the pokemon does not match the static encounter ball and there is a valid wild encounter skip static encounter
2017-04-22 20:04:12 +00:00
if ( result ! = null & & ( pkm . WasEgg | | Gen4WildResult = = null | | EncounterStaticMatch . Any ( s = > ! s . Gift | | pkm . Ball = = s . Ball ) ) )
2017-04-25 00:42:15 +00:00
{
verifyTransferLegalityG4 ( ) ;
2017-04-01 01:35:43 +00:00
return result ;
2017-04-25 00:42:15 +00:00
}
2017-03-26 23:15:24 +00:00
2017-04-07 00:41:25 +00:00
EncounterStaticMatch = null ;
2017-03-26 23:15:24 +00:00
EncounterMatch = null ; // Reset Encounter Object, test for remaining encounters
}
if ( pkm . WasEgg ) // Invalid transfer is already checked in encounter egg
return verifyEncounterEgg ( ) ;
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 ( Gen4Result = = null & & Gen4WildResult ! = null )
{
Gen4Result = Gen4WildResult ;
EncounterMatch = WildEncounter ;
}
2017-03-26 23:15:24 +00:00
2017-04-24 00:53:22 +00:00
var trade = Legal . getValidIngameTrade ( pkm ) ;
if ( trade ! = null )
{
2017-03-26 23:15:24 +00:00
Gen4Result = verifyEncounterTrade ( ) ;
2017-04-24 00:53:22 +00:00
EncounterMatch = trade ;
}
2017-03-26 23:15:24 +00:00
2017-04-25 00:42:15 +00:00
verifyTransferLegalityG4 ( ) ;
2017-04-22 20:04:12 +00:00
return Gen4Result ? ? ( wasEvent
? new CheckResult ( Severity . Invalid , V78 , CheckIdentifier . Encounter )
: new CheckResult ( Severity . Invalid , V80 , CheckIdentifier . Encounter ) ) ;
2017-03-26 23:15:24 +00:00
}
2017-01-27 05:35:26 +00:00
private CheckResult verifyVCEncounter ( int baseSpecies )
{
// Sanitize Species to non-future species#
int species = pkm . Species ;
if ( ( pkm . VC1 & & species > Legal . MaxSpeciesID_1 ) | |
( pkm . VC2 & & species > Legal . MaxSpeciesID_2 ) )
species = baseSpecies ;
2017-02-14 02:06:01 +00:00
// Check existing EncounterMatch
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 ( ( EncountersGBMatch ? ? EncounterMatch ) = = null )
2017-04-08 16:08:54 +00:00
return new CheckResult ( CheckIdentifier . Encounter ) ; // Avoid duplicate invaild message
2017-02-15 06:06:15 +00:00
2017-04-04 02:59:29 +00:00
var s = EncounterMatch as List < EncounterStatic > ;
2017-04-04 03:28:04 +00:00
var sgb = s ? . FirstOrDefault ( v = > GameVersion . GBCartEraOnly . Contains ( v . Version ) | | v . Version = = GameVersion . VCEvents ) ;
2017-04-04 02:59:29 +00:00
if ( sgb ! = null )
2017-02-15 06:06:15 +00:00
{
bool exceptions = false ;
2017-04-04 02:59:29 +00:00
exceptions | = sgb . Version = = GameVersion . VCEvents & & baseSpecies = = 151 & & pkm . TID = = 22796 ;
2017-02-15 06:06:15 +00:00
if ( ! exceptions )
2017-03-21 07:18:38 +00:00
AddLine ( new CheckResult ( Severity . Invalid , V79 , CheckIdentifier . Encounter ) ) ;
2017-02-15 06:06:15 +00:00
}
2017-03-10 04:27:03 +00:00
EncounterMatch = Legal . getRBYStaticTransfer ( species ) ;
2017-01-27 05:35:26 +00:00
var ematch = ( EncounterStatic ) EncounterMatch ;
if ( pkm . Met_Location ! = ematch . Location )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V81 , CheckIdentifier . Encounter ) ;
2017-01-27 05:35:26 +00:00
if ( pkm . Egg_Location ! = ematch . EggLocation )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V59 , CheckIdentifier . Encounter ) ;
2017-01-27 05:35:26 +00:00
2017-03-26 08:25:21 +00:00
if ( species = = 150 & & pkm . Moves . Contains ( 6 ) ) // pay day
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V82 , CheckIdentifier . Encounter ) ;
2017-02-13 06:40:47 +00:00
2017-01-27 05:35:26 +00:00
return new CheckResult ( CheckIdentifier . Encounter ) ;
}
2017-04-07 00:41:25 +00:00
#endregion
2016-10-23 19:48:49 +00:00
private void verifyLevel ( )
2016-03-19 05:49:21 +00:00
{
2016-10-23 19:48:49 +00:00
MysteryGift MatchedGift = EncounterMatch as MysteryGift ;
if ( MatchedGift ! = null & & MatchedGift . Level ! = pkm . Met_Level )
{
2017-03-26 08:25:21 +00:00
if ( pkm . HasOriginalMetLocation & & ( ! ( MatchedGift is WC7 ) | | ( ( WC7 ) MatchedGift ) . MetLevel ! = pkm . Met_Level ) )
2016-11-13 23:40:34 +00:00
{
2017-03-21 07:18:38 +00:00
AddLine ( new CheckResult ( Severity . Invalid , V83 , CheckIdentifier . Level ) ) ;
2016-11-13 23:40:34 +00:00
return ;
}
2016-10-23 19:48:49 +00:00
}
2016-12-12 01:13:59 +00:00
if ( MatchedGift ! = null & & MatchedGift . Level > pkm . CurrentLevel )
{
2017-03-21 07:18:38 +00:00
AddLine ( new CheckResult ( Severity . Invalid , V84 , CheckIdentifier . Level ) ) ;
2016-12-12 01:13:59 +00:00
return ;
}
2016-10-23 19:48:49 +00:00
int lvl = pkm . CurrentLevel ;
2017-03-19 23:52:56 +00:00
if ( pkm . IsEgg )
{
2017-03-21 07:18:38 +00:00
int elvl = pkm . Format < = 3 ? 5 : 1 ;
if ( elvl ! = lvl )
AddLine ( Severity . Invalid , string . Format ( V52 , elvl ) , CheckIdentifier . Level ) ;
2017-03-19 23:52:56 +00:00
}
2016-10-23 19:48:49 +00:00
else if ( lvl < pkm . Met_Level )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V85 , CheckIdentifier . Level ) ;
2016-10-23 19:48:49 +00:00
else if ( ( pkm . WasEgg | | EncounterMatch = = null ) & & ! Legal . getEvolutionValid ( pkm ) & & pkm . Species ! = 350 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V86 , CheckIdentifier . Level ) ;
2016-10-23 19:48:49 +00:00
else if ( lvl > pkm . Met_Level & & lvl > 1 & & lvl ! = 100 & & pkm . EXP = = PKX . getEXP ( pkm . Stat_Level , pkm . Species ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Fishy , V87 , CheckIdentifier . Level ) ;
2016-10-23 19:48:49 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V88 , CheckIdentifier . Level ) ;
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
2017-05-01 15:25:20 +00:00
// There is no way to prevent a gen1 trade evolution as held items (everstone) did not exist.
// Machoke, Graveler, Haunter and Kadabra captured in the second phase evolution, excluding in-game trades, are already checked
if ( pkm . Format < = 2 & & Type ! = typeof ( EncounterTrade ) & & EncounterSpecies = = pkm . Species & & Legal . Trade_Evolution1 . Contains ( EncounterSpecies ) )
verifyG1TradeEvo ( ) ;
}
private void verifyG1TradeEvo ( )
{
var mustevolve = pkm . TradebackStatus = = TradebackType . WasTradeback | | ( pkm . Format = = 1 & & Legal . IsOutsider ( pkm ) ) ;
if ( ! mustevolve )
return ;
// Pokemon have been traded but it is not evolved, trade evos are sequential dex numbers
var unevolved = specieslist [ pkm . Species ] ;
var evolved = specieslist [ pkm . Species + 1 ] ;
AddLine ( Severity . Invalid , string . Format ( V405 , unevolved , evolved ) , CheckIdentifier . Level ) ;
2016-03-19 05:49:21 +00:00
}
2017-04-07 00:41:25 +00:00
#region verifyMedals
2016-11-08 16:43:57 +00:00
private void verifyMedals ( )
{
if ( pkm . Format < 6 )
return ;
2017-03-25 17:24:56 +00:00
verifyMedalsRegular ( ) ;
verifyMedalsEvent ( ) ;
}
private void verifyMedalsRegular ( )
{
2017-04-15 19:22:29 +00:00
uint data = BitConverter . ToUInt32 ( pkm . Data , 0x2C ) ;
if ( ( data & 3 ) ! = 0 ) // 2 unused flags
AddLine ( Severity . Invalid , V98 , CheckIdentifier . Training ) ;
int TrainCount = 0 ;
data > > = 2 ;
for ( int i = 2 ; i < 32 ; i + + )
{
if ( ( data & 1 ) ! = 0 )
TrainCount + + ;
data > > = 1 ;
}
2016-11-08 16:43:57 +00:00
if ( pkm . IsEgg & & TrainCount > 0 )
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V89 , CheckIdentifier . Training ) ; }
else if ( TrainCount > 0 & & pkm . GenNumber > 6 )
{ AddLine ( Severity . Invalid , V90 , CheckIdentifier . Training ) ; }
2017-01-25 17:17:20 +00:00
else
{
if ( pkm . Format > = 7 )
{
if ( pkm . SecretSuperTrainingUnlocked )
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V91 , CheckIdentifier . Training ) ; }
2017-01-25 17:17:20 +00:00
if ( pkm . SecretSuperTrainingComplete )
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V92 , CheckIdentifier . Training ) ; }
2017-01-25 17:17:20 +00:00
}
else
{
if ( TrainCount = = 30 ^ pkm . SecretSuperTrainingComplete )
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V93 , CheckIdentifier . Training ) ; }
2017-01-25 17:17:20 +00:00
}
}
2017-03-25 17:24:56 +00:00
}
private void verifyMedalsEvent ( )
{
2017-04-15 19:22:29 +00:00
byte data = pkm . Data [ 0x3A ] ;
if ( ( data & 0xC0 ) ! = 0 ) // 2 unused flags highest bits
AddLine ( Severity . Invalid , V98 , CheckIdentifier . Training ) ;
int TrainCount = 0 ;
for ( int i = 0 ; i < 6 ; i + + )
{
if ( ( data & 1 ) ! = 0 )
TrainCount + + ;
data > > = 1 ;
}
if ( pkm . IsEgg & & TrainCount > 0 )
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V89 , CheckIdentifier . Training ) ; }
2017-04-15 19:22:29 +00:00
else if ( TrainCount > 0 & & pkm . GenNumber > 6 )
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V90 , CheckIdentifier . Training ) ; }
2017-04-15 19:22:29 +00:00
else if ( TrainCount > 0 )
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Fishy , V94 , CheckIdentifier . Training ) ; }
2016-11-08 16:43:57 +00:00
}
2017-04-07 00:41:25 +00:00
#endregion
2016-10-23 19:48:49 +00:00
private void verifyRibbons ( )
2016-03-20 22:20:11 +00:00
{
if ( ! Encounter . Valid )
2016-10-23 19:48:49 +00:00
return ;
2016-09-17 19:21:23 +00:00
2016-03-20 22:20:11 +00:00
List < string > missingRibbons = new List < string > ( ) ;
List < string > invalidRibbons = new List < string > ( ) ;
2016-09-03 15:10:22 +00:00
2017-04-18 02:11:01 +00:00
// Check Event Ribbons
var encounterContent = ( EncounterMatch as MysteryGift ) ? . Content ? ? EncounterMatch ;
var set1 = pkm as IRibbonSet1 ;
var set2 = pkm as IRibbonSet2 ;
if ( set1 ! = null )
verifyRibbonSet1 ( set1 , encounterContent , missingRibbons , invalidRibbons ) ;
if ( set2 ! = null )
verifyRibbonSet2 ( set2 , encounterContent , missingRibbons , invalidRibbons ) ;
// Check Unobtainable Ribbons
2016-10-23 19:48:49 +00:00
if ( pkm . IsEgg )
2016-09-03 15:10:22 +00:00
{
2016-10-23 19:48:49 +00:00
var RibbonNames = ReflectUtil . getPropertiesStartWithPrefix ( pkm . GetType ( ) , "Ribbon" ) ;
2017-04-18 02:11:01 +00:00
if ( set1 ! = null )
RibbonNames = RibbonNames . Except ( RibbonSetHelper . getRibbonNames ( set1 ) ) ;
if ( set2 ! = null )
RibbonNames = RibbonNames . Except ( RibbonSetHelper . getRibbonNames ( set2 ) ) ;
2016-10-23 19:48:49 +00:00
foreach ( object RibbonValue in RibbonNames . Select ( RibbonName = > ReflectUtil . GetValue ( pkm , RibbonName ) ) )
2016-09-03 15:10:22 +00:00
{
2016-10-23 19:48:49 +00:00
if ( RibbonValue as bool? = = true ) // Boolean
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V95 , CheckIdentifier . Ribbon ) ; return ; }
2016-10-23 19:48:49 +00:00
if ( ( RibbonValue as int? ) > 0 ) // Count
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V95 , CheckIdentifier . Ribbon ) ; return ; }
2016-09-03 15:10:22 +00:00
}
2016-10-23 19:48:49 +00:00
return ;
2016-09-03 15:10:22 +00:00
}
2016-03-20 22:20:11 +00:00
2016-10-23 19:48:49 +00:00
// Unobtainable ribbons for Gen Origin
if ( pkm . GenNumber > 3 )
{
2016-12-11 18:30:41 +00:00
if ( ReflectUtil . getBooleanState ( pkm , nameof ( PK3 . RibbonChampionG3Hoenn ) ) = = true )
2017-03-21 07:18:38 +00:00
invalidRibbons . Add ( V96 ) ; // RSE HoF
2016-12-11 18:30:41 +00:00
if ( ReflectUtil . getBooleanState ( pkm , nameof ( PK3 . RibbonArtist ) ) = = true )
2017-03-21 07:18:38 +00:00
invalidRibbons . Add ( V97 ) ; // RSE Master Rank Portrait
2016-10-23 19:48:49 +00:00
}
2017-04-18 02:11:01 +00:00
if ( pkm . Format > = 4 & & pkm . GenNumber > 4 )
2016-10-23 19:48:49 +00:00
{
2016-12-11 18:30:41 +00:00
if ( ReflectUtil . getBooleanState ( pkm , nameof ( PK4 . RibbonChampionSinnoh ) ) = = true )
2017-03-21 07:18:38 +00:00
invalidRibbons . Add ( V99 ) ; // DPPt HoF
2016-12-11 18:30:41 +00:00
if ( ReflectUtil . getBooleanState ( pkm , nameof ( PK4 . RibbonLegend ) ) = = true )
2017-03-21 07:18:38 +00:00
invalidRibbons . Add ( V100 ) ; // HGSS Defeat Red @ Mt.Silver
2016-10-23 19:48:49 +00:00
}
if ( pkm . Format > = 6 & & pkm . GenNumber > = 6 )
{
2016-12-11 18:30:41 +00:00
if ( ReflectUtil . getBooleanState ( pkm , nameof ( PK6 . RibbonCountMemoryContest ) ) = = true )
2017-03-21 07:18:38 +00:00
invalidRibbons . Add ( V106 ) ; // Gen3/4 Contest
2016-12-11 18:30:41 +00:00
if ( ReflectUtil . getBooleanState ( pkm , nameof ( PK6 . RibbonCountMemoryBattle ) ) = = true )
2017-03-21 07:18:38 +00:00
invalidRibbons . Add ( V105 ) ; // Gen3/4 Battle
2016-10-23 19:48:49 +00:00
}
2016-12-11 18:30:41 +00:00
if ( ReflectUtil . getBooleanState ( pkm , nameof ( PK6 . RibbonRecord ) ) = = true )
2017-03-21 07:18:38 +00:00
invalidRibbons . Add ( V104 ) ; // Unobtainable
2016-03-20 22:20:11 +00:00
if ( missingRibbons . Count + invalidRibbons . Count = = 0 )
2016-09-03 15:10:22 +00:00
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V103 , CheckIdentifier . Ribbon ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-09-03 15:10:22 +00:00
}
2016-03-20 22:20:11 +00:00
string [ ] result = new string [ 2 ] ;
if ( missingRibbons . Count > 0 )
2017-04-15 08:20:29 +00:00
result [ 0 ] = string . Format ( V101 , string . Join ( ", " , missingRibbons . Select ( z = > z . Replace ( "Ribbon" , "" ) ) ) ) ;
2016-03-20 22:20:11 +00:00
if ( invalidRibbons . Count > 0 )
2017-04-15 08:20:29 +00:00
result [ 1 ] = string . Format ( V102 , string . Join ( ", " , invalidRibbons . Select ( z = > z . Replace ( "Ribbon" , "" ) ) ) ) ;
2017-03-17 06:16:11 +00:00
AddLine ( Severity . Invalid , string . Join ( Environment . NewLine , result . Where ( s = > ! string . IsNullOrEmpty ( s ) ) ) , CheckIdentifier . Ribbon ) ;
2016-03-20 22:20:11 +00:00
}
2017-04-18 02:11:01 +00:00
private void verifyRibbonSet1 ( IRibbonSet1 set1 , object encounterContent , List < string > missingRibbons , List < string > invalidRibbons )
{
var names = RibbonSetHelper . getRibbonNames ( set1 ) ;
var sb = RibbonSetHelper . getRibbonBits ( set1 ) ;
var eb = RibbonSetHelper . getRibbonBits ( encounterContent as IRibbonSet1 ) ;
if ( pkm . Gen3 )
2017-04-30 23:53:54 +00:00
{
2017-04-18 02:11:01 +00:00
eb [ 0 ] = sb [ 0 ] ; // permit Earth Ribbon
2017-05-01 05:11:51 +00:00
if ( pkm . Version = = 15 & & MatchedType = = typeof ( EncounterStaticShadow ) ) // only require national ribbon if no longer on C/XD
2017-04-30 23:53:54 +00:00
eb [ 1 ] = ( pkm as CK3 ) ? . RibbonNational ? ? ( pkm as XK3 ) ? . RibbonNational ? ? true ;
}
2017-04-18 02:11:01 +00:00
for ( int i = 0 ; i < sb . Length ; i + + )
if ( sb [ i ] ! = eb [ i ] )
( eb [ i ] ? missingRibbons : invalidRibbons ) . Add ( names [ i ] ) ;
}
private void verifyRibbonSet2 ( IRibbonSet2 set2 , object encounterContent , List < string > missingRibbons , List < string > invalidRibbons )
{
var names = RibbonSetHelper . getRibbonNames ( set2 ) ;
var sb = RibbonSetHelper . getRibbonBits ( set2 ) ;
var eb = RibbonSetHelper . getRibbonBits ( encounterContent as IRibbonSet2 ) ;
if ( EncounterMatch is EncounterLink )
eb [ 0 ] = true ; // require Classic Ribbon
if ( ( EncounterMatch as EncounterStatic ) ? . RibbonWishing ? ? false )
eb [ 1 ] = true ; // require Wishing Ribbon
for ( int i = 0 ; i < sb . Length ; i + + )
if ( sb [ i ] ! = eb [ i ] )
( eb [ i ] ? missingRibbons : invalidRibbons ) . Add ( names [ i ] ) ;
}
2017-04-30 23:53:54 +00:00
private void verifyCXD ( )
{
if ( Type = = typeof ( EncounterSlot [ ] ) ) // pokespot
{
// find origin info, if nothing returned then the PID is unobtainable
var slot = ( ( EncounterSlot [ ] ) EncounterMatch ) [ 0 ] . SlotNumber ;
var pidiv = MethodFinder . getPokeSpotSeeds ( pkm , slot ) ;
if ( ! pidiv . Any ( ) )
AddLine ( Severity . Invalid , V400 , CheckIdentifier . PID ) ;
}
else if ( Type = = typeof ( EncounterStatic ) )
{
// Starters have a correlation to the Trainer ID numbers
var spec = ( ( EncounterStatic ) EncounterMatch ) . Species ;
switch ( spec )
{
case 133 : // Eevee
case 196 : // Espeon
case 197 : // Umbreon
break ; // todo
}
}
}
2016-10-23 19:48:49 +00:00
private void verifyAbility ( )
2016-03-21 15:01:08 +00:00
{
2016-10-29 06:41:22 +00:00
int [ ] abilities = pkm . PersonalInfo . Abilities ;
2017-03-18 23:17:42 +00:00
if ( abilities [ 1 ] = = 0 )
abilities [ 1 ] = abilities [ 0 ] ;
2016-10-23 19:48:49 +00:00
int abilval = Array . IndexOf ( abilities , pkm . Ability ) ;
2016-03-21 15:01:08 +00:00
if ( abilval < 0 )
2016-10-23 19:48:49 +00:00
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V107 , CheckIdentifier . Ability ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2016-03-21 15:01:08 +00:00
2017-04-14 23:24:41 +00:00
bool? AbilityUnchanged = true ;
// 3 states flag: true for unchanged, false for changed, null for uncertain/allowing PID mismatch
// if true, check encounter ability
// if true or false, check PID/AbilityNumber
if ( 3 < = pkm . Format & & pkm . Format < = 5 & & abilities [ 0 ] ! = abilities [ 1 ] ) // 3-5 and have 2 distinct ability now
AbilityUnchanged = verifyAbilityPreCapsule ( abilities , abilval ) ;
if ( EncounterMatch ! = null )
2016-03-23 02:47:13 +00:00
{
2017-04-10 04:59:44 +00:00
// Check Ability Mismatches
int? EncounterAbility = ( EncounterMatch as EncounterStatic ) ? . Ability ? ?
( EncounterMatch as EncounterTrade ) ? . Ability ? ?
( EncounterMatch as EncounterLink ) ? . Ability ;
2017-04-12 03:55:34 +00:00
2017-04-14 23:24:41 +00:00
if ( ( AbilityUnchanged ? ? false ) & & EncounterAbility ! = null & & EncounterAbility ! = 0 & & pkm . AbilityNumber ! = EncounterAbility )
2016-03-31 02:55:27 +00:00
{
2017-04-14 23:24:41 +00:00
if ( pkm . Format > = 6 & & abilities [ 0 ] ! = abilities [ 1 ] & & pkm . AbilityNumber < 4 ) //Ability Capsule
AddLine ( Severity . Valid , V109 , CheckIdentifier . Ability ) ;
else if ( pkm . Gen3 & & EncounterMatch is EncounterTrade & & EncounterAbility = = 1 < < abilval ) // Edge case (Static PID?)
AddLine ( Severity . Valid , V115 , CheckIdentifier . Ability ) ;
else
AddLine ( Severity . Invalid , V223 , CheckIdentifier . Ability ) ;
2017-04-10 04:59:44 +00:00
return ;
2016-10-23 19:48:49 +00:00
}
2017-04-10 04:59:44 +00:00
2017-04-12 03:55:34 +00:00
switch ( pkm . GenNumber )
2017-03-22 23:47:14 +00:00
{
2017-04-12 03:55:34 +00:00
case 5 : verifyAbility5 ( abilities ) ; break ;
case 6 : verifyAbility6 ( abilities ) ; break ;
case 7 : verifyAbility7 ( abilities ) ; break ;
2016-03-31 02:55:27 +00:00
}
2016-03-23 02:47:13 +00:00
}
2016-03-22 04:50:39 +00:00
2017-04-12 03:11:58 +00:00
if ( 3 < = pkm . GenNumber & & pkm . GenNumber < = 4 & & pkm . AbilityNumber = = 4 )
AddLine ( Severity . Invalid , V112 , CheckIdentifier . Ability ) ;
2017-04-14 23:24:41 +00:00
else if ( AbilityUnchanged ! = null & & abilities [ pkm . AbilityNumber > > 1 ] ! = pkm . Ability )
AddLine ( Severity . Invalid , pkm . Format < 6 ? V113 : V114 , CheckIdentifier . Ability ) ;
2016-10-23 19:48:49 +00:00
else
2017-04-12 03:55:34 +00:00
AddLine ( Severity . Valid , V115 , CheckIdentifier . Ability ) ;
2016-03-21 15:01:08 +00:00
}
2017-04-14 23:24:41 +00:00
private bool? verifyAbilityPreCapsule ( int [ ] abilities , int abilval )
2017-04-12 03:11:58 +00:00
{
2017-04-15 02:55:40 +00:00
// CXD pokemon could have any ability without maching PID
2017-04-14 23:24:41 +00:00
if ( pkm . Version = = ( int ) GameVersion . CXD & & pkm . Format = = 3 )
return null ;
// gen3 native or gen4/5 origin
if ( pkm . Format = = 3 | | ! pkm . InhabitedGeneration ( 3 ) )
return true ;
// Evovled in gen4/5
if ( pkm . Species > Legal . MaxSpeciesID_3 )
return false ;
// gen3Species will be zero for pokemon with illegal gen 3 encounters, like Infernape with gen 3 "origin"
var gen3Species = EvoChainsAllGens [ 3 ] . FirstOrDefault ( ) ? . Species ? ? 0 ;
if ( gen3Species = = 0 )
return true ;
// Fall through when gen3 pkm transferred to gen4/5
return verifyAbilityGen3Transfer ( abilities , abilval , gen3Species ) ;
2017-04-12 03:11:58 +00:00
}
2017-04-14 23:24:41 +00:00
private bool? verifyAbilityGen3Transfer ( int [ ] abilities , int abilval , int Species_g3 )
2017-04-12 03:11:58 +00:00
{
2017-04-14 23:24:41 +00:00
var abilities_g3 = PersonalTable . E [ Species_g3 ] . Abilities . Where ( a = > a ! = 0 ) . Distinct ( ) . ToArray ( ) ;
2017-04-12 03:11:58 +00:00
if ( abilities_g3 . Length = = 2 )
// For non-GC, it has 2 abilities in gen 3, must match PID
return pkm . Version ! = ( int ) GameVersion . CXD ;
2017-04-14 23:24:41 +00:00
2017-04-13 15:48:13 +00:00
var Species_g45 = Math . Max ( EvoChainsAllGens [ 4 ] . FirstOrDefault ( ) ? . Species ? ? 0 , pkm . Format = = 5 ? EvoChainsAllGens [ 5 ] . FirstOrDefault ( ) ? . Species ? ? 0 : 0 ) ;
2017-04-12 03:11:58 +00:00
if ( Species_g45 > Species_g3 )
// it have evolved in gen 4 or 5 games, ability must match PID
2017-04-14 23:24:41 +00:00
return false ;
2017-04-12 03:11:58 +00:00
2017-04-12 03:55:34 +00:00
var Evolutions_g45 = Math . Max ( EvoChainsAllGens [ 4 ] . Length , pkm . Format = = 5 ? EvoChainsAllGens [ 5 ] . Length : 0 ) ;
2017-04-12 03:11:58 +00:00
if ( Evolutions_g45 > 1 )
{
// Evolutions_g45 > 1 and Species_g45 = Species_g3 with means both options, evolve in gen 4-5 or not evolve, are possible
if ( pkm . Ability = = abilities_g3 [ 0 ] )
// It could evolve in gen 4-5 an have generation 3 only ability
// that means it have not actually evolved in gen 4-5, ability do not need to match PID
2017-04-14 23:24:41 +00:00
return null ;
2017-04-12 03:11:58 +00:00
if ( pkm . Ability = = abilities [ 1 ] )
// It could evolve in gen4-5 an have generation 4 second ability
// that means it have actually evolved in gen 4-5, ability must match PID
2017-04-14 23:24:41 +00:00
return false ;
2017-04-12 03:11:58 +00:00
}
// Evolutions_g45 == 1 means it have not evolved in gen 4-5 games,
// ability do not need to match PID, but only generation 3 ability is allowed
if ( pkm . Ability ! = abilities_g3 [ 0 ] )
// Not evolved in gen4-5 but do not have generation 3 only ability
AddLine ( Severity . Invalid , V373 , CheckIdentifier . Ability ) ;
2017-04-14 23:24:41 +00:00
return null ;
2017-04-12 03:11:58 +00:00
}
2017-04-12 03:55:34 +00:00
private void verifyAbility5 ( int [ ] abilities )
{
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterSlot [ ] ) )
2017-04-12 03:55:34 +00:00
{
// Hidden Abilities for Wild Encounters are only available at a Hidden Grotto
bool grotto = ( ( EncounterSlot [ ] ) EncounterMatch ) . All ( slot = > slot . Type = = SlotType . HiddenGrotto ) ;
if ( pkm . AbilityNumber = = 4 ^ grotto )
AddLine ( Severity . Invalid , grotto ? V217 : V108 , CheckIdentifier . Ability ) ;
}
2017-04-24 00:53:22 +00:00
else if ( Type = = typeof ( MysteryGift ) )
2017-04-12 03:55:34 +00:00
verifyAbilityMG456 ( abilities , ( ( PGF ) EncounterMatch ) . AbilityType ) ;
}
private void verifyAbility6 ( int [ ] abilities )
{
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterSlot [ ] ) & & pkm . AbilityNumber = = 4 )
2017-04-12 03:55:34 +00:00
{
var slots = ( EncounterSlot [ ] ) EncounterMatch ;
bool valid = slots . Any ( slot = > slot . DexNav | |
slot . Type = = SlotType . FriendSafari | |
slot . Type = = SlotType . Horde ) ;
if ( ! valid )
AddLine ( Severity . Invalid , V300 , CheckIdentifier . Ability ) ;
}
2017-04-24 00:53:22 +00:00
else if ( Type = = typeof ( MysteryGift ) )
2017-04-12 03:55:34 +00:00
verifyAbilityMG456 ( abilities , ( ( WC6 ) EncounterMatch ) . AbilityType ) ;
else if ( Legal . Ban_NoHidden6 . Contains ( pkm . SpecForm ) & & pkm . AbilityNumber = = 4 )
AddLine ( Severity . Invalid , V112 , CheckIdentifier . Ability ) ;
}
private void verifyAbility7 ( int [ ] abilities )
{
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterSlot [ ] ) & & pkm . AbilityNumber = = 4 )
2017-04-12 03:55:34 +00:00
{
var slots = ( EncounterSlot [ ] ) EncounterMatch ;
bool valid = slots . Any ( slot = > slot . Type = = SlotType . SOS ) ;
if ( ! valid )
AddLine ( Severity . Invalid , V111 , CheckIdentifier . Ability ) ;
}
2017-04-24 00:53:22 +00:00
else if ( Type = = typeof ( MysteryGift ) )
2017-04-12 03:55:34 +00:00
verifyAbilityMG456 ( abilities , ( ( WC7 ) EncounterMatch ) . AbilityType ) ;
else if ( Legal . Ban_NoHidden7 . Contains ( pkm . SpecForm ) & & pkm . AbilityNumber = = 4 )
AddLine ( Severity . Invalid , V112 , CheckIdentifier . Ability ) ;
}
private void verifyAbilityMG456 ( int [ ] abilities , int cardtype )
{
int abilNumber = pkm . AbilityNumber ;
if ( cardtype < 3 & & abilNumber ! = 1 < < cardtype ) // set number
{
// Ability can be flipped 0/1 if Ability Capsule is available, is not Hidden Ability, and Abilities are different.
if ( pkm . Format > = 6 & & cardtype < 2 & & abilNumber < 3 & & abilities [ 0 ] ! = abilities [ 1 ] )
AddLine ( Severity . Valid , V109 , CheckIdentifier . Ability ) ;
else
AddLine ( Severity . Invalid , V110 , CheckIdentifier . Ability ) ;
}
else if ( cardtype = = 3 & & abilNumber = = 4 ) // 1/2 only
AddLine ( Severity . Invalid , V110 , CheckIdentifier . Ability ) ;
}
2017-04-07 00:41:25 +00:00
#region verifyBall
2017-03-21 07:18:38 +00:00
private void verifyBallEquals ( params int [ ] balls )
{
int ball = pkm . Ball ;
if ( balls . Any ( b = > b = = ball ) )
AddLine ( Severity . Valid , V119 , CheckIdentifier . Ball ) ;
else
AddLine ( Severity . Invalid , V118 , CheckIdentifier . Ball ) ;
}
2016-10-23 19:48:49 +00:00
private void verifyBall ( )
2016-03-21 15:01:08 +00:00
{
2017-02-28 04:57:24 +00:00
if ( pkm . Format < 3 )
return ; // no ball info saved
2016-10-23 19:48:49 +00:00
2016-03-23 02:47:13 +00:00
if ( ! Encounter . Valid )
2016-10-23 19:48:49 +00:00
return ;
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( MysteryGift ) )
2016-10-23 19:48:49 +00:00
{
2017-03-31 08:12:49 +00:00
if ( pkm . Species = = 490 & & ( ( MysteryGift ) EncounterMatch ) . Ball = = 0 )
2017-03-30 18:58:30 +00:00
// there is no ball data in Manaphy Mystery Gift
verifyBallEquals ( 4 ) ; // Pokeball
else
verifyBallEquals ( ( ( MysteryGift ) EncounterMatch ) . Ball ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterLink ) )
2016-10-23 19:48:49 +00:00
{
2017-03-21 07:18:38 +00:00
verifyBallEquals ( ( ( EncounterLink ) EncounterMatch ) . Ball ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterTrade ) )
2016-10-23 19:48:49 +00:00
{
2017-03-21 07:18:38 +00:00
verifyBallEquals ( 4 ) ; // Pokeball
2016-10-23 19:48:49 +00:00
return ;
}
2017-03-13 19:12:55 +00:00
2017-04-08 00:45:22 +00:00
if ( pkm . Species = = 292 & & pkm . GenNumber > 3 ) // Shedinja. For gen3, copy the ball from Nincada
2017-04-04 03:02:40 +00:00
{
2017-04-08 00:45:22 +00:00
verifyBallEquals ( 4 ) ; // Pokeball Only
2017-04-04 03:02:40 +00:00
return ;
}
2017-03-13 19:28:39 +00:00
if ( pkm . Ball = = 0x14 & & pkm . Gen7 ) // Heavy Ball
2017-03-13 19:12:55 +00:00
{
2017-03-14 01:38:56 +00:00
var lineage = Legal . getLineage ( pkm ) ;
if ( lineage . Any ( e = > Legal . AlolanCaptureNoHeavyBall . Contains ( e ) ) )
2017-03-15 04:13:39 +00:00
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V116 , CheckIdentifier . Ball ) ;
2017-03-15 04:13:39 +00:00
return ;
}
2017-03-13 19:12:55 +00:00
}
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( EncounterStatic ) )
2016-04-21 03:46:18 +00:00
{
EncounterStatic enc = EncounterMatch as EncounterStatic ;
2016-10-23 19:48:49 +00:00
if ( enc ? . Gift ? ? false )
2017-03-21 07:18:38 +00:00
verifyBallEquals ( enc . Ball ) ;
2017-03-30 06:31:02 +00:00
else if ( pkm . Met_Location = = 75 & & pkm . Gen5 ) // DreamWorld
verifyBallEquals ( Legal . DreamWorldBalls ) ;
2016-11-08 16:43:57 +00:00
else
2017-03-21 07:18:38 +00:00
verifyBallEquals ( Legal . getWildBalls ( pkm ) ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterSlot [ ] ) )
2016-10-23 19:48:49 +00:00
{
2017-03-30 11:18:05 +00:00
EncounterSlot [ ] enc = EncounterMatch as EncounterSlot [ ] ;
2017-01-25 03:49:40 +00:00
if ( pkm . Met_Location = = 30016 & & pkm . Gen7 ) // Poké Pelago
2017-03-21 07:18:38 +00:00
verifyBallEquals ( 4 ) ; // Pokeball
2017-03-30 11:24:38 +00:00
// For gen3/4 safari zones and BCC getValidWildEncounters already filter to not return
2017-03-30 11:18:05 +00:00
// mixed possible encounters between safari, BCC and other encounters
// That means is the first encounter is not safari then there is no safari encounter in the array
else if ( 3 < = pkm . GenNumber & & pkm . GenNumber < = 4 & & Legal . IsSafariSlot ( enc . First ( ) . Type ) )
2017-03-31 08:12:49 +00:00
verifyBallEquals ( 5 ) ; // Safari Ball
else if ( pkm . GenNumber = = 4 & & enc . First ( ) . Type = = SlotType . BugContest )
verifyBallEquals ( 0x18 ) ; // Sport Ball
2016-11-08 16:43:57 +00:00
else
2017-03-21 07:18:38 +00:00
verifyBallEquals ( Legal . getWildBalls ( pkm ) ) ;
2016-10-23 19:48:49 +00:00
return ;
}
if ( pkm . WasEgg )
{
2017-02-23 05:19:29 +00:00
verifyBallEgg ( ) ;
return ;
2016-11-11 05:10:28 +00:00
}
2016-03-28 05:05:51 +00:00
2017-03-21 07:18:38 +00:00
verifyBallEquals ( 4 ) ; // Pokeball
2016-11-11 05:10:28 +00:00
}
2017-02-23 05:19:29 +00:00
private void verifyBallEgg ( )
{
if ( pkm . GenNumber < 6 ) // No inheriting Balls
{
2017-03-21 07:18:38 +00:00
verifyBallEquals ( 4 ) ; // Must be Pokéball -- no ball inheritance.
2017-02-23 05:19:29 +00:00
return ;
}
if ( pkm . Ball = = 0x01 ) // Master Ball
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V117 , CheckIdentifier . Ball ) ; return ; }
2017-02-23 05:19:29 +00:00
if ( pkm . Ball = = 0x10 ) // Cherish Ball
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Invalid , V120 , CheckIdentifier . Ball ) ; return ; }
2017-02-23 05:19:29 +00:00
if ( pkm . Ball = = 0x04 ) // Poké Ball
2017-03-21 07:18:38 +00:00
{ AddLine ( Severity . Valid , V119 , CheckIdentifier . Ball ) ; return ; }
2017-02-23 05:19:29 +00:00
switch ( pkm . GenNumber )
{
case 6 : // Gen6 Inheritance Rules
verifyBallEggGen6 ( ) ;
return ;
case 7 : // Gen7 Inheritance Rules
verifyBallEggGen7 ( ) ;
return ;
}
}
private void verifyBallEggGen6 ( )
2016-11-11 05:10:28 +00:00
{
if ( pkm . Gender = = 2 ) // Genderless
{
2017-03-21 07:18:38 +00:00
verifyBallEquals ( 4 ) ; // Must be Pokéball as ball can only pass via mother (not Ditto!)
2016-11-11 05:10:28 +00:00
return ;
}
if ( Legal . BreedMaleOnly . Contains ( pkm . Species ) )
{
2017-03-21 07:18:38 +00:00
verifyBallEquals ( 4 ) ; // Must be Pokéball as ball can only pass via mother (not Ditto!)
2016-11-11 05:10:28 +00:00
return ;
}
2016-10-23 19:48:49 +00:00
2017-03-21 07:18:38 +00:00
int ball = pkm . Ball ;
if ( ball > = 26 )
{
AddLine ( Severity . Invalid , V126 , CheckIdentifier . Ball ) ;
return ;
}
if ( ball = = 0x05 ) // Safari Ball
2016-11-11 05:10:28 +00:00
{
if ( Legal . getLineage ( pkm ) . All ( e = > ! Legal . Inherit_Safari . Contains ( e ) ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else if ( pkm . AbilityNumber = = 4 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-10-23 19:48:49 +00:00
2016-11-11 05:10:28 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( 0x10 < ball & & ball < 0x18 ) // Apricorn Ball
2016-11-11 05:10:28 +00:00
{
2017-02-04 18:42:56 +00:00
if ( Legal . getLineage ( pkm ) . All ( e = > ! Legal . Inherit_Apricorn6 . Contains ( e ) ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
if ( pkm . AbilityNumber = = 4 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-03-22 04:31:06 +00:00
2016-11-11 05:10:28 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( ball = = 0x18 ) // Sport Ball
2016-11-11 05:10:28 +00:00
{
if ( Legal . getLineage ( pkm ) . All ( e = > ! Legal . Inherit_Sport . Contains ( e ) ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else if ( pkm . AbilityNumber = = 4 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-03-23 02:47:13 +00:00
2016-11-11 05:10:28 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( ball = = 0x19 ) // Dream Ball
2016-11-11 05:10:28 +00:00
{
2017-03-21 07:18:38 +00:00
if ( Legal . getLineage ( pkm ) . Any ( e = > Legal . Inherit_Dream . Contains ( e ) ) )
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-10-23 19:48:49 +00:00
2016-11-26 01:54:32 +00:00
if ( pkm . AbilityNumber = = 4 & & Legal . Ban_DreamHidden . Contains ( pkm . Species ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
2016-11-26 01:54:32 +00:00
2016-11-11 05:10:28 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( 0x0D < = ball & & ball < = 0x0F )
2016-11-11 05:10:28 +00:00
{
2017-03-21 07:18:38 +00:00
if ( ! Legal . Ban_Gen4Ball_6 . Contains ( pkm . Species ) )
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
return ;
2016-03-29 05:30:23 +00:00
}
2017-03-21 07:18:38 +00:00
if ( 0x02 < = ball & & ball < = 0x0C ) // Don't worry, Ball # 0x05 was already checked.
2016-11-11 05:10:28 +00:00
{
if ( Legal . Ban_Gen3Ball . Contains ( pkm . Species ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2017-04-02 13:39:39 +00:00
else if ( pkm . AbilityNumber = = 4 & & Legal . Ban_Gen3BallHidden . Contains ( pkm . SpecForm ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-03-21 15:01:08 +00:00
2016-11-11 05:10:28 +00:00
return ;
}
if ( pkm . Species > 650 & & pkm . Species ! = 700 ) // Sylveon
{
2017-03-21 07:18:38 +00:00
if ( Legal . getWildBalls ( pkm ) . Contains ( pkm . Ball ) )
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
return ;
}
2016-11-12 14:52:40 +00:00
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V125 , CheckIdentifier . Ball ) ;
2016-03-21 15:01:08 +00:00
}
2017-02-23 05:19:29 +00:00
private void verifyBallEggGen7 ( )
2016-11-11 05:10:28 +00:00
{
2016-11-12 05:23:33 +00:00
var Lineage = Legal . getLineage ( pkm ) . ToArray ( ) ;
2016-12-02 02:48:38 +00:00
if ( 722 < = pkm . Species & & pkm . Species < = 730 ) // G7 Starters
{
2017-03-21 07:18:38 +00:00
verifyBallEquals ( 4 ) ;
2016-12-02 02:48:38 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
int ball = pkm . Ball ;
if ( ball = = 0x05 ) // Safari Ball
2016-11-12 05:23:33 +00:00
{
2017-04-04 03:02:40 +00:00
if ( ! Lineage . Any ( e = > Legal . Inherit_Safari . Contains ( e ) | | Legal . Inherit_SafariMale . Contains ( e ) ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2017-04-04 03:02:40 +00:00
else if ( pkm . AbilityNumber = = 4 & & Lineage . Any ( e = > Legal . Ban_SafariBallHidden_7 . Contains ( e ) ) )
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
else
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( 0x10 < ball & & ball < 0x18 ) // Apricorn Ball
2016-11-12 05:23:33 +00:00
{
2017-04-04 03:02:40 +00:00
if ( ! Lineage . Any ( e = > Legal . Inherit_Apricorn7 . Contains ( e ) ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2017-04-04 03:02:40 +00:00
else if ( pkm . AbilityNumber = = 4 & & ( Lineage . Contains ( 029 ) | | Lineage . Contains ( 032 ) ) ) // Nido
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
else
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( ball = = 0x18 ) // Sport Ball
2016-11-12 05:23:33 +00:00
{
2017-04-04 03:02:40 +00:00
if ( ! Lineage . Any ( e = > Legal . Inherit_Sport . Contains ( e ) ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2017-04-04 03:02:40 +00:00
else if ( pkm . AbilityNumber = = 4 & & ( Lineage . Contains ( 313 ) | | Lineage . Contains ( 314 ) ) ) // Volbeat/Illumise
AddLine ( Severity . Invalid , V122 , CheckIdentifier . Ball ) ;
else
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( ball = = 0x19 ) // Dream Ball
2016-11-12 05:23:33 +00:00
{
2017-03-21 07:18:38 +00:00
if ( Lineage . Any ( e = > Legal . Inherit_Dream . Contains ( e ) | | Legal . Inherit_DreamMale . Contains ( e ) ) )
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( 0x0D < = ball & & ball < = 0x0F ) // Dusk Heal Quick
2016-11-12 05:23:33 +00:00
{
2017-03-21 07:18:38 +00:00
if ( ! Legal . Ban_Gen4Ball_7 . Contains ( pkm . Species ) )
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
return ;
}
2017-03-21 07:18:38 +00:00
if ( 0x02 < = ball & & ball < = 0x0C ) // Don't worry, Ball # 0x05 was already checked.
2016-11-12 05:23:33 +00:00
{
2017-03-21 07:18:38 +00:00
if ( ! Legal . Ban_Gen3Ball_7 . Contains ( pkm . Species ) )
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V121 , CheckIdentifier . Ball ) ;
2016-11-12 05:23:33 +00:00
return ;
}
2016-11-12 14:52:40 +00:00
2017-03-21 07:18:38 +00:00
if ( ball = = 26 )
2016-11-12 14:52:40 +00:00
{
2016-11-14 06:24:29 +00:00
if ( ( pkm . Species > 731 & & pkm . Species < = 785 ) | | Lineage . Any ( e = > Legal . PastGenAlolanNatives . Contains ( e ) ) )
2016-11-12 14:52:40 +00:00
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 14:52:40 +00:00
return ;
}
if ( Lineage . Any ( e = > Legal . PastGenAlolanScans . Contains ( e ) ) )
{
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , V123 , CheckIdentifier . Ball ) ;
2016-11-12 14:52:40 +00:00
return ;
}
// next statement catches all new alolans
}
if ( pkm . Species > 721 )
2016-11-11 05:10:28 +00:00
{
2017-03-21 07:18:38 +00:00
verifyBallEquals ( Legal . getWildBalls ( pkm ) ) ;
2016-11-11 05:10:28 +00:00
return ;
}
2016-11-12 14:52:40 +00:00
2017-03-21 07:18:38 +00:00
if ( ball > = 27 )
{
AddLine ( Severity . Invalid , V126 , CheckIdentifier . Ball ) ;
return ;
}
AddLine ( Severity . Invalid , V125 , CheckIdentifier . Ball ) ;
2016-11-11 05:10:28 +00:00
}
2017-04-07 00:41:25 +00:00
#endregion
2016-10-23 19:48:49 +00:00
private CheckResult verifyHistory ( )
2016-03-22 04:31:06 +00:00
{
2016-03-23 02:47:13 +00:00
if ( ! Encounter . Valid )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V127 , CheckIdentifier . History ) ;
2016-12-08 02:28:24 +00:00
2016-10-23 19:48:49 +00:00
if ( pkm . GenNumber < 6 )
2016-12-08 02:28:24 +00:00
{
if ( pkm . Format < 6 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V128 , CheckIdentifier . History ) ;
2016-12-08 02:28:24 +00:00
if ( pkm . OT_Affection > 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V129 , CheckIdentifier . History ) ;
2016-12-08 02:28:24 +00:00
if ( pkm . OT_Memory > 0 | | pkm . OT_Feeling > 0 | | pkm . OT_Intensity > 0 | | pkm . OT_TextVar > 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V130 , CheckIdentifier . History ) ;
2016-12-08 02:28:24 +00:00
}
2017-02-07 06:19:10 +00:00
if ( pkm . Format > = 6 & & pkm . GenNumber ! = pkm . Format & & pkm . CurrentHandler ! = 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V124 , CheckIdentifier . History ) ;
2017-02-07 06:19:10 +00:00
2016-12-08 02:28:24 +00:00
if ( pkm . HT_Gender > 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , string . Format ( V131 , pkm . HT_Gender ) , CheckIdentifier . History ) ;
2017-01-25 17:17:20 +00:00
2017-01-11 01:14:48 +00:00
MysteryGift mg = EncounterMatch as MysteryGift ;
2016-03-23 05:49:46 +00:00
WC6 MatchedWC6 = EncounterMatch as WC6 ;
2017-01-11 01:14:48 +00:00
WC7 MatchedWC7 = EncounterMatch as WC7 ;
2016-03-22 04:31:06 +00:00
if ( MatchedWC6 ? . OT . Length > 0 ) // Has Event OT -- null propagation yields false if MatchedWC6=null
{
2017-01-11 01:14:48 +00:00
if ( pkm . OT_Friendship ! = PersonalTable . AO [ MatchedWC6 . Species ] . BaseFriendship )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V132 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . OT_Affection ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V133 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . CurrentHandler ! = 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V134 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
}
2017-01-11 01:14:48 +00:00
else if ( MatchedWC7 ? . OT . Length > 0 ) // Has Event OT -- null propagation yields false if MatchedWC7=null
{
if ( pkm . OT_Friendship ! = PersonalTable . SM [ MatchedWC7 . Species ] . BaseFriendship )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V132 , CheckIdentifier . History ) ;
2017-01-11 01:14:48 +00:00
if ( pkm . OT_Affection ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V133 , CheckIdentifier . History ) ;
2017-01-11 01:14:48 +00:00
if ( pkm . CurrentHandler ! = 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V134 , CheckIdentifier . History ) ;
2017-01-11 01:14:48 +00:00
}
else if ( mg ! = null & & mg . Format < 6 & & pkm . Format > = 6 )
{
if ( pkm . OT_Affection ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V133 , CheckIdentifier . History ) ;
2017-01-11 01:14:48 +00:00
if ( pkm . CurrentHandler ! = 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V134 , CheckIdentifier . History ) ;
2017-01-11 01:14:48 +00:00
}
2017-01-31 01:49:28 +00:00
// Geolocations
var geo = new [ ]
2016-11-11 03:29:00 +00:00
{
2017-01-31 01:49:28 +00:00
pkm . Geo1_Country , pkm . Geo2_Country , pkm . Geo3_Country , pkm . Geo4_Country , pkm . Geo5_Country ,
pkm . Geo1_Region , pkm . Geo2_Region , pkm . Geo3_Region , pkm . Geo4_Region , pkm . Geo5_Region ,
} ;
2017-01-27 13:59:08 +00:00
2017-01-31 01:49:28 +00:00
// Check sequential order (no zero gaps)
bool geoEnd = false ;
for ( int i = 0 ; i < 5 ; i + + )
{
if ( geoEnd & & geo [ i ] ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V135 , CheckIdentifier . History ) ;
2017-01-27 13:59:08 +00:00
2017-01-31 01:49:28 +00:00
if ( geo [ i ] ! = 0 )
continue ;
if ( geo [ i + 5 ] ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V136 , CheckIdentifier . History ) ;
2017-01-31 01:49:28 +00:00
geoEnd = true ;
}
if ( pkm . Format > = 7 )
{
if ( pkm . VC1 )
2017-01-27 13:59:08 +00:00
{
var hasGeo = geo . Any ( d = > d ! = 0 ) ;
if ( ! hasGeo )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V137 , CheckIdentifier . History ) ;
2017-01-27 13:59:08 +00:00
}
2016-12-03 03:50:02 +00:00
2017-01-25 17:17:20 +00:00
if ( pkm . GenNumber > = 7 & & pkm . CNTs . Any ( stat = > stat > 0 ) )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V138 , CheckIdentifier . History ) ;
2016-12-03 03:50:02 +00:00
if ( ! pkm . WasEvent & & pkm . HT_Name . Length = = 0 ) // Is not Traded
{
if ( pkm . CurrentHandler ! = 0 ) // Badly edited; PKHeX doesn't trip this.
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V139 , CheckIdentifier . History ) ;
2016-12-03 03:50:02 +00:00
if ( pkm . HT_Friendship ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V140 , CheckIdentifier . History ) ;
2016-12-03 03:50:02 +00:00
if ( pkm . HT_Affection ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V141 , CheckIdentifier . History ) ;
2016-12-03 03:50:02 +00:00
// We know it is untraded (HT is empty), if it must be trade evolved flag it.
2017-01-02 22:23:24 +00:00
if ( Legal . getHasTradeEvolved ( pkm ) // if evo chain requires a trade
& & ( EncounterMatch as EncounterSlot [ ] ) ? . Any ( slot = > slot . Species = = pkm . Species ) ! = true // Wild Encounter
& & ( EncounterMatch as EncounterStatic ) ? . Species ! = pkm . Species ) // Static Encounter
2016-12-03 03:50:02 +00:00
{
if ( pkm . Species ! = 350 ) // Milotic
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V142 , CheckIdentifier . History ) ;
2016-12-03 03:50:02 +00:00
if ( pkm . CNT_Beauty < 170 ) // Beauty Contest Stat Requirement
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V143 , CheckIdentifier . History ) ;
2016-12-03 03:50:02 +00:00
if ( pkm . CurrentLevel = = 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V144 , CheckIdentifier . History ) ;
2016-12-03 03:50:02 +00:00
}
}
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V145 , CheckIdentifier . History ) ;
2016-11-11 03:29:00 +00:00
}
2017-04-01 21:20:00 +00:00
// Determine if we should check for Handling Trainer Memories
// A Pokémon is untraded if...
bool untraded = pkm . HT_Name . Length = = 0 | | pkm . Geo1_Country = = 0 ;
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( MysteryGift ) )
2017-04-01 21:20:00 +00:00
{
untraded | = ! pkm . WasEventEgg ;
untraded & = pkm . WasEgg ;
}
if ( pkm . WasLink & & ( EncounterMatch as EncounterLink ) ? . OT = = false )
untraded = false ;
else if ( pkm . GenNumber < 6 )
untraded = false ;
if ( untraded ) // Is not Traded
2016-10-23 19:48:49 +00:00
{
if ( pkm . HT_Name . Length ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V146 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . Geo1_Country ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V147 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . HT_Memory ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V148 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . CurrentHandler ! = 0 ) // Badly edited; PKHeX doesn't trip this.
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V139 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . HT_Friendship ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V140 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . HT_Affection ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V141 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . XY & & pkm . CNTs . Any ( stat = > stat > 0 ) )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V138 , CheckIdentifier . History ) ;
2016-03-22 04:31:06 +00:00
// We know it is untraded (HT is empty), if it must be trade evolved flag it.
2016-10-23 19:48:49 +00:00
if ( Legal . getHasTradeEvolved ( pkm ) & & ( EncounterMatch as EncounterSlot [ ] ) ? . Any ( slot = > slot . Species = = pkm . Species ) ! = true )
2016-03-22 04:31:06 +00:00
{
2016-10-23 19:48:49 +00:00
if ( pkm . Species ! = 350 ) // Milotic
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V142 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . CNT_Beauty < 170 ) // Beauty Contest Stat Requirement
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V143 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . CurrentLevel = = 1 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V144 , CheckIdentifier . History ) ;
2016-03-22 04:31:06 +00:00
}
}
else // Is Traded
{
2017-02-23 05:19:29 +00:00
if ( pkm . Format = = 6 & & pkm . HT_Memory = = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V150 , CheckIdentifier . History ) ;
2016-03-22 04:31:06 +00:00
}
2016-03-31 01:53:34 +00:00
2016-10-23 19:48:49 +00:00
// Memory ChecksResult
if ( pkm . IsEgg )
2016-03-31 01:53:34 +00:00
{
2016-10-23 19:48:49 +00:00
if ( pkm . HT_Memory ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V149 , CheckIdentifier . History ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . OT_Memory ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V151 , CheckIdentifier . History ) ;
2016-03-31 01:53:34 +00:00
}
2017-04-24 00:53:22 +00:00
else if ( MatchedType ! = typeof ( WC6 ) )
2016-03-31 01:53:34 +00:00
{
2016-10-23 19:48:49 +00:00
if ( pkm . OT_Memory = = 0 ^ ! pkm . Gen6 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V152 , CheckIdentifier . History ) ;
2016-11-11 06:11:53 +00:00
if ( pkm . GenNumber < 6 & & pkm . OT_Affection ! = 0 )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , V129 , CheckIdentifier . History ) ;
2016-03-31 01:53:34 +00:00
}
2016-03-22 04:31:06 +00:00
// Unimplemented: Ingame Trade Memories
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , V145 , CheckIdentifier . History ) ;
2016-03-22 04:31:06 +00:00
}
2016-10-23 19:48:49 +00:00
private CheckResult verifyCommonMemory ( int handler )
2016-05-07 06:16:35 +00:00
{
int m = 0 ;
2016-05-09 23:09:40 +00:00
int t = 0 ;
2016-05-07 06:16:35 +00:00
string resultPrefix = "" ;
switch ( handler )
{
case 0 :
2016-10-23 19:48:49 +00:00
m = pkm . OT_Memory ;
t = pkm . OT_TextVar ;
2017-03-21 07:18:38 +00:00
resultPrefix = V205 ;
2016-05-07 06:16:35 +00:00
break ;
case 1 :
2016-10-23 19:48:49 +00:00
m = pkm . HT_Memory ;
t = pkm . HT_TextVar ;
2017-03-21 07:18:38 +00:00
resultPrefix = V206 ;
2016-05-07 06:16:35 +00:00
break ;
}
int matchingMoveMemory = Array . IndexOf ( Legal . MoveSpecificMemories [ 0 ] , m ) ;
2017-02-21 03:40:50 +00:00
if ( matchingMoveMemory ! = - 1 & & pkm . Species ! = 235 & & ! Legal . getCanLearnMachineMove ( pkm , Legal . MoveSpecificMemories [ 1 ] [ matchingMoveMemory ] , 6 ) )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , string . Format ( V153 , resultPrefix ) , CheckIdentifier . Memory ) ;
2017-02-21 03:40:50 +00:00
2016-05-09 23:09:40 +00:00
if ( m = = 6 & & ! Legal . LocationsWithPKCenter [ 0 ] . Contains ( t ) )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , string . Format ( V154 , resultPrefix ) , CheckIdentifier . Memory ) ;
2017-02-21 03:40:50 +00:00
2016-05-10 01:19:31 +00:00
if ( m = = 21 ) // {0} saw {2} carrying {1} on its back. {4} that {3}.
2017-02-21 03:40:50 +00:00
if ( ! Legal . getCanLearnMachineMove ( new PK6 { Species = t , EXP = PKX . getEXP ( 100 , t ) } , 19 , 6 ) )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , string . Format ( V153 , resultPrefix ) , CheckIdentifier . Memory ) ;
2017-02-21 03:40:50 +00:00
if ( ( m = = 16 | | m = = 48 ) & & ( t = = 0 | | ! Legal . getCanKnowMove ( pkm , t , 6 ) ) )
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , string . Format ( V153 , resultPrefix ) , CheckIdentifier . Memory ) ;
2017-02-21 03:40:50 +00:00
if ( m = = 49 & & ( t = = 0 | | ! Legal . getCanRelearnMove ( pkm , t , 6 ) ) ) // {0} was able to remember {2} at {1}'s instruction. {4} that {3}.
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Invalid , string . Format ( V153 , resultPrefix ) , CheckIdentifier . Memory ) ;
2017-02-21 03:40:50 +00:00
2017-03-21 07:18:38 +00:00
return new CheckResult ( Severity . Valid , string . Format ( V155 , resultPrefix ) , CheckIdentifier . Memory ) ;
}
private void verifyOTMemoryIs ( int [ ] values )
{
if ( pkm . OT_Memory ! = values [ 0 ] )
AddLine ( Severity . Invalid , string . Format ( V197 , V205 , values [ 0 ] ) , CheckIdentifier . Memory ) ;
if ( pkm . OT_Intensity ! = values [ 1 ] )
AddLine ( Severity . Invalid , string . Format ( V198 , V205 , values [ 1 ] ) , CheckIdentifier . Memory ) ;
if ( pkm . OT_TextVar ! = values [ 2 ] )
AddLine ( Severity . Invalid , string . Format ( V199 , V205 , values [ 2 ] ) , CheckIdentifier . Memory ) ;
if ( pkm . OT_Feeling ! = values [ 3 ] )
AddLine ( Severity . Invalid , string . Format ( V200 , V205 , values [ 3 ] ) , CheckIdentifier . Memory ) ;
2016-05-07 06:16:35 +00:00
}
2016-10-23 19:48:49 +00:00
private void verifyOTMemory ( )
2016-05-06 03:05:22 +00:00
{
2016-11-26 01:30:39 +00:00
if ( pkm . Format < 6 )
2016-10-23 19:48:49 +00:00
return ;
2016-11-26 01:30:39 +00:00
if ( ! History . Valid )
2016-10-23 19:48:49 +00:00
return ;
2016-05-06 03:05:22 +00:00
2016-11-26 01:30:39 +00:00
if ( pkm . GenNumber < 6 )
2016-05-06 03:05:22 +00:00
{
2017-03-21 07:18:38 +00:00
verifyOTMemoryIs ( new [ ] { 0 , 0 , 0 , 0 } ) ; // empty
2016-10-23 19:48:49 +00:00
return ;
2016-05-06 03:05:22 +00:00
}
2016-11-26 01:30:39 +00:00
2017-04-22 20:04:12 +00:00
if ( Type = = typeof ( EncounterTrade ) )
2017-01-25 17:17:20 +00:00
{
// Undocumented, uncommon, and insignificant -- don't bother.
return ;
}
2017-04-24 00:53:22 +00:00
if ( MatchedType = = typeof ( WC6 ) )
2016-05-06 03:05:22 +00:00
{
2017-03-21 07:18:38 +00:00
WC6 g = EncounterMatch as WC6 ;
verifyOTMemoryIs ( new [ ] { g . OT_Memory , g . OT_Intensity , g . OT_TextVar , g . OT_Feeling } ) ;
return ;
2016-05-06 03:05:22 +00:00
}
2017-04-24 00:53:22 +00:00
if ( MatchedType = = typeof ( WC7 ) )
2016-11-26 01:30:39 +00:00
{
2017-03-21 07:18:38 +00:00
WC7 g = EncounterMatch as WC7 ;
verifyOTMemoryIs ( new [ ] { g . OT_Memory , g . OT_Intensity , g . OT_TextVar , g . OT_Feeling } ) ;
return ;
2016-11-26 01:30:39 +00:00
}
2017-03-21 07:18:38 +00:00
if ( pkm . GenNumber > = 7 )
2016-11-26 01:30:39 +00:00
{
2017-03-21 07:18:38 +00:00
verifyOTMemoryIs ( new [ ] { 0 , 0 , 0 , 0 } ) ; // empty
2016-11-26 01:30:39 +00:00
return ;
}
2016-10-23 19:48:49 +00:00
switch ( pkm . OT_Memory )
2016-05-06 03:05:22 +00:00
{
2016-05-25 05:20:19 +00:00
case 2 : // {0} hatched from an Egg and saw {1} for the first time at... {2}. {4} that {3}.
2016-10-23 19:48:49 +00:00
if ( ! pkm . WasEgg & & pkm . Egg_Location ! = 60004 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V160 , V205 ) , CheckIdentifier . Memory ) ;
2016-10-23 19:48:49 +00:00
break ;
2016-05-06 03:05:22 +00:00
case 4 : // {0} became {1}’ s friend when it arrived via Link Trade at... {2}. {4} that {3}.
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V161 , V205 ) , CheckIdentifier . Memory ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-05-09 23:09:40 +00:00
case 6 : // {0} went to the Pokémon Center in {2} with {1} and had its tired body healed there. {4} that {3}.
2016-10-23 19:48:49 +00:00
int matchingOriginGame = Array . IndexOf ( Legal . LocationsWithPKCenter [ 0 ] , pkm . OT_TextVar ) ;
2016-05-10 00:51:35 +00:00
if ( matchingOriginGame ! = - 1 )
{
int gameID = Legal . LocationsWithPKCenter [ 1 ] [ matchingOriginGame ] ;
2016-10-23 19:48:49 +00:00
if ( pkm . XY & & gameID ! = 0 | | pkm . AO & & gameID ! = 1 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V162 , V205 ) , CheckIdentifier . Memory ) ;
2016-05-10 00:51:35 +00:00
}
2016-10-23 19:48:49 +00:00
AddLine ( verifyCommonMemory ( 0 ) ) ;
return ;
2016-05-06 03:35:18 +00:00
case 14 :
2016-11-09 06:10:32 +00:00
if ( ! Legal . getCanBeCaptured ( pkm . OT_TextVar , pkm . GenNumber , ( GameVersion ) pkm . Version ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V165 , V205 ) , CheckIdentifier . Memory ) ;
2016-10-23 19:48:49 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Valid , string . Format ( V164 , V205 ) , CheckIdentifier . Memory ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-05-06 03:05:22 +00:00
}
2016-10-23 19:48:49 +00:00
if ( pkm . XY & & Legal . Memory_NotXY . Contains ( pkm . OT_Memory ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V163 , V205 ) , CheckIdentifier . Memory ) ;
2016-10-23 19:48:49 +00:00
if ( pkm . AO & & Legal . Memory_NotAO . Contains ( pkm . OT_Memory ) )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V163 , V205 ) , CheckIdentifier . Memory ) ;
2016-05-06 03:05:22 +00:00
2016-10-23 19:48:49 +00:00
AddLine ( verifyCommonMemory ( 0 ) ) ;
2016-05-06 03:05:22 +00:00
}
2016-10-23 19:48:49 +00:00
private void verifyHTMemory ( )
2016-05-06 03:05:22 +00:00
{
2016-10-23 19:48:49 +00:00
if ( pkm . Format < 6 )
return ;
2016-05-06 03:05:22 +00:00
if ( ! History . Valid )
2016-10-23 19:48:49 +00:00
return ;
2016-05-06 03:05:22 +00:00
2017-03-12 23:36:23 +00:00
if ( pkm . Format > = 7 )
2016-11-26 01:30:39 +00:00
{
2017-03-12 23:36:23 +00:00
/ *
* Bank Transfer adds in the Link Trade Memory .
* Trading 7 < - > 7 between games ( not Bank ) clears this data .
* /
if ( pkm . HT_Memory = = 0 )
{
if ( pkm . HT_TextVar ! = 0 | | pkm . HT_Intensity ! = 0 | | pkm . HT_Feeling ! = 0 )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V329 , CheckIdentifier . Memory ) ;
2017-01-27 13:59:08 +00:00
return ;
2017-03-12 23:36:23 +00:00
}
2017-01-27 04:13:27 +00:00
2017-01-27 13:59:08 +00:00
if ( pkm . HT_Memory ! = 4 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V156 , CheckIdentifier . Memory ) ;
2017-01-27 05:35:26 +00:00
if ( pkm . HT_TextVar ! = 0 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V157 , CheckIdentifier . Memory ) ;
2017-01-27 13:59:08 +00:00
if ( pkm . HT_Intensity ! = 1 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V158 , CheckIdentifier . Memory ) ;
2017-01-27 13:59:08 +00:00
if ( pkm . HT_Feeling > 10 )
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V159 , CheckIdentifier . Memory ) ;
2016-11-26 01:30:39 +00:00
return ;
}
2016-10-23 19:48:49 +00:00
switch ( pkm . HT_Memory )
2016-05-06 03:05:22 +00:00
{
2017-01-27 04:13:27 +00:00
case 0 :
2017-01-27 13:59:08 +00:00
if ( string . IsNullOrEmpty ( pkm . HT_Name ) )
2017-01-27 04:13:27 +00:00
return ;
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , V150 , CheckIdentifier . Memory ) ; return ;
2016-05-06 03:05:22 +00:00
case 1 : // {0} met {1} at... {2}. {1} threw a Poké Ball at it, and they started to travel together. {4} that {3}.
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V202 , V206 ) , CheckIdentifier . Memory ) ; return ;
2016-10-23 19:48:49 +00:00
2016-05-06 03:05:22 +00:00
case 2 : // {0} hatched from an Egg and saw {1} for the first time at... {2}. {4} that {3}.
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V160 , V206 ) , CheckIdentifier . Memory ) ; return ;
2016-10-23 19:48:49 +00:00
2016-05-06 03:35:18 +00:00
case 14 :
2017-03-21 07:18:38 +00:00
if ( Legal . getCanBeCaptured ( pkm . HT_TextVar , pkm . GenNumber ) )
AddLine ( Severity . Valid , string . Format ( V164 , V206 ) , CheckIdentifier . Memory ) ;
2016-10-23 19:48:49 +00:00
else
2017-03-21 07:18:38 +00:00
AddLine ( Severity . Invalid , string . Format ( V165 , V206 ) , CheckIdentifier . Memory ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-05-06 03:05:22 +00:00
}
2016-10-23 19:48:49 +00:00
AddLine ( verifyCommonMemory ( 1 ) ) ;
2016-05-06 03:05:22 +00:00
}
2016-10-23 19:48:49 +00:00
private void verifyRegion ( )
2016-05-11 23:20:31 +00:00
{
2016-10-23 19:48:49 +00:00
if ( pkm . Format < 6 )
return ;
bool pass ;
switch ( pkm . ConsoleRegion )
2016-05-11 23:20:31 +00:00
{
2016-05-12 04:18:05 +00:00
case 0 : // Japan
2016-10-23 19:48:49 +00:00
pass = pkm . Country = = 1 ;
2016-05-11 23:20:31 +00:00
break ;
2016-05-12 04:18:05 +00:00
case 1 : // Americas
2016-10-23 19:48:49 +00:00
pass = 8 < = pkm . Country & & pkm . Country < = 52 | | new [ ] { 153 , 156 , 168 , 174 , 186 } . Contains ( pkm . Country ) ;
2016-05-11 23:20:31 +00:00
break ;
2016-05-12 04:18:05 +00:00
case 2 : // Europe
2016-10-23 19:48:49 +00:00
pass = 64 < = pkm . Country & & pkm . Country < = 127 | | new [ ] { 169 , 184 , 185 } . Contains ( pkm . Country ) ;
2016-05-11 23:20:31 +00:00
break ;
2016-05-12 04:18:05 +00:00
case 4 : // China
2016-10-23 19:48:49 +00:00
pass = pkm . Country = = 144 | | pkm . Country = = 160 ;
2016-05-11 23:20:31 +00:00
break ;
2016-05-12 04:18:05 +00:00
case 5 : // Korea
2016-10-23 19:48:49 +00:00
pass = pkm . Country = = 136 ;
2016-05-11 23:20:31 +00:00
break ;
2016-05-12 04:18:05 +00:00
case 6 : // Taiwan
2016-10-23 19:48:49 +00:00
pass = pkm . Country = = 128 ;
2016-05-11 23:20:31 +00:00
break ;
2016-10-23 19:48:49 +00:00
default :
2017-03-23 03:12:45 +00:00
AddLine ( new CheckResult ( Severity . Invalid , V301 , CheckIdentifier . Geography ) ) ;
2016-10-23 19:48:49 +00:00
return ;
2016-05-11 23:20:31 +00:00
}
2016-10-23 19:48:49 +00:00
if ( ! pass )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V302 , CheckIdentifier . Geography ) ;
2016-10-23 19:48:49 +00:00
else
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V303 , CheckIdentifier . Geography ) ;
2016-05-11 23:20:31 +00:00
}
2016-10-23 19:48:49 +00:00
private void verifyForm ( )
2016-04-14 10:17:03 +00:00
{
if ( ! Encounter . Valid )
2016-10-23 19:48:49 +00:00
return ;
2016-04-14 10:17:03 +00:00
2016-10-23 19:48:49 +00:00
if ( pkm . Format < 4 )
return ;
2016-11-09 05:43:22 +00:00
if ( pkm . AltForm > pkm . PersonalInfo . FormeCount )
{
2016-11-14 15:33:39 +00:00
bool valid = false ;
int species = pkm . Species ;
if ( species = = 201 ) // Unown
{
2017-03-25 17:24:56 +00:00
int maxCount = pkm . GenNumber = = 2 ? 26 : 28 ; // A-Z : A-Z?!
if ( pkm . AltForm < maxCount )
2016-11-14 15:33:39 +00:00
valid = true ;
}
if ( species = = 414 & & pkm . AltForm < 3 ) // Wormadam base form kept
2017-03-25 17:24:56 +00:00
valid = true ;
2016-11-14 15:33:39 +00:00
if ( ( species = = 664 | | species = = 665 ) & & pkm . AltForm < 18 ) // Vivillon Pre-evolutions
valid = true ;
if ( ! valid ) // ignore list
2017-03-23 03:12:45 +00:00
{ AddLine ( Severity . Invalid , string . Format ( V304 , pkm . PersonalInfo . FormeCount , pkm . AltForm ) , CheckIdentifier . Form ) ; return ; }
2016-11-09 05:43:22 +00:00
}
2016-10-23 19:48:49 +00:00
switch ( pkm . Species )
2016-04-14 10:17:03 +00:00
{
2016-11-14 02:25:33 +00:00
case 25 : // Pikachu
2017-04-24 00:53:22 +00:00
if ( pkm . Format = = 6 & & pkm . AltForm ! = 0 ^ Type = = typeof ( EncounterStatic ) )
2016-10-23 19:48:49 +00:00
{
2017-04-24 00:53:22 +00:00
string msg = Type = = typeof ( EncounterStatic ) ? V305 : V306 ;
2017-02-21 03:40:50 +00:00
AddLine ( Severity . Invalid , msg , CheckIdentifier . Form ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-04-24 00:53:22 +00:00
if ( pkm . Format = = 7 & & pkm . AltForm ! = 0 ^ Type = = typeof ( MysteryGift ) )
2016-10-23 19:48:49 +00:00
{
2016-11-14 02:25:33 +00:00
var gift = EncounterMatch as WC7 ;
2016-10-23 19:48:49 +00:00
if ( gift ! = null & & gift . Form ! = pkm . AltForm )
{
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V307 , CheckIdentifier . Form ) ;
2016-10-23 19:48:49 +00:00
return ;
}
}
2016-04-23 21:16:12 +00:00
break ;
2017-01-31 22:01:32 +00:00
case 487 : // Giratina
2017-02-03 03:30:17 +00:00
if ( pkm . AltForm = = 1 ^ pkm . HeldItem = = 112 ) // Origin form only with Griseous Orb
2017-01-31 22:01:32 +00:00
{
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V308 , CheckIdentifier . Form ) ;
2017-01-31 22:01:32 +00:00
return ;
}
break ;
2017-02-01 04:11:11 +00:00
case 493 : // Arceus
{
int item = pkm . HeldItem ;
int form = 0 ;
if ( ( 298 < = item & & item < = 313 ) | | item = = 644 )
form = Array . IndexOf ( Legal . Arceus_Plate , item ) + 1 ;
else if ( 777 < = item & & item < = 793 )
form = Array . IndexOf ( Legal . Arceus_ZCrystal , item ) + 1 ;
if ( form ! = pkm . AltForm )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V308 , CheckIdentifier . Form ) ;
2017-02-01 04:11:11 +00:00
else if ( form ! = 0 )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V309 , CheckIdentifier . Form ) ;
2017-02-01 04:11:11 +00:00
}
2017-02-13 01:06:09 +00:00
break ;
2017-03-23 06:34:35 +00:00
case 647 : // Keldeo
{
int index = Array . IndexOf ( pkm . Moves , 548 ) ; // Secret Sword
bool noSword = index < 0 ;
if ( pkm . AltForm = = 0 ^ noSword ) // mismatch
vMoves [ noSword ? 0 : index ] = new CheckResult ( Severity . Invalid , V169 , CheckIdentifier . Move ) ;
break ;
}
2017-02-13 01:06:09 +00:00
case 649 : // Genesect
{
int item = pkm . HeldItem ;
int form = 0 ;
if ( 116 < = item & & item < = 119 )
form = item - 115 ;
if ( form ! = pkm . AltForm )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V308 , CheckIdentifier . Form ) ;
2017-02-13 01:06:09 +00:00
else
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V309 , CheckIdentifier . Form ) ;
2017-02-13 01:06:09 +00:00
}
2017-02-01 04:11:11 +00:00
break ;
2016-11-14 02:25:33 +00:00
case 658 : // Greninja
2016-11-09 05:43:22 +00:00
if ( pkm . AltForm > 1 ) // Ash Battle Bond active
{
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V310 , CheckIdentifier . Form ) ;
2016-11-09 05:43:22 +00:00
return ;
}
break ;
2016-11-14 02:25:33 +00:00
case 664 : // Scatterbug
case 665 : // Spewpa
2016-10-23 19:48:49 +00:00
if ( pkm . AltForm > 17 ) // Fancy & Pokéball
{
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V311 , CheckIdentifier . Form ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-03-25 17:24:56 +00:00
if ( ! Legal . CheckVivillonPattern ( pkm . AltForm , pkm . Country , pkm . Region ) )
AddLine ( Severity . Fishy , V312 , CheckIdentifier . Form ) ;
2016-04-14 10:17:03 +00:00
break ;
2016-11-14 02:25:33 +00:00
case 666 : // Vivillon
2016-10-23 19:48:49 +00:00
if ( pkm . AltForm > 17 ) // Fancy & Pokéball
{
2017-04-24 00:53:22 +00:00
if ( Type ! = typeof ( MysteryGift ) )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V312 , CheckIdentifier . Form ) ;
2016-10-23 19:48:49 +00:00
else
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V313 , CheckIdentifier . Form ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2017-03-25 17:24:56 +00:00
if ( ! Legal . CheckVivillonPattern ( pkm . AltForm , pkm . Country , pkm . Region ) )
AddLine ( Severity . Fishy , V312 , CheckIdentifier . Form ) ;
2016-04-14 10:17:03 +00:00
break ;
2016-11-14 02:25:33 +00:00
case 670 : // Floette
2016-10-23 19:48:49 +00:00
if ( pkm . AltForm = = 5 ) // Eternal Flower -- Never Released
{
2017-04-24 00:53:22 +00:00
if ( Type ! = typeof ( MysteryGift ) )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V314 , CheckIdentifier . Form ) ;
2016-10-23 19:48:49 +00:00
else
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V315 , CheckIdentifier . Form ) ;
2016-10-23 19:48:49 +00:00
return ;
}
2016-04-14 10:17:03 +00:00
break ;
2016-11-14 02:25:33 +00:00
case 718 : // Zygarde
2016-11-09 05:43:22 +00:00
if ( pkm . AltForm > = 4 )
{
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V310 , CheckIdentifier . Form ) ;
2016-11-09 05:43:22 +00:00
return ;
}
break ;
2017-02-01 04:11:11 +00:00
case 773 : // Silvally
{
int item = pkm . HeldItem ;
int form = 0 ;
if ( ( 904 < = item & & item < = 920 ) | | item = = 644 )
form = item - 903 ;
if ( form ! = pkm . AltForm )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V308 , CheckIdentifier . Form ) ;
2017-02-01 04:11:11 +00:00
else if ( form ! = 0 )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V309 , CheckIdentifier . Form ) ;
2017-02-01 04:11:11 +00:00
break ;
}
2016-11-14 02:25:33 +00:00
case 774 : // Minior
if ( pkm . AltForm < 7 )
2016-11-09 05:43:22 +00:00
{
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V310 , CheckIdentifier . Form ) ;
2016-11-09 05:43:22 +00:00
return ;
}
break ;
2017-02-03 03:27:48 +00:00
// Party Only Forms
case 492 : // Shaymin
case 676 : // Furfrou
case 720 : // Hoopa
2017-04-15 00:49:13 +00:00
if ( pkm . AltForm ! = 0 & & pkm . Box > - 1 & & pkm . Format < = 6 ) // has form but stored in box
2017-02-03 03:30:17 +00:00
{
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V316 , CheckIdentifier . Form ) ;
2017-02-03 03:30:17 +00:00
return ;
}
2017-02-03 03:27:48 +00:00
break ;
2016-04-14 10:17:03 +00:00
}
2016-11-14 02:19:09 +00:00
2017-02-02 05:59:39 +00:00
if ( pkm . Format > = 7 & & pkm . GenNumber < 7 & & pkm . AltForm ! = 0 )
{
if ( pkm . Species = = 25 | | Legal . AlolanOriginForms . Contains ( pkm . Species ) )
2017-03-23 03:12:45 +00:00
{ AddLine ( Severity . Invalid , V317 , CheckIdentifier . Form ) ; return ; }
2017-02-02 05:59:39 +00:00
}
2016-10-23 19:48:49 +00:00
if ( pkm . AltForm > 0 & & new [ ] { Legal . BattleForms , Legal . BattleMegas , Legal . BattlePrimals } . Any ( arr = > arr . Contains ( pkm . Species ) ) )
2017-03-23 03:12:45 +00:00
{ AddLine ( Severity . Invalid , V310 , CheckIdentifier . Form ) ; return ; }
2016-04-14 10:17:03 +00:00
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V318 , CheckIdentifier . Form ) ;
2016-04-14 10:17:03 +00:00
}
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
private void verifyMiscG1 ( )
{
if ( pkm . Format > 1 )
return ;
var Type_A = ( pkm as PK1 ) . Type_A ;
var Type_B = ( pkm as PK1 ) . Type_B ;
if ( pkm . Species = = 137 )
{
// Porygon can have any type combination of any generation 1 species because of the move Conversion,
// that change Porygon type to match the oponent types
var Type_A_Match = Legal . Types_Gen1 . Any ( t = > t = = Type_A ) ;
var Type_B_Match = Legal . Types_Gen1 . Any ( t = > t = = Type_B ) ;
if ( ! Type_A_Match )
AddLine ( Severity . Invalid , V386 , CheckIdentifier . Misc ) ;
if ( ! Type_B_Match )
AddLine ( Severity . Invalid , V387 , CheckIdentifier . Misc ) ;
if ( Type_A_Match & & Type_B_Match )
{
var TypesAB_Match = PersonalTable . RB . IsValidTypeCombination ( Type_A , Type_B ) ;
if ( TypesAB_Match )
AddLine ( Severity . Valid , V391 , CheckIdentifier . Misc ) ;
else
AddLine ( Severity . Invalid , V388 , CheckIdentifier . Misc ) ;
}
}
else // Types must match species types
{
var Type_A_Match = Type_A = = PersonalTable . RB [ pkm . Species ] . Types [ 0 ] ;
var Type_B_Match = Type_B = = PersonalTable . RB [ pkm . Species ] . Types [ 1 ] ;
AddLine ( Type_A_Match ? Severity . Valid : Severity . Invalid , Type_A_Match ? V392 : V389 , CheckIdentifier . Misc ) ;
AddLine ( Type_B_Match ? Severity . Valid : Severity . Invalid , Type_B_Match ? V393 : V390 , CheckIdentifier . Misc ) ;
}
var catch_rate = ( pkm as PK1 ) . Catch_Rate ;
switch ( pkm . TradebackStatus )
{
case TradebackType . Any :
case TradebackType . WasTradeback :
if ( catch_rate = = 0 | | Legal . HeldItems_GSC . Any ( h = > h = = catch_rate ) )
{ AddLine ( Severity . Valid , V394 , CheckIdentifier . Misc ) ; }
else if ( pkm . TradebackStatus = = TradebackType . WasTradeback )
{ AddLine ( Severity . Invalid , V395 , CheckIdentifier . Misc ) ; }
else
goto case TradebackType . Gen1_NotTradeback ;
break ;
case TradebackType . Gen1_NotTradeback :
2017-05-01 15:25:20 +00:00
if ( ( EncounterMatch as EncounterStatic ) ? . Version = = GameVersion . Stadium | | EncounterMatch is EncounterTradeCatchRate )
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
// Encounters detected by the catch rate, cant be invalid if match this encounters
{ AddLine ( Severity . Valid , V398 , CheckIdentifier . Misc ) ; }
2017-05-01 15:25:20 +00:00
if ( ( ( pkm . Species = = 149 ) & & ( catch_rate = = PersonalTable . Y [ 149 ] . CatchRate ) ) | |
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
( Legal . Species_NotAvailable_CatchRate . Contains ( pkm . Species ) & & ( catch_rate = = PersonalTable . RB [ pkm . Species ] . CatchRate ) ) )
{ AddLine ( Severity . Invalid , V396 , CheckIdentifier . Misc ) ; }
else if ( ! EvoChainsAllGens [ 1 ] . Any ( e = > catch_rate = = PersonalTable . RB [ e . Species ] . CatchRate | | catch_rate = = PersonalTable . Y [ e . Species ] . CatchRate ) )
{ AddLine ( Severity . Invalid , pkm . Gen1_NotTradeback ? V397 : V399 , CheckIdentifier . Misc ) ; }
else
{ AddLine ( Severity . Valid , V398 , CheckIdentifier . Misc ) ; }
break ;
}
}
2016-10-23 19:48:49 +00:00
private void verifyMisc ( )
2016-04-22 02:32:22 +00:00
{
2017-01-26 19:16:21 +00:00
if ( pkm . Format = = 7 & & ( ( PK7 ) pkm ) . PelagoEventStatus ! = 0 )
{
// TODO: Figure out what PelagoEventStati are legal.
}
2017-01-25 07:34:50 +00:00
2016-10-23 19:48:49 +00:00
if ( pkm . IsEgg )
2016-09-03 15:10:22 +00:00
{
2016-10-23 19:48:49 +00:00
if ( new [ ] { pkm . Move1_PPUps , pkm . Move2_PPUps , pkm . Move3_PPUps , pkm . Move4_PPUps } . Any ( ppup = > ppup > 0 ) )
2017-04-12 03:11:58 +00:00
{ AddLine ( Severity . Invalid , V319 , CheckIdentifier . Misc ) ; }
2016-10-23 19:48:49 +00:00
if ( pkm . CNTs . Any ( stat = > stat > 0 ) )
2017-04-12 03:11:58 +00:00
{ AddLine ( Severity . Invalid , V320 , CheckIdentifier . Misc ) ; }
2017-04-15 02:55:40 +00:00
if ( pkm . Format = = 2 & & ( pkm . PKRS_Cured | | pkm . PKRS_Infected ) )
2017-04-12 03:11:58 +00:00
{ AddLine ( Severity . Invalid , V368 , CheckIdentifier . Misc ) ; }
var HatchCycles = ( EncounterMatch as EncounterStatic ) ? . EggCycles ;
if ( HatchCycles = = 0 )
HatchCycles = pkm . PersonalInfo . HatchCycles ;
2017-04-15 02:55:40 +00:00
if ( pkm . CurrentFriendship > HatchCycles )
2017-04-12 03:11:58 +00:00
{ AddLine ( Severity . Invalid , V374 , CheckIdentifier . Misc ) ; }
2016-09-03 15:10:22 +00:00
}
2016-12-11 02:55:04 +00:00
if ( Encounter . Valid )
2016-04-22 02:32:22 +00:00
{
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( MysteryGift ) )
2016-12-11 02:55:04 +00:00
{
if ( pkm . FatefulEncounter )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V321 , CheckIdentifier . Fateful ) ;
2016-12-11 02:55:04 +00:00
else
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V322 , CheckIdentifier . Fateful ) ;
2016-12-11 02:55:04 +00:00
return ;
}
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( EncounterStatic ) )
2016-11-13 17:37:28 +00:00
{
var enc = EncounterMatch as EncounterStatic ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var fateful = enc . Fateful ;
if ( pkm . Gen3 & & pkm . WasEgg & & ! pkm . IsEgg )
// Fatefull generation 3 eggs lost fatefull mark after hatch
fateful = false ;
if ( fateful )
2016-12-11 02:55:04 +00:00
{
if ( pkm . FatefulEncounter )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Valid , V323 , CheckIdentifier . Fateful ) ;
2016-12-11 02:55:04 +00:00
else
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V324 , CheckIdentifier . Fateful ) ;
2016-12-11 02:55:04 +00:00
}
else if ( pkm . FatefulEncounter )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V325 , CheckIdentifier . Fateful ) ;
2016-11-13 17:37:28 +00:00
}
2017-04-02 13:39:39 +00:00
else if ( pkm . FatefulEncounter )
2017-03-30 22:14:52 +00:00
AddLine ( Severity . Invalid , V325 , CheckIdentifier . Fateful ) ;
2017-04-02 13:39:39 +00:00
if ( pkm . GenNumber = = 5 )
2017-03-19 17:44:46 +00:00
{
var enc = EncounterMatch as EncounterStatic ;
bool req = enc ? . NSparkle ? ? false ;
2017-04-02 13:39:39 +00:00
if ( pkm . Format = = 5 )
{
bool has = ( ( PK5 ) pkm ) . NPokémon ;
if ( req & & ! has )
AddLine ( Severity . Invalid , V326 , CheckIdentifier . Fateful ) ;
if ( ! req & & has )
AddLine ( Severity . Invalid , V327 , CheckIdentifier . Fateful ) ;
}
if ( req )
{
if ( pkm . IVs . Any ( iv = > iv ! = 30 ) )
AddLine ( Severity . Invalid , V218 , CheckIdentifier . IVs ) ;
if ( pkm . OT_Name ! = "N" | | pkm . TID ! = 00002 | | pkm . SID ! = 00000 )
AddLine ( Severity . Invalid , V219 , CheckIdentifier . Trainer ) ;
if ( pkm . IsShiny )
AddLine ( Severity . Invalid , V220 , CheckIdentifier . Shiny ) ;
}
2017-03-19 17:44:46 +00:00
}
2016-04-22 02:32:22 +00:00
}
}
2016-12-01 03:37:53 +00:00
private void verifyVersionEvolution ( )
{
if ( pkm . Format < 7 )
return ;
// No point using the evolution tree. Just handle certain species.
switch ( pkm . Species )
{
case 745 : // Lycanroc
if ( ! pkm . WasEgg )
break ;
if ( pkm . AltForm = = 0 & & pkm . Version = = 31 // Moon
| | pkm . AltForm = = 1 & & pkm . Version = = 30 ) // Sun
if ( pkm . IsUntraded )
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V328 , CheckIdentifier . Evolution ) ;
2016-12-01 03:37:53 +00:00
break ;
case 791 : // Solgaleo
if ( pkm . Version = = 31 & & pkm . IsUntraded )
{
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( MysteryGift ) & & ( ( MysteryGift ) EncounterMatch ) . Species = = pkm . Species ) // Gifted via Mystery Gift
2016-12-01 03:37:53 +00:00
break ;
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V328 , CheckIdentifier . Evolution ) ;
2016-12-01 03:37:53 +00:00
}
break ;
case 792 : // Lunala
if ( pkm . Version = = 30 & & pkm . IsUntraded )
{
2017-04-24 00:53:22 +00:00
if ( Type = = typeof ( MysteryGift ) & & ( ( MysteryGift ) EncounterMatch ) . Species = = pkm . Species ) // Gifted via Mystery Gift
2016-12-01 03:37:53 +00:00
break ;
2017-03-23 03:12:45 +00:00
AddLine ( Severity . Invalid , V328 , CheckIdentifier . Evolution ) ;
2016-12-01 03:37:53 +00:00
}
break ;
}
}
2017-04-07 00:41:25 +00:00
#region verifyMoves
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 List < object > GetEncounterMoves ( )
{
var encounters = new List < object > ( ) ;
if ( null ! = EventGiftMatch )
encounters . AddRange ( EventGiftMatch ) ;
if ( null ! = EncounterStaticMatch )
encounters . AddRange ( EncounterStaticMatch ) ;
if ( null ! = EncounterMatch )
encounters . Add ( EncounterMatch ) ;
if ( pkm . WasEgg & & ! encounters . Any ( ) )
encounters . Add ( null ) ; // use null encounter for player hatched eggs
return encounters ;
}
private List < object > GetEncounterMovesGen3Egg ( )
{
// Gen 3 eggs can be also a non-egg encounter,
// Ignore gen 3 non-egg encounters without special moves, egg encounter will return valid for this moves combinations
var encounters = new List < object > ( ) ;
if ( null ! = EventGiftMatch )
encounters . AddRange ( EventGiftMatch . Where ( x = > ( x as IMoveset ) ? . Moves ! = null ) ) ;
if ( null ! = EncounterStaticMatch )
encounters . AddRange ( EncounterStaticMatch . Where ( x = > ( x as IMoveset ) ? . Moves ! = null ) ) ;
2017-04-13 15:48:13 +00:00
if ( null ! = ( EncounterMatch as EncounterTrade ) )
encounters . Add ( EncounterMatch ) ;
else if ( null ! = ( EncounterMatch as IMoveset ) ? . 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
encounters . Add ( EncounterMatch ) ;
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
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 ( ! pkm . IsEgg )
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
{
// Add player hatched egg before special egg, this will allow to show correct legality erros if the pokemon have normal egg moves and event egg moves
encounters . Add ( 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
//Can not distinguish event egg and normal egg after hatching, and not in the EncounterStaticMatch
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
var specialeggs = Legal . getG3SpecialEggEncounter ( pkm ) ;
foreach ( var specialegg in specialeggs )
{
if ( specialegg . Moves . Any ( m = > m ! = 0 & & pkm . Moves . Contains ( m ) ) )
encounters . Add ( specialegg ) ;
}
}
else if ( ! encounters . Any ( ) )
// add player hatched egg except if there is a gen 3 gift egg or event egg encounter adn the pokemon is inside an egg
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
encounters . Add ( null ) ;
return encounters ;
}
private List < object > GetEncounterMovesGBEra ( )
{
var encounters = new List < object > ( ) ;
// Gen 1 only have WasEgg true if it can be a gen2 hatched transfer to gen 1 games, not possible in VC
if ( pkm . WasEgg )
encounters . Add ( null ) ;
2017-05-01 15:25:20 +00:00
if ( EncountersGBMatch = = null )
return encounters ;
if ( EncountersGBMatch . First ( ) . Generation = = 1 )
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
{
2017-05-01 15:25:20 +00:00
// If the first encounter is from generation 1, any encounter from generation 2 will not return any valid move that is not valid in gen1 encounter
// but it is needed to determine if pokemon could be from only one generation to check tradeback status
encounters . Add ( EncountersGBMatch . First ( ) . Encounter ) ;
}
else
{
// Add non egg encounters, start with generation 2
// generation 1 will change valid gen 1 lvl moves for every encounter
encounters . AddRange ( EncountersGBMatch . Where ( t = > t . Type ! = GBEncounterType . EggEncounter ) . Select ( e = > e . Encounter ) ) ;
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +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
return encounters ;
}
2017-02-28 04:57:24 +00:00
private CheckResult [ ] verifyMoves ( GameVersion game = GameVersion . Any )
2016-03-12 17:16:41 +00:00
{
2017-03-23 06:34:35 +00:00
int [ ] Moves = pkm . Moves ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var res = parseMovesForEncounters ( game , Moves ) ;
2017-03-23 06:34:35 +00:00
// Duplicate Moves Check
verifyNoEmptyDuplicates ( Moves , res ) ;
if ( Moves [ 0 ] = = 0 ) // Can't have an empty moveslot for the first move.
res [ 0 ] = new CheckResult ( Severity . Invalid , V167 , CheckIdentifier . Move ) ;
return res ;
}
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
private void UptateGen1LevelUpMoves ( ValidEncounterMoves EncounterMoves , int defaultLvlG1 , int generation )
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-27 05:05:32 +00:00
switch ( generation )
2017-04-09 02:05:29 +00:00
{
case 1 :
case 2 :
2017-04-27 05:05:32 +00:00
var lvlG1 = ( EncounterMatch as IEncounterable ) ? . LevelMin + 1 ? ? 6 ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
if ( lvlG1 ! = defaultLvlG1 )
EncounterMoves . validLevelUpMoves [ 1 ] = Legal . getValidMoves ( pkm , EvoChainsAllGens [ 1 ] , generation : 1 , minLvLG1 : lvlG1 , LVL : true , Tutor : false , Machine : false , MoveReminder : false ) . ToList ( ) ;
2017-04-09 02:05:29 +00:00
break ;
}
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
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
}
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
private ValidEncounterMoves getEncounterValidMoves ( int defaultspecies , int encounterspecies , object encounter , int encounterlevel )
{
var minLvLG1 = pkm . GenNumber < = 2 ? encounterlevel + 1 : 0 ;
// If encounter species is the same species from the first match, the one in variable EncounterMatch, its evolution chains is already in EvoChainsAllGens
var EvolutionChains = defaultspecies = = EncounterSpecies ? EvoChainsAllGens : Legal . getEvolutionChainsAllGens ( pkm , encounter ) ;
var LevelMoves = Legal . getValidMovesAllGens ( pkm , EvoChainsAllGens , minLvLG1 : minLvLG1 , Tutor : false , Machine : false , RemoveTransferHM : false ) ;
var TMHMMoves = Legal . getValidMovesAllGens ( pkm , EvoChainsAllGens , LVL : false , Tutor : false , MoveReminder : false , RemoveTransferHM : false ) ;
var TutorMoves = Legal . getValidMovesAllGens ( pkm , EvoChainsAllGens , LVL : false , Machine : false , MoveReminder : false , RemoveTransferHM : false ) ;
2017-04-27 05:05:32 +00:00
return new ValidEncounterMoves
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
{
EncounterSpecies = encounterspecies ,
validLevelUpMoves = LevelMoves ,
validTMHMMoves = TMHMMoves ,
validTutorMoves = TutorMoves ,
EvolutionChains = EvolutionChains ,
minLvlG1 = minLvLG1
} ;
}
private List < ValidEncounterMoves > getEncountersValidMoves ( List < object > encounters , DexLevel [ ] vs )
{
2017-04-27 05:05:32 +00:00
var defaultspecies = Legal . getEncounterSpecies ( EncounterMatch , vs ) ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var r = new List < ValidEncounterMoves > ( ) ;
2017-04-27 05:05:32 +00:00
foreach ( DexLevel evo in vs )
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
{
2017-04-27 05:05:32 +00:00
// Store only one set of valid moves for species; use the minimum level encounter for that species
var encounters_evo = encounters . Where ( e = > Legal . getEncounterSpecies ( e , vs ) = = evo . Species ) . ToList ( ) ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
if ( ! encounters_evo . Any ( ) )
continue ;
2017-04-27 05:05:32 +00:00
// For every possible encounter species, get valid moves using minimum encounter level for each species
// Generation 1 encounters will overwrite the valid level moves of gen 1 if encounter level is not the minimum
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var minlevel = encounters_evo . Min ( e = > Legal . getEncounterLevel ( pkm , e ) ) ;
var encounter_minlevel = encounters_evo . First ( e = > Legal . getEncounterLevel ( pkm , e ) = = minlevel ) ;
r . Add ( getEncounterValidMoves ( defaultspecies , evo . Species , encounter_minlevel , minlevel ) ) ;
}
return r ;
}
private CheckResult [ ] parseMovesForEncounters ( GameVersion game , int [ ] Moves )
2017-04-05 05:01:48 +00:00
{
2017-04-06 04:28:03 +00:00
if ( pkm . Species = = 235 ) // special handling for Smeargle
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
return parseMovesForSmeargle ( Moves ) ; // Smeargle can have any moves except a few
2017-04-05 05:01:48 +00:00
// Gather Encounters
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 encounters = pkm . GenNumber < = 2 ? GetEncounterMovesGBEra ( ) :
pkm . GenNumber = = 3 & & pkm . WasEgg ? GetEncounterMovesGen3Egg ( ) :
GetEncounterMoves ( ) ;
2017-04-07 00:41:25 +00:00
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
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
// it could be duplicated between EncounterMatch and EncounterStaticMatch or EncounterMatch and EventGiftMatch
encounters = encounters . Distinct ( ) . ToList ( ) ;
if ( ! encounters . Any ( ) ) // There isn't any valid encounter and wasnt an egg
2017-04-27 05:05:32 +00:00
return parseMovesNoEncounters ( ) ;
2017-04-07 00:41:25 +00:00
2017-04-05 05:01:48 +00:00
// Iterate over encounters
bool pre3DS = pkm . GenNumber < 6 ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var vs = Legal . getValidPreEvolutions ( pkm ) . ToArray ( ) ;
// gather valid moves for encounter species
var EncountersMoves = getEncountersValidMoves ( encounters , vs ) ;
2017-04-06 04:28:03 +00:00
CheckResult [ ] res = new CheckResult [ 4 ] ;
2017-04-05 05:01:48 +00:00
foreach ( var enc in encounters )
{
EncounterMatch = enc ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
if ( pkm . GenNumber < = 2 )
EncounterOriginalGB = enc ;
2017-04-27 05:05:32 +00:00
EncounterSpecies = Legal . getEncounterSpecies ( EncounterMatch , vs ) ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var EncounterMoves = EncountersMoves . First ( e = > e . EncounterSpecies = = EncounterSpecies ) ;
EvoChainsAllGens = EncounterMoves . EvolutionChains ;
if ( pkm . GenNumber < = 3 )
pkm . WasEgg = ( EncounterMatch = = null ) | | ( ( EncounterMatch as IEncounterable ) ? . EggEncounter ? ? false ) ;
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 EncounterMatchGen = EncounterMatch as IGeneration ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var defaultG1LevelMoves = EncounterMoves . validLevelUpMoves [ 1 ] ;
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
var defaultTradeback = pkm . TradebackStatus ;
2017-04-10 00:43:05 +00:00
if ( EncounterMatchGen ! = null )
2017-04-27 05:05:32 +00:00
// Generation 1 can have different minimum level in different encounter of the same species; update valid level moves
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
UptateGen1LevelUpMoves ( EncounterMoves , EncounterMoves . minLvlG1 , EncounterMatchGen . Generation ) ;
2017-04-05 05:01:48 +00:00
res = pre3DS
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
? parseMovesPre3DS ( game , EncounterMoves . validLevelUpMoves , EncounterMoves . validTMHMMoves , EncounterMoves . validTutorMoves , Moves )
: parseMoves3DS ( game , EncounterMoves . validLevelUpMoves , EncounterMoves . validTMHMMoves , EncounterMoves . validTutorMoves , Moves ) ;
2017-04-05 05:01:48 +00:00
if ( res . All ( x = > x . Valid ) )
break ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
2017-04-27 05:05:32 +00:00
if ( EncounterMatchGen ? . Generation = = 1 ) // not valid, restore generation 1 moves
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
EncounterMoves . validLevelUpMoves [ 1 ] = defaultG1LevelMoves ;
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
pkm . TradebackStatus = defaultTradeback ;
2017-04-05 05:01:48 +00:00
}
return res ;
}
2017-04-27 05:05:32 +00:00
private CheckResult [ ] parseMovesNoEncounters ( )
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
{
EncounterSpecies = pkm . Species ;
var validLevelMoves = Legal . getValidMovesAllGens ( pkm , EvoChainsAllGens , minLvLG1 : 1 , Tutor : false , Machine : false , RemoveTransferHM : false ) ;
var validTMHM = Legal . getValidMovesAllGens ( pkm , EvoChainsAllGens , LVL : false , Tutor : false , MoveReminder : false , RemoveTransferHM : false ) ;
var validTutor = Legal . getValidMovesAllGens ( pkm , EvoChainsAllGens , LVL : false , Machine : false , MoveReminder : false , RemoveTransferHM : false ) ;
Legal . RemoveFutureMoves ( pkm , ref validLevelMoves , ref validTMHM , ref validTutor ) ;
var empty = Legal . GetEmptyMovesList ( EvoChainsAllGens ) ;
var emptyegg = Legal . GetEmptyEggMovesList ( ) ;
return parseMoves ( pkm . Moves , validLevelMoves , pkm . RelearnMoves , validTMHM , validTutor , new int [ 0 ] , emptyegg , emptyegg , empty , new int [ 0 ] , new int [ 0 ] , false ) ;
}
private CheckResult [ ] parseMovesForSmeargle ( int [ ] Moves )
2017-04-05 05:01:48 +00:00
{
if ( ! pkm . IsEgg )
return parseMovesSketch ( Moves ) ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var validLevelMoves = Legal . getValidMovesAllGens ( pkm , EvoChainsAllGens , minLvLG1 : 1 , Tutor : false , Machine : false , RemoveTransferHM : false ) ;
2017-04-05 05:01:48 +00:00
// can only know sketch as egg
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 empty = Legal . GetEmptyMovesList ( EvoChainsAllGens ) ;
var emptyegg = Legal . GetEmptyEggMovesList ( ) ;
return parseMoves ( pkm . Moves , validLevelMoves , new int [ 0 ] , empty , empty , new int [ 0 ] , emptyegg , emptyegg , empty , new int [ 0 ] , new int [ 0 ] , false ) ;
2017-04-05 05:01:48 +00:00
}
2017-03-26 17:17:30 +00:00
private GameVersion [ ] getBaseMovesIsEggGames ( )
2017-03-25 17:24:56 +00:00
{
2017-03-26 17:17:30 +00:00
GameVersion [ ] Games = { } ;
2017-03-25 17:24:56 +00:00
switch ( pkm . GenNumber )
{
2017-03-26 02:57:38 +00:00
case 1 :
case 2 :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . GS , GameVersion . C } ;
break ;
2017-03-25 17:24:56 +00:00
case 3 :
2017-04-01 18:32:59 +00:00
switch ( ( GameVersion ) pkm . Version )
2017-03-26 13:39:09 +00:00
{
case GameVersion . R :
case GameVersion . S :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . RS } ;
break ;
2017-03-26 13:39:09 +00:00
case GameVersion . E :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . E } ;
break ;
2017-03-26 13:39:09 +00:00
case GameVersion . FR :
case GameVersion . LG :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . FRLG } ;
break ;
2017-03-26 13:39:09 +00:00
}
2017-03-25 17:24:56 +00:00
break ;
case 4 :
2017-03-26 13:39:09 +00:00
switch ( ( GameVersion ) pkm . Version )
{
case GameVersion . D :
case GameVersion . P :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . DP } ;
break ;
2017-03-26 13:39:09 +00:00
case GameVersion . Pt :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . Pt } ;
break ;
2017-03-26 13:39:09 +00:00
case GameVersion . HG :
case GameVersion . SS :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . HGSS } ;
break ;
2017-03-26 13:39:09 +00:00
}
2017-03-25 17:24:56 +00:00
break ;
case 5 :
2017-03-26 13:39:09 +00:00
switch ( ( GameVersion ) pkm . Version )
{
case GameVersion . B :
case GameVersion . W :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . BW } ;
break ;
case GameVersion . Pt :
Games = new [ ] { GameVersion . Pt } ;
break ;
2017-03-26 13:39:09 +00:00
case GameVersion . B2 :
case GameVersion . W2 :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . B2W2 } ;
break ;
2017-03-26 13:39:09 +00:00
}
2017-03-25 17:24:56 +00:00
break ;
}
2017-03-26 17:17:30 +00:00
return Games ;
2017-03-26 13:39:09 +00:00
}
2017-04-01 16:45:13 +00:00
private CheckResult [ ] parseMovesIsEggPreRelearn ( int [ ] Moves , int [ ] SpecialMoves , bool allowinherited )
2017-03-26 13:39:09 +00:00
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
2017-03-27 02:10:31 +00:00
var ValidSpecialMoves = SpecialMoves . Where ( m = > m ! = 0 ) . ToList ( ) ;
2017-03-26 13:39:09 +00:00
// Some games can have different egg movepools. Have to check all situations.
2017-03-26 17:17:30 +00:00
GameVersion [ ] Games = getBaseMovesIsEggGames ( ) ;
2017-03-26 13:39:09 +00:00
int splitctr = Legal . getSplitBreedGeneration ( pkm ) . Contains ( pkm . Species ) ? 1 : 0 ;
2017-03-26 17:17:30 +00:00
foreach ( var ver in Games )
2017-03-25 17:24:56 +00:00
{
2017-03-26 17:17:30 +00:00
for ( int i = 0 ; i < = splitctr ; i + + )
2017-03-26 16:29:50 +00:00
{
2017-04-13 15:48:13 +00:00
var baseSpecies = Legal . getBaseEggSpecies ( pkm , i ) ;
2017-04-04 02:59:29 +00:00
if ( baseSpecies ! = pkm . Species )
continue ;
2017-03-26 17:17:30 +00:00
var baseEggMoves = Legal . getBaseEggMoves ( pkm , i , ver , pkm . GenNumber < 4 ? 5 : 1 ) ? . ToList ( ) ? ? new List < int > ( ) ;
2017-03-27 02:10:31 +00:00
var InheritedLvlMoves = Legal . getBaseEggMoves ( pkm , i , ver , 100 ) ? . ToList ( ) ? ? new List < int > ( ) ;
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
var EggMoves = Legal . getEggMoves ( pkm , i , ver ) ? . ToList ( ) ? ? new List < int > ( ) ;
2017-03-27 02:10:31 +00:00
var InheritedTutorMoves = ver = = GameVersion . C ? Legal . getTutorMoves ( pkm , pkm . Species , pkm . AltForm , false , 2 ) ? . ToList ( ) : new List < int > ( ) ;
2017-03-26 17:17:30 +00:00
// Only TM Hm moves from the source game of the egg, not any other games from the same generation
2017-03-27 02:10:31 +00:00
var InheritedTMHMMoves = Legal . getTMHM ( pkm , pkm . Species , pkm . AltForm , pkm . GenNumber , ver , false ) ? . ToList ( ) ;
InheritedLvlMoves . RemoveAll ( x = > baseEggMoves . Contains ( x ) ) ;
2017-03-26 17:17:30 +00:00
if ( pkm . Format > 2 | | SpecialMoves . Any ( ) )
{
// For gen 2 is not possible to difference normal eggs from event eggs
// If there is no special moves assume normal egg
res = verifyPreRelearnEggBase ( Moves , baseEggMoves , EggMoves , InheritedLvlMoves , InheritedTMHMMoves , InheritedTutorMoves , ValidSpecialMoves , allowinherited , ver ) ;
if ( res . All ( r = > r . Valid ) ) // moves is satisfactory
return res ;
}
2017-03-27 02:10:31 +00:00
if ( pkm . Format ! = 2 )
continue ;
// For gen 2 if does not match special egg check for normal egg too
res = verifyPreRelearnEggBase ( Moves , baseEggMoves , EggMoves , InheritedLvlMoves , InheritedTMHMMoves , InheritedTutorMoves , new List < int > ( ) , true , ver ) ;
if ( res . All ( r = > r . Valid ) ) // moves are satisfactory
return res ;
2017-03-25 17:24:56 +00:00
}
}
2017-04-05 05:01:48 +00:00
for ( int i = 0 ; i < 4 ; i + + )
if ( res [ i ] = = null )
res [ i ] = new CheckResult ( Severity . Invalid , V176 , CheckIdentifier . Move ) ;
2017-03-25 17:24:56 +00:00
return res ;
}
2017-04-01 16:45:13 +00:00
private CheckResult [ ] parseMovesWasEggPreRelearn ( int [ ] Moves , List < int > [ ] validLevelMoves , List < int > [ ] validTMHM , List < int > [ ] validTutor )
2017-03-26 15:20:55 +00:00
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
// Some games can have different egg movepools. Have to check all situations.
GameVersion [ ] Games = { } ;
2017-04-11 01:20:58 +00:00
int gen = pkm . GenNumber ;
switch ( gen )
2017-03-26 15:20:55 +00:00
{
case 1 :
case 2 :
2017-03-26 17:17:30 +00:00
Games = new [ ] { GameVersion . GS , GameVersion . C } ;
2017-03-26 15:20:55 +00:00
break ;
case 3 : // Generation 3 does not overwrite source game after pokemon hatched
2017-03-26 17:17:30 +00:00
Games = getBaseMovesIsEggGames ( ) ;
2017-03-26 15:20:55 +00:00
break ;
case 4 :
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
Games = new [ ] { GameVersion . HGSS } ;
2017-03-26 15:20:55 +00:00
break ;
case 5 :
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
Games = new [ ] { GameVersion . B2W2 } ;
2017-03-26 15:20:55 +00:00
break ;
}
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
var issplitbreed = Legal . getSplitBreedGeneration ( pkm ) . Contains ( pkm . Species ) ;
2017-03-26 15:20:55 +00:00
foreach ( var ver in Games )
{
2017-04-07 00:41:25 +00:00
var EventEggMoves = ( EncounterMatch as IMoveset ) ? . Moves ? ? new int [ 0 ] ;
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 BaseLvlMoves = 489 < = pkm . Species & & pkm . Species < = 490 ? 1 : 100 ;
var LvlupEggMoves = Legal . getBaseEggMoves ( pkm , ver , BaseLvlMoves ) ;
// Level up, TMHM or tutor moves exclusive to the incense egg species, like Azurill, incompatible with the non-incense species egg moves
2017-04-23 12:54:52 +00:00
var ExclusiveIncenseMoves = issplitbreed ? Legal . getExclusivePreEvolutionMoves ( pkm , Legal . getBaseEggSpecies ( pkm ) , EvoChainsAllGens , ver ) : null ;
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 EggMoves = Legal . getEggMoves ( pkm , ver ) ;
bool volt = ( gen > 3 | | ver = = GameVersion . E ) & & Legal . LightBall . Contains ( pkm . Species ) ;
var SpecialMoves = volt & & EventEggMoves . Length = = 0 ? new [ ] { 344 } : new int [ 0 ] ; // Volt Tackle for bred Pichu line
2017-04-01 16:45:13 +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
res = parseMoves ( Moves , validLevelMoves , new int [ 0 ] , validTMHM , validTutor , SpecialMoves , LvlupEggMoves , EggMoves , ExclusiveIncenseMoves , EventEggMoves , new int [ 0 ] , issplitbreed ) ;
2017-04-01 16:45:13 +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
if ( res . All ( r = > r . Valid ) ) // moves is satisfactory
return res ;
2017-03-26 15:20:55 +00:00
}
return res ;
}
2017-03-23 06:34:35 +00:00
private CheckResult [ ] parseMovesSketch ( int [ ] Moves )
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
for ( int i = 0 ; i < 4 ; i + + )
res [ i ] = Legal . InvalidSketch . Contains ( Moves [ i ] )
? new CheckResult ( Severity . Invalid , V166 , CheckIdentifier . Move )
: new CheckResult ( CheckIdentifier . Move ) ;
return res ;
}
2017-04-04 02:59:29 +00:00
private CheckResult [ ] parseMoves3DS ( GameVersion game , List < int > [ ] validLevelMoves , List < int > [ ] validTMHM , List < int > [ ] validTutor , int [ ] Moves )
{
2017-04-05 05:01:48 +00:00
if ( EncounterMatch is IMoveset )
return parseMovesSpecialMoveset ( Moves , validLevelMoves , validTMHM , validTutor ) ;
// Everything else
return parseMovesRelearn ( Moves , validLevelMoves , validTMHM , validTutor , 0 , game ) ;
2017-04-04 02:59:29 +00:00
}
2017-04-01 18:32:59 +00:00
private CheckResult [ ] parseMovesPre3DS ( GameVersion game , List < int > [ ] validLevelMoves , List < int > [ ] validTMHM , List < int > [ ] validTutor , int [ ] Moves )
{
if ( pkm . IsEgg )
{
2017-04-07 04:23:08 +00:00
int [ ] SpecialMoves = ( EncounterMatch as IMoveset ) ? . 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
// Gift do not have special moves but also should not have normal egg moves
2017-04-12 03:11:58 +00:00
var allowinherited = SpecialMoves = = null & & ! pkm . WasGiftEgg & & pkm . Species ! = 489 & & pkm . Species ! = 490 ;
2017-04-07 04:23:08 +00:00
return parseMovesIsEggPreRelearn ( Moves , SpecialMoves ? ? new int [ 0 ] , allowinherited ) ;
2017-04-01 18:32: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
if ( pkm . GenNumber < = 2 & & ( EncounterMatch as IGeneration ) ? . Generation = = 1 )
return parseMovesGen1 ( Moves , validLevelMoves , validTMHM , validTutor ) ;
2017-04-01 18:32:59 +00:00
if ( pkm . WasEgg )
return parseMovesWasEggPreRelearn ( Moves , validLevelMoves , validTMHM , validTutor ) ;
2017-04-05 05:01:48 +00:00
return parseMovesSpecialMoveset ( Moves , validLevelMoves , validTMHM , validTutor ) ;
2017-03-23 06:34:35 +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 CheckResult [ ] parseMovesGen1 ( int [ ] Moves , List < int > [ ] validLevelMoves , List < int > [ ] validTMHM , List < int > [ ] validTutor )
{
GameVersion [ ] games = Legal . getGen1GameEncounter ( pkm ) ;
CheckResult [ ] res = new CheckResult [ 4 ] ;
var G1Encounter = ( EncounterMatch as IEncounterable ) ;
if ( G1Encounter = = null )
return parseMovesSpecialMoveset ( Moves , validLevelMoves , validTMHM , validTutor ) ;
var InitialMoves = new int [ 0 ] ;
int [ ] SpecialMoves = ( EncounterMatch as IMoveset ) ? . Moves ? ? new int [ 0 ] ;
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 empty = Legal . GetEmptyMovesList ( EvoChainsAllGens ) ;
var emptyegg = Legal . GetEmptyEggMovesList ( ) ;
foreach ( GameVersion ver in games )
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 VerInitialMoves = Legal . getInitialMovesGBEncounter ( G1Encounter . Species , G1Encounter . LevelMin , ver ) . ToArray ( ) ;
if ( VerInitialMoves . SequenceEqual ( InitialMoves ) )
return res ;
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
res = parseMoves ( Moves , validLevelMoves , new int [ 0 ] , validTMHM , validTutor , SpecialMoves , emptyegg , emptyegg , empty , new int [ 0 ] , VerInitialMoves , false ) ;
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 ( res . All ( r = > r . Valid ) )
return res ;
InitialMoves = VerInitialMoves ;
}
return res ;
}
2017-04-05 05:01:48 +00:00
private CheckResult [ ] parseMovesSpecialMoveset ( int [ ] Moves , List < int > [ ] validLevelMoves , List < int > [ ] validTMHM , List < int > [ ] validTutor )
2017-04-04 02:59:29 +00:00
{
2017-04-05 05:01:48 +00:00
int [ ] RelearnMoves = pkm . GenNumber > = 6 ? pkm . RelearnMoves : new int [ 0 ] ;
var mg = EncounterMatch as IMoveset ;
int [ ] SpecialMoves = mg ? . Moves ? ? new int [ 0 ] ;
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 empty = Legal . GetEmptyMovesList ( EvoChainsAllGens ) ;
var emptyegg = Legal . GetEmptyEggMovesList ( ) ;
CheckResult [ ] res = parseMoves ( Moves , validLevelMoves , RelearnMoves , validTMHM , validTutor , SpecialMoves , emptyegg , emptyegg , empty , new int [ 0 ] , new int [ 0 ] , false ) ;
2017-04-05 05:01:48 +00:00
if ( res . Any ( r = > ! r . Valid ) )
2017-04-04 02:59:29 +00:00
return res ;
2017-04-05 05:01:48 +00:00
2017-04-24 00:53:22 +00:00
if ( pkm . GenNumber > = 6 & & EncounterMatch . GetType ( ) . IsSubclassOf ( typeof ( MysteryGift ) ) )
RelearnBase = ( ( MysteryGift ) EncounterMatch ) . RelearnMoves ;
2017-04-04 02:59:29 +00:00
return res ;
}
2017-04-01 16:45:13 +00:00
private CheckResult [ ] parseMovesRelearn ( int [ ] Moves , List < int > [ ] validLevelMoves , List < int > [ ] validTMHM , List < int > [ ] validTutor , int SkipOption , GameVersion game )
{
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 empty = Legal . GetEmptyMovesList ( EvoChainsAllGens ) ;
var emptyegg = Legal . GetEmptyEggMovesList ( ) ;
var issplitbreed = pkm . WasEgg & & Legal . SplitBreed . Contains ( pkm . Species ) ;
var EggMoves = pkm . WasEgg ? Legal . getEggMoves ( pkm , game ) : emptyegg ;
// Level up, TMHM or tutor moves exclusive to the incense egg species, like Azurill, incompatible with the non-incense species egg moves
2017-04-23 12:54:52 +00:00
var ExclusiveIncenseMoves = issplitbreed ? Legal . getExclusivePreEvolutionMoves ( pkm , Legal . getBaseEggSpecies ( pkm ) , EvoChainsAllGens , game ) : empty ;
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
2017-04-01 16:45:13 +00:00
int [ ] RelearnMoves = pkm . RelearnMoves ;
2017-04-05 05:01:48 +00:00
int [ ] SpecialMoves = ( EncounterMatch as IMoveset ) ? . Moves ? ? new int [ 0 ] ;
2017-04-01 16:45:13 +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
CheckResult [ ] res = parseMoves ( Moves , validLevelMoves , RelearnMoves , validTMHM , validTutor , SpecialMoves , emptyegg , EggMoves , ExclusiveIncenseMoves , new int [ 0 ] , new int [ 0 ] , issplitbreed ) ;
2016-03-15 06:54:13 +00:00
2016-03-15 06:26:51 +00:00
for ( int i = 0 ; i < 4 ; i + + )
2017-04-01 16:45:13 +00:00
if ( ( pkm . IsEgg | | res [ i ] . Flag ) & & ! RelearnMoves . Contains ( Moves [ i ] ) )
2017-03-23 06:34:35 +00:00
res [ i ] = new CheckResult ( Severity . Invalid , string . Format ( V170 , res [ i ] . Comment ) , res [ i ] . Identifier ) ;
2016-03-15 06:26:51 +00:00
2016-03-12 17:16:41 +00:00
return res ;
}
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
private CheckResult [ ] parseMoves ( int [ ] moves , List < int > [ ] learn , int [ ] relearn , List < int > [ ] tmhm , List < int > [ ] tutor , int [ ] special , List < int > [ ] lvlupegg , List < int > [ ] egg , List < int > [ ] IncenseExclusiveMoves , int [ ] eventegg , int [ ] initialmoves , bool issplitbreed )
2017-02-13 07:08:39 +00:00
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
2017-03-25 15:41:45 +00:00
var Gen1MovesLearned = new List < int > ( ) ;
var EggMovesLearned = new List < int > ( ) ;
2017-04-07 00:41:25 +00:00
var LvlupEggMovesLearned = new List < int > ( ) ;
2017-03-25 15:41:45 +00:00
var EventEggMovesLearned = new List < int > ( ) ;
2017-03-25 17:19:38 +00:00
var IsGen2Pkm = pkm . Format = = 2 | | pkm . VC2 ;
2017-04-10 00:43:05 +00:00
var required = Legal . getRequiredMoveCount ( pkm , moves , learn , tmhm , tutor , initialmoves ) ;
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 LvlupEggMovesSplitLearned = new List < int > [ egg . Length ] ;
var EggMovesSplitLearned = new List < int > [ egg . Length ] ;
var IncenseMovesLearned = new List < int > ( ) ;
2017-04-15 02:55:40 +00:00
for ( int i = 0 ; i < egg . 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
{
LvlupEggMovesSplitLearned [ i ] = new List < int > ( ) ;
EggMovesSplitLearned [ i ] = new List < int > ( ) ;
}
2017-03-25 15:41:45 +00:00
// Check none moves and relearn moves before generation moves
for ( int m = 0 ; m < 4 ; m + + )
2017-02-13 07:08:39 +00:00
{
2017-03-25 15:41:45 +00:00
if ( moves [ m ] = = 0 )
2017-04-10 00:43:05 +00:00
res [ m ] = new CheckResult ( m < required ? Severity . Invalid : Severity . Valid , V167 , CheckIdentifier . Move ) ;
2017-03-25 15:41:45 +00:00
else if ( relearn . Contains ( moves [ m ] ) )
res [ m ] = new CheckResult ( Severity . Valid , V172 , CheckIdentifier . Move ) { Flag = true } ;
}
2017-03-25 17:19:38 +00:00
if ( res . All ( r = > r ! = null ) )
2017-03-25 15:41:45 +00:00
return res ;
2017-03-25 20:53:33 +00:00
bool MixedGen1NonTradebackGen2 = false ;
2017-03-25 15:41:45 +00:00
// Check moves going backwards, marking the move valid in the most current generation when it can be learned
int [ ] generations = getGenMovesCheckOrder ( pkm ) ;
2017-03-25 20:53:33 +00:00
foreach ( var gen in generations )
2017-03-25 15:41:45 +00:00
{
if ( ! pkm . InhabitedGeneration ( gen ) )
continue ;
2017-03-25 17:19:38 +00:00
var HMLearned = new int [ 0 ] ;
2017-03-25 15:41:45 +00:00
// Check if pokemon knows HM moves from generation 3 and 4 but are not valid yet, that means it cant learn the HMs in future generations
bool KnowDefogWhirlpool = false ;
if ( gen = = 4 & & pkm . Format > 4 )
{
2017-03-25 17:19:38 +00:00
// Copy to array the hm found or else the list will be emptied when the legal status of moves changes in the current generation
HMLearned = moves . Where ( ( m , i ) = > ! ( res [ i ] ? . Valid ? ? false ) & & Legal . HM_4_RemovePokeTransfer . Any ( l = > l = = m ) ) . Select ( ( m , i ) = > i ) . ToArray ( ) ;
2017-03-25 15:41:45 +00:00
// Defog and Whirlpool at the same time, also both can't be learned in future generations or else they will be valid
2017-03-25 17:19:38 +00:00
KnowDefogWhirlpool = moves . Where ( ( m , i ) = > ( m = = 250 | | m = = 432 ) & & ! ( res [ i ] ? . Valid ? ? false ) ) . Count ( ) = = 2 ;
2017-03-25 15:41:45 +00:00
}
else if ( gen = = 3 & & pkm . Format > 3 )
2017-03-25 17:19:38 +00:00
HMLearned = moves . Select ( ( m , i ) = > i ) . Where ( i = > ! ( res [ i ] ? . Valid ? ? false ) & & Legal . HM_3 . Any ( l = > l = = moves [ i ] ) ) . ToArray ( ) ;
2017-03-25 15:41:45 +00:00
2017-03-25 20:53:33 +00:00
bool native = gen = = pkm . Format ;
2017-03-25 15:41:45 +00:00
for ( int m = 0 ; m < 4 ; m + + )
{
if ( res [ m ] ? . Valid ? ? false )
continue ;
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 ( moves [ m ] = = 0 )
continue ;
2017-03-25 15:41:45 +00:00
2017-04-10 00:43:05 +00:00
if ( gen = = 1 & & initialmoves . Contains ( moves [ m ] ) )
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
res [ m ] = new CheckResult ( Severity . Valid , native ? V361 : string . Format ( V362 , gen ) , CheckIdentifier . Move ) ;
else if ( learn [ gen ] . Contains ( moves [ m ] ) )
2017-03-25 20:53:33 +00:00
res [ m ] = new CheckResult ( Severity . Valid , native ? V177 : string . Format ( V330 , gen ) , CheckIdentifier . Move ) ;
2017-03-25 17:19:38 +00:00
else if ( tmhm [ gen ] . Contains ( moves [ m ] ) )
2017-03-25 20:53:33 +00:00
res [ m ] = new CheckResult ( Severity . Valid , native ? V173 : string . Format ( V331 , gen ) , CheckIdentifier . Move ) ;
2017-03-25 17:19:38 +00:00
else if ( tutor [ gen ] . Contains ( moves [ m ] ) )
2017-04-08 16:08:54 +00:00
res [ m ] = new CheckResult ( Severity . Valid , native ? V174 : string . Format ( V332 , gen ) , CheckIdentifier . Move ) ;
2017-03-25 15:41:45 +00:00
else if ( gen = = pkm . GenNumber & & special . Contains ( moves [ m ] ) )
res [ m ] = new CheckResult ( Severity . Valid , V175 , CheckIdentifier . Move ) ;
2017-03-25 20:53:33 +00:00
if ( res [ m ] = = null )
continue ;
2017-04-27 05:05:32 +00:00
// Check for incense exclusive moves; must not be special/event.
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
if ( res [ m ] . Valid & & issplitbreed & & IncenseExclusiveMoves [ gen ] . Contains ( moves [ m ] ) & & ! eventegg . Contains ( moves [ m ] ) & & ! special . Contains ( moves [ m ] ) )
IncenseMovesLearned . Add ( m ) ;
2017-03-25 20:53:33 +00:00
if ( res [ m ] . Valid & & gen = = 1 )
Gen1MovesLearned . Add ( m ) ;
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
if ( res [ m ] . Valid & & gen < = 2 & & pkm . TradebackStatus = = TradebackType . Any & & pkm . GenNumber ! = gen )
pkm . TradebackStatus = TradebackType . WasTradeback ;
2017-03-25 15:41:45 +00:00
}
2017-03-25 18:02:33 +00:00
if ( gen = = generations . Last ( ) )
2017-03-25 15:41:45 +00:00
{
2017-04-07 00:41:25 +00:00
// Check higher-level moves after all the moves but just before egg moves to differentiate it from normal level up moves
2017-03-26 15:20:55 +00:00
// Also check if the base egg moves is a non tradeback move
for ( int m = 0 ; m < 4 ; m + + )
{
2017-04-07 00:41:25 +00:00
if ( res [ m ] ? . Valid ? ? false ) // Skip valid move
continue ;
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 ( moves [ m ] = = 0 )
continue ;
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
if ( ! lvlupegg . Any ( e = > e . Contains ( moves [ m ] ) ) ) // Check if contains level-up egg moves from parents
2017-04-01 01:35:43 +00:00
continue ;
if ( IsGen2Pkm & & Gen1MovesLearned . Any ( ) & & moves [ m ] > Legal . MaxMoveID_1 )
2017-03-26 15:20:55 +00:00
{
2017-04-01 01:35:43 +00:00
res [ m ] = new CheckResult ( Severity . Invalid , V334 , CheckIdentifier . Move ) ;
MixedGen1NonTradebackGen2 = true ;
2017-03-26 15:20:55 +00:00
}
2017-04-01 01:35:43 +00:00
else
res [ m ] = new CheckResult ( Severity . Valid , V345 , CheckIdentifier . Move ) ;
2017-04-07 00:41:25 +00:00
LvlupEggMovesLearned . Add ( m ) ;
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
if ( pkm . TradebackStatus = = TradebackType . Any & & pkm . GenNumber = = 1 )
pkm . TradebackStatus = TradebackType . WasTradeback ;
2017-04-15 02:55:40 +00:00
if ( issplitbreed )
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
{
// Only add to split breed lists learned moves that can be from one of the egg species, ignore common moves
if ( lvlupegg [ 0 ] . Contains ( moves [ m ] ) & & ! lvlupegg [ 1 ] . Contains ( moves [ m ] ) )
LvlupEggMovesSplitLearned [ 0 ] . Add ( m ) ;
if ( ! lvlupegg [ 0 ] . Contains ( moves [ m ] ) & & lvlupegg [ 1 ] . Contains ( moves [ m ] ) )
LvlupEggMovesSplitLearned [ 1 ] . Add ( m ) ;
}
2017-03-26 15:20:55 +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
// Check egg moves after all the generations and all the moves, every move that can't be learned in another source should have preference
2017-03-25 15:41:45 +00:00
// the moves that can only be learned from egg moves should in the future check if the move combinations can be breed in gens 2 to 5
for ( int m = 0 ; m < 4 ; m + + )
{
if ( res [ m ] ? . Valid ? ? false )
continue ;
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 ( moves [ m ] = = 0 )
continue ;
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
if ( egg . Any ( e = > e . Contains ( moves [ m ] ) ) )
2017-03-25 15:41:45 +00:00
{
2017-03-25 17:19:38 +00:00
if ( IsGen2Pkm & & Gen1MovesLearned . Any ( ) & & moves [ m ] > Legal . MaxMoveID_1 )
2017-03-25 15:41:45 +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
// To learn exclusive generation 1 moves the pokemon was tradeback, but it can't be trade to generation 1
2017-03-25 15:41:45 +00:00
// without removing moves above MaxMoveID_1, egg moves above MaxMoveID_1 and gen 1 moves are incompatible
res [ m ] = new CheckResult ( Severity . Invalid , V334 , CheckIdentifier . Move ) { Flag = true } ;
MixedGen1NonTradebackGen2 = true ;
}
else
res [ m ] = new CheckResult ( Severity . Valid , V171 , CheckIdentifier . Move ) { Flag = true } ;
EggMovesLearned . Add ( m ) ;
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
if ( pkm . TradebackStatus = = TradebackType . Any & & pkm . GenNumber = = 1 )
pkm . TradebackStatus = TradebackType . WasTradeback ;
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
if ( issplitbreed )
{
// Only add to split breed lists egg moves that can be from one of the egg species, ignore common moves
if ( egg [ 0 ] . Contains ( moves [ m ] ) & & ! egg [ 1 ] . Contains ( moves [ m ] ) )
EggMovesSplitLearned [ 0 ] . Add ( m ) ;
if ( ! egg [ 0 ] . Contains ( moves [ m ] ) & & egg [ 1 ] . Contains ( moves [ m ] ) )
EggMovesSplitLearned [ 1 ] . Add ( m ) ;
}
2017-03-25 15:41:45 +00:00
}
2017-03-25 20:53:33 +00:00
if ( ! eventegg . Contains ( moves [ m ] ) )
continue ;
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
if ( ! egg . Any ( e = > e . Contains ( moves [ m ] ) ) )
2017-03-25 15:41:45 +00:00
{
2017-03-25 20:53:33 +00:00
if ( IsGen2Pkm & & Gen1MovesLearned . Any ( ) & & moves [ m ] > Legal . MaxMoveID_1 )
2017-03-25 15:41:45 +00:00
{
2017-03-25 20:53:33 +00:00
res [ m ] = new CheckResult ( Severity . Invalid , V334 , CheckIdentifier . Move ) { Flag = true } ;
MixedGen1NonTradebackGen2 = true ;
2017-03-25 15:41:45 +00:00
}
2017-03-25 20:53:33 +00:00
else
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
res [ m ] = new CheckResult ( Severity . Valid , V333 , CheckIdentifier . Move ) { Flag = true } ;
2017-03-25 15:41:45 +00:00
}
Encounter Type fix and detection of pokemon that should have evolve on trade (#1105)
* Detect encounter trades that evolve on trade and have not been evolved
Detect generation 1 pokemon with special catch rates : krabby trade and Pokemon Stadium
Detect generation 1 pokemon that evolve on trade and have been traded but not evolved
Detect pokemon with tradeback status any but with only encounters from the other GB generation, that means they are WasTradeback
Detect pokemon with moves from the other GB generation, change tradebackstatus to WasTradeback
* Fix dppt surfing and fishing encounter type, is is surfing because the battle background is the same as other surfingfishing encounters
Fix headbutt encounter type, the encounter type depends on the battle background used when battle a pokemon, for headbutt it changes with the player tile, is the player is in a city it will be building encounter, in a grass tile tall grass, in water it is surfingfishing and cave inside a cave. Some locations have more than one possible encounter type, for example routes with trees near the grass, near the water and near non-combat tiles.
Also added slot type headbutt special for the special trees, those trees are all in routes and are only adjacent to non-combat tiles
* Fix encounter type for missing areas with multiple grass encounters types: Mt Coronet, Mt Silver Cave and Stark Mountain (Issue # 1095)
* Fixes and typos
* Check for non-japanese e-reader pokemon, is unreleased
2017-05-01 15:07:20 +00:00
if ( pkm . TradebackStatus = = TradebackType . Any & & pkm . GenNumber = = 1 )
pkm . TradebackStatus = TradebackType . WasTradeback ;
2017-03-25 20:53:33 +00:00
EventEggMovesLearned . Add ( m ) ;
2017-03-25 15:41:45 +00:00
}
2017-03-25 17:19:38 +00:00
// A pokemon could have normal egg moves and regular egg moves
// Only if all regular egg moves are event egg moves or all event egg moves are regular egg moves
2017-04-07 00:41:25 +00:00
var RegularEggMovesLearned = EggMovesLearned . Union ( LvlupEggMovesLearned ) . 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
if ( RegularEggMovesLearned . Any ( ) & & EventEggMovesLearned . Any ( ) )
2017-03-25 15:41:45 +00:00
{
2017-03-25 17:19:38 +00:00
// Moves that are egg moves or event egg moves but not both
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
var IncompatibleEggMoves = RegularEggMovesLearned . Except ( EventEggMovesLearned ) . Union ( EventEggMovesLearned . Except ( RegularEggMovesLearned ) ) . ToList ( ) ;
2017-03-25 17:19:38 +00:00
if ( IncompatibleEggMoves . Any ( ) )
2017-03-25 15:41:45 +00:00
{
2017-03-25 17:19:38 +00:00
foreach ( int m in IncompatibleEggMoves )
{
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 ( EventEggMovesLearned . Contains ( m ) & & ! EggMovesLearned . Contains ( m ) )
2017-03-25 17:19:38 +00:00
res [ m ] = new CheckResult ( Severity . Invalid , V337 , CheckIdentifier . Move ) ;
else if ( ! EventEggMovesLearned . Contains ( m ) & & EggMovesLearned . Contains ( m ) )
res [ m ] = new CheckResult ( Severity . Invalid , V336 , CheckIdentifier . Move ) ;
2017-04-07 00:41:25 +00:00
else if ( ! EventEggMovesLearned . Contains ( m ) & & LvlupEggMovesLearned . Contains ( m ) )
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
res [ m ] = new CheckResult ( Severity . Invalid , V358 , CheckIdentifier . Move ) ;
2017-03-25 17:19:38 +00:00
}
2017-03-25 15:41:45 +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
// If there is no incompatibility with event egg check that there is no inherited move in gift eggs and event eggs
else if ( RegularEggMovesLearned . Any ( ) & & ( pkm . WasGiftEgg | | pkm . WasEventEgg ) )
{
foreach ( int m in RegularEggMovesLearned )
{
2017-04-15 02:55:40 +00:00
if ( EggMovesLearned . Contains ( m ) )
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
res [ m ] = new CheckResult ( Severity . Invalid , pkm . WasGiftEgg ? V377 : V341 , CheckIdentifier . Move ) ;
else if ( LvlupEggMovesLearned . Contains ( m ) )
res [ m ] = new CheckResult ( Severity . Invalid , pkm . WasGiftEgg ? V378 : V347 , CheckIdentifier . Move ) ;
}
}
else if ( issplitbreed )
{
// If there is no error in previous checks now check for incompatibility moves between split breed species
if ( ( EggMovesSplitLearned [ 0 ] . Any ( ) | | IncenseMovesLearned . Any ( ) ) & & EggMovesSplitLearned [ 1 ] . Any ( ) )
{
var species = specieslist ;
2017-04-15 02:55:40 +00:00
var splitbreedspecies0 = species [ Legal . getBaseEggSpecies ( pkm ) ] ; // 0
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 splitbreedspecies1 = species [ Legal . getBaseEggSpecies ( pkm , 1 ) ] ;
foreach ( int m in EggMovesSplitLearned [ 0 ] )
// Example: Azurill Egg move, incompatible with Marill egg moves
res [ m ] = new CheckResult ( Severity . Invalid , string . Format ( V375 , splitbreedspecies0 , splitbreedspecies1 ) , CheckIdentifier . Move ) ;
foreach ( int m in EggMovesSplitLearned [ 1 ] )
// Example: Marill Egg move, incompatible with Azurill egg moves
res [ m ] = new CheckResult ( Severity . Invalid , string . Format ( V375 , splitbreedspecies1 , splitbreedspecies0 ) , CheckIdentifier . Move ) ;
foreach ( int m in IncenseMovesLearned )
// Example: Azurill levelup/tmhm/tutor move, incompatible with Marill egg moves
res [ m ] = new CheckResult ( Severity . Invalid , string . Format ( V376 , splitbreedspecies0 , splitbreedspecies1 ) , CheckIdentifier . Move ) ;
}
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
else if ( EncounterMatch = = null & & ! EggMovesSplitLearned [ 0 ] . Any ( ) & & ! IncenseMovesLearned . Any ( ) )
{
// Day care egg with no incense species exclusive moves, we can assume non-incense egg, that means there is no need to check if evolution from incense species is valid
EncounterSpecies = Legal . getBaseEggSpecies ( pkm , 1 ) ;
}
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
}
2017-03-25 15:41:45 +00:00
}
2017-03-25 17:19:38 +00:00
if ( 3 < = gen & & gen < = 4 & & pkm . Format > gen )
2017-03-25 15:41:45 +00:00
{
// After all the moves from the generations 3 and 4,
// including egg moves if is the origin generation because some hidden moves are also special egg moves in gen 3
// Check if the marked hidden moves that were invalid at the start are now marked as valid, that means
// the hidden move was learned in gen 3 or 4 but was not removed when transfer to 4 or 5
if ( KnowDefogWhirlpool )
2017-04-01 01:35:43 +00:00
{
int invalidCount = moves . Where ( ( m , i ) = > ( m = = 250 | | m = = 432 ) & & ( res [ i ] ? . Valid ? ? false ) ) . Count ( ) ;
if ( invalidCount = = 2 ) // can't know both at the same time
for ( int i = 0 ; i < 4 ; i + + ) // flag both moves
if ( moves [ i ] = = 250 | | moves [ i ] = = 432 )
res [ i ] = new CheckResult ( Severity . Invalid , V338 , CheckIdentifier . Move ) ;
}
2017-03-25 15:41:45 +00:00
2017-04-01 01:35:43 +00:00
for ( int i = 0 ; i < HMLearned . Length ; i + + )
if ( res [ i ] ? . Valid ? ? false )
res [ i ] = new CheckResult ( Severity . Invalid , string . Format ( V339 , gen , gen + 1 ) , CheckIdentifier . Move ) ;
2017-03-25 15:41:45 +00:00
}
// Mark the gen 1 exclusive moves as illegal because the pokemon also have Non tradeback egg moves.
if ( MixedGen1NonTradebackGen2 )
foreach ( int m in Gen1MovesLearned )
res [ m ] = new CheckResult ( Severity . Invalid , V335 , CheckIdentifier . Move ) ;
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
if ( gen = = 1 & & pkm . Format = = 1 & & pkm . Gen1_NotTradeback )
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
{
// Check moves learned at the same level in red/blue and yellow, illegal because there is no move reminder
// Only two incompatibilites and only there are no illegal combination if generation 2 or 7 are included in the analysis
ParseRedYellowIncompatibleMoves ( moves , ref res ) ;
ParseEvolutionsIncompatibleMoves ( moves , tmhm [ 1 ] , ref res ) ;
}
2017-04-23 12:54:52 +00:00
if ( Legal . EvolutionWithMove . Contains ( pkm . Species ) )
{
// Pokemon that evolved by leveling up while learning a specific move
// This pokemon could only have 3 moves from preevolutions that are not the move used to evolved
// including special and eggs moves before realearn generations
ParseEvolutionLevelupMove ( moves , EggMovesSplitLearned , IncenseMovesLearned , ref res ) ;
}
2017-03-25 17:19:38 +00:00
if ( res . All ( r = > r ! = null ) )
2017-03-25 15:41:45 +00:00
return res ;
}
Generation 1 and 2 legal Improvements (#1099)
* Refactor parseMovesForEncounter to gather valid moves for species encounter, some Pokemon can have valid encounters with different source species from the encounter, the valid moves change if the encounter species change because some preevolutions moves are illegal if pokemon caught already evolved.
Example, generation 1 Pikachu that can have a RBY Pikachu encounter and GSC Pichu encounter, the valid moves for the first encounters should not have any Pichu exclusive evolution moves
Also assign the encounter match from gb when parsing moves like the variable Encounter Match, to store the encounter that is valid for the pokemon moves instead the first encounter.
Store the species encounter, this will be needed to check if the evolution is valid for species that evolve leveling with a given learned move
* Add Tradeback Status to the pokemon, this variable for generations 1 and 2 use data like the catch rate to determine if trade between generations 1 and 2 was possible.
If analysis is for VC games tradeback have value NotTradeback for every gen 1 pokemon, but for cart saves some pokemon can be determine that have not been tradeback, if catch rate match species catch rate but do not match a valid generation 2 held item that means the pokemon habe been never traded to generation 2 games, that allow to discart encounters and moves from generation 2.
Also if is not tradeback catch rate is used to filter encounters, catch rate determine in what species was captured the pokemon discarting some preevolutions moves
Also add option for generation 1 cart save analysis to check legal status not allowing generation 2 games, like VC games but with Stadium allowed, like the generation 1 non tradeback rules from Smogon
Also change evolution chains to included generation 2 preevolutions for gen 1 pokemon if tradeback was possible, it is needed to avoid parsemoves to check illegal pokemon like Hitmonchan with Tyrogue level up moves
* Check legal values of generation 1 type and catch rate
Replace pokemon catch rate after changind pokemon species always if pokemon was not tradeback from generation 2, the catch rate will keep unchanged only if it can be a held item and do not match species catch rate (default item)
Also if catch rate is changed use base species catch rate to avoid legal errors if the catch rate of the evolution species if is not possible with the current moves
* Filter ingame trades and static encounters with catch rate for generation 1 non tradeback
* Fix min moves for generation 1 metapod encounter
* Clean up
* Fix encounter level for generation 1, valid moves are those with one level after the encounter level, pokemon can not learn a new move until level up
Clean up type validation
Fix generation 3 fatefull encounter eggs, the pokemon lost the fatefull mark when it hatch
* Clean-up
* Use new variable EncounterSpecies when it is needed to detect the species of the encounter, the old code wont work if the encounter is a wild slots array
* Fix generation 1 evolution chains and catch rate as default held item
* Fix Generation 1 Yellow Pikachu and Kadabra catch rates
2017-04-27 04:27:59 +00:00
if ( pkm . Species = = 292 & & EncounterSpecies ! = 292 )
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-12 03:11:58 +00:00
// Ignore Shedinja if the Encounter was also a Shedinja, assume null Encounter as a Nincada egg
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
// Check Shedinja evolved moves from Ninjask after egg moves
// Those moves could also be inherited egg moves
ParseShedinjaEvolveMoves ( moves , ref res ) ;
}
2017-03-25 15:41:45 +00:00
for ( int m = 0 ; m < 4 ; m + + )
{
if ( res [ m ] = = null )
res [ m ] = new CheckResult ( Severity . Invalid , V176 , CheckIdentifier . Move ) ;
2017-02-13 07:08:39 +00:00
}
return res ;
}
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 void ParseRedYellowIncompatibleMoves ( int [ ] moves , ref CheckResult [ ] res )
{
var incompatible = new List < int > ( ) ;
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
if ( pkm . Species = = 134 & & pkm . CurrentLevel < 47 & & moves . Contains ( 151 ) )
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
{
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
// Vaporeon in Yellow learn Mist and Haze at level 42, Mist only if level up in day-care
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
// Vaporeon in Red Blue learn Acid Armor at level 42 and level 47 in Yellow
if ( moves . Contains ( 54 ) )
incompatible . Add ( 54 ) ;
if ( moves . Contains ( 114 ) )
incompatible . Add ( 114 ) ;
2017-04-10 00:43:05 +00:00
if ( incompatible . 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
incompatible . Add ( 151 ) ;
}
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
if ( pkm . Species = = 136 & & pkm . CurrentLevel < 47 & & moves . Contains ( 43 ) & & moves . Contains ( 123 ) )
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
{
// Flareon in Yellow learn Smog at level 42
// Flareon in Red Blue learn Leer at level 42 and level 47 in Yellow
incompatible . Add ( 43 ) ;
incompatible . Add ( 123 ) ;
}
2017-04-10 00:43:05 +00:00
for ( int m = 0 ; m < 4 ; m + + )
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 ( incompatible . Contains ( moves [ m ] ) )
res [ m ] = new CheckResult ( Severity . Invalid , V363 , CheckIdentifier . Move ) ;
}
}
private void ParseEvolutionsIncompatibleMoves ( int [ ] moves , List < int > tmhm , ref CheckResult [ ] res )
{
2017-04-10 00:43:05 +00:00
var species = specieslist ;
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 currentspecies = species [ pkm . Species ] ;
var previousspecies = string . Empty ;
var incompatible_previous = new List < int > ( ) ;
var incompatible_current = new List < int > ( ) ;
if ( pkm . Species = = 34 & & moves . Contains ( 31 ) & & moves . Contains ( 37 ) )
{
// Nidoking learns Thrash at level 23
// Nidorino learns Fury Attack at level 36, Nidoran♂ at level 30
// Other moves are either learned by Nidoran♂ up to level 23 or by TM
incompatible_current . Add ( 31 ) ;
incompatible_previous . Add ( 37 ) ;
previousspecies = species [ 33 ] ;
}
if ( pkm . Species = = 103 & & moves . Contains ( 23 ) & & moves . Any ( m = > Legal . G1Exeggcute_IncompatibleMoves . Contains ( moves [ m ] ) ) )
{
// Exeggutor learns stomp at level 28
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
// Exeggcute learns Stun Spore at 32, PoisonPowder at 37 and Sleep Powder at 48
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
incompatible_current . Add ( 23 ) ;
incompatible_previous . AddRange ( Legal . G1Exeggcute_IncompatibleMoves ) ;
previousspecies = species [ 103 ] ;
}
if ( 134 < = pkm . Species & & pkm . Species < = 136 )
{
previousspecies = species [ 133 ] ;
var ExclusiveMoves = Legal . getExclusiveMoves ( 133 , pkm . Species , 1 , tmhm , moves ) ;
var EeveeLevels = Legal . getMinLevelLearnMove ( 133 , 1 , ExclusiveMoves [ 0 ] ) ;
var EvoLevels = Legal . getMaxLevelLearnMove ( pkm . Species , 1 , ExclusiveMoves [ 1 ] ) ;
for ( int i = 0 ; i < ExclusiveMoves [ 0 ] . Count ; i + + )
{
// There is a evolution move with a lower level that current eevee move
if ( EvoLevels . Any ( ev = > ev < EeveeLevels [ i ] ) )
incompatible_previous . Add ( ExclusiveMoves [ 0 ] [ i ] ) ;
}
for ( int i = 0 ; i < ExclusiveMoves [ 1 ] . Count ; i + + )
{
// There is a eevee move with a greather level that current evolution move
if ( EeveeLevels . Any ( ev = > ev > EvoLevels [ i ] ) )
incompatible_current . Add ( ExclusiveMoves [ 1 ] [ i ] ) ;
}
}
for ( int m = 0 ; m < 4 ; m + + )
{
if ( incompatible_current . Contains ( moves [ m ] ) )
2017-04-10 00:43:05 +00:00
res [ m ] = new CheckResult ( Severity . Invalid , string . Format ( V365 , currentspecies , previousspecies ) , CheckIdentifier . Move ) ;
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 ( incompatible_previous . Contains ( moves [ m ] ) )
res [ m ] = new CheckResult ( Severity . Invalid , string . Format ( V366 , currentspecies , previousspecies ) , CheckIdentifier . Move ) ;
}
}
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
private void ParseShedinjaEvolveMoves ( int [ ] moves , ref CheckResult [ ] res )
{
List < int > [ ] ShedinjaEvoMoves = Legal . getShedinjaEvolveMoves ( pkm ) ;
var ShedinjaEvoMovesLearned = new List < int > ( ) ;
2017-04-10 23:47:08 +00:00
for ( int gen = Math . Min ( pkm . Format , 4 ) ; gen > = 3 ; gen - - )
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
{
bool native = gen = = pkm . Format ;
for ( int m = 0 ; m < 4 ; m + + )
{
if ( res [ m ] ? . Valid ? ? false )
continue ;
2017-04-01 01:35:43 +00:00
if ( ! ShedinjaEvoMoves [ gen ] . Contains ( moves [ m ] ) )
continue ;
res [ m ] = new CheckResult ( Severity . Valid , native ? V355 : string . Format ( V356 , gen ) , CheckIdentifier . Move ) ;
ShedinjaEvoMovesLearned . Add ( m ) ;
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
if ( ShedinjaEvoMovesLearned . Count < = 1 )
return ;
foreach ( int m in ShedinjaEvoMovesLearned )
res [ m ] = new CheckResult ( Severity . Invalid , V357 , CheckIdentifier . Move ) ;
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-23 12:54:52 +00:00
private void ParseEvolutionLevelupMove ( int [ ] moves , List < int > [ ] EggMovesSplitLearned , List < int > IncenseMovesLearned , ref CheckResult [ ] res )
{
// Ignore if there is an invalid move or an empty move, this validtion is only for 4 non-empty moves that are all valid, but invalid as a 4 combination
// Ignore Mr.Mime and Sodowodoo from generations 1 to 3, they cant be evolved from Bonsly or Munchlax
2017-04-27 05:05:32 +00:00
// Ignore if encounter species is the evolution species, the pokemon was not evolved by the player
if ( ! res . All ( r = > r ? . Valid ? ? false ) | | moves . Any ( m = > m = = 0 ) | |
( Legal . BabyEvolutionWithMove . Contains ( pkm . Species ) & & pkm . GenNumber < = 3 ) | |
EncounterSpecies = = pkm . Species )
2017-04-23 12:54:52 +00:00
return ;
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-27 05:05:32 +00:00
// Mr.Mime and Sodowodoo from eggs that does not have any exclusive egg move or level up move from Mime Jr or Bonsly.
// The egg can be assumed to be a non-incense egg if the pokemon was not evolved by the player
if ( EncounterMatch = = null & & pkm . WasEgg & & Legal . BabyEvolutionWithMove . Contains ( pkm . Species ) & &
! IncenseMovesLearned . Any ( ) & & ! EggMovesSplitLearned [ 0 ] . Any ( ) )
2017-04-23 12:54:52 +00:00
return ;
2017-04-23 14:46:14 +00:00
var ValidMoves = Legal . getValidPostEvolutionMoves ( pkm , pkm . Species , EvoChainsAllGens , GameVersion . Any ) ;
2017-04-23 12:54:52 +00:00
// Add the evolution moves to valid moves in case some of this moves could not be learned after evolving
2017-04-27 05:05:32 +00:00
switch ( pkm . Species )
2017-04-23 12:54:52 +00:00
{
case 122 : // Mr. Mime (Mime Jr with Mimic)
case 185 : // Sudowoodo (Bonsly with Mimic)
ValidMoves . Add ( 102 ) ;
break ;
case 424 : // Ambipom (Aipom with Double Hit)
ValidMoves . Add ( 458 ) ;
break ;
case 463 : // Lickilicky (Lickitung with Rollout)
ValidMoves . Add ( 205 ) ;
break ;
case 465 : // Tangrowth (Tangela with Ancient Power)
case 469 : // Yanmega (Yamma with Ancient Power)
case 473 : // Mamoswine (Piloswine with Ancient Power)
ValidMoves . Add ( 246 ) ;
break ;
case 700 : // Sylveon (Eevee with Fairy Move)
// Add every fairy moves without cheking if eevee learn it or not, pokemon moves are determined legal before this function
ValidMoves . AddRange ( Legal . FairyMoves ) ;
break ;
case 763 : // Tsareena (Steenee with Stomp)
2017-04-27 05:05:32 +00:00
ValidMoves . Add ( 023 ) ;
2017-04-23 12:54:52 +00:00
break ;
}
2017-04-27 05:05:32 +00:00
if ( moves . Any ( m = > ValidMoves . Contains ( m ) ) )
return ;
for ( int m = 0 ; m < 4 ; m + + )
res [ m ] = new CheckResult ( Severity . Invalid , string . Format ( V385 , specieslist [ pkm . Species ] ) , CheckIdentifier . Move ) ;
2017-04-23 12:54:52 +00:00
}
2017-03-25 17:24:56 +00:00
private void verifyPreRelearn ( )
{
// For origins prior to relearn moves, need to try to match a mystery gift if applicable.
if ( pkm . WasEvent | | pkm . WasEventEgg )
{
EventGiftMatch = new List < MysteryGift > ( Legal . getValidGifts ( pkm ) ) ;
EncounterMatch = EventGiftMatch . FirstOrDefault ( ) ;
}
}
2016-10-23 19:48:49 +00:00
private CheckResult [ ] verifyRelearn ( )
2016-03-12 17:16:41 +00:00
{
2016-03-29 05:30:23 +00:00
RelearnBase = null ;
2017-03-23 06:34:35 +00:00
2017-01-27 05:35:26 +00:00
if ( pkm . GenNumber < 6 | | pkm . VC1 )
2017-03-23 06:34:35 +00:00
return verifyRelearnNone ( ) ;
2016-10-24 05:03:19 +00:00
2016-10-23 19:48:49 +00:00
if ( pkm . WasLink )
2017-03-23 06:34:35 +00:00
return verifyRelearnLink ( ) ;
if ( pkm . WasEvent | | pkm . WasEventEgg )
return verifyRelearnMysteryGift ( ) ;
2016-03-23 02:47:13 +00:00
2017-03-23 06:34:35 +00:00
if ( pkm . WasEgg & & ! Legal . NoHatchFromEgg . Contains ( pkm . Species ) )
return verifyRelearnEgg ( ) ;
if ( pkm . RelearnMove1 ! = 0 & & Legal . getDexNavValid ( pkm ) )
return verifyRelearnDexNav ( ) ;
return verifyRelearnNone ( ) ;
}
private CheckResult [ ] verifyRelearnMysteryGift ( )
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
int [ ] RelearnMoves = pkm . RelearnMoves ;
// Get gifts that match
EventGiftMatch = new List < MysteryGift > ( Legal . getValidGifts ( pkm ) ) ;
foreach ( MysteryGift mg in EventGiftMatch . ToArray ( ) )
{
int [ ] moves = mg . RelearnMoves ;
2016-03-12 17:16:41 +00:00
for ( int i = 0 ; i < 4 ; i + + )
2017-03-23 06:34:35 +00:00
res [ i ] = moves [ i ] ! = RelearnMoves [ i ]
2017-03-21 07:18:38 +00:00
? new CheckResult ( Severity . Invalid , string . Format ( V178 , movelist [ moves [ i ] ] ) , CheckIdentifier . RelearnMove )
2016-10-23 19:48:49 +00:00
: new CheckResult ( CheckIdentifier . RelearnMove ) ;
2017-03-23 06:34:35 +00:00
if ( res . Any ( r = > ! r . Valid ) )
EventGiftMatch . Remove ( mg ) ;
2016-03-12 17:16:41 +00:00
}
2017-03-23 06:34:35 +00:00
if ( EventGiftMatch . Count > 1 )
return res ;
if ( EventGiftMatch . Count = = 1 )
2016-03-12 17:16:41 +00:00
{
2017-03-23 06:34:35 +00:00
EncounterMatch = EventGiftMatch [ 0 ] ;
RelearnBase = EventGiftMatch [ 0 ] . RelearnMoves ;
return res ;
}
// No gift match, thus no relearn moves
2017-04-22 20:04:12 +00:00
EncounterMatch = Type = null ;
2017-03-23 06:34:35 +00:00
return verifyRelearnNone ( ) ;
}
private CheckResult [ ] verifyRelearnDexNav ( )
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
int [ ] RelearnMoves = pkm . RelearnMoves ;
2016-04-16 18:35:16 +00:00
2017-03-23 06:34:35 +00:00
// DexNav Pokémon can have 1 random egg move as a relearn move.
res [ 0 ] = ! Legal . getValidRelearn ( pkm , 0 ) . Contains ( RelearnMoves [ 0 ] )
? new CheckResult ( Severity . Invalid , V183 , CheckIdentifier . RelearnMove )
: new CheckResult ( CheckIdentifier . RelearnMove ) ;
// All other relearn moves must be empty.
for ( int i = 1 ; i < 4 ; i + + )
res [ i ] = RelearnMoves [ i ] ! = 0
? new CheckResult ( Severity . Invalid , V184 , CheckIdentifier . RelearnMove )
: new CheckResult ( CheckIdentifier . RelearnMove ) ;
// Update the relearn base moves if the first relearn move is okay.
if ( res [ 0 ] . Valid )
RelearnBase = new [ ] { RelearnMoves [ 0 ] , 0 , 0 , 0 } ;
return res ;
}
private CheckResult [ ] verifyRelearnNone ( )
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
int [ ] RelearnMoves = pkm . RelearnMoves ;
// No relearn moves should be present.
for ( int i = 0 ; i < 4 ; i + + )
res [ i ] = RelearnMoves [ i ] ! = 0
? new CheckResult ( Severity . Invalid , V184 , CheckIdentifier . RelearnMove )
: new CheckResult ( CheckIdentifier . RelearnMove ) ;
return res ;
}
private CheckResult [ ] verifyRelearnLink ( )
{
// The WasLink check indicated that it was from the Pokémon Link
var Link = Legal . getValidLinkGifts ( pkm ) ;
// But no encounter was able to be matched. Abort!
if ( Link = = null )
return verifyRelearnNone ( ) ;
EncounterMatch = Link ;
CheckResult [ ] res = new CheckResult [ 4 ] ;
int [ ] RelearnMoves = pkm . RelearnMoves ;
int [ ] LinkRelearn = ( ( EncounterLink ) EncounterMatch ) . RelearnMoves ;
// Pokémon Link encounters should have their relearn moves match exactly.
RelearnBase = LinkRelearn ;
for ( int i = 0 ; i < 4 ; i + + )
res [ i ] = LinkRelearn [ i ] ! = RelearnMoves [ i ]
? new CheckResult ( Severity . Invalid , string . Format ( V178 , movelist [ LinkRelearn [ i ] ] ) , CheckIdentifier . RelearnMove )
: new CheckResult ( CheckIdentifier . RelearnMove ) ;
return res ;
}
private CheckResult [ ] verifyRelearnEgg ( )
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
int [ ] RelearnMoves = pkm . RelearnMoves ;
// Some games can have different egg movepools. Have to check all situations.
GameVersion [ ] Games = { } ;
switch ( pkm . GenNumber )
{
case 6 :
Games = new [ ] { GameVersion . XY , GameVersion . ORAS } ;
break ;
case 7 :
Games = new [ ] { GameVersion . SM } ;
break ;
2016-03-12 17:16:41 +00:00
}
2017-03-23 06:34:35 +00:00
bool checkAllGames = pkm . WasTradedEgg ;
2017-03-26 13:39:09 +00:00
bool splitBreed = Legal . getSplitBreedGeneration ( pkm ) . Contains ( pkm . Species ) ;
2017-03-23 06:34:35 +00:00
int iterate = ( checkAllGames ? Games . Length : 1 ) * ( splitBreed ? 2 : 1 ) ;
for ( int i = 0 ; i < iterate ; i + + )
2016-03-12 17:16:41 +00:00
{
2017-03-23 06:34:35 +00:00
// Obtain parameters for the Egg's Base Moves
int gameSource = ! checkAllGames ? - 1 : i % iterate / ( splitBreed ? 2 : 1 ) ;
int skipOption = splitBreed & & iterate / 2 < = i ? 1 : 0 ;
GameVersion ver = gameSource = = - 1 ? GameVersion . Any : Games [ gameSource ] ;
2016-10-24 05:03:19 +00:00
2017-03-23 06:34:35 +00:00
// Generate & Analyze compatibility
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
res = verifyRelearnEggBase ( RelearnMoves , skipOption , splitBreed , ver ) ;
2017-03-23 06:34:35 +00:00
if ( res . All ( r = > r . Valid ) ) // egg is satisfactory
break ;
}
2016-03-12 17:16:41 +00:00
2017-03-23 06:34:35 +00:00
verifyNoEmptyDuplicates ( RelearnMoves , res ) ;
return res ;
}
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
private CheckResult [ ] verifyRelearnEggBase ( int [ ] RelearnMoves , int skipOption , bool splitBreed , GameVersion ver )
2017-03-23 06:34:35 +00:00
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
2016-03-12 17:16:41 +00:00
2017-03-23 06:34:35 +00:00
// Obtain level1 moves
2017-03-25 17:24:56 +00:00
List < int > baseMoves = new List < int > ( Legal . getBaseEggMoves ( pkm , skipOption , ver , 1 ) ) ;
2017-03-23 06:34:35 +00:00
int baseCt = baseMoves . Count ;
if ( baseCt > 4 ) baseCt = 4 ;
// Obtain Inherited moves
var inheritMoves = Legal . getValidRelearn ( pkm , skipOption ) . ToList ( ) ;
var inherited = RelearnMoves . Where ( m = > m ! = 0 & & ( ! baseMoves . Contains ( m ) | | inheritMoves . Contains ( m ) ) ) . ToList ( ) ;
int inheritCt = inherited . Count ;
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
// Obtain alternate split breed species inherited move
var splitbreedinvalid = false ;
var skipOption_alt = ! splitBreed ? 0 : skipOption = = 1 ? 0 : 1 ;
var inheritMoves_alt = splitBreed ? Legal . getValidRelearn ( pkm , skipOption_alt ) . ToList ( ) : new List < int > ( ) ;
2017-03-23 06:34:35 +00:00
// Get required amount of base moves
int unique = baseMoves . Concat ( inherited ) . Distinct ( ) . Count ( ) ;
int reqBase = inheritCt = = 4 | | baseCt + inheritCt > 4 ? 4 - inheritCt : baseCt ;
if ( RelearnMoves . Where ( m = > m ! = 0 ) . Count ( ) < Math . Min ( 4 , baseMoves . Count ) )
reqBase = Math . Min ( 4 , unique ) ;
2017-01-10 06:51:11 +00:00
2017-03-23 06:34:35 +00:00
// Check if the required amount of Base Egg Moves are present.
for ( int i = 0 ; i < reqBase ; i + + )
2016-03-12 17:16:41 +00:00
{
2017-03-23 06:34:35 +00:00
if ( baseMoves . Contains ( RelearnMoves [ i ] ) )
res [ i ] = new CheckResult ( Severity . Valid , V179 , CheckIdentifier . RelearnMove ) ;
else
{
// mark remaining base egg moves missing
for ( int z = i ; z < reqBase ; z + + )
res [ z ] = new CheckResult ( Severity . Invalid , V180 , CheckIdentifier . RelearnMove ) ;
2016-03-12 17:16:41 +00:00
2017-03-23 06:34:35 +00:00
// provide the list of suggested base moves for the last required slot
2017-03-25 17:24:56 +00:00
string em = string . Join ( ", " , baseMoves . Select ( m = > m > = movelist . Length ? V190 : movelist [ m ] ) ) ;
2017-03-23 06:34:35 +00:00
res [ reqBase - 1 ] . Comment + = string . Format ( Environment . NewLine + V181 , em ) ;
break ;
}
}
2016-03-12 17:16:41 +00:00
2017-03-23 06:34:35 +00:00
// Non-Base moves that can magically appear in the regular movepool
if ( Legal . LightBall . Contains ( pkm . Species ) )
inheritMoves . Add ( 344 ) ;
// Inherited moves appear after the required base moves.
for ( int i = reqBase ; i < 4 ; i + + )
{
if ( RelearnMoves [ i ] = = 0 ) // empty
res [ i ] = new CheckResult ( Severity . Valid , V167 , CheckIdentifier . RelearnMove ) ;
else if ( inheritMoves . Contains ( RelearnMoves [ i ] ) ) // inherited
res [ i ] = new CheckResult ( Severity . Valid , V172 , CheckIdentifier . RelearnMove ) ;
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 if ( inheritMoves_alt . Contains ( RelearnMoves [ i ] ) ) // inherited
splitbreedinvalid = true ;
2017-03-23 06:34:35 +00:00
else // not inheritable, flag
res [ i ] = new CheckResult ( Severity . Invalid , V182 , CheckIdentifier . RelearnMove ) ;
2016-03-12 17:16:41 +00:00
}
2017-04-15 02:55:40 +00:00
if ( splitbreedinvalid )
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 species = specieslist ;
var splitbreedspecies0 = species [ Legal . getBaseEggSpecies ( pkm , skipOption ) ] ;
var splitbreedspecies1 = species [ Legal . getBaseEggSpecies ( pkm , skipOption_alt ) ] ;
for ( int i = reqBase ; i < 4 ; i + + )
{
if ( inheritMoves . Contains ( RelearnMoves [ i ] ) & & ! inheritMoves_alt . Contains ( RelearnMoves [ i ] ) )
res [ i ] = new CheckResult ( Severity . Invalid , string . Format ( V379 , splitbreedspecies0 , splitbreedspecies1 ) , CheckIdentifier . RelearnMove ) ;
if ( ! inheritMoves . Contains ( RelearnMoves [ i ] ) & & inheritMoves_alt . Contains ( RelearnMoves [ i ] ) )
res [ i ] = new CheckResult ( Severity . Invalid , string . Format ( V379 , splitbreedspecies1 , splitbreedspecies0 ) , CheckIdentifier . RelearnMove ) ;
}
}
2017-03-25 17:24:56 +00:00
RelearnBase = baseMoves . ToArray ( ) ;
2016-03-12 17:16:41 +00:00
return res ;
}
2017-03-23 06:34:35 +00:00
2017-03-26 13:39:09 +00:00
/ * Similar to verifyRelearnEgg but in pre relearn generation is the moves what should match the expected order
but only if the pokemon is inside an egg * /
2017-03-27 02:10:31 +00:00
private CheckResult [ ] verifyPreRelearnEggBase ( int [ ] Moves , List < int > baseMoves , List < int > eggmoves , List < int > lvlmoves , List < int > tmhmmoves , List < int > tutormoves , List < int > specialmoves , bool AllowInherited , GameVersion ver )
2017-03-26 13:39:09 +00:00
{
CheckResult [ ] res = new CheckResult [ 4 ] ;
// Obtain level1 moves
2017-03-26 15:07:36 +00:00
int baseCt = baseMoves . Count ;
2017-03-26 13:39:09 +00:00
if ( baseCt > 4 ) baseCt = 4 ;
// Obtain Inherited moves
2017-03-26 15:07:36 +00:00
var inherited = Moves . Where ( m = > m ! = 0 & & ( ! baseMoves . Contains ( m ) | | specialmoves . Contains ( m ) | | eggmoves . Contains ( m ) | | lvlmoves . Contains ( m ) | | tmhmmoves . Contains ( m ) | | tutormoves . Contains ( m ) ) ) . ToList ( ) ;
int inheritCt = inherited . Count ;
2017-03-26 13:39:09 +00:00
// Get required amount of base moves
int unique = baseMoves . Concat ( inherited ) . Distinct ( ) . Count ( ) ;
int reqBase = inheritCt = = 4 | | baseCt + inheritCt > 4 ? 4 - inheritCt : baseCt ;
2017-03-26 15:07:36 +00:00
if ( Moves . Where ( m = > m ! = 0 ) . Count ( ) < Math . Min ( 4 , baseMoves . Count ) )
2017-03-26 13:39:09 +00:00
reqBase = Math . Min ( 4 , unique ) ;
var em = string . Empty ;
2017-03-26 15:07:36 +00:00
var moveoffset = 0 ;
2017-03-26 13:39:09 +00:00
// Check if the required amount of Base Egg Moves are present.
2017-03-26 15:07:36 +00:00
for ( int i = moveoffset ; i < reqBase ; i + + )
2017-03-26 13:39:09 +00:00
{
if ( baseMoves . Contains ( Moves [ i ] ) )
res [ i ] = new CheckResult ( Severity . Valid , V179 , CheckIdentifier . Move ) ;
2017-03-26 16:05:58 +00:00
else
2017-03-26 13:39:09 +00:00
{
// mark remaining base egg moves missing
for ( int z = i ; z < reqBase ; z + + )
res [ z ] = new CheckResult ( Severity . Invalid , V180 , CheckIdentifier . Move ) ;
// provide the list of suggested base moves for the last required slot
em = string . Join ( ", " , baseMoves . Select ( m = > m > = movelist . Length ? V190 : movelist [ m ] ) ) ;
break ;
}
}
2017-03-26 15:07:36 +00:00
moveoffset + = reqBase ;
2017-03-26 13:39:09 +00:00
// Check also if the required amount of Special Egg Moves are present, ir are after base moves
2017-03-27 02:10:31 +00:00
for ( int i = moveoffset ; i < moveoffset + specialmoves . Count ; i + + )
2017-03-26 13:39:09 +00:00
{
if ( specialmoves . Contains ( Moves [ i ] ) )
res [ i ] = new CheckResult ( Severity . Valid , V333 , CheckIdentifier . Move ) ;
else
{
// mark remaining special egg moves missing
2017-03-27 02:10:31 +00:00
for ( int z = i ; z < moveoffset + specialmoves . Count ; z + + )
2017-03-26 13:39:09 +00:00
res [ z ] = new CheckResult ( Severity . Invalid , V342 , CheckIdentifier . Move ) ;
2017-04-10 00:43:05 +00:00
// provide the list of suggested base moves and species moves for the last required slot
if ( ! string . IsNullOrEmpty ( em ) ) em + = ", " ;
2017-03-26 16:05:58 +00:00
else
2017-04-10 00:43:05 +00:00
em = string . Join ( ", " , baseMoves . Select ( m = > m > = movelist . Length ? V190 : movelist [ m ] ) ) + ", " ;
2017-03-26 16:05:58 +00:00
em + = string . Join ( ", " , specialmoves . Select ( m = > m > = movelist . Length ? V190 : movelist [ m ] ) ) ;
2017-03-26 13:39:09 +00:00
break ;
}
}
2017-04-10 00:43:05 +00:00
if ( ! string . IsNullOrEmpty ( em ) )
2017-03-26 16:05:58 +00:00
res [ reqBase > 0 ? reqBase - 1 : 0 ] . Comment = string . Format ( Environment . NewLine + V343 , em ) ;
2017-03-26 13:39:09 +00:00
// Non-Base moves that can magically appear in the regular movepool
2017-04-10 00:43:05 +00:00
if ( pkm . GenNumber > = 3 & & Legal . LightBall . Contains ( pkm . Species ) )
2017-03-26 13:39:09 +00:00
eggmoves . Add ( 344 ) ;
// Inherited moves appear after the required base moves.
2017-03-26 15:07:36 +00:00
var AllowInheritedSeverity = AllowInherited ? Severity . Valid : Severity . Invalid ;
2017-03-27 02:10:31 +00:00
for ( int i = reqBase + specialmoves . Count ; i < 4 ; i + + )
2017-03-26 13:39:09 +00:00
{
if ( Moves [ i ] = = 0 ) // empty
res [ i ] = new CheckResult ( Severity . Valid , V167 , CheckIdentifier . Move ) ;
2017-03-26 15:07:36 +00:00
else if ( eggmoves . Contains ( Moves [ i ] ) ) // inherited egg move
res [ i ] = new CheckResult ( AllowInheritedSeverity , AllowInherited ? V344 : V341 , CheckIdentifier . Move ) ;
else if ( lvlmoves . Contains ( Moves [ i ] ) ) // inherited lvl moves
res [ i ] = new CheckResult ( AllowInheritedSeverity , AllowInherited ? V345 : V347 , CheckIdentifier . Move ) ;
else if ( tmhmmoves . Contains ( Moves [ i ] ) ) // inherited TMHM moves
res [ i ] = new CheckResult ( AllowInheritedSeverity , AllowInherited ? V349 : V350 , CheckIdentifier . Move ) ;
else if ( tutormoves . Contains ( Moves [ i ] ) ) // inherited tutor moves
res [ i ] = new CheckResult ( AllowInheritedSeverity , AllowInherited ? V346 : V348 , CheckIdentifier . Move ) ;
2017-03-26 13:39:09 +00:00
else // not inheritable, flag
res [ i ] = new CheckResult ( Severity . Invalid , V340 , CheckIdentifier . Move ) ;
}
return res ;
}
2017-03-23 06:34:35 +00:00
private void verifyNoEmptyDuplicates ( int [ ] Moves , CheckResult [ ] res )
{
bool emptySlot = false ;
for ( int i = 0 ; i < 4 ; i + + )
{
if ( Moves [ i ] = = 0 )
emptySlot = true ;
else if ( emptySlot )
res [ i ] = new CheckResult ( Severity . Invalid , V167 , res [ i ] . Identifier ) ;
else if ( Moves . Count ( m = > m = = Moves [ i ] ) > 1 )
res [ i ] = new CheckResult ( Severity . Invalid , V168 , res [ i ] . Identifier ) ;
}
}
2017-04-07 00:41:25 +00:00
#endregion
2017-01-08 07:54:09 +00:00
public static string [ ] movelist = Util . getMovesList ( "en" ) ;
2017-04-10 00:43:05 +00:00
public static string [ ] specieslist = Util . getMovesList ( "en" ) ;
2016-03-26 03:39:31 +00:00
private static readonly string [ ] EventRibName =
2016-03-23 02:47:13 +00:00
{
"Country" , "National" , "Earth" , "World" , "Classic" ,
"Premier" , "Event" , "Birthday" , "Special" , "Souvenir" ,
"Wishing" , "Battle Champ" , "Regional Champ" , "National Champ" , "World Champ"
} ;
2017-03-25 23:38:40 +00:00
/// <summary>
/// Converts a Check result Severity determination (Valid/Invalid/etc) to the localized string.
/// </summary>
/// <param name="s"><see cref="Severity"/> value to convert to string.</param>
/// <returns>Localized <see cref="string"/>.</returns>
private static string getString ( Severity s )
{
switch ( s )
{
case Severity . Indeterminate : return V500 ;
case Severity . Invalid : return V501 ;
case Severity . Fishy : return V502 ;
case Severity . Valid : return V503 ;
default : return V504 ;
}
}
2016-03-11 04:36:32 +00:00
}
}