Commit graph

2391 commits

Author SHA1 Message Date
Kurt
2cd1a29b76 Fix platinum turnback giratina
if ko'd in the distortion world, it'll return to turnback cave; uses the
same encountertype as DP.

Closes #1156, Thanks @iKamus !
2017-05-27 21:20:13 -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
pokecal
1bb891a8a3 fix BW2 checksum offset
ExportSAV without changes will become export same data.
2017-05-28 11:01:27 +09:00
pokecal
0cae317770 add EventFlags resources BW
I recently noticed that some activation use TID/SID,
I will re-check past resources that have abnormal value(e.g.AzureFlute),
after researching BW2,Pt.
2017-05-26 19:17:28 +09:00
Kurt
113001f280 Temp gen2 met location filter bypass
#978
crystal location data => no location values to compare to
2017-05-23 22:38:21 -07:00
Kurt
be80a6b9da Fix HGSS wallpaper get/set & editing
the special wallpaper values are +0x10 (ie 0x20, 0x21... instead of
0x10, 0x11) from the contiguous sequence of regular box wallpaper IDs
(anti cheat probing?).

Xor tweak allows for single invert method; use this invert with the base
implementation's method.

Range check for setting the box wallpaper (just in case). The underlying
error was fixed; the 255 val was reading from the wrong offset (now
fixed).

Thanks Scarfy!

https://projectpokemon.org/forums/files/file/1-pkhex/?do=findComment&comment=344
2017-05-23 21:38:15 -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
b8a799f7ed Fix gender ratio comparison
http://bulbapedia.bulbagarden.net/wiki/Personality_value#Gender
For a Pokémon with a 50/50 male/female gender ratio, there is actually a
129/256 (50.390625%) chance for the Pokémon to be male and 127/256
(49.609375%) chance for the Pokémon to be female.

remove unnecessary parameter passing

#1163
2017-05-23 18:48:16 -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
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
wwwwwwzx
13be5201b1 Several minor fixes and update Chinese translation 2017-05-19 22:05:08 -07:00
Kurt
63b3c8b020 Fix gen1/2 moves with 40 pp given 3 ppups
cap is 61:
http://bulbapedia.bulbagarden.net/wiki/Power_Point#Base_value_alteration

cap forced maximum at 63
2017-05-19 09:22:12 -07:00
Kurt
483998d930 Change gen4 (egg) met location setter
Closes #1135
clear both if zero
set value to dp location if a valid dp location, else set faraway place
set value to pthgss location if originated from pthgss
2017-05-18 22:40:38 -07:00
pokecal
ea33a2cb77 add EventFlags resources HGSS
Fix DP for consistency.
(now all DP&HGSS flag/const position number is same as in game used)
Checked with HG. SS not checked. (Groudon flag unknown)
2017-05-19 11:21:27 +09:00
Kurt
84d901f647 Simplify PID gender checking
don't have multiple locations where comparisons are done, just generate
the gender and compare
only fetch gender once from getter
2017-05-18 19:16:11 -07:00
Kurt
3d498c6a1e Fix BATREV saves converting mystery gifts
OT field needed for gift string get/set. Other values unnecessary for
basic function.
#1151
2017-05-18 17:51:08 -07:00
Kurt
933bee7778 Ignore memory restriction for past gen same OT xfrs
Closes #1145
2017-05-18 17:38:26 -07:00
Kurt
72865bbfe9 Add recursive shadow lock check template
nowhere near complete/functional, just getting out of src control until
more effort is exerted on this topic
2017-05-18 17:36:43 -07:00
Kurt
845d64cbc6 Add mystery gift species preference
insert to front of list if the species matches
eevee gift in gen7 has all species at 50 including eevee; not sure if
this strategy is needed for the other formats but just in case.
2017-05-17 22:10:19 -07:00
Kurt
fc676ec648 Flag unparsed pkms
With every format now supported, can flag GameVersion=0 pkm
2017-05-17 21:50:52 -07:00
Kurt
a415ca78df Fix folder location fetch & x/c/bk# extension fetch
Closes #1149
2017-05-17 20:39:10 -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
7d39b70d91 Fix wc7 deletion
shift down logic does not apply for array writes; the setter sets empty
slots to fill all required slots
Closes #1142
2017-05-16 21:29:34 -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
f674d45854 Misc changes
Properly handle egg hatch counters for generated mystery gifts, as well
as HT friendship for gen6+
fetch form specific (friendship doesn't change but abilities fetch
species specific data later, so just fetch once up front). Do not depend
on save file as SAV7 importing PGF may have different abilities
allocated
Pad buttons for folder popup
fix double Japanese/International error message for importing jpk1<->pk1
2017-05-16 20:34:24 -07:00
Kurt
1659405dc4 Add quick folder open menu item
Closes #1137
allows loading of tab separated value text file "savpaths.txt" which can
also be used to 'favorite' locations (ie, the program checks for
duplicate paths and only adds the first).
folder availability checked on form creation

shortcut: press ctrl-F on main window

Thanks @sora10pls !
2017-05-16 16:27:43 -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
404651774a Further simplifications
Gender color display was copypasted everywhere, now just call the gender
color method.
2017-05-13 12:51:33 -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
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
pokecal
d134abcd4a add EventFlags resources DP
This resources include some flags, not all,
that be changed when defeated/captured in game,
but sufficient to repop.
2017-05-13 10:15:13 +09:00
Matt
2b0e7ceb5c Unban Heracronite and Houndoominite 2017-05-12 12:59:51 -04:00
Kurt
d94a1c5efb Add beginnings of encounter slot legality
currently unused code
2017-05-12 09:41:21 -07:00
Kurt
aeb90d262c Cleanup 2017-05-12 09:33:12 -07:00
Kurt
6af17352c9 Update HGSS valid hatch location list
Closes #1119
2017-05-12 08:55:24 -07:00
Evan Dixon
3fa2c98407 Cleanup 2017-05-11 23:58:44 -05:00
Evan Dixon
96e315c035 Fixed missing resource references 2017-05-11 23:40:57 -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