Commit graph

594 commits

Author SHA1 Message Date
Kurt
99baca5f5e Use min parameter count
PK2 doesn't like getting passed null for the byte[] parameter (rightly
so); don't depend on the src code order having the first constructor
being the one with the least arguments

fix it in pk1/2 so that the first constructor has the least args, anyway
2019-03-16 20:04:44 -07:00
Kurt
8a08d32dff Simplify pkm constructors
remove Identifier param. 99% of the time, identifier is not provided,
resulting in a useless call

end result:
provide 'create new' and 'create from' constructors
2019-03-16 18:41:56 -07:00
Kurt
fb76032a39 Remove unnecessary null checks on constructors 2019-03-16 18:23:50 -07:00
Kurt
5765ce8229 Extract gc version IDs to separate logic 2019-03-16 16:48:38 -07:00
Kurt
ebc7c6ae29 Remove PKX.LCRNG method
Duplicate with RNG.LCRNG
reuse cryptarray for gen5 mysterygift r/w
2019-03-16 16:25:25 -07:00
Kurt
fc10fd3d60 Simplify transfer xor, extract glyph conversion 2019-03-16 16:19:00 -07:00
Kurt
9ca4ef1e09 Move pkx hidden power logic to HiddenPower.cs 2019-03-16 12:07:22 -07:00
Kurt
13a6d16cb9 Relocate checksum/dexform logic 2019-03-16 12:01:21 -07:00
Kurt
174f9758a1
Fix gen1 hm index check
Closes #2266
2019-02-28 10:01:28 -08:00
Kurt
fb818f203d Add gb pp/stat calc test
refer #2265
2019-02-25 17:39:41 -08:00
Russell Jones
2909c4afef
Update _K12.cs 2019-02-26 01:26:19 +00:00
Kurt
30e36579be Misc updates
add more xmldoc
revise some comments for clarity
redo a little bit of logic for perf
rename some methods for better description
2019-02-24 13:57:10 -08:00
Kurt
52dd2d6701 Misc tweaks
replace linq for Encrypt/Decrypt pkmdata fetch with faster length check
& optional resize (Span pls!?)
update pk6 comment for why affection is not cleared
2019-02-23 16:05:01 -08:00
Kurt
d792c0d3a0 use u/L
use 'u' to denote uint values, so that less IL ops are required
~(21->17) in the case of IVs
no functional change, just a fun exercise looking at generated IL and
finding ways to use less ops
2019-02-23 15:36:26 -08:00
Kurt
17f954b4e8 Xmldoc
Reorder to match parameter order
add more xmldoc
2019-02-23 14:57:35 -08:00
Kurt
a339cc9289 Extract pouch manipulation logic
add overloads for API syntactic sugar
make ItemConverter internal again
2019-02-22 22:48:34 -08:00
Kurt
05ba7c519c Misc simplifications
removed duplicate sorting GUI logic
extract grid fetch method
2019-02-21 23:17:50 -08:00
Kurt
df94afa711 Misc updates
extract some enums to core, use Enum.GetNames to do string fetch
make stamp listbox taller
clean up Display*ID setters
2019-02-21 21:54:41 -08:00
Kurt
c9e894a46d Misc reductions
hide setters for LegalInfo outside assembly (shouldn't overwrite the
stored values)
update GenNumber to Gen* if appropriate; GenNumber checks for first Gen*
to match, is a little more explicit and quicker than calling twice when
checking a range
2019-02-21 20:41:04 -08:00
Kurt
f30b2766cb Use Heal methods 2019-02-20 22:16:38 -08:00
Kurt
941b1b5c47 Extract some reused logic
Put the methods in Tables4; kinda breaks the 'only arrays here' rule but
they only reference values in this file(partial class).
2019-02-20 22:10:15 -08:00
Kurt
1b221e052c Add PP Heal method 2019-02-20 22:08:28 -08:00
Kurt
d1f6a5a3ff Misc clean
no functional change
2019-02-15 11:46:46 -08:00
Kurt
c67b774e1e use enum to decorate rather than comments 2019-02-14 18:12:25 -08:00
Kurt
684191772f Misc refactoring (showdownset null)
Set default values to prevent any properties from being null
extract ClearNickname logic for hot path & reusable method
extract item conversion and move to appropriate logic class
2019-02-11 21:49:05 -08:00
Kurt
2498b6bf50 Misc updates
Simplify unknown gen expression
allow mutation of FormIndex if desired
2019-02-10 21:31:27 -08:00
Kurt
182348526c Add display TID/SID get/set 2019-02-10 10:31:20 -08:00
Kurt
a39f917f84 Simplify expression
ternary with a null check and long method signature is pretty ugly
2019-02-09 23:22:22 -08:00
Kurt
54ba9a0312 Update file->open for pb7 filtering
add pb7 to pkm extension list, ignore it in gen7 (sm/usum), update gg
filtering (allow pb7, not bk7)
add comments indicating format source game
2019-02-09 20:33:37 -08:00
Kurt
383d4b7700 "" -> string.Empty
be explicit that the string is empty rather than possibly missing
disallow encrypted export for BK4 (they're not encrypted), removes type
check
simplify replaceall in showdownset (don't call ReplaceAll 4x, just get
valid chars and rebuild)
simplify get ribbon sprite name (precompute ToLower and appended values
2019-02-07 21:40:20 -08:00
Kurt
f481404503 Misc clean 2019-02-02 10:19:41 -08:00
Kurt
6ed9f979de Continued refactoring
removing null results as indicators of no data (c# 8 sooooon)
2019-02-01 23:26:43 -08:00
Kurt
aa022fad40 Misc refactoring
remove some null usages, return an empty array instead
reduce as arg
2019-02-01 23:08:03 -08:00
Kurt
d29f670840 Add QRPK7 to PK7
roughly converts the data into a PK7
2019-01-29 21:07:42 -08:00
Kurt
c033fe2741 Increase precision for cp/size calc
still isn't close enough, but removes the usage of decimals for cp calc.
redd.it/ahac9i

CP calc doesn't flag anything I have that is legal, but the calc is
still off by 2 bits at most... whyyyy? Even the same code run in cpp
results in the same inaccuracy? Maybe this is some arm64 difference?
2019-01-22 21:08:48 -08:00
Kurt
8652677a79 Misc tweaks
showdownset: contains char instead of string
gameinfo: static readonly array instead of redefining new on update
legality: order of operation / value reuse / simplification / comments
pkx: compare char instead of single character string
header/footer: move assignment into method as an out instead of ref
2019-01-20 21:55:28 -08:00
Kurt
b5cf02a933 Add more party related properties/methods 2019-01-12 10:54:38 -08:00
Kurt
ca0e012c5c Add Heal, make status_condition a pkm property
also split out battle box slot offset fetch
if anyone finds where colo&xd store their status bits, lmk 👍
2019-01-11 22:25:48 -08:00
Kurt
ec76bd6b03 Fix ability bit inversion
one of these was not like the other
ty TORNADO (discord)
2019-01-11 08:09:52 -08:00
Kurt
19f49eb4a7 Misc update
remove duplicate pb7 method (present in _K6); note that the fixed length
should not be changed to SIZE_STORED
comment out useless assignment
2019-01-09 21:11:14 -08:00
Kurt
d85bb76208 Mirror order of operations from pb7
see prior commit; this doesn't make any difference since
CurrentFriendship isn't being called; but we're just matching the flow.
Closes #2235
2019-01-08 18:35:26 -08:00
Kurt
fef80d5a05 Fix pb7 trade logic
Update handler after friendship update (CurrentHandler needs to update
afterwards)
Fix argument order (gender & nonpresent region data)
#2235 side effect
2019-01-08 18:32:42 -08:00
Kurt
bc8b48eb88 Fix sort writeback for locked slots
clear flag, update properties
#2235
2019-01-08 18:31:14 -08:00
Kurt
6bd0e87ea3 Fix copyto discarding elements
don't continue; instead seek forward
#2235 part 1, need surgery for part 2 (starter/locked prevents writing
data to the slot, but the slot can still be swapped)
2019-01-08 16:45:16 -08:00
Kurt
75202c7a89 Misc updates
reducing allocations, increasing clarity by removing some magic numbers
probably can rewrite some of the evo loading/checking for even less, but
good for now.
2019-01-06 16:22:45 -08:00
Kurt
744646e30d Add gold bottle cap bypass for LGPE
All IVs are flagged in LGPE even if they're perfect :(
Might have to revisit this for future games and if LGPE transfer out and
maintain these bad flags (this is bad for inspecting parents before
breeding).

Closes #2229 , thanks @SteelPhase (report) and @sora10pls (verified)!
2019-01-06 16:21:34 -08:00
Kurt
9a4f12c279 Misc updates
rearrange pkm version groups for clear break between
twins/siblings/family
clear pokelist for sav7b on non-exportable saves (prevents b1s1 from
showing markings)
rename horohoro (pgo) to non romaji lol, hide daycare/party tabs on
nonexportable save
remove some unnecessary operations
rewrite getallcontrolsoftype to remove ToList() and make generic
2019-01-05 15:40:25 -08:00
Kurt
0c9b760470 Move GetIV to pkm, misc simplifications
remove linq for characteristic calc (get max IV) and others
remove some reliance on new[] for iv/ev
pk5 replace bitmagic with property get->set copy for cleanliness
2019-01-05 10:51:41 -08:00
Kurt
92d633e8ad Allow IsPokeStar=false 2018-12-31 21:04:13 -08:00
Kurt
5fcd8541ba Add pokestar studio fame / star stat pk5[0x87]
how did this get forgotten so easily lol
added legality check; eggs can't participate in pokestar studio.

not editable from GUI, use ExtraBytes editor.
Re-add 0x86 (array was copied from pk4?) and reorder/comment
2018-12-31 21:01:58 -08:00
Kurt
bd56999b20 Increase search flexibility
add more version fetch methods, add reset method to reset encounter
priority
#2219
2018-12-30 17:30:57 -08:00
Kurt
988e71bec5 Remove QRText property
removes PKM<-QRPKM class dependency
fix invalid value oob exception (nature & ability fuzz)
2018-12-26 17:31:23 -08:00
Kurt
9db771c0d5 Split out common 6+ pkm format to abstract class
Didn't really feel like pulling out the shared structure get/set
operations, only the derived properties & overall fixer methods. Should
be easier to maintain if any handling updates.

Clean up pb7 unused stuff; removes ribbon logic since none are used.

c# 8.0 interface defaults can maybe pull out more logic (ex making
FixRelearn and relearn moves into an interface); multiple inheritance
can be useful as features are added/dropped between generations.
2018-12-25 22:56:32 -08:00
Kurt
2cef99e444 Add setter for pk1/2 Language
https://projectpokemon.org/home/forums/topic/48873-batch-editor-language-is-not-working/
2018-12-22 14:47:31 -08:00
Kurt
2d774ac7cc Allow dynamic default savefile type load
Make extrabytes a pkm property (don't mutate array pls)
reconfigure startup loading to only initialize after initial load of sav
& pkm (using blanks if not provided)
2018-12-19 22:10:32 -08:00
Kurt
ea07b9636d Speed up pkm data present check for pk3 format
see
6dbeb24b6f

ensure bad egg flag isn't set, and the species flag is set.
2018-12-15 19:37:19 -08:00
Kurt
6dbeb24b6f Clarify mystery flags
thanks pret!

0ad332124e/include/pokemon.h (L277-L279)
2018-12-14 23:26:46 -08:00
Kurt
fb10a1f983 add size rating indications when viewing pkm data 2018-12-13 21:10:38 -08:00
Kurt
fc65a65fd9 Add go random IVs method
https://projectpokemon.org/home/forums/topic/48779-go-park-melmetal/
2018-12-12 18:06:39 -08:00
Kurt
efb9b7eba2 Misc cleanup
removes clickonce logic/reference
2018-12-10 20:32:08 -08:00
Kurt
3038c1eedb Fix pb7 zh string handling
no remapping ok
2018-12-08 10:02:37 -08:00
Kurt
d84ceabe93 speculate on unused stat
there's a value in trainer pokes that gets set to an unused pkm byte
this byte is fetched in the stat/cp calc, but is never used (param
unused)
plans for future? it's right next to friendship in trpoke7b, maybe there
might be another stat amp?
https://www.serebii.net/magikarpjump/trainerrank.shtml
stronger trainer => stronger monz /speculation
2018-12-06 22:58:35 -08:00
Kurt
8a98a89f6e Add height/weight and float->scalar
pgo transfer logic disassembly
FF 83 02 D1 FC 6F 04 A9  FA 67 05 A9 F8 5F 06 A9
2018-12-06 21:03:33 -08:00
Kurt
cb8585f423 Minor optimization
2d array -> 1d
skip copy by cloning instead
eliminate %24 (number is 0-31) by duplicating 0-7 as 24-31

dropping a modulo, >1 bounds check, and a half loop unroll should be
less cpu cycles :)
2018-12-03 23:12:54 -08:00
Kurt
cc59c3cbe8 Remove variable naming hiding
new property named Stats
update sav7b/pb7 to delete unused handling trainer parameters too
2018-12-03 20:59:48 -08:00
Kurt
1d76d799fd Add stats get/set and batch editor suggest
Closes #2196
2018-12-03 20:53:37 -08:00
Kurt
7229ca76f6 Update party stat level on level max mod
Closes #2194 , pb7 are always stored in party format -- also PK1/2 store
it in their box format
2018-12-03 15:40:09 -08:00
Kurt
3d7f3caef8 Add status condition prop to all mainline formats
Closes #2160 , use Batch Editor to modify slots; it's not worth GUI
presence as it's only saved for party format mons and is undocumented
for anything besides affliction flags
2018-12-02 21:23:10 -08:00
Kurt
c0960fdedb Fix hyper trained data editing
pb7 do have hyper training flags; add interface so code works
appropriately.
Closes #2190
2018-12-02 09:01:35 -08:00
Kurt
35a85670b3 Set height/weight dex values
Closes #2167
Based off sub_71001D16A0 with shortcut modifications:
* code marks new entries for evolution processing later using the low
bit (hence the << 1); in save files I can't see any bits set, but I
can't see anywhere in the code that DOESNT set this bit. Thus the
assumption of post-processing.

As noted in gameplay, a new capture doesn't set Min and Max; it only
sets it if it is above the usual sizing values.

Megas apparently don't set until seen in battle, so don't worry about
setting the other forme based indexes.
2018-11-27 22:05:36 -08:00
Kurt
20c42a0f01 re-add colo valid override
Closes #2161 ; can't figure out xd one
2018-11-26 19:24:49 -08:00
Kurt
085a6e2a2b Misc cxd format updates
fix friendship for xk3
fix colo fateful read
2018-11-26 19:21:48 -08:00
Kurt
76a2e4f527 Add AltForm parameter to exp/level fetch
Starter Pikachu & Eevee have different growth rates than their base
forms (seriously WHY?)

remove old api surface in PKX as a breaking change as adding the
parameter is necessary.
2018-11-26 16:55:16 -08:00
Kurt
5ca597d44b Add height scalar classification 2018-11-25 19:46:32 -08:00
Kurt
f358c0e4cf Handle all deviating met location string versions 2018-11-22 10:11:51 -08:00
Kurt
cfbdb7c26c Add parameter-less constructors
Removes null check for hot path where data is actually provided
2018-11-21 14:15:48 -08:00
Kurt
03dd61bc58 Reset CP on common modifications 2018-11-21 12:31:05 -08:00
Kurt
58080f36c9 Add WB7 and legality detection logic
Derived from WC7 with minor alterations (dynamic OT/Nickname which is
stored in the Full data). Since the 0x108 is not stored in the save
file, just keep the full data around.
2018-11-21 12:24:41 -08:00
Kurt
eb6e3fbbe9 Don't reset friendship, only for this format
Friendship affects stats, keep current friendship when updating the
trainer.
2018-11-20 19:15:38 -08:00
Kurt
ec7fc8e2f0 Fix maxgameID for pkm reference
threw a snag in pkm generator since it doesn't reference savefile max
2018-11-19 16:15:09 -08:00
Kurt
ba1a7c2bcf Fix broken tests
rework getblank for version specific
2018-11-19 16:14:49 -08:00
Kurt
3841df1234 Temp workaround for cp calc precision
float -> decimal

https://projectpokemon.org/home/forums/topic/48524-cp-height-weight-calculations/
2018-11-18 23:14:08 -08:00
Kurt
65febae125 Clamp max CP at 10k
ingame max is 10k
2018-11-18 15:32:47 -08:00
Kurt
6a0a6aa82a Add methods for 7b quirks
nidoran m/f when sanitized with the old way show the gender symbols as
'?'
2018-11-14 22:51:53 -08:00
Kurt
adb6b345be Treat GameVersion.GO like other GG vers 2018-11-14 17:40:11 -08:00
Kurt
2fb698805d Use latest personal table as master 2018-11-13 19:20:37 -08:00
Kurt
181e75818c Use agreed upon lgpe starter forme name
Thanks @Marty-D !
2018-11-13 19:20:21 -08:00
Kurt
28fec9882b Add pkm variant for beluga 2018-11-13 19:10:31 -08:00
Kurt
98ebf4c5cb Add sort pointer repointing
LGPE uses a list of pkm for boxes, and has pointers indicating where
each party member is at
need some logic for handling the sorting. Had suspected this a while
back so this pre-work came in handy (untested tho)

make eventflags offset ptr virtual, I might end up doing things
differently for event flags
2018-11-10 21:04:24 -08:00
Kurt
113eb550d4 Add IAwakened interface for future PB7 format 2018-11-10 20:21:36 -08:00
Kurt
fe989d48fe Misc prep updates
Update comments / xmldoc
Add a savefile storage compressor (ie array[] with empty interstitials
-> list); return true if the compression moved anything (repopulate
views), and the count of occupied slots in the list.
Add saveblock base class; I haven't really liked how SAV6/7 do all the
logic; I'll still expose properties that will then point to a saveblock.
Cuts down clutter.
Add template Dex manipulator, with gen6/7 implementations
Speculate sequential gp/ge gameversion IDs
2018-11-01 15:38:09 -07:00
Kurt
f709448220 Update 18.11.01
Update event binaries with latest from the Event Gallery
2018-10-31 14:08:58 -07:00
Kurt
8f9cc6cd7e Fix xmldoc ampersands 2018-10-31 13:52:09 -07:00
Kurt
39f98a4a94 Misc qol updates
Check max case for level first, then iterate upwards (eliminates inner
if)
change wc* nature to sbyte (update comparisons, 0xFF too magic-y)
use Rand.Next(x) instead of (0, x)
2018-10-27 21:59:31 -07:00
Kurt
ed3699fbb4 Update Ho-Oh mattle check
More languages than Italian have a rule-breaking name. Rework checks a
bit
Flag eggs more accurately
Update force hatch to move Link Trade met location to Egg Location

fix Ho-oh -> Ho-Oh text strings (correctness is key!)
2018-10-27 16:06:06 -07:00
Kurt
359a529870 Misc updates
Move some logic around, fix style warnings
2018-10-27 08:53:09 -07:00
Kurt
78c7535dea Fix pk1->pk2 conversion 2018-09-29 21:03:34 -07:00
Kurt
90f1d0cb09 Misc cleanup 2018-09-29 12:22:13 -07:00
Kurt
e0e628844f Update copyto protection
skip over write protected slots (locked/team), may eventually weaken the
GUI to allow modding boxdata with locked slots (which will be skipped).
2018-09-24 19:43:59 -07:00
Kurt
7715d7e14f Add boolean OrderByCustom overload
Closes #2125 ; final sorting is skipped as bool only yields two groups
instead of many, resulting in a preferentially poor sort result
2018-09-20 17:29:55 -07:00
Kurt
41408a235c Add filename without extension property
for encrypting the pkm -> 'ekx'
2018-09-16 10:48:04 -07:00
Kurt
b280ffcfef style updates
should be pretty much it
2018-09-14 22:37:47 -07:00
Kurt
9a04109e01 Localize zygarde complete
form string already there, just repoint
2018-09-12 21:16:14 -07:00
Kurt
930d07c080 Misc simplifications
reference shared base class
reorder arguments to match pk1, remove extra space
2018-09-12 20:55:30 -07:00
Kurt
e77247e652 Fix call order
new empty party list with empty slots now fills correctly

https://projectpokemon.org/home/forums/topic/47453-bug-with-generation-2-party-slot/
Thanks AcroBlade!
2018-09-11 20:33:26 -07:00
Kurt
b20020fbe6 Update 18.09.11
Update event binaries with latest from the Event Gallery
2018-09-10 19:10:28 -07:00
Kurt
d8c355cf64 use sprite resource name instead of species-form
Closes #2113
2018-09-07 19:11:22 -07:00
Kurt
106a02eedd Fix infinite loop pk1/2 -> pk<7 2018-09-01 15:09:04 -07:00
Kurt
1fe304e78f Rework mg nick/lang checks
add common interface

https://projectpokemon.org/home/forums/topic/47295-bug-event-golduck-name-not-matching-species/
2018-08-30 18:09:52 -07:00
Kurt
4dc04cb4b9 Add pelago status value check + etc
0, [9,19] are set (didn't see 15), but there's also a switch case which
references all values 0-19.

these values are used by a 80 sbyte array (4*20) in the Resort.cro

remove usages of "goto case"
2018-08-27 20:44:26 -07:00
Kurt
ab0a792968 Move valid item override to pk1, pk2 uses base
Closes #2101
2018-08-21 07:47:23 -07:00
Kurt
19f9765752 Add missing species setter
Closes #2100
2018-08-21 07:37:15 -07:00
Kurt
29f73993b1 Misc reorg
simplify gameinfo comments/return
move item1->item2 conversion to itemconverter

just general upkeep
2018-08-20 22:09:35 -07:00
Kurt
d307a30cad misc optimization
list initial size is 4; oftentimes it's greater, and always padded
2018-08-19 16:26:08 -07:00
Kurt
c0b5d3eef7 Abstract away pk1/pk2 properties to shared class
some inefficiencies with pk1 altform/iskorean but is much easier to
manage
2018-08-19 15:50:15 -07:00
Kurt
7ef5d9e547 Add pk1 current level property party->box setter
https://projectpokemon.org/home/forums/topic/47086-bug-trades-between-two-saves-1g/?do=findComment&comment=235241

fresh encounters have yet to be boxed and don't have the value; set it
whenever setting a Stored slot.
2018-08-19 13:35:20 -07:00
Kurt
d7f39ea343 Extract pkm searching to separate classes
search logic can now be reused by core projects

adds option to provide extra filters run at the end (prior to clone
check)
2018-08-16 20:06:40 -07:00
Kurt
e366f9a93d Misc tweaks
only have one empty forme array object
rename method for clarity
show version ID for hidden savefile program window titles
2018-08-15 21:15:06 -07:00
Kurt
f079f62956 Remove fullness/enjoyment check
Although bank 6->7 deletes the values for these fields, Pokémon Refresh
can still reintroduce new values.

Closes #2090 , thanks @Lusamine !
2018-08-14 16:45:51 -07:00
Kurt
fc73eee570 Extract PokemonList* to inherited class
Logic is essentially identical; implement a base class and have the
generation specific structures implment the differences.

Reduce the verbosity a little
2018-08-05 17:28:54 -07:00
Kurt
4c96efb9b7 Update pk2->pk1 party stat transfer logic
pk1 boxdata stores current level & current hp, which is only present in
pk2 party data.
if the user drops in pk2(boxdata), the transfer leaves 0 for both
values, which isn't correct.
detect stat_level to determine if values should be regenerated or not.

Thanks HaxAras for finding this :)
2018-07-31 14:29:47 -07:00
Kurt
f35712fcf2 Extract experience logic to separate file
add exp bar logic, unused.
2018-07-29 17:43:30 -07:00
Kurt
d916be1020 Style updates 2018-07-29 13:27:48 -07:00
Kurt
c8563a3737 Respacening
Style guidelines, handle a bunch of files
no functional change
2018-07-26 19:34:27 -07:00
Kurt
f0090669bb Update catch rate related logic
#2071
2018-07-24 19:33:42 -07:00
Kurt
279f44a645 Simplify GB stat calc, fix pk2->pk1 xfer fainting
Remove unnecessary floor operation, don't fetch stat arrays for each
stat

Current HP is a box stat in pk1 format (offset 0x1), which isn't stored
in box pk2's. If the hp is zero, set it to the current HP.

Thanks HaxAras for the conversion tip!
2018-07-24 16:41:18 -07:00
Kurt
64284eafef Add pk1/pk2 direct import checks
dragdrop: check
import files from folder: check
no other paths convert afaik

Closes #2074
2018-07-24 15:49:00 -07:00
Kurt
81355dfaf4 Update translatables for pkm conversion 2018-07-24 15:36:46 -07:00
Kurt
b97e967304 Misc cleanup 2018-07-22 17:14:22 -07:00
Kurt
a693ba87ba Update cosplay sprite handling
Cosplay are stuck on gen6, cap pikachu can interact with bank; make
Cosplay the oddball resource.
2018-07-22 12:06:43 -07:00
Kurt
0c5c9bc33c Misc clean / xmldoc updates
remove unused label in QR (use window Font)
escape & -> &amp; for xmldoc proper style
2018-07-21 19:20:11 -07:00
Kurt
c7175fbdb4 Misc reorg
bye bye SAVUtil and PKMUtil
2018-07-20 21:32:33 -07:00
Kurt
f27f11bfc8 Clean up pk7/sav6/sav7 simple methods
extract GetFormDuration to method, remove unused GetIsCompatible
specialized variant (there's a generalized version in SAVUtil.cs,
IsPKMCompatible -- might do another round of WinForms->Core absorption
2018-07-20 20:25:28 -07:00
Kurt
cc509de83c Add lgpe properties 2018-07-14 21:55:45 -07:00
Kurt
cb80c02011 Check Yellow catchrates when updating species
https://projectpokemon.org/home/forums/topic/46259-yellow-kadabra/
2018-07-14 18:08:51 -07:00
Kurt
baac632218 Enable editing gen1/2 hidden power type 2018-07-14 10:56:11 -07:00
Kurt
625a77589b Extract geolocation logic to interface
mixins would be nice but I guess extensions cover this
2018-07-14 10:34:34 -07:00
Kurt
5d20c79568 Add showdownset localization for slot previews
Localization only for game strings (not Ability/Nature/Stat/etc labels)
feels kinda goofy but it works
2018-07-13 19:13:25 -07:00
Kurt
98a1677d14 Fix property reference
oops
2018-07-12 20:36:59 -07:00
Kurt
296d1c20ed Use ITrainerInfo interface for trdata 2018-07-12 18:15:20 -07:00
Kurt
d20706dd70 Update xmldoc
le lenny goes here
2018-07-11 19:19:19 -07:00
Kurt
01323c0ee8 Add id7 setters
can now set TrainerID7 / TrainerSID7 via batch editor
2018-07-10 21:25:03 -07:00
Kurt
7f31fdf874 Simplify string trim
RemoveRange instead of while {remove last}
2018-07-10 17:54:05 -07:00
Kurt
f8c43d4a06 Rework gen1 trade OT handling
convert all dictionaries to char-byte instead of string (saves 50KB on
compressed dll, lul)
update OT string comparison for pre/post transfer specimens

Showing "TRAINER" for all languages isn't correct, just show a mapped
character

Closes #2049 , thanks @egzonqj & @WEERSOQUEER !
2018-07-10 16:45:24 -07:00
Kurt
e588565657 Refactoring
reduce pk3/ck3/xk3 logic, share AbilityBit property within _K3, and when
loading, type check (favored over hardcoding individual load cases)
pull some non-gui code from PKMEditor to core/etc for general data
fetching
2018-07-06 17:37:07 -07:00
Kurt
e2fd00a27a Restore while loop
Yeah forgot that extremely bad RNG rolls (0,0,0,0,0) leaves 510
remaining, and the last EV can't have that much

rework loop to be simpler & quicker by checking the last IV for validity
only
(don't bother keeping it unrolled
2018-07-04 12:23:42 -07:00
Kurt
397de97f3c Remove excessive references to Util.Rand32()
all usages besides fetching a 32bit random value should use rand.next
remove unnecessary do-while loop for calculating random EVs (always
returns 510 in total)
2018-07-04 11:30:43 -07:00
Kurt
e495883d87 Reorder marking for speed last
Closes #2040
2018-07-02 14:37:21 -07:00
Kurt
3674a11cfe Misc simplifications
absorb verifier calls into the parsing methods
2018-07-01 17:07:29 -07:00
Kurt
9f8edc89bf Refactoring
put some string[] behind IReadOnlyList to prevent any consumer from
modifying it
2018-06-30 09:59:48 -07:00
Kurt
e4a83dbbac Update GetPKMExtensions to support lower gens
gen1&2 are allowed for 1-2/7+, else the minimum is gen3.
2018-06-27 18:53:08 -07:00
Kurt
69cd79c6b5 Simplify GetUnownForm method
yeah lets not fetch a throwaway byte array to remove the need to
rightshift

use the GetRandomPID fetch.
2018-06-27 18:52:02 -07:00
Kurt
dc3cdd4491 Fix gen1/2 gender detect
gender: take top 4 bits of gr:
31 = 0x1F = 1
63 = 0x3F = 3
127 = 0x7F = 7
191 = 0xBF = 11

See the pattern? If we change the compares from >= to >, we -1. All
numbers match except for the 25/75 ratio pkm... which unveils the
problem.

Simplify the calc for these using the logic above, which fixes the error
and makes the code easier to read!

Thanks SystemError for assisting :)
2018-06-27 18:31:24 -07:00
Kurt
ed099916b5 Simplify g1/2 shinify action, better retain gender
easy modification which isn't 'random' resulting in a slightly higher
chance of retaining the current gender if possible. threshold values can
change genders (1f:7m), but is slicker overall
2018-06-27 18:14:19 -07:00
Kurt
fba8adb32f Add XY wild undiscovered egg group IV check
Closes #2025
add misc updates/simplifications (personal stuff used in pkNX)
2018-06-24 21:55:00 -07:00
Kurt
e29cf2a903 Rework secondary check flow
Checks.cs initially started out small, but over the years it has grown
to handle multiple types of checks. With all these checks next to
eachother, it's hard to see the overall groups. Splitting them up
(potentially further?) allows for more focused maintenance &
understanding.

Not sure if I'm happy with the overall bandaids used (checks no longer
done within LegalityAnalysis so variable repointing is excessively
used), but I'm happier the way it is now compared to the huge Checks.cs
2018-06-23 22:00:01 -07:00
Kurt
7591f54de3 Misc updates
Add safari min flawless IVs to reroll (can expand if #2025 is required
for egg group15)
Use EV/IVTotal (faster, not linq array based)
Fix missing pumpkaboo form regression, Closes #2026
Relocate swapbits to appropriate class, unneeded in PKM.cs
2018-06-22 06:24:33 -07:00
Kurt
f3ef122214 Refactoring
continued simplification

core.cs is pretty much the following:
misc one-off junk
moveset fetch
encounter table fetch
evo chain fetch

might eventually move things around a bit further for cleanliness so
that misc meta junk is the only thing that remains in core.
2018-06-18 21:56:30 -07:00
Kurt
9a0ddf1f5e Handle farfetch'd ’ nickname check case
https://projectpokemon.org/home/forums/topic/45837-g3%C2%A0farfetch’d-nickname/
Thanks Davil!
2018-06-17 11:34:39 -07:00
Kurt
efe77e3b5c Don't clear unown forme on pk4->bk4
Closes #2011
2018-06-16 10:29:36 -07:00
Kurt
f8a1d26694 Fill empty ability values with ability1
update handling that checked for this case to instead check for
equivalence to ability1 instead of 0

was generating a PGF with ability[1] = 0, which is not correct. Just fix
the binaries to behave and get rid of all the workarounds since future
tables don't have missing values.
2018-06-15 23:41:07 -07:00
Kurt
cb5e1239ae Refactoring
Extract game value limits
Rearrange GameVersion util logic extensions
add better gameversion fetch for generator (equivalent to pkmeditor)
2018-06-15 16:00:28 -07:00
Kurt
b9652a835d Weaken gen2 egg species checks for pre-evos in gen1
VC can inhabit both gens

Add Tradeback setting setter for legality tests
Add GBCartEra setting setter for legality tests

Thanks @iiippppk !
2018-06-12 18:46:31 -07:00
Kurt
9faba26e90 Add egg base move branch
Closes #1991
Thanks @iiippppk  !

Improve pk2 version detect to better provide gs vs c egg base moves
2018-06-11 07:23:48 -07:00
Kurt
021ac7c54f Refactoring
where!contains -> except
relocate special tutor
2018-06-09 16:04:06 -07:00
Kurt
450d40535d Relocate hypertraining properties to interface
lessen temp array creation, speed++
2018-06-05 21:31:42 -07:00
Kurt
a5af7a443b Revert outer comparison
type check done in loop, whatever comes out of ConvertPKM is either the
desired type or null.
2018-06-04 21:32:15 -07:00
Kurt
59b4b8f755 Simplify pkm conversion
just loop instead of goto, let the jit handle optimization
src looks quite pretty now!
some tradeoffs made but much more maintainable now
2018-06-04 21:28:14 -07:00
Kurt
6cff642ff1 Skip format check on pk* init
also remove ck3/xk3 no-op call (no encryption for those formats, like
bk4).
2018-06-04 20:25:54 -07:00
Kurt
ae3b6a7fa1 Simplify IContestStats usage
remove new[] creating for checking if any contest stats exist
(HasContestStats)
2018-06-02 21:19:03 -07:00
Kurt
730709b33b Add entree forest abstractions
make cryptarray public
2018-05-27 14:19:19 -07:00
Kurt
6a3b422a14 Fix xd fateful gift pkm
stored as wc3's, make "Version" from IVersion rather than int so that
"WasXD" recognizes it.

Update handling for fateful encounter trade-away cases.

#1970
2018-05-27 10:11:01 -07:00
Kurt
c349ab8218 Relocate vc lang detect to pkx
reusable
2018-05-24 16:53:54 -07:00
Kurt
047272c2ba Add batrev party viewing/handling
ezpz

party 4 bytes at end:
pkm, 0 (b) party index (b), 0x8000 (be u16)

not sure if there's a better way to detect party count...
2018-05-19 14:42:21 -07:00
Kurt
ca14b43b62 Relocate memory specific data to own file
allows easier handling for memory interactions
2018-05-19 10:04:07 -07:00
Kurt
23083317d7 Refactoring
pull out GameStrings

add debug output for crystal headbutt trees
fix qrpkm item access
2018-05-18 21:35:57 -07:00
Kurt
95b4d0820d Minor reorganization
amount of pkm obj classes is pretty high, move the static utility
classes to another folder

breaks usage of pkm.ShowdownText; removes a dependency from PKM.
2018-05-18 19:33:11 -07:00
Kurt
d772a82953 Move batch editor logic to core
previous hurdle a year ago was propertyinfo fetching not looking at the
base class's properties; dig deeper for all properties to mimic existing
code for netframework

end result is batch editing now possible without gui
2018-05-17 22:43:07 -07:00
Kurt
3ee6070b98 Fix poketch write
1123c24b0c
had addressed the loading, however, it did not address the saving

update pkx to not create a new array every time IsPKM is called
(possibly a lot)
2018-05-13 20:35:09 -07:00
Kurt
857919bd28 Add basic plugin sys
reference PKHeX.Core, main window loads assemblies & initializes
providing an ISaveProvider and the menustrip control (to insert controls
into)

pretty rough but should allow for inserting external control buttons &
allowing it to edit the UI a little

example: https://github.com/kwsch/PKHeXPluginExample
feedback is appreciated
2018-05-13 12:49:29 -07:00
Kurt
99005d8fc0 Refactoring
more discards & simplifications
2018-05-12 12:28:48 -07:00
Kurt
e2f11edc43 Refactoring
discards, Array.Find over FirstOrDefault
2018-05-12 08:41:29 -07:00
Kurt
5a3c8f4147 Remove trailing whitespace 2018-05-12 08:41:29 -07:00
Kurt
e32495252f Set altform before gender
bb5622f5db (commitcomment-28951163)
2018-05-11 21:48:58 -07:00
Kurt
9c5814346b Add showdownset parse case template test 2018-05-11 21:44:09 -07:00
Kurt
bb5622f5db Fix greninja import
pass null forms thru the converter
Closes #1937
2018-05-11 21:09:39 -07:00
Kurt
4ae1b79ad5 Handle mimikyu totem export
Closes #1935
2018-05-11 17:44:27 -07:00
Kurt
f82e545ab0 Update gender handling
Closes #1934 , unrelated tho
2018-05-10 20:22:32 -07:00
Kurt
815705bc5e Fix gender handling
Closes #1933

if not allowed to be genderless, flag as invalid gender
only permit valid genders after genderless is ruled out
(both done by checking the low bit)
2018-05-10 18:53:23 -07:00
Kurt
16ed4353b2 More generator updates
Store 4g giratina held item for enc->pkm legality
revise usages of GetSaneGender
Rearrange some logic
Better handle impossible version encounters (gen4)

gen 1-5 done, stuck on 659 - bunnelby egg...?
2018-05-09 17:50:56 -07:00
Kurt
3e885a8440 Update forme parse
Closes #1931
2018-05-07 18:24:30 -07:00
Kurt
19a0560474 Misc cleanup
extend byte[]->pkm iterator for specifying start/stop
clean up some in main window
2018-05-06 22:24:25 -07:00
Kurt
7e9b5362d0 Simplify showdownset form handling
replace all dashes with spaces, and vice versa
Closes #1930
2018-05-06 18:46:51 -07:00
Kurt
5cb232d474 Sanity check some showdownset import values 2018-05-06 18:40:51 -07:00
Kurt
71970b3332 Add gen1/3 speciesID direct get/set
https://projectpokemon.org/home/forums/topic/45108-pkhex-suggestion/
2018-05-04 18:05:41 -07:00
Kurt
4b6ee3fbf5 Update 'sorter'
Adds IV count sorting
Adds Itemless & Illegal deleting
Adds Max level modding, item clearing. Handle egg cases sensitively.

remove final sortby for reversal case as the incremental integer
prevents further ordering.

Any suggestions? Keep in mind that some modifications can be done by the
Batch Editor scripts; smart deletions & sorts are highest value
additions ;)
2018-05-01 19:24:47 -07:00
Kurt
4c9177fcb3 Add sort force-reverse
hold control when triggering the sort
sneaky linq to reverse a sort by:
* re-doing the initial sort, then
* reversing the sorted pkm data by using a throwaway increment
* re-doing the final sort
2018-04-30 21:39:12 -07:00
Kurt
bbcbdd80a1 Update 'sorter' with more functionality
Nest item choices into separated groups (based on their overall
function).

Adds 3 more deletion options: eggs, untrained, or not-matching-savefile.
Adds 1 more modification option: Max Friendship of current handler
2018-04-30 17:32:23 -07:00
Kurt
daf093879b More generator updates
all the way up to nidorina

extract some reusable methods
exclude invalid headbutt encounters
use built in randomgender
2018-04-29 18:26:36 -07:00
Kurt
70992138e2 Misc encounter->pkm generating fixes
eggs for Gen1 must be generated in Gen2
gen1 wild encounter initial moves
gen4 abilities have 0 for single ability mons
2018-04-28 16:30:56 -07:00