Commit graph

131 commits

Author SHA1 Message Date
Kurt
4ed0e30ace Minor tweaks
Muh infinitesimally small perf gainz found while waiting for next dota match
2021-07-26 23:33:56 -07:00
Kurt
c9640f8561 Comments: forme->form 2021-07-26 14:14:39 -07:00
Kurt
46f50a3a56 Use named consts for magic gender values
More personal magic value comparisons
2021-07-13 18:22:04 -07:00
Kurt
f66662b8db More deferral tweaks for non-HA having HA 2021-04-22 13:47:33 -07:00
Kurt
645f2b4db5 Revert implicit casting
Looks like netstandard2.0 wasn't meant to receive that new c#9 goodie
2021-03-29 00:14:44 -07:00
Kurt
3822981590
Rework EncounterCriteria to be ability indexed rather than direct ability (#3179)
* Exploration: rework ability criteria to ability numbers desired

* Sync remaining changes

* Update EncounterCriteria.cs

* Add xmldoc

* Improve speed of IsDualGender check

* More xmldoc updates

Should be doing this on main but meh, this branch is gonna get merged later

* Fix typo

* Update WC7.cs

* Update PersonalInfo.cs
2021-03-23 17:05:15 -07:00
Kurt
09089da14e Use more expression return style
Reduces indentation & bracketing, a bit more concise
2021-01-01 17:08:49 -08:00
Kurt
46f3b17a67 Replace this[] indirect access with direct table access
The static constructor setup methods don't need to be maxSpecies aware, they always succeed. So just remove the self-imposed-safe bounds checks by accessing & mutating the table directly.
2021-01-01 15:24:11 -08:00
Kurt
24332b6979 Minor tweaks 2020-12-30 13:08:15 -08:00
Kurt
e8c23f6644 Simplify some repeated comparisons with expressions
Less prone for bugs since it uses the same value for all comparisons without re-specifying
2020-12-29 00:37:59 -08:00
Kurt
93910df2c6 Use new switch statements 2020-12-23 17:14:38 -08:00
Kurt
98be0f6739 Target type'd new 2020-12-21 17:17:56 -08:00
Kurt
5729718d68 Simplify ternary byte casts
No longer needed to explicitly cast, thanks c#9 !
2020-12-21 16:53:28 -08:00
Kurt
62018cce1a Unify concepts with different names
AltForm & Form & Forme => Form
GenNumber & Generation => Generation

Extract out SpeciesForm interface, and re-add IGeneration

For those using PKHeX as a dependency, this should be a pretty straightforward manual replacement... GenNumber and AltForm should be quick find-replace`s.
2020-12-10 20:42:30 -08:00
Kurt
915727ed67 Add g-kanto formes
Probably will refactor things when shiny/ball legality is detailed
2020-11-11 13:27:08 -08:00
Kurt
36051e0f82 Minor clean 2020-10-25 10:02:52 -07:00
Kurt
7a01b1249c Minor clean
Handle more messages, add more xmldoc
2020-10-18 09:43:41 -07:00
Kurt
0de76b57b1 Handle incorrect bred stunfisk local form value
The game uses 0x5E if 0x5A+everstone, otherwise it uses 0x58
For determining the seed species-form, we want to use everstone breeds as that resolves to the correct species-form values.

Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Co-Authored-By: Marty-D <1645989+Marty-D@users.noreply.github.com>
2020-10-08 13:12:25 -07:00
Kurt
76b704cfe1 Fix g1 yellow personal table in binary rather than while running 2020-09-19 07:52:35 -07:00
Kurt
5d3bc289b6 seal hunting
Mark things as sealed as they shouldn't be inherited from or overriden in a derived class.
2020-09-07 13:51:13 -07:00
Kurt
cf9e5ec37f Minor refactoring
Change Ability array to IReadOnlyList, add method to check ability index in personal data
Suppress some message warnings
Change EvolutionChain short-circuit for VC to jump from gen6 directly down to gen2. There aren't any notradeback 1 situations, so a notradeback1 will always start with g=1, so no need for the other if-continue.

Simplify pk5 conversion
2020-09-06 10:53:13 -07:00
Kurt
36dd5ece21 Initial Isle of Armor support
Co-Authored-By: sciresm <sciresm@users.noreply.github.com>
Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
Co-Authored-By: Archit Date <architdate@gmail.com>
2020-06-19 18:51:15 -05:00
Kurt
2cdb5d26db Clean up some method signatures
rename things to be a little more consistent in naming conventions
2020-06-16 21:46:22 -05:00
Kurt
aaf6642d31 Rename Data -> BinLinker 2020-03-20 15:18:59 -07:00
Kurt
843330a375 Remove unnecessary null checks
this is a null free project /s
dont provide null, else u deserve to get an exception
2020-01-18 16:57:25 -08:00
Kurt
c446ff5b51 Fix non-galar egg moves passing
Closes #2516
2019-11-24 18:18:26 -08:00
Kurt
4bcf60746b Add egg move sharing checks
Was referencing wild caught mons that are given a single egg move; this
logic handles shared egg moves too via daycare.

Probably need to rework SplitBreed into a dictionary; this might not
catch Mime/etc split breeds if they have different tables.
2019-11-17 17:14:21 -08:00
Kurt
13adc38ee8 Add elemental tutors
Closes #2443
Capture some array references to avoid re-fetching array -- array
reference is readonly so it probably won't matter
2019-11-17 11:13:57 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08: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
d3b0c392b2 Minor tweaks
no functional change
2019-10-03 22:21:33 -07:00
Kurt
8d8adde2b1 sealed
sealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealed
2019-10-03 19:09:02 -07:00
Kurt
ab0b8979e9
Add swsh content placeholders (#2392)
placeholder content until real data is dumped
2019-09-23 16:56:47 -07:00
Kurt
62d08d7c30 Misc clean
split some methods with optional parameters=null
add more xmldoc
replace some magic numbers -> enum/const references
consolidate common array operations (span soon maybe?)
2019-09-10 00:21:51 -07:00
Kurt
7c3e5aa83c Make RandomGender a method instead of property
See pkNX for similar change; the functionality is really *method*
2019-02-17 22:13:40 -08:00
Kurt
59b41937e1 Misc variable name changes
readability++
2019-02-06 23:28:02 -08:00
Kurt
13090c0ced misc gen1 updates
sav1: assign personal table based on (detected/provided) version
catchrate editor: allow to use savefile personal
remove gb era prompt whenever gb/blank loaded; have it as a setting (can
be overridden for VC now). keep allowgbera as autodetect
personaltable: track format for debugging purposes/info

update translations
2019-01-21 20:06:02 -08:00
Kurt
f97417fe85 Remove some unused bitflag regions
cuts down memory footprint by quite a bit (bool[] is 4bytes per bool)
2019-01-06 22:21:25 -08:00
Kurt
c2422d6927 Misc updates
possibly gonna update the iencounterable api for criteria
check/enforcement, rather than just generating random encounter data.
2018-12-29 22:19:44 -08:00
Kurt
00af735afd Add personal table for gg 2018-11-11 13:11:07 -08:00
Kurt
73ee5e5afd Add personal info structure update changes
One field added to indicate the GO species or whatever; the 891/892
meltan values match here. Might not be only for GO species translation,
might be for fetching models idk
2018-11-10 20:59:55 -08:00
Kurt
6e41b44047 Add telekensis flag & sprite flags
next bit on ev yield is for telekenesis immunity
6 bits for color, 2 bits for flags
2018-08-26 17:20:00 -07:00
Kurt
f4bfdb8311 Remove unnecessary empty array allocations
yay net 4.6
read more: http://justinvp.com/2015/07/20/array-empty/
2018-08-01 18:30:51 -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
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
b0990c8a08 Add xmldoc 2018-07-04 08:43: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
2813b19be0 Fix out of bounds species fetch
provide max species ID rather than table length check; this[>#] can
return forme specific values which do not relate to the species

#2020
2018-06-17 21:52:52 -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
28ef791014 Update hovered slot on box change
using keyboard instead of mouse can change box without moving mouse
outside the slot picturebox
trigger an update when the box is changed, but only if the updating
parent has the hovered child (ie a boxviewer changing box while hovering
the main window won't re-cry the main window slot since it wasn't
updated)
Closes #1940

add some gender threshold properties to personalinfo
2018-05-13 08:14:46 -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
b1cb5226f7 Fix b2w2 tutor reads
yikes what a typo
Closes #1895
2018-04-10 17:36:54 -07:00
Kurt
a24e5aa742 Update personalinfo usages
less temp array usages, add methods for cleaner understanding
2018-03-25 13:54:30 -07:00
Kurt
f55028c1a0 Fix KChart errors
gen1 & gen2 types aren't laid out contiguously (yay bird type and extra
types)
fix gen2 type accessors looking at the wrong byte

type sprites now load correctly, and 3rd ability no longer throws an
error (forced to None).
2018-03-18 11:22:20 -07:00
Kurt
75dbec6038 Remove unnecessary switch entries
null return is only really useful for implementing; can remove the
chance for null when using the api
2018-03-17 20:05:35 -07:00
Kurt
47643f49b6 remove linq personalinfo bit fetch
reads the bits out of the original array (saves a few ms by not
allocating/gc)
2018-02-16 19:34:42 -08:00
Kurt
5ec99b6c1c Refactoring
expose individual types, items, and abilities
2017-12-26 18:54:08 -08:00
Kurt
acb105b706 Fix platinum altforms not having formcount set
fix by hex editing the manually altered field in the personal table so
that it matches HGSS
thanks @sora10pls !

fix unused writeback location for saving tmhm data
2017-11-28 23:14:08 -08:00
Kurt
f25b4fea9c Add forme range check method to personalinfo
relocates logic to better location
2017-11-21 18:32:27 -08:00
Kurt
8b2ec89c52 Add default value for formecount
https://projectpokemon.org/home/forums/topic/42632-bug-gsc-titles-support-broken-gs-transfers-not-recognized/?do=findComment&comment=223647
2017-11-20 08:08:48 -08:00
Kurt
6394dac19f Rework mysterygift pkm sprite generation
don't bother converting to pkm then generating the sprite off that; use
the overload with int/bool

removes sav/pkm dependency for generating gift descriptions, and
standardizes the names a little. maybe a PKMBase interface would be
useful...
2017-11-18 11:34:23 -08:00
Kurt
d8acdf2aa1 Fix partner pikachu sprite
fix form+1 overflow (cap7 pikachu in sm accesses gumshoos1! bad!)
2017-11-10 19:53:11 -08:00
Michael Scire
78acb8e13b Fix save resigning for USUM, add resources for new pokemon 2017-11-08 11:31:09 -08:00
Kurt
ae773f189b add usum tutor data
one large list at static.rodata:005E6860, formatted to look like AO
table with deletions & insertions at the bottom.
bitflags are used in one large set (not 4 chunks of 4 like prior).
2017-11-08 01:25:10 -08:00
Kurt
9ef4152736 add more xml docs 2017-11-06 22:44:51 -08:00
Kurt
8a84f63fcb Add usum special tutor bitflags
( ͡° ͜ʖ ͡°)
2017-10-24 19:59:46 -07:00
Kurt
69cf1eaa9c add more pkhex.core xml documentation
adds a bunch of documentation useful for those unfamiliar with the core
library
2017-10-23 23:12:58 -07:00
Kurt
1e377c2963 interpolation++
no functional change (assumed)
2017-09-29 22:58:25 -07:00
Kurt
496cc35f97 Fix mew male gender
Closes #1489
2017-09-23 22:44:54 -07:00
Kurt
cbda637981 Remove old (GF fixed) shiny correlation
Transporter was updated
2017-09-06 09:12:56 -07:00
Kurt
84c90e973e usum prep
Copied binaries from sm, references set up for saving time later

I assume not much will change in terms of structures, so it should just
be a file replacement & filling in static encounter table => 'working'
legality checks
2017-08-31 22:37:28 -07:00
Kurt
c627a86f8c Fix g4 move tutor lookup
personalinfo setup wasn't populating info for form indexes
remove erroneous pid-type mismatch message on gen3/4 non-matching if
there are no deferred encounters
2017-08-27 11:04:31 -07:00
Kurt
cb8777f767 Refactoring
now that the logic has become more stable, polish away some complexity
2017-07-29 11:54:52 -07:00
Kurt
4e9b6be8e5 Convert console output to debug output
output messages are now no longer in release builds, as they are only
visible when debugging in an IDE.
2017-07-01 19:43:51 -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
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
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
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
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