Commit graph

176 commits

Author SHA1 Message Date
Kurt
867c705597 Fix broken gen2 tests
add oddish to the mix
2018-04-01 15:51:55 -07:00
Kurt
ba4c911566 Refactoring & finish eevee test case
generates a legal pk* for every possible encounter; there's likely other
scenarios and more roughness to smooth out, but seems legit for now
2018-03-31 20:37:36 -07:00
Kurt
d03ff147d4 Add template -> pkm method
fix signature if no versions are provided (empty params is [0], not
null)
2018-03-29 21:04:05 -07:00
Kurt
e74e7878cd Lower dragonair encounter level req for trade
https://projectpokemon.org/home/forums/topic/44555-gen2-legality-issue-with-in-game-trade/
Thanks Bumidek !
2018-03-29 08:50:23 -07:00
Kurt
76b4db1477 Add egg converter & test
only tested for gen7 egg->pkm (not to eventual set)

pretty sure a good chunk of the egg generation logic can be pulled out
for reuse in other IEncounterable generators (IEncounterable
extensions?)
2018-03-28 20:40:07 -07:00
Kurt
78616e1ad5 Add showdownset -> pkm encounter fetch test case
Test parsing glaceon, input must equal output
Test generating encounters for a specific version (exists only on Moon)
Test generating encounters for the same version (add handling trainer
data to permit Tutors)

fixes error in VC generations-present fetch which allowed movesets from
generations 3-6 lul
exclude negative/invalid gameversions
2018-03-27 19:45:22 -07:00
Kurt
d1cfdd782e Rework ball / frame check passing
Two checks are performed for Gen 3 & 4:
A: Encounterability (wurmple, ball, ability)
B: RNG Compatibility (frame)

Original code only checked 'A'
Recent code ordered by 'A', but returned anything that matched 'B'. If
'B was not satisfied, an 'A' match would get deferred, allowing for an
eventual B & !A to be returned before a A & !B being returned.

yay bool logic

we want to prefer a RNGFrameMatch as well as a SlotCompatible match
original code (no RNG checks) retrieves with SlotCompatible just fine
recent adding in framematch resulted in deferring compatible if not RNG
frame, yielding !A matches before A & !B

maintain 3 queues (A & B get yielded immediately) to track A!B, !AB, and
!A!B
not necessary to check unown case anymore as it'll fall into the A!B
group. better performant to skip that check in favor of only adding for
fail.

thanks theSlayer!
2018-03-21 20:19:54 -07:00
Kurt
636736c3fa Add g3 safari ball wild deferrals
Pineco is valid but also can be sourced to altering cave
similar for sandslash
Thanks theSlayer!
2018-03-21 17:30:19 -07:00
Kurt
2c4e3358e4 Fix ninjask evo move comparison
https://projectpokemon.org/home/forums/topic/44413-bug-information-about-bug-found-on-the-new-version-180319/
2018-03-18 15:30:19 -07:00
Kurt
9da1913f1b Only check static IVs if original IVs still exist
https://projectpokemon.org/home/forums/topic/44319-bug-vc-mew/
Thanks Davil!
2018-03-09 20:00:13 -08:00
Kurt
76385a6b4a Fix gsc pre-evo species chain filtering
simplify gsc check to do only once

https://projectpokemon.org/home/forums/topic/43278-gen-2-hitmonlee-and-hitmonchan-flagged-as-illegal-if-location-is-mt-mortar-at-level-10/
2018-01-01 13:53:28 -08:00
Kurt
dccad6c2f4 Simplify/fix UnSanitizeString
Species and Nicknamed params were never used; foreign always resulted in
true for cases when it actually mattered.

Filter to the non-fullwidth characters, check the char type (latin base
vs jp/zh/ko) in order to determine if the full/half symbols should be
squished

could be faster replacing char instead of string, so change those

add two test cases for half width & full width string
sanitization/unsanitization
2017-12-28 22:50:32 -08:00
Kurt
24b5cc48ed Fix gb encounter move comparison
don't calc NoMoveReminder for non-gen2 formats, also fix comparisons
(gen1 || gen2&&noRemind)
Closes #1707
2017-12-17 21:26:31 -08:00
Kurt
e8c4cc8fa8 Fix broken crystal origin pkm test
works fine on a crystal save, the test needs this enabled for crystal
origins
2017-12-17 19:42:31 -08:00
Kurt
21c1dde3a7 Fix static encounter gift / egg edge case
extract EncounterStatic match determination; in doing so fixes "lvl" by
passing byval.

Pichu encounters (2) come before the Gift level 25 pikachu, causing lvl
to be dropped to 5. When pikachu comes around, it compares 5==25 -> bad;
pulling out the method and passing byval allows it to be 25 at the start
of every new encounterstatic checked.
2017-12-16 18:24:03 -08:00
Kurt
d3d7d7d50d Add slot level / IsEncounterable beginnings
dynamic level -> calc level
no sweet scent -> proc available (rock smash/fish)

change frame checking in encountergenerator to save which frame it was
found on (unused but possibly later can capture this for output)
2017-11-29 21:31:52 -08:00
Kurt
0bc2ee0938 Skip scatterbug static encounter forme check
closes #1668
add 2/3 pkms provided as test cases (spewpa can be ignored, close
enough. just want an evo & orig).
2017-11-28 19:29:25 -08:00
Kurt
c5b7ebf50a Add egg forme check
all other egg formes that are disallowed are checked later; check for
totems here
Closes #1667
2017-11-27 18:13:54 -08:00
Kurt
9806677d5e EncounterType init update
move MarkEncounterTypeData back above the area size reduction so that
the mark-by-locationID special handling will work
prevent slottype from becoming overwritten if already defined by special
case handling

add examples provided to automated test cases
closes #1648
2017-11-22 07:52:17 -08:00
Kurt
5859daf1d8 Add maxspecies checks for gen7
accesses arrays outside the range for the new USUM species
Closes #1631 , add test case
also adds lycanroc test cases for #1630
2017-11-18 21:50:48 -08:00
Kurt
311e110f6b Block wild dusk rockruff
closes #1627
adds test cases
2017-11-17 20:02:01 -08:00
Kurt
1ea29eb66c Add legality test case setup
hopefully the pathfinding isn't machine sensistive...
2017-11-17 16:00:26 -08:00
Evan Dixon
563d03e51a Merge remote-tracking branch 'origin/master' into f/savedata-checksum-tests 2017-11-13 20:53:58 -06:00
Kurt
9ba5ede81a Fix broken test 2017-11-08 13:30:52 -08:00
Evan Dixon
52a22fbf7d Add more checks to failing test 2017-11-07 19:21:17 -06:00
Evan Dixon
889302fea6 Merge remote-tracking branch 'origin/master' into f/savedata-checksum-tests 2017-11-07 19:07:55 -06:00
Evan Dixon
bb02488c6d Add checksum tests 2017-11-07 19:07:13 -06:00
Kurt
d08bd25b4f always clear memecrypto sig on load
allows verification & resigning to work as intended
reverts to code prior to refactor

b1641772e6 (diff-1681616e650971296aa4b549afadd0eaL116)

cleanup suggestions for tests
2017-11-07 16:57:18 -08:00
Michael Scire
b1641772e6 Refactor Memecrypto API, Add Memecrypto Tests
Refactors the Memecrypto API to improve generalized usage.

Adds unit tests that verify memecrypto works, so that future changes
don't potentially break the code.
2017-11-06 03:24:48 -08:00
Evan Dixon
e0673ea6fc Add basic test for pokemon name retreival 2017-11-01 21:16:14 -05:00
Kurt
c7dfc3d9b0 Cleanup
union / count usages
remove unnecessary stuff
2017-10-06 21:03:23 -07:00
Kurt
6bd0e7ce72 sync remaining
pls revoke my access
2017-10-03 18:20:31 -07:00
Kurt
6611e874c3 more usum prep
species added requires the 'latest personal table' reference to be
USUM's; the other referencs for .SM are fine as there's no possibility
to have a species ID high enough for it to matter.
2017-09-18 22:36:06 -07:00
Kurt
7efd771bf4 Misc refactoring
add docs, move some data fetching to more appropriate class
remove old XP memecrypto support handling, was previously removed due to
net standard/core split
refactor memecrypto to handle multiple save sizes (USUM won't be the
same size save file); placeholder -1 for USUM size
2017-09-16 11:38:58 -07:00
Kurt
c55b3df939 Add nyx antishiny pidiv detection
( ͡° ͜ʖ ͡°)
2017-09-12 00:27:16 -07:00
Kurt
b948f27646 Add wordfilter
#1442
2017-09-05 22:57:45 -07:00
Kurt
b078064e08 Improve xdrng seed search speed
refer to stackexchange links, makes XDRNG PID/IV search so quick (2^3
instead of 2^8 or 2^16; as fast as a gen3 shiny pokemon (2^13=8192 times
as fast as last release)

throw in some auto-inlining to eliminate some overhead in repetitive
search calls
2017-08-05 01:51:29 -07:00
Kurt
fe06309134 Add IV framegap search
Only usable for searching Method 4 IV spreads -> seeds;
1,3's search uses the same approach as the 1,2 search
I took the 1,2 search derivation to iterate for the next step, which
allows us to not know anything about the middle rand bits.

optimize a little bit more, move the pre-loop add to the initialization
stage; moving to the precomputed section pays off after 256 calls to the
method
2017-08-03 21:35:41 -07:00
Kurt
4945744599 Update Pokewalker PID checks
wildeep to the rescue 7y ago

http://www.smogon.com/forums/threads/past-gen-rng-research.61090/page-12#post-2661504

test cases need gender specified as gender is stored in a field (not
directly grabbed from PID)

addresses pokewalker pkms provided in #1377, RoC's PC has a bunch of
hacks ;)
2017-08-01 23:48:35 -07:00
Kurt
2a2f5669e4 Add wc3->pk3 conversion
fixes 10ANIV pikachu having Thunderbolt twice
un-duplicates CHANNEL event data
adds seed->PIDIV generator template for M1/2/4, CXD, Channel, and BACD

improve pkm converter to update nickname of hatched eggs. isn't perfect
(farfetch'd) but works better than before
2017-07-15 18:36:55 -07:00
Kurt
b760509fcb Misc gen3 event updates
Add special ribbon detection (for wc3),
speed up seeds from IVs calc (flip top bit of seed to get the result for
other iteration)
Add a bunch of gen3 event data
2017-07-01 16:50:45 -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
ac16492daa update abilityflip g5mgshiny checks
Closes #1269
Also adds pokewalker PID check (don't think it works correctly but close
enough for now)
2017-06-24 17:24:36 -07:00
Evan Dixon
560f4eab0b Target netstanard1.3 and net46
I recently learned about targetting multiple frameworks in .Net Standard libraries. The main benefit here si taht PKHeX.WinForms and PKHeX.Tests no longer need to carry around the .Net Core DLLs. While it's now an option, I encourage PKHeX.Core to avoid framework-specific compiler directives.
2017-06-24 08:12:35 -05: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
11b2dc35d7 Refactor main form into smaller pieces
pkm editor, sav editor, menus, and a manager to glue the storage slots
together
decouples the pkm/sav editors from a static savefile reference.

improves dragdrop/click view/set/delete indication, hides unavailable
contextmenuitems, and fixes a few incorrect references. Box Subviewer
slots now have all the indication/events that the main save editor slots
have.

pls report behavior bugs 👍
2017-05-22 21:55:12 -07:00
Kurt
d29acfb171 Add encounter slot checking
Frame list now can be queried for encounter slot matches
2017-05-14 23:21:34 -07:00
Kurt
6c6b3ae4b6 Refactoring
Add in frametype, rename classes for more coherent structure
2017-05-14 14:42:18 -07:00
Kurt
9380ca25d9 Update current RNG frame detection methods
Still not hooked in or handling every case, but is enough progress for
now.
2017-05-14 12:42:27 -07:00
Kurt
5ec3521d48 More c#7 shorthand
outs & pattern matching, other simplifications
2017-05-13 10:20:25 -07:00
Kurt
a70a4d5e3f Switch to c# 7 get/set expressions
Add gen5 battle box locked flags
no functional change otherwise, just shorter
2017-05-12 20:32:43 -07:00
Evan Dixon
23f2c9dcaa Add missing package for MemeCrypto in .Net Framework
Closes #1123
2017-05-12 12:16:11 -05:00
Evan Dixon
97afb43abc Added packages to test project 2017-05-11 23:58:24 -05: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
Kurt
f1db88026b Add frlg unown PIDIV type
The modified form-finding routine generates the PID gen halves in the
reverse order like events. Due to possible collisions with event PIDIVs,
only run it for unown (since that's all it applies to); the analyzing of
PIDIVs to find incorrect usages isn't really feasible (collision) for
this one.
#1103
2017-05-01 08:37:23 -07:00
Kurt
ad6a48b7f1 Add gen3 force shiny event PIDIV detection
matches for berry fix zigzagoon

use correct type comparison for checking if national ribbon is to be set
or not; change XDC to CXD for parity with other references
2017-04-30 22:11:51 -07:00
Kurt
0bad6738d4 Add C/XD specific checks
Pokespot: a given PID will satisfy ~37% of the time, flag pokespot
encounters
I can see hatching eggs being a problem, no idea how this would work
2017-04-30 16:53:54 -07:00
Kurt
2a28019ef3 Add gen3 event pidiv detection
includes antishiny mechanism detection, needed 2 new enum values to tag
those.
handle overflow case
2017-04-29 23:18:36 -07:00
Kurt
e814e7291f Add chain shiny and shinyPGF pidiv detection
delete incorrect legality message entry (used a few lines up for super
training flags), is unused.
fix for transferred 8<=xor<16 PIDs in which case the encryption constant
is used (as it is the unmodified PID)
2017-04-29 20:04:54 -07:00
Kurt
82375ca464 Add PIDIV matching
Includes 1 test for each pkm pidiv type, haven't added absolutely every
method possible but it's enough for now
2017-04-29 16:22:32 -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
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
Evan Dixon
da4df453de Added "Any CPU" build configurations
Prefer 32-bit is enabled, so there will be no functional difference from before, except that any of the assemblies can be referenced by a 64-bit process.
2017-02-02 23:41:58 -06:00
Tsunamical
2bfdb72e1b Tests: Use DateTime.UtcNow for test cases
DateTime.UtcNow is considerably faster than DateTime.Now, and since this
value isn't used for actual game purposes, we can take advantage of it.
2017-02-01 10:18:09 -05:00
Kurt
2fb56a99bf Bump .NET to 4.6
Farewell XP support. :godmode:
2017-01-30 20:45:34 -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
Kaphotics
d72db5ae72 MarkByte => MarkValue
Includes marking coloring for main form as well
changes type from byte to int
2016-10-30 19:15:48 -07:00
Kaphotics
ed14ab7436 Add personalinfo references per PKM format
Fix possible hang in pk6/pk7 if country/region is unset (continues
loop).

PersonalInfo references are not to be used when calculating stats (use
the savefile table instead)
2016-10-23 22:01:39 -07:00
Kaphotics
edb4928117 Minor cleanup
Unused usings/references
2016-08-10 19:32:57 -07:00
Evan Dixon
35d4edf85d Fixed crash in DateUtil when Year is 0 2016-08-10 19:54:12 -05:00
Evan Dixon
98c86ddb7a Removed "Any CPU" project and solution configurations 2016-08-10 10:04:41 -05:00
Evan Dixon
a7f2f2e209 Set test platform to x86 to fix a processor type mismatch warning 2016-08-10 09:47:53 -05:00
Evan Dixon
e53fe6e180 Added tests for PKM.EggMetDate 2016-08-10 09:46:38 -05:00
Evan Dixon
17078c8d28 Added test for PKM.MetDate 2016-08-10 09:42:58 -05:00
Evan Dixon
9852c42ca1 Added tests for DateUtil 2016-08-10 09:24:40 -05:00