Commit graph

78 commits

Author SHA1 Message Date
Evan Dixon
52c4fbbe97 Converted PKHeX.Core to .Net Standard
Refactored and rearranged things as needed to allow the change
2017-05-11 23:34:18 -05:00
javierhimura
b14ac67c1f 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-26 21:27:59 -07:00
Kurt
dc911351fe Import pk2pk functionality
Exposes reflective conversion capability and sanity checking methods for
use in the class library.
2017-04-23 20:33:17 -07:00
Kurt
6bd2e3b20a Update egg related legality checks for g4
#1078
unhatched -> hatched when checking a hatched egg
faraway check for Pt as well as HGSS.
2017-04-19 21:39:05 -07:00
Kurt
c45a9f0428 Transfer legality for HGSS eggs
Faraway place (3002) can be retained on transfer
2017-04-10 18:46:37 -07:00
Kurt
691493cafe String editing refactor
Move all sanitization operations from PK* and SAV* to PKX; add general
method for fetching a generation specific string
Changes the Text subform editor to show trash bytes when appropriate.
Special characters to be shown can be easily inserted in the future.
2017-04-09 14:06:50 -07:00
wwwwwwzx
ef7ca4f65c Misc legality checks (gen5-7) (#1020)
* Add Flabebe and Pumkaboo altform HA legality check

Fix issue #999
The derived value SpecForm can use for other legality checks

* Add N's pkm and Hidden Grotto shiny legality checks

-fix early return in verifyMisc
-add N's pkm legality check: IVs, OT Name, TID, SID, Shiny
-add Hidden Grotto shiny check

* Fix spelling

* More edge cases for gen6 ball checks

Ban several altform hidden ability with gen3 ball

* Fix gen4 Formcount for altform

Manually fix several bytes (http://i.imgur.com/l0Amuto.png)
2017-04-02 06:39:39 -07:00
Kurt
d54bb72d59 Temp fix egg detection
Egg location should be used to detect if it was an egg; encounter
matching should determine if it is a StaticEncounter gift.
2017-04-01 13:02:37 -07:00
javierhimura
f0e6e96435 parseMoves functions improvement (#1018)
* Add egg locations and gits egg locations for gen 4 and 5
Add WasGiftEgg property and diferenciate from WasEventEgg

* Separate parseMoves Pre Relearn and Post Relearn generations
Separte parseMoves Pre Relearn egg-encounter for non-egg encounters, a gen3 pokemon can be both
Post Relearn IsEgg pokemon should have all moves as relearn moves
parseMovesSketch should not be used for Smeargle inside an egg
WasGiftEgg should not have egg moves

* Fix WasEgg and WasEventEgg functions for Manaphy

* Add gen 5 trade egg location
Check for generation 3 IsEgg if is a gift egg or an event egg that there is a valid encounter for the egg

* Move parseMovesGetGift bellow WasEggPreRelearn. WasEggPreRelearn is already checking for gift encounters, some generation 3 pokemon could be both an egg or an event encounter

* Check for gift egg without valid encounter in verifyEncounterEgg

* Check WasEventEgg without encounter in verifyEncounterEgg
2017-04-01 09:45:13 -07:00
Kurt
13965d2766 gender check update
check gender correctly for transferred species
2017-03-25 00:01:02 -07:00
Kurt
0ba4f9b53f Cleanup
Fix b2w2 tutor tables
fix gen5 recognizing of transferred eggs
fix xml warnings
fix crlf
2017-03-24 18:23:39 -07:00
Kurt
b6c4eab36b Misc legality fixes & improvements
Recognize gen4/5 events
check ability mismatch
check nature mismatch
2017-03-23 21:42:33 -07:00
javierhimura
d7927d80b4 Gen 2 filter encounter location when pokemon have crystal met location to found only in crystal encounters
If the pokemon does not have met location but cant be tradeback to gen 1 games then search only in gold and silver encounters
2017-03-21 01:50:35 +01:00
Kurt
55e8732740 Add gen4 egg loc detection 2017-03-19 23:44:55 -07:00
Kurt
9c4c52eec9 Update egg location/level checks for 3-5
Extracted some reusable parts
2017-03-19 21:36:03 -07:00
Kurt
a099d18c9c Alpha 3-5 legality checking
Incorporates files from #190
Skeleton added for future implementations; currently missing gifts,
encounter info, and the fine tuning that follows.
Basically sets up areas for future implementation... feel free to submit
pull requests filling in the EncounterStatic/EncounterTrade blocks with
the basic info. I'll probably focus on gen5->4->3 in terms of priority.

Encounter slots need to be marked up for encounter slot legality (yay
32bit RNG), and will be used for PIDIV detection too.

XD/C is not in this round of implementation. Pretty much every pkm 3-5
will show up as invalid until this round of dev is finished.
2017-03-18 16:50:34 -07:00
Kurt
a52083ee21 Add hidden power power calculating
Add setter for HPType for gen2 pkm
obviously can mess with gender in gen2

also tweaked gen1/2 IsNicknamed setters to clear nickname, as well as
use the PKX get species name per format rather than doing it within the
class.
2017-03-04 17:19:57 -08:00
Kurt
5c7ef42b54 Update reflection property fetching
Closes #919

Properties fetched would return PKM.cs properties (not declared in XK3
or PK3), such as Hidden Power Type.

The setter for Hidden Power type is unused everywhere, but was called
via reflection on transfer away from xk3/ck3 format. This caused IVs to
be tampered with in most cases.

By only fetching Declared properties (ie, within XK3.cs only), only the
'real' shared properties will be transferred. Extending this to the
batch editor, we can use this Declared-only filtering to grab more pkm
formats. While things are being updated, throw in pk1/pk2/bk4/ck3/xk3
formats to the dropdown.
2017-03-02 21:00:41 -08:00
Kurt
051dba736e Add egg checking for gen2
Delay egg move checking until the end to finish validating moves
2017-02-27 20:57:24 -08:00
Kurt
b2f9bf50ec Minor refactoring
Memories are only set by generation 6 games (bank i/o is a single
memory). Only check for gen6 situations.

Generation=2 and Format=1 is not possible, as for 1/2 it's dependent on
format. Would need to detect encounters for gen2 games to determine what
game it originated from.

Tabs->Spaces
2017-02-20 19:40:50 -08:00
javierhimura
4ccbce5f24 Fix VC2 2017-02-16 12:06:05 +01:00
javierhimura
036449dfa0 Check future gen evolutions in InhabitedGeneration
Return true when format equals generation
2017-02-16 01:33:17 +01:00
javierhimura
3622733ece GenU returns should returns false for VC pokemon 2017-02-15 23:11:01 +01:00
Kurt
0f45adda89 Handle skipped gens
Expand InhabitedGeneration to actually check if it can inhabit
generation instead of if species can exist on generation
misc behavior tweaks
2017-02-15 00:11:12 -08:00
Kurt
749aa97bb3 Tweak gen1+transfer checking
Add stadium exclusives (surfchu / amnesiaduck) which are flagged on gen7
2017-02-13 18:06:01 -08:00
Kurt
578f05cd2e Initial Gen1 legality checks (WIP)
Have only tested pk1 format so far; there's still a few cases that are
unhandled (move discrepancies between games, trade gifts, event mew,
tmhm).

pls no report bugs unless you are very detailed (include WHY it is
wrong).
2017-02-12 17:00:03 -08:00
Kurt
cbccc6a28b Add rby encounters
Includes fishing slots
todo on trades/static encounters; feel free to pull request (look at
tables6/7 for ref).
2017-02-12 09:52:31 -08:00
Kurt
25f6b5259b Refactoring
Add documentation for PKM/PKX, move some code around
2017-02-04 18:27:28 -08:00
Kurt
cadd7342c0 Change pkm date properties to public
Allows direct use for randomization via the Batch Editor
2017-02-04 10:43:18 -08:00
Kurt
40456702a9 Misc tweaks
Fixes marking set #798
sleep deprivation ftw
2017-01-31 19:35:18 -08:00
Kurt
3da9bcd0df update SM dex iterator
#772
sneak in misc changes to PKM.cs, to snazzify HPType calc and to allow
markings to be converted from g7 format to g6
2017-01-29 16:55:35 -08:00
Kurt
e5d9381c58 Add basic VC legality checks
I may use VC and VC1 a little too interchangeably; things would have to
be updated if GSC were ever released anyway. Usage of VC is for generic
stuff while VC1 allows VC2 to slip by.

no shiny mew 🌵
memories + geolocation, gee thanks bank.

Would need to be updated with gen1 legality checking to add moves/finer
encounter details, but this will do for now. Please don't report things
marked 'legal' that have invalid moves/levels.
2017-01-26 21:35:26 -08:00
Kurt
f282711e35 Cleanup
Use S/M met locations for Pokémon GO origin
Changing to VC1 or GO now autofills met location
Un-alphabetize RGBY games and move to end of games list (+go)
Mark unused region names (Kanto string appears twice in text bank 3,
30013 is used)
Move hypertraining stat toggling to pkm object

shift 1->7 logic to repeat less operations
add more 1->7 logic pertaining to memories
add RefreshAbility method (0 based input, not 1/2/4)
2017-01-25 22:51:52 -08:00
Kurt
45367cdce7 Update cleared data legality checks
Add in a few more, a little bit of shuffling
2017-01-25 09:17:20 -08:00
Michael Scire
792f7ce04c WIP PK1 -> PK7 Transfers.
Still needs language/3ds country region
and memories, because I'm not sure how
to do those in the void of a save file
context.
2017-01-25 03:29:38 -08:00
Michael Scire
5a23fda752 Add support for VC/Horohoro game ID markings 2017-01-24 07:12:14 -08:00
Kurt
db5e084ef9 Further refactoring
Move System.Drawing usage out of Core to WinForms, as System.Drawing is
not in .NET Core/Standard. Simple methods to return resource name
strings have been added instead.
2017-01-11 17:55:42 -08:00
Kurt
7da6f1ab1d Cleanup 2017-01-08 00:14:34 -08:00
Kurt
595c7eb4c5 Split winforms to separate project
resources still are associated with winforms, eh
program still runs fine and I've replicated the mono build options. lmk
if this breaks stuff
2017-01-07 23:54:09 -08:00
Kurt
ed47e389d4 Improve supported extension openfiledialog
Existing code supported 3-x, wasn't updated for gen1/2.
Allows gens1/2 to override to their own gen format filter, and allows
gen7 to allow finding of pk1 files (not yet converted).

Noticed the backup would overwrite an existing backup; thus we only back
up if the target file exists AND the backup doesn't already exist.
2017-01-04 22:22:50 -08:00
Kurt
ab7f9d7df1 Refactoring
move origin validity check to pkm class
2017-01-02 22:15:17 -08:00
ReignOfComputer
a5d0ab0fa6 Remove extra bracket in filename when exporting form 2016-12-26 17:49:53 +08:00
Kurt
251dc9c46a Add locked slot indication and write protection
Reinterpreted #637, now utilizing the lock symbol (cropped to 30px
vertical height) to indicate strongly that the slot is locked (which can
only be viewed).
2016-12-15 23:17:17 -08:00
Kurt
f050ab65f5 simplify string interpolation
pretty
2016-12-07 22:57:12 -08:00
Kurt
5627b07e84 Add more memory checks
Mostly gen3-5 checks if they're ever supported; added bad hack check.

Check yer battle videos to expose da haxxers.
2016-12-07 18:28:28 -08:00
Kurt
247864ce8f Reimplement individual mark accessors
#571 alternative
2016-12-03 09:20:53 -08:00
Kurt
92e5076012 Remove individual mark properties
With gen7 using a different marking format, a public general
implementation is not used
Closes #571
2016-12-03 09:09:33 -08:00
Kurt
a60b0a8bca Make currentlevel set public
Can't set via private setter via reflection
Closes #563
2016-12-02 19:53:04 -08:00
Kurt
8d08f291c3 Add private EXP setter
set level will set the correct EXP
Closes #562
2016-12-02 19:33:02 -08:00
Kurt
ae8280bb22 Add form# to dumped pkm
Closes #479
2016-11-23 20:24:01 -08:00