Commit graph

111 commits

Author SHA1 Message Date
Kurt
68aa9aeec9 Relocate encounter data loading to separate files
shifts encounter data from Legal's split tables to individual files for
easier maintenance and initialization. Legal Core's init is so much
simpler now.

fix resource name typo
2017-07-25 00:28:43 -07:00
Kurt
fb9dd6103d Unban daily ribbons for OR/AS
Ribbon Belle at Mauville Hills gives the daily ribbons
Closes #1343
2017-07-21 08:48:35 -07:00
Kurt
2d18440445 Fix wurmple evo gen3/4
yeah it was never the lowest 16 bits as every-internet-source claims.

1D9C9130 silcoon => 3716[8] = cascoon (nope)
#1330 was correct!
2017-07-17 15:58:15 -07:00
Kurt
dc0a43ae8f Handle link gifts without ribbons
Link gifts had the possibility of having all those ribbons (even
Event3), but none were used.
2017-07-14 20:42:51 -07:00
Kurt
f84cab6272 Block bred Ash Greninja
Closes #1329
2017-07-13 21:12:16 -07:00
Kurt
ee29b4a31f Reorder mysterygift 5+ egg generating logic
Closes #1331 where IsEgg was checked before it was set
handle legality cases (set nickname & flag)
2017-07-13 21:05:20 -07:00
Kurt
cb76d51e38 Simplify vc transfer checks
supply met level so the static encounter has a level to work with
instead of 0
Closes #1316

in other areas:
level 48 charizard VC1 transfer changed to mewtwo causes minlvl >
maxlevel, handle instead of throwing exception.
2017-07-09 08:47:17 -07:00
Kurt
60becb6e37 Fix typo
461fb70f90 (commitcomment-22965638)
2017-07-06 22:05:54 -07:00
Kurt
43be0c6e99 Add missing gen4-5 artist ribbon check
allow artist ribbon if any of the gen3 contest ribbons have master rank
2017-07-05 18:42:06 -07:00
Kurt
fd1c7419b1 Set fateful for xd pkm transferred away
Only way to know if it originated in XD is to check the matched
encounter data

Closes #1290
2017-07-04 13:24:18 -07:00
Kurt
1c4a1af633 Misc updates
Detect channel, only detect Channel PIDIV for RS origin (only really
care about method1/2/4 being used when it shouldn't)
Channel does this weird thing called not setting the met level.

Refactor set suggested met location to a method that can suppress
popups.
2017-06-29 19:32:29 -07:00
Kurt
2546ddfd8e Misc gen3 related updates
detect gen3 event eggs better
2017-06-28 22:09:26 -07:00
Kurt
6a054fa7f5 Fix r2 ribbon checks
Closes #1276
if there's any stragglers just report back in that thread
2017-06-26 22:18:42 -07:00
Kurt
dfb7e144b2 Invert language check for VC origin pkm
There's more languages than English/Japanese :)
Closes #1274
2017-06-26 20:32:05 -07:00
Kurt
19bf8de17c Add gen1/2 EV checks 2017-06-26 20:12:49 -07:00
Kurt
4b1e91677e Fix misc legality issues
Closes #1273
not noted anywhere was encounterstatic pikachu on gen6 (pokewalker->6)
would get flagged.
2017-06-24 17:24:37 -07:00
Kurt
5d6ccdedd2 Fix ribbonset comparison check
Closes #1265
2017-06-22 19:01:31 -07:00
Kurt
427eb268e1 Add ribbonresult class to separate invalid/missing
convert non-egg check to ienumerable iteration too

eventually ribbons will have a separate txt file
(PropertyName\tDisplayName), which will be used for both Legality and
Ribbon Editor.

#1250
2017-06-21 23:12:06 -07:00
Kurt
7a8ce986fa Update ribbonset4 iteration
only enforce none from the only 4/5 set; there's 4 ribbons checked by
any which can be received later on.
#1250
2017-06-21 21:46:20 -07:00
Kurt
a1b66ab11d Tighten met level check with hasoriginal
#1261
2017-06-21 20:47:07 -07:00
Kurt
3c07f1d0e2 Check if encounter is within level range
Can't rely on met level (or minimum) for a precise met level in most
cases.
#1261
#1259
2017-06-21 20:40:22 -07:00
Kurt
9efd49b0bc More egg related check changes
Properly check for actual held item
move unhittable check (verifyMisc isnt called when parsing pk1/pk2;
verifyMiscG1 is)
add egg PP check, add common method to be shared between gen1 checks and
GBA+
#1257
2017-06-21 09:18:33 -07:00
Kurt
966792713c Add egg held item check
no hold pls
#1257
2017-06-20 22:55:05 -07:00
Kurt
8cc3a36708 Add manaphy egg sprite
Closes #1256
2017-06-20 22:19:04 -07:00
Kurt
9b76d9b214 Next round of ribbon checking
Returned messages are slightly misleading since missing/invalid are
mixed together with the static method.

#1250
~322 lines to check ribbons, on top of the interface abstraction... so
much required... kinda understandable as there's over 100 ribbons to
check.
2017-06-20 21:57:03 -07:00
Kurt
1a9da12404 Misc updates
fields->properties, capitalize
fix pkm fields toggle referencing old pkm file, simplify that process
instead of constantly referencing Format
2017-06-20 17:57:23 -07:00
Kurt
6921a2ebee Initial ribbon refactor
remove legality check's use of reflection which checked individual
properties; add interfaces to interact with the ribbons of each PKM
type. With this, every ribbon attribute is accessible via its
corresponding interface (cast)

will have to add checks for individual interfaces as per #1250

I didn't feel like adding much documentation, is pretty straightforward.
Cast a pkm object to the desired ribbon set; if not null, can access
ribbons regardless of pkm format.
2017-06-19 21:43:44 -07:00
Kurt
82c8bc01bd Add gen1-4 EV check for untrained pkm
Rework some checks for eggs, closes #1248

GetEggHatchLevel uses Format instead of Generation; should only be used
on IsEgg=true pkm
2017-06-18 21:13:53 -07:00
Kurt
caa46455a8 Add suspicious OT check
Closes #1246
2017-06-18 16:47:23 -07:00
Kurt
5b4cedf14b Refactoring
Rewrote showdown set exporting to be much clearer, added auto-fixing of
relearn moves when importing showdown set (applies suggested relearn
moves)
Simplified main form loading routine (from ~160 to ~25 by extracting
methods)
2017-06-18 13:02:02 -07:00
Kurt
b5d2db6610 Add shinyleaf/pokeathlon stat legality check
#1236
2017-06-17 22:16:24 -07:00
Kurt
3f38b123a3 Refactoring
mostly renaming things, includes a little bit of added sugar and
splitting methods to simplify the codebase.

all methods are now PascalCase
2017-06-17 18:37:19 -07:00
Kurt
7f318433ed Update gen3 fateful checks
met location FE doesn't propagate to future games, only obedience flag
2017-06-16 21:45:03 -07:00
Kurt
0cb17ccb42 Add c/xd ingame trades
as wc3 as it's the closest structure without creating a new
encountertrade subtype
2017-06-14 21:57:23 -07:00
Kurt
81534c4645 Update gen3 fateful encounter checks
Closes #1230
Colosseum pokemon do not get fateful encounter, all pkm from XD (except
the starters) are fateful.
Add requirement for National ribbon if shadow CK3 is transferred to XK3
and vice versa; actually check for national ribbon during CK3/XK3
(RibbonSet1 interface)
2017-06-14 21:07:42 -07:00
Kurt
2979c4f7ec Misc gen2 fixes
still a few problems left:
surf encounters
roamer met locations
national park encounters
lake of rage all-gyarados encounters (?)

#1221
2017-06-12 22:16:20 -07:00
Kurt
8a4c40908b Enforce met location matching for crystal data
Only while format == 2
improve detection for gen1/2 ingame trades
2017-06-12 18:15:26 -07:00
Kurt
8a1691eb91 Let pkmdb fetch from save backups
Only if compiled in debug; bumps my searchables to 6 figures lol

bulk legality scan yielded one exception (bad CXD pidiv for starters)
bullk sav fetch yielded one exception (unknown type didn't define
SeenFlagOffsets)
2017-06-09 23:13:41 -07:00
Kurt
1f479310da Misc fixes
gen5 N pkm already checked, don't flag SID
mystery gift non-eggs already checked, don't flag SID
add used DNA splicers to b2w2 permitted key item list
fix b2w2 new-altform movesets; kyurem is tricky where the form does not
exist in bw's moveset, so both indexes have to be used.

Closes #1211 , thanks @sora10pls !
2017-06-09 17:52:20 -07:00
Kurt
3580861b0b Add gen7 encountertrade IV/memory checks
gen6 definitely has memories tho, they're probably varied per pkm.
2017-06-08 18:24:34 -07:00
javierhimura
0b1fcbbe6d New legallity checks (#1196)
* Add move source to the check result for current moves, it will be used for analysis of evolution with move to determine how many egg moves had the pokemon and determine if the evolution move could be a egg move that was forgotten

* Verify evolution for species that evolved leveling up with an specific move learned, the evolution must be at least one level after the pokemon could legally learn the move or one level after transfer to the first generation where it can evolve

* Check to detect traded unevolved Kadabra based in catch rate and moves exclusive from yellow or red/blue
If pokemon have data exclusive from one version but is in another version that means it should be evolved

* Check no tradeback moves for preevolutions, like Pichu exclusive non tradeback moves for a Pikachu, that Pikachu could not have at the same time Pichu gen 2 moves and gen 1 moves because move reminder do not allow to relearn Pichu moves and gen 2 moves must be forgotten to trade into generation 1 games

* Legallity strings for non tradeback checks

* https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_breeding#Passing_moves_down
Eggs only inherit a level up move if both parents know the move, that means genderless and male only moves could not have any level up move as an egg except the base egg moves because Ditto is one parent
Nidoran male and Volbeat excluded because they can breed with Nidoran female and Illusime

* Small check to not search for egg moves in genderless pokemon, generation 2 data include egg moves for Starmie

* Fix female only species

* Stomp is not a possible egg moves of Stanee

* Fix Steenee evolution move, it cant be inherited as an egg
2017-06-06 20:10:05 -07:00
Kurt
99fd2dc72d Add PGF forced shiny check
Moved ability forcing to be above shininess forcing as ability bits
shouldn't be set back after a PID has been forced.
2017-06-03 18:40:44 -07:00
Kurt
4201e10a0e Misc cleanup
Add PCD fixed PID check
improve PID matching for CXD pkm
hide no-pidiv match seed (00000000)
fix matching fateful for wild pokespot pkm
don't generate eggs for c/xd
2017-06-03 15:16:27 -07:00
Kurt
f70bd02d69 Fix wurmple evo lockup
while loop wasn't checking the modified EC value, thus looping forever
standardize usage across core
2017-06-01 18:41:22 -07:00
Kurt
82750de1b8 Add initial gen3 event detection
egg events supported, only some gen3 event distros supported
will eventually flag for PIDIV type mismatching

@kamronbatman
2017-05-29 00:48:25 -07:00
Kurt
9a7dc9998c Misc fixes
Track gen1/2 origin game as well  as generation
fix pk2 gender setting (incorrect bitmask & wasn't set from tabs)
extend female gender check for gen2 to apply to GS encounters -- if met
location is missing, was traded to gen1 which clears gender.
2017-05-28 16:56:51 -07:00
Kurt
e01c8a5786 Misc gen3 related legal check fixes 2017-05-28 15:49:20 -07:00
Kurt
178017b104 Relocate female gender checks
Per discussion in #1170

Revise message descriptions
Gen1 err message now used
2017-05-28 10:35:41 -07:00
javierhimura
5cf870d73f Mark OT Female trainer from Gamecube and VC pokemon as invalid.
Gamecube games and generation 1 games do not have female player character.
Generation 2 is not checked because if the pokemon is in format 2 and have met location data stored that means it was caught in crystal where female player is allowed, checks are not included for generation VC2 pokemon
2017-05-28 16:02:57 +02:00
Kurt
61eaa7774d allow insta-hatch eggs
pelago can drain to 0, will hatch immediately on current gen
im sure there's some ways to force-walk to trip to 0 on prior gens, but
this is such a minor check and has no impact for online play

Thanks @Kirzi !
2017-05-27 22:50:10 -07:00
Kurt
74dbeb5cf6 Cleanup
throw in more c#7 lang sugar to checks

flag invalid hatch cycles (over species max || 0); existing wouldn't
flag for non-static encounters.
2017-05-27 22:40:21 -07:00
Kurt
db2d043199 unroll cxd seed completely
re-letter for clearer order of RNG results, don't unroll 3x to roll
forward 2x (just unroll 1,1 then 1).

Put origin seed in RNG Reporter => frame 1 result
Closes #1169
2017-05-27 22:18:04 -07:00
Kurt
858aa50689 Refactor encounter matching
exercise in deferred execution/state machine, only calculate possible
matches until a sufficiently valid match is obtained. Previous setup
would try to calculate the 'best match' and had band-aid workarounds in
cases where a subsequent check may determine it to be a false match.

There's still more ways to improve speed:
- precalculate relationships for Encounter Slots rather than iterating
over every area
- yielding individual slots instead of an entire area
- group non-egg wondercards by ID in a dict/hashtable for faster
retrieval

reworked some internals:
- EncounterMatch is always an IEncounterable instead of an object, for
easy pattern matching.
- Splitbreed checking is done per encounter and is stored in the
EncounterEgg result
- Encounter validation uses Encounter/Move/RelearnMove/Evolution to
whittle to the final encounter.

As a part of the encounter matching, a lazy peek is used to check if an
invalid encounter should be retained instead of discarded; if another
encounter has not been checked, it'll stop the invalid checks and move
on. If it is the last encounter, no other valid encounters exist so it
will keep the parse for the invalid encounter.

If no encounters are yielded, then there is no encountermatch. An
EncounterInvalid is created to store basic details, and the parse is
carried out.

Breaks some legality checking features for flagging invalid moves in
more detail, but those can be re-added in a separate check (if
splitbreed & any move invalid -> check for other split moves).

Should now be easier to follow the flow & maintain 😄
2017-05-27 21:17:57 -07:00
Kurt
5f94a2e0f4 Update encountertrade ability legality check
check for encountertrade edge case first, then ability capsule

Closes #1163
2017-05-23 20:10:57 -07:00
Kurt
7e30d863b0 Revert dexlevel evotree fetch + re-implement fix
check requireslevelup during evolution validity check, not during tree
generation as movepool fetch treats the 'level' as the max possible
level it was at (not the level it was encountered).

fix dropping pkm from external source causing exception (final return
false caused it to proceed with regular dragdrop operation from source
slot).

#1163
2017-05-23 18:35:32 -07:00
Kurt
933bee7778 Ignore memory restriction for past gen same OT xfrs
Closes #1145
2017-05-18 17:38:26 -07:00
Kurt
58f9e808d7 Invert evo level check comparison
I knew something was odd with this logic...
2017-05-16 22:03:00 -07:00
Kurt
4e1a520b0a Evolution check fixes
Evolution info was not checked for non-eggs; for mystery gifts check
that the level of the evolution is not less than the level of the
matched encounter
fix spacing (cosmetic)
add temp flagging for magnetpull/static slots (will eventually refactor
into something functional that considers a set of slots including
swarm/etc)
2017-05-16 21:09:53 -07:00
Kurt
5ec3521d48 More c#7 shorthand
outs & pattern matching, other simplifications
2017-05-13 10:20:25 -07:00
Kurt
a3e1ec2a82 Flag any cxd origin with bad pidiv 2017-05-13 00:04:04 -07:00
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
Renamed from PKHeX/Legality/Checks.cs (Browse further)