Commit graph

40 commits

Author SHA1 Message Date
Kurt
8acb336d51 Use enum for species comparisons
slightly easier to read with named values
2019-12-08 17:39:19 -08:00
Kurt
9401b7a790 More readonly struct tweaks
help dat compiler
minor clean elsewhere
2019-10-26 23:18:25 -07:00
Kurt
e3efa65160 Cleanup
handle messages for dirty cleaning :)
2019-10-26 12:33:58 -07:00
Kurt
bb84ec4e89 Handle some vs message suggestions 2019-10-19 20:33:17 -07:00
Kurt
02420d3e93
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases

Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization

* Handle bits more obviously without null

* Make SaveFile.BAK explicitly readonly again

* merge constructor methods to have readonly fields

* Inline some properties

* More nullable handling

* Rearrange box actions

define straightforward classes to not have any null properties

* Make extrabyte reference array immutable

* Move tooltip creation to designer

* Rearrange some logic to reduce nesting

* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum

* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case

* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable

* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator

* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever

* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)

* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-16 18:47:31 -07:00
Kurt
4baf745af8 Use some c#8 sugar
static local functions
switch expressions
using usings :)

nullable next?
2019-10-07 18:40:09 -07:00
Kurt
8d8adde2b1 sealed
sealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealed
2019-10-03 19:09:02 -07:00
Kurt
c5ebbbbe15 Minor clean
Magic number -> const usage
default(T) -> default (c#7.x feature)
remove some unused stuff
fix indentation in some spots
2019-09-10 22:07:50 -07:00
Kurt
8f9cc6cd7e Fix xmldoc ampersands 2018-10-31 13:52:09 -07:00
Kurt
359a529870 Misc updates
Move some logic around, fix style warnings
2018-10-27 08:53:09 -07:00
Kurt
b280ffcfef style updates
should be pretty much it
2018-09-14 22:37:47 -07:00
Kurt
99005d8fc0 Refactoring
more discards & simplifications
2018-05-12 12:28:48 -07:00
Kurt
5a3c8f4147 Remove trailing whitespace 2018-05-12 08:41:29 -07:00
Kurt
84c5decfc0 Comment out unused
temp = temp permanent lul
2018-03-10 19:40:57 -08:00
Kurt
c20f03434f Add FrameCache object
arbitrary access for RNG frame results, only generating frames when the
frame is unavailable. all calculated frames are cached.

to be used in RNG searching where caching seeds is necessary (repeat
checks)
2018-02-04 16:30:50 -08:00
Kurt
f21906ee9a store gen3 origin seed for default frames 2017-12-03 07:13:28 -08:00
Kurt
d301cb5469 Remove ESV rollback for varied level encounters
ESV rand is stored uniquely now via generated frames from FrameFinder,
no need to roll back.
2017-12-02 22:34:54 -08:00
Kurt
15489b8a7c Use dppt specific rand calls 2017-12-02 15:44:44 -08:00
Kurt
87748e18c9 Continued updates for frame generating
fixes broken test, provide encounter proc call
2017-12-01 22:49:38 -08:00
Kurt
40ec87fc9d Add gen4 lead frame finding variants
can use level call or not at all (fixed slot)
still untested, assumed same call order as gen3.
2017-12-01 21:23:37 -08:00
Kurt
48242109fd Rework lead required to flags 2017-12-01 17:27:09 -08:00
Kurt
15ab0d5aff Add origin seed for frame output
looks like for gen4 I have to yield twice as many frames (for FixedLevel
and non) as level call usage is dependent on encounter
2017-12-01 16:33:03 -08:00
Matt
1fcac7c06b
Fix level check compare 2017-12-01 15:13:03 -05:00
Kurt
4b954cd102 Add static/magnet fail enum value
can fail leading to regular ESV calc
2017-11-30 23:07:11 -08:00
Kurt
5d74096243 Apply static/magnet groups by slot type
only apply for emerald (only game in gen3 that supports it)
2017-11-30 22:34:57 -08:00
Kurt
2ab805ba98 Add method h safari analogues for ESV->slot 2017-11-30 19:31:38 -08:00
Kurt
9930e8765a Add frame level checking
still WIP but should be working fairly well
2017-11-29 23:20:49 -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
36894a588d Add FRLG unown frame matching
Turns out there was no documentation anywhere on encounterslot numbers
for the individual forms; some sites had overall rates.
Assuming a human filled out the encounter slots, forms would repeat left
to right until a new form takes over. Below slot numbers match the rates
when summed up.

https://pastebin.com/raw/bQt3ZMbq
2017-11-29 18:28:20 -08:00
Kurt
c7a59453b1 Fix frlg safari rod slot checks
tfw whole legit boxes of dratini were flagged -> now legal
2017-11-28 20:56:21 -08:00
Kurt
be4d30bb6d Add pokeblock slot filtering
since there's 300 calls to rand to shuffle, I wouldn't be surprised if
there are vblanks messing up the frames

judging from my data 6 years ago (wow, still wrong, just look at the
frame offsets)

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

looks like it happens quite erratically. may have to just override this
to return true for all gen3 safari mons as it's entirely unpredictable.
2017-11-26 20:07:38 -08:00
Kurt
187726b4af Use static/magnet pull values
reorganize a little for lead use cases
2017-11-26 16:09:24 -08:00
Kurt
22abce5e16 Update gen3 frame finder 2017-11-26 14:48:55 -08:00
Kurt
0f3529e764 Add gen3 swarm encounter slot call
via pret/pokeemerald (and pokeruby); rate is set at 50%
swarm pokemon have the ability to have 4 fixed moves, so derive from
EncounterSlot to have moves, and remove special handling from
VerifyCurrentMoves (now picked up by IMoveset pattern
2017-11-26 11:00:54 -08:00
Kurt
1162ba5b3d update bcc slot table
https://pastebin.com/Y0VRnJxu
not sure what the 2nd rand value is

still some things to sort out with RoC's PC
2017-11-25 22:28:38 -08:00
Kurt
ad5e69550e Add hgss safari slot block priority bypass
allows hgss safari mons regardless of frame call (table is currently all
Slot=0).

may need separate handling down the road:
* switch slot number to an enum for slot codes (>0 = slot number, less
than -> do something else).

not something im interested in right now
2017-11-25 15:03:37 -08:00
Kurt
fbce8582c7 Add encounter slot checking
emerald silly stuff like magnet pull not implemented so some stuff may
be not matched.
2017-11-25 13:53:39 -08: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
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