Commit graph

522 commits

Author SHA1 Message Date
Kurt
6ee552b860 Compare propertyvalue for Legal batch
seal the classes, no need to derive (nothing virtual)
2021-07-10 13:45:14 -07:00
Kurt
3fa311f6ed Misc tweaks
more annotations - all bool->out ? are annotated now
fix gender symbol inversion (forgot to set text)
extract some methods to reduce nesting
2021-07-06 08:42:15 -07:00
Kurt
16c8a18928 Show box/slot offset by 1 when loading as SlotCache
Closes #3229
also revises parsing to not ToString(), and doesn't add a skip if the slot is empty
2021-07-03 09:28:35 -07:00
Kurt
103aa9aa4b
Revise EncounterArea and EncounterType for clarity (#3228)
EncounterArea now stores a more specific type'd array for encounter slots. Better iteration and less casting, as the nonspecific `Slots` fetch is rarely referenced.

EncounterType renamed to GroundTile to reflect how it actually works in Gen4. Was previously an ambiguous field that was clarified a little; we can describe it a little better now. Keep the GUI the same to not scare the end users.

Change Trash Byte properties to get/set a Span. Trash Byte legality checking easier on the garbage collector?
2021-06-29 20:58:06 -07:00
Kurt
3e7775fc44
Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately (#3222)
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately

Don't store within the object, track the slot origin data separately.

Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.

- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code

* Remove WasLink virtual in PKM

Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.

* Use Fateful to directly check gen5 mysterygift origins

No other encounter types in gen5 apply Fateful

* Simplify double ball comparison

Used to be separate for deferral cases, now no longer needed to be separate.

* Grab move/relearn reference and update locally

Fix relearn move identifier

* Inline defog HM transfer preference check

HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.

* Extract more met location metadata checks: WasBredEgg

* Replace Console.Write* with Debug.Write*

There's no console output UI, so don't include them in release builds.

* Inline WasGiftEgg, WasEvent, and WasEventEgg logic

Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
2021-06-22 20:23:48 -07:00
Kurt
49b7d4522c Sync missing change 2021-06-09 18:40:17 -07:00
Kurt
2083201ee1 Add ObjectType custom filter logic 2021-06-08 20:28:13 -07:00
Kurt
035584dc7c Extract templating from EditPKMUtil, rename methods 2021-06-07 20:02:57 -07:00
Kurt
871de4e213 Add more xmldoc 2021-06-06 11:56:54 -07:00
Kurt
8c970ec991 Minor tweaks
no functional change, readability++
add more xmldoc
2021-06-03 12:04:19 -07:00
Kurt
138501da2f Minor clean
Condense some expressions
Use less linq
Rename some fields
2021-05-29 15:31:47 -07:00
Kurt
64dbb9ae74 Abstract filter matching
Similar to prior commit adding modifications and suggestions
2021-05-27 14:43:32 -07:00
Kurt
05e37eb073 Extend batch editing to allow for plugins to add new mods 2021-05-27 12:20:00 -07:00
Kurt
236fd2943f Add hgss pokewalker stored pk4 fetch
ty atrius
2021-05-25 10:07:14 -07:00
Kurt
04ea271b8b Update ShowdownSet.cs 2021-05-20 08:24:22 -07:00
Kurt
2655892db1 Choose a gender on unspecified 2021-05-19 17:12:30 -07:00
Kurt
fac7555c50 postfix gender form
handle all permutations of Indeedee-M/F (M/F)

if it detects (F), it uses female, otherwise it uses whatever the detected form was (0/1) and sets the values accordingly.
2021-05-19 13:12:18 -07:00
Kurt
2c820bfbe9 Minor tweaks 2021-05-18 13:29:55 -07:00
Kurt
44affe3caa Add flag unit tests, more xmldoc 2021-05-15 11:32:25 -07:00
Kurt
ebefa0a918 Update ShowdownSet.cs 2021-05-15 10:20:19 -07:00
Kurt
e31980d15e Clean up nickname parsing, make Gender an int type
Breaking change for anyone using IBattleTemplate (alm)
2021-05-14 23:41:14 -07:00
Kurt
50b15cd740 Use range/index
More in line with modernizing the codebase with latest c# syntax

improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
2021-05-14 15:30:55 -07:00
Kurt
07584a8774 Add chateau score, seaside cycle score
Update some other areas too
looks like this fixes the sube pkx fetch method for extraslots, yay.
2021-05-13 23:12:53 -07:00
Kurt
ceede68861 Minor tweaks 2021-05-07 22:11:10 -07:00
Kurt
31142ee297 Replace some linq usage with direct logic 2021-05-06 23:26:38 -07:00
Kurt
2aed4c3118 Add shedinja dropped ribbons/marking considerations
Nice bug ya got there, gamefreak.

Coulda cleared the AffixedRibbon value instead of copying it on Shedinja creation, and it would have made this unnecessary.

Please ditch the Affixed Ribbon gimmick for future games, thanks!
2021-04-21 15:20:16 -07:00
Kurt
25565e6f07 More pattern matching expressions
Shapes are fancy; nested pattern checks
2021-04-20 02:17:28 -07:00
Kurt
9dfa1077ee Rename internal PKMInfo class to match batch names 2021-04-20 01:50:47 -07:00
Kurt
d9c22b1d74 Move pk1/2 EV maxing to class 2021-04-20 01:50:27 -07:00
Kurt
b64edb751d More xmldoc 2021-04-20 01:50:04 -07:00
Kurt
2f078e6565 Minor tweaks
Make HP IV set use single array fetch, less memory required
add some xmldoc
2021-04-20 01:02:32 -07:00
Kurt
0d45075d4b
Rewrite settings handling; enhance some user experiences (#3193)
- Settings now stored as json next to exe
- Settings now exposes all legality checking setttings that can be changed
- Slot hovering now can play cries in MGDB/PKMDB/etc, not just the main boxes.
- Enhanced hover text for mystery gifts and encounters that have movesets
- Show recently loaded save files in ctrl-f browser
- Toggle auto-load savefile setting to be none/detect-latest/last-loaded
- Custom extensions & extra backup paths can now be configured directly in the json settings
- Settings editor now uses propertygrid & tabs.
2021-04-11 18:09:54 -07:00
Kurt
cfcefca14f Add splitbreed relearn suggest recursion 2021-04-10 11:03:21 -07:00
Kurt
fb972b9782 Update MoveSetApplicator.cs
Closes #3191 , uses a better method
2021-04-09 11:22:10 -07:00
Kurt
673c0d93a6 Extract event flag/work editing from GUI
now <200 lines for editing (ignoring the diff functions), yay
Opening the editor allocates less (no copying save file)
2021-04-05 20:52:49 -07:00
Kurt
0626b0c29b
Add Breeding move ordering logic, and use in legality analysis (#3183)
* Initial bred moveset validation logic

Unpeel the inheritance via recursion and permitted moves

* Volt tackle considerations

* Optimize out empty slot skips

* Add tests, fix off-by-one's

* Require all base moves if empty slot in moveset

* Add test to prove failure per Anubis' provided test

* Tweak enum labels for easier debugging

When two enums share the same underlying value, the ToString/name of the value may be either of the two (or the last defined one, in my debugging). Just give it a separate magic value.

* Fix recursion oopsie

Also check for scenario where no-base-moves but not enough moves to push base moves out

* Add Crystal tutor checks

* Add specialized gen2 verification method

Game loops through father's moves and pushes in one iteration, rather than checking by type.

* Add another case with returning base move

* Add push-out requirement for re-added base moves

* Minor tweaks

Condense tests, fix another off-by-one noticed when creating tests

* Disallow inherited parent levelup moves

Disallow volt tackle on Gen2/R/S

* Split MoveBreed into generation specific classes

Gen2 behaves slightly different from Gen3/4, which behaves slightly different from Gen5... and Gen6 behaves differently too.

Add some xmldoc as the api is starting to solidify

* Add method overload that returns the parse

Verify that the parse order is as expected

* Add reordering suggestion logic

Try sorting first, then go nuclear with rebuilding.

* Return base moves if complete fail

* Set base moves when generating eggs, only.

* Use breed logic to check for egg ordering legality

Don't bother helping for split-breed species
2021-04-04 18:30:01 -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
8d3f990667 Make some properties into consts 2021-03-20 12:47:21 -07:00
Kurt
33e2c64721 Split SAV3 into version classes
Begone are the version-switch cases for value fetching.
2021-03-15 23:51:58 -07:00
Kurt
6bce4eea14 Minor clean
Annotations (nullable), some switch cases for readability
2021-03-14 16:16:55 -07:00
Kurt
49541e6073 Rework mainline sav3 to not operate off chunks
Previous style was to resize the sav buffer and concat all the storage chunks at the end. Allocated a double save file.

Now, just allocate 3 buffers.
2021-03-07 23:22:07 -08:00
Kurt
21e1e6def5 Check format 3/4 for setpidnature 2021-02-02 15:39:41 -08:00
Kurt
f85ee7615d Replace dashes with spaces for cosplay pikachu (rock star)
Can't replace all dashes with spaces, because Pom-Pom Oricorio exists.
2021-02-02 09:19:29 -08:00
Kurt
8db21c2bd0 Update 21.01.30
Latest cumulative update release with mgdb/pget binaries updated.
2021-01-30 10:46:05 -08:00
Kurt
bdbbe5194e Update MoveSetApplicator.cs 2021-01-30 10:34:24 -08:00
Kurt
4f7faf9c85 Moveset generator tweaks, dexnav move logic 2021-01-30 10:15:38 -08:00
Kurt
7497e08f9b Template fields with species for save file
Fix PP since gen8 has pound at 35 rather than 40
2021-01-27 08:40:37 -08:00
Kurt
8546ecaf46 Fix suggested moveset 2021-01-21 09:27:33 -08:00
Kurt
680e8b711d Add some code analysis for try-return with nullable out 2021-01-17 00:05:07 -08:00
Kurt
bb1d23e112 Minor clean
Use some enums, save a few virtual/static fetches
2021-01-16 12:01:40 -08:00
Kurt
33ad654be6 Mark encstatic version on init rather than post-init 2021-01-03 16:49:49 -08:00
Kurt
1f600f3518 Fix Gen2 Shiny ShowdownSet import
SetNature loops by changing the PID which doesn't exist; there's no nature or abilities in gen1/2 so just skip these two methods completely.
2021-01-02 19:58:25 -08:00
Kurt
7629d3f887 Bounds check empty permutations
If the length is 0 or malformed input, we return empty.
2021-01-02 19:23:39 -08:00
Kurt
97be69bca1 Use EncounterMatch when EncounterOriginal doesn't matter 2021-01-02 14:47:39 -08:00
Kurt
09089da14e Use more expression return style
Reduces indentation & bracketing, a bit more concise
2021-01-01 17:08:49 -08:00
Kurt
813180453e Delete duplicate HT bit fetch method
Make expression methods
2021-01-01 16:39:33 -08:00
Kurt
4d1832b124 Move showdown stuff to subfolder 2020-12-29 15:39:24 -08:00
Kurt
c119f18af3 spec->species 2020-12-28 22:22:52 -08:00
Kurt
6502c9df33 Condense some expressions, extract static class 2020-12-28 21:42:54 -08:00
Kurt
e44100a9fd Remove unnecessary ComboItem logic 2020-12-28 11:56:00 -08:00
Kurt
ee5349ff98 moar is or 2020-12-25 12:30:26 -08:00
Kurt
4a8a495d04 Condense some switch expressions
Should be it for now; exhaustively searched for all that made sense to change
2020-12-25 10:58:33 -08:00
Kurt
4d0108331a Move LegalityAnalysis derived movesets out of class
LegalityAnalysis just does the analysis; no need to do unnecessary suggestion logic inside the object.
2020-12-24 16:36:50 -08:00
Kurt
997e0751f3 Minor clean
Handle remainder of c#9 sugar
Fix some spelling mistakes
2020-12-21 23:37:07 -08:00
Kurt
514b60b447 Merge type check with usage in if statements
if x is y with z property true, then :D
2020-12-21 22:33:48 -08:00
Kurt
4890e0e952 Change move source requests from a bunch of bools to bitflag enum
little more sane & clear
2020-12-21 21:24:16 -08:00
Kurt
d225f3391a Split up DataUtil to separate files
ya i know there's already a localizeutil class, whatever
2020-12-21 19:13:18 -08:00
Kurt
594db92ad0 Minor clean
Handle some stragglers
2020-12-21 17:48:08 -08:00
Kurt
98be0f6739 Target type'd new 2020-12-21 17:17:56 -08:00
Kurt
0303eada32 this is not that
clearer than before, yay
2020-12-21 17:12:39 -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
7c4c1e0913 Minor prep clean 2020-12-10 19:49:53 -08:00
Kurt
6f7602f2ad Change signatures to use readonly if possible
Extract get/set team methods for battle video
2020-12-05 06:09:33 -08:00
Kurt
e72c80613e Extract metadata/state tracking from SaveFile obj 2020-12-05 05:36:23 -08:00
Kurt
8eb582c997 Move species/move names to parsesettings 2020-11-27 18:45:06 -08:00
Kurt
fa36b70b29 Split Analysis into two separate classes
Will rename in next commit
2020-11-27 12:00:49 -08:00
Kurt
db71d689b2 Number fused slots, check backing byte[] for slot find 2020-11-01 18:40:10 -08:00
Kurt
a2fb9c48eb Add fused calyrex block 2020-11-01 17:55:52 -08:00
Kurt
7e93bcfb61 Handle contest ribbon deadlock scenario
Contest Star needs all 5 ribbons; all 5 ribbons require contest star. Incrementally adding will fail on the last ribbon. Try setting both at the end.
When removing ribbons, attempt to remove the pair first, as the incremental removal will fail each time (contest star last).

#3061
2020-10-29 19:11:03 -07:00
Kurt
9264150b2b Add shiny1 batch editor, add ctrl-shiny (1)
GUI: Ctrl click star to get shiny1, shift click for shiny0, any-click to get random

make Alt click modify the SID instead of PID

add SetShinySID shiny type
2020-10-25 10:42:48 -07:00
Kurt
3e1bc1f59d Show extra slots in the "Other" tab 2020-10-24 14:57:53 -07:00
Kurt
1bd3ec79cf Misc tweaks for suggesting moves when IsEgg
Closes #3032

Don't suggest tutor moves for current moves if it is an egg
2020-10-14 18:55:30 -07:00
Kurt
945ef24142 Add SK2 to batch editor supported types
Could do it via reflection but ehh
2020-10-09 14:44:12 -07:00
Kurt
706618d331 Force Hidden Power IVs for format2 imports
Closes #3019
2020-10-09 09:52:29 -07:00
Kurt
bca8a80b39 Minor clean 2020-10-03 17:09:22 -07:00
Kurt
2b7e06e217 Refactoring
Extract some logic, suppress some compiler messages
2020-09-18 22:11:13 -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
0111c3dd6f Set Max EVs for ShowdownSet`s imported onto GBPKM with unspecified EVs
https://github.com/architdate/PKHeX-Plugins/issues/48
2020-09-07 10:56:25 -07:00
Kurt
9191f023a3 Minor clean
Nullability annotations and some logic simplification
2020-09-06 11:24:54 -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
Brian Fischer
c4e9bbcc45
Changes to suggested hyper training logic (#2968)
- Changed suggested hyper training logic to not hyper train over some possibly intentional unusual speed IVs
- Showdown import will not do any hyper training on pokemon encountered in gen 8, because with Hidden Power removed from the game in gen 8, all specified IVs in the showdown format are guaranteed to be deliberate for stat purposes.
2020-08-14 21:49:01 -07:00
Kurt
32f2703339 Fix entire-box swaps by using correct lengths
Add SIZE_BOXSLOT and update usages
Make SIZE_STORED protected like SIZE_PARTY

probably need to redesign how slot metadata is presented within the savefile...
Closes #2961 ty @Kermalis !
2020-08-07 16:16:10 -07:00
Kurt
85d1b0e7ad Split gen6/7 affection stats to interface
not in future formats, doesn't belong
2020-08-02 11:06:30 -07:00
Kurt
e84ce77008 Split memories from main pkm class to interface
pk6/7/8, not pb7
2020-07-31 17:25:14 -07:00
Kurt
b7211000b0 Split Country/Region/ConsoleRegion from ITrainerInfo
Only present in mainline gen6/7 game pairs, so it's not wise to have it for all games
2020-07-31 13:53:42 -07:00
Kurt
27f15d2f20 Split Country/Region/ConsoleRegion to interface 2020-07-31 11:17:31 -07:00
Archit Date
fa3bdfe5f6
update showdownset parsing for new gmax impl (#2957)
Gigantamax: Yes is now in a new line instead of -Gmax. Have maintained legacy support since showdown is supporting legacy as well. Set the export to the newer format.
2020-07-30 20:16:57 -07:00
Kurt
7bd36ca0c8 Minor clean
Fix xmldoc, revert ??= because whatever nullable logic plugin I have isn't detecting this right
2020-07-26 08:54:52 -07:00
Kurt
705822c965 Abstract some gen1/2 encounter types from their parent class 2020-07-18 15:36:30 -05:00
Kurt
69a0c61406 Heal PP on apply suggested moves
Closes #2919
Sure ya coulda set suggested PP as well as a command, but we'll do it for the user automatically. Not really an upside to keep the old PP values.
2020-07-03 01:17:05 -05:00
Kurt
993673f0de Minor clean
no functional change
2020-06-27 23:36:53 -05:00
Kurt
c565c7ca2c Extract move suggest logic, add battleversion clamp
Closes #2911
2020-06-27 13:06:28 -05: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
bfef634a1a Set shiny type regardless of format
Don't loop if not required to loop
2020-06-12 11:45:56 -07:00
Kurt
c3215083c2 Update ShowdownSet.cs 2020-06-05 09:55:00 -07:00
Kurt
4f40330af9 Add Dynamax Level = 10 to showdownset if legal
Closes #2835 ; zacian/zamazenta/eternatus can't have a DynamaxLevel other than 0.

Co-Authored-By: Mikewando <mikewando@users.noreply.github.com>
2020-05-16 15:15:41 -07:00
Kurt
8a54e8c7b9 psim behavior update: Preserve "Antique" on tea export
https://github.com/smogon/pokemon-showdown/pull/6429
2020-04-17 11:41:34 -07:00
Kurt
1192ff7307 Case insensitive shiny/suggest
closes #2809 , nothing wrong with existing behavior, just allowing the "suggest" and "shiny" to be any.
2020-04-15 16:23:20 -07:00
Kurt
49bdfa7f9d Add date copy $suggest 2020-04-13 09:23:31 -07:00
Kurt
76e1f70b9e Update ShowdownSet.cs 2020-04-12 20:31:44 -07:00
Kurt
33bdacebe8 Minor tweaks
Handle some compiler/extension suggestions
2020-04-12 16:07:59 -07:00
Kurt
30d21e4532 Extract out showdown set interface 2020-04-12 13:05:29 -07:00
Kurt
270d984130 Minor clean
Remove unnecessary null checks
Mark some methods with nullable type
2020-04-04 19:30:50 -07:00
Kurt
5e32e9203e Add setting to apply nature to statnature on import
Co-Authored-By: toim22 <toim22@users.noreply.github.com>

#2794
2020-03-19 13:47:25 -07:00
Kurt
d21cca7a90 Move gmax strip to top 2020-03-14 12:21:42 -07:00
Kurt
0a39e0a834 Handle gmax tox with latest showdown logic 2020-03-13 17:43:21 -07:00
Kurt
4c226340fe Add shiny sprites, alcremie sprites & big sprites for all
Keeping the 30x40 for now; might change my mind later.
Kept the gmax sprites but they're unused.
2020-03-03 20:22:57 -08:00
Kurt
7919beaddc Filter out duplicate moves 2020-03-03 18:23:00 -08:00
Kurt
5240e67a14 Revert "Loop shiny force regardless of format"
This reverts commit cc8e5d9c32.
2020-02-21 15:02:16 -08:00
Kurt
66efbaf407 Add box manip for heal all slots 2020-02-17 19:28:20 -08:00
Kurt
cc8e5d9c32 Loop shiny force regardless of format
https://github.com/kwsch/PKHeX/issues/2717#issuecomment-586741748
2020-02-16 11:46:06 -08:00
Kurt
48bc4ec8fa Don't yield twice
oops lol
2020-02-07 21:34:05 -08:00
Kurt
6d24905a7d Update hypertrained IVs on export
Don't indicate flawed IVs; just pre-compute the hidden power type.
Remove unnecessary language logic (not needed due to prior commit)

Optimize string concat to a single interpolation, because it's totally a performance improvement!!!1
2020-02-07 17:50:42 -08:00
Kurt
9ffac4382a Replace gender symbols for nidoran with -M/F 2020-02-07 17:42:28 -08:00
Kurt
1cd23e6587 Don't include language name as nickname on set export 2020-02-07 17:42:16 -08:00
Kurt
dd07126d83 Relocate level suggestions to EncounterSuggestion 2020-01-28 16:21:38 -08:00
Kurt
c301ce88ab Update Random to be a bit more thread safe
Random isn't thread safe; users of PKHeX.Core.dll might run multithreaded operations (see PKSM + ALM), so we need to have a thread-specific RNG available.

Thread Local get; to improve performance, save the random object locally whenever it is used more than once in the method.

https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadlocal-1?redirectedfrom=MSDN&view=netframework-4.8
https://stackoverflow.com/questions/18333885/threadstatic-v-s-threadlocalt-is-generic-better-than-attribute/18337158#18337158
2020-01-25 21:49:52 -08:00
Kurt
b5d48bc14f Split up portions of CommonEdits
Cuts out about half the size; there's still a bunch of apply-value logic but it's not really big enough for a separate class.

Rename BallRandomizer->BallApplicator
2020-01-25 16:47:44 -08:00
Kurt
88dcb59798 Extract language initialization to core
Call this method whenever you boot a separate app that needs legality strings to be ready.
2020-01-25 16:27:16 -08:00
Kurt
5be9c6bcc8 Remove unnecessary null handling
objects are no longer null
2020-01-20 23:32:05 -08:00
Archit Date
117bb35621 handle smogon sets with multiple moves (#2647)
sometimes competitive sets have multiple moves in one slot as optional coverage moves. Handle these cases by splitting and trimming over '/'.  Example: https://pastebin.com/raw/jvPziRdC (The dusk mane set)
2020-01-19 22:30:09 -08: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
8312c52cc1 Make Move[] readonly list
contract: don't modify the template movesets
mystery gift now exposes IRelearn, remove unnecessary type checks
2020-01-18 16:46:38 -08:00
Kurt
0cd9c47953 Make Relearn array for encounters readonly
No change em
2020-01-18 16:31:24 -08:00
Kurt
8315f740cb Merge branch 'master' of https://github.com/kwsch/PKHeX 2020-01-16 18:54:11 -08:00
Kurt
857124acf0 Swap zen galar -> galar zen
ty showdown for changing your convention over a month ago
a01e2a26bc (diff-58e367765263b7e21df251b3e7619b70L9307)
2020-01-16 18:54:09 -08:00
Archit Date
22ed59d6a3 sanity check necrozma forms (#2638)
smogon allows Dusk Mane as well as Dusk-Mane as their form argument
2020-01-15 20:48:53 -08:00
Kurt
5a20dc707d Rewrite encounter suggestions
Don't clone legality templates, and keep suggested information minimal -- this isn't automod
2020-01-12 19:40:36 -08:00
Kurt
eaeebea923 Remove another method shortcut
EncounterSuggestion needs a facelift anyway
2020-01-12 17:00:03 -08:00
Kurt
7cbf8d0fcf Set gen3 count ribbons appropriately
ty anubis
2020-01-11 15:51:25 -08:00
Kurt
0dd4d1fe7a Remove unnecessary casts 2020-01-06 17:50:18 -08:00
Kurt
ecabbfff53 Add individual Move#_PP $suggest
#2603
add in "secret" heal/healPP actions -- do ".Heal=$suggest" to refresh
all stats like it was healed at the pokecenter. I can't think of a good
way to handle invoking of methods (">", but what about parameters?)
2020-01-03 20:21:02 -08:00
Kurt
350895aba6 Use permissive string search, add indeedee-M case
Manually modified showdown sets can contain errors (capitalization,
etc). Use the string search api to permit weaker matches, since there's
not going to be any exact-matches-with-different-caps/spaces.
2020-01-02 15:49:35 -08:00
Kurt
166f8d82e5 Misc clean
Refactor out some logic, make "en" literals reference one spot (where
appropriate)
2020-01-01 19:07:21 -08:00
Kurt
be50abcc44 Add SubEventLog block object, etc
Adds gym team records, remove from savefile properties
update block list documentation
2019-12-28 21:53:58 -08:00
Kurt
b255937e86 Revise input parameter names
pk instead of pkm (consistency)
Lowercase anything that started with uppercase (not static state)
2019-12-26 18:47:31 -08:00
Kurt
8e1fe5e305 Don't apply template fake console data if invalid
pkmeditor only for blank data load
2019-12-08 20:09:45 -08:00
Kurt
f54bc7bf6f Batch editor updates
.PID=$shiny0 will do squares
anything else will do stars

.RelearnMoves=$suggestAll will give ALL TR moves, not just the ones for
its current movepool.
.Ribbons=$suggest will give all valid ribbons
.Ribbons=$suggestNone will remove all ribbons (except required ones like
event ribbons)
Closes #2568
2019-12-08 17:52:17 -08:00
Kurt
414cb2d39e don't apply rib-markings on all
legality concerns
2019-12-03 23:41:24 -08:00
Kurt
d70a234552 Add $suggest for PKM.Ball
sets a legal ball, with preference for color matching
2019-12-03 20:14:36 -08:00
Kurt
a0f2aded02 Use more optimized index find 2019-12-03 18:24:28 -08:00
Archit Date
3526c37f1e update forme to showdown strings (#2558)
* update forme to showdown strings

Galarian is represented as Galar on PS!
Polteageist has no form atall
galarian now called Galar by default to match with Alola as a forme. changed darmanitan forme-strings in form converter. Added sinistea to the forme ignore list when converting to showdown
2019-12-03 16:41:52 -08:00
Kurt
594c44f6c0 Set Gender for template
Closes #2548
2019-11-30 23:44:47 -08:00
Kurt
b58ff25741 Use stat nature for showdown set export
thanks @sora10pls
2019-11-26 11:36:20 -08:00
Kurt
5435a5d93e Minor updates
Fix mark (ribbon) read for index > 64
Heal party stats on set detail import
Wipe HT Language for eggs/untraded
Extract BST total color logic
2019-11-25 17:32:10 -08:00
Kurt
22a5df5181 Only set permitted record flags for Move[]
Closes #2523
2019-11-25 12:02:30 -08:00
Archit Date
a05bed8f18 updated shiny indicator for xor0 (#2522) 2019-11-25 09:27:42 -08:00
Kurt
9d02a2c2b1 Simplify comparison
never null
2019-11-24 09:48:22 -08:00
Kurt
cf12f7f4bc Fix type comparison
works fine without this, but this is the correct type comparison
2019-11-24 06:43:42 -08:00
Kurt
32d8225023 Fix drag slot equality check
prevents deleting party slots if a slot is dragged into its original
slot (X->X); Equals check only checked reference
2019-11-24 06:42:41 -08:00
Kurt
dd51ed707f Update record flags on default showdown import
Closes #2511
2019-11-24 06:06:08 -08:00
Kurt
66ebf7cb60 Add $suggest for techrecord & (stat)nature 2019-11-23 12:02:58 -08:00
Archit Date
915f6a5e42 fix toxtricity parsing (#2496)
Full amped form has no form string, so does not need fixing. Exporting low key form also adds a hyphen, so that does not need fixing either!
2019-11-22 14:17:52 -08:00
Kurt
a50169d3d2 Add shift-set shinyxor0 pid
Display xor value on hover, not gonna do alternate stars/square display
Closes #2482
2019-11-20 20:38:05 -08:00
Kurt
1be9a6f70d Fix sav4 load for daycare / gts slots
Closes #2481
2019-11-20 19:16:25 -08:00
Kurt
2aaa3763ee Fix record setting logic
Thanks @AnalogMan151 ! #2416
Fix method reference lol
2019-11-20 18:18:33 -08:00
Archit Date
686f69484d set gigantamax flag from showdown set (#2469) 2019-11-19 15:57:08 -08:00
Kurt
915c2d52b1 Update handling for non-competitive set import
Gen3 item paste -> Gen3 item import => take item ID as is
once parsing moves starts, break if any following lines are not move
lines
Closes #2412 , thanks @The-Fireplace  !
2019-11-16 16:34:28 -08:00
Kurt
3e4127b9e1 Track Gigantamax flag for set data
Closes #2436
2019-11-16 14:37:33 -08:00
Kurt
d7657f948d Update documentation for techrecord flag methods
Allow an ienumerable of moves rather than a readonly list
2019-11-16 08:18:57 -08:00
Kurt
87bb8f3b3f Fix record clear 2019-11-16 08:00:58 -08:00
Kurt
981ed9a253 Add technical record flag editor & api 2019-11-15 23:12:28 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00
Kurt
a6b6383538 Handle more messages
un-nest some classes, tooltip/menu disposing
2019-10-27 20:39:15 -07:00
Kurt
b8835facd5 Rename public "pkm" properties to non-lowercase
lowercase = local variable or private member
2019-10-27 12:57:04 -07:00
Kurt
9401b7a790 More readonly struct tweaks
help dat compiler
minor clean elsewhere
2019-10-26 23:18:25 -07:00
Kurt
fcc993784b Rename abstract pkm inherited class names
leading underscore for a class name = pls no
2019-10-26 12:42:33 -07:00
Kurt
e3efa65160 Cleanup
handle messages for dirty cleaning :)
2019-10-26 12:33:58 -07:00
Kurt
5dcee4fb9a Set random moves if GetMoveSet yields invalid set
Closes #2406
No clean way to check for these edge scenarios, so just double check the
moveset and return random moves if we fail
2019-10-24 18:11:25 -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
87f43a47d8 Bump lang version to 8
some lang upgrades
2019-10-04 20:10:50 -07:00
Kurt
255cdc6ae0 Seal r2
https://www.reddit.com/r/csharp/comments/dd5c1o/til_sealed_override_modifier/

only a few instances for now
2019-10-04 15:56:22 -07:00
Kurt
8d8adde2b1 sealed
sealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealed
2019-10-03 19:09:02 -07:00
Kurt
930f4a2062 Use format specific item IDs 2019-09-25 22:40:16 -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
02014273b8 Remove unused abstractions (slotview) 2019-09-21 10:31:59 -07:00
Kurt
b41f2a3062 Extract logic from PKX
Extract Species Name logic to SpeciesName
Extract Language logic to Language
Remove FormConverter wrapper for string[] fetch
Rearrange some logic to more appropriate locations, update access
modifiers / types
Move some pkm array methods to arrayutil, make generic

PKX.GetVCLanguage was a dupe of _K12.GuessedLanguage() so just expose
the method

PKX is now back to pkm data manip only
2019-09-18 19:58:23 -07:00
Kurt
0fe42a1db3 Minor tweaks
no functional change
2019-09-14 11:48:07 -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
02f36655a0 Reload box data cache on resetting slots
clear box and other calls to ResetSlots weren't reloading with the NEW
modified pkms.
2019-09-09 20:23:18 -07:00
Kurt
6d8ff992e2
Clean up / fix external drag in (#2383)
* stash

* Consolidate some logic
2019-09-03 19:54:41 -07:00
Kurt
b81a1e1e29 Refactoring
Increase abstraction for arbitrary slot get/set operations, and fracture
SAV4 behavior for each game type.

Adds: Undo/Redo of party slot changes
Fixes: Fixed Gen5 daycare slot 2 reading, and EXP reading
Fixes: Some slot color glitchiness
Fixed: Box layout editor now hides the flag label if no flags are
present
Fixed: Gen7 box flags are now shown (unknown purpose lol)
Changed: savefile objects are generally smaller (removed a few shared
offset fields)
2019-09-02 19:30:58 -07:00
Kurt
bf6c25eca7 Break up SlotChangeManager logic
A little bit cleaner when the logic is separated
Keep an abstraction of BoxEdit to cache the current box contents.
Already fetched to show sprites; any future fetches (for preview text /
hover sprite) can reuse the already fetched pkm data.

Should probably rewrite this stuff completely, but effort better spent
elsewhere
2019-08-20 19:50:28 -07:00
Kurt
a608e0b252 Minor clean
Remove some unnecessary properties from SaveFile
Enumerate checksum flag results for GC memcard checking
Remove unnecessary checks on savefile type
Add some documentation
Decapitalize some method parameters
2019-07-14 15:06:45 -07:00
Kurt
c7eecf5976 Extract summary object to core 2019-07-13 17:43:05 -07:00
Kurt
f37a587a1c Minor simplifications
move some pk3->pk4 stuff into object constructor
annotate pk3->pk4 string buffer (trash) quirks
split Heal into Party/PP method uses. Setting suggested stats no longer
refreshes PP
apply current level to Stat Level (wasn't being set previously)
2019-07-12 16:41:13 -07:00
Kurt
59ddd4b3dd Add lure ball to ball color table 2019-06-22 20:00:17 -07:00
Kurt
cbd039b18c Extract datasource filtered lists to object
GameInfo has been the storage for the current Game Language environment
When using GameInfo, only one environment is tracked at a time, which is
initialized by the PKM editor (items, moves). Rework things to allow
multiple filtered sources to exist, and keep the filtering logic in
PKHeX.Core for reuse in other programs... ;)
2019-06-22 10:50:32 -07:00
Kurt
55d486af31 Extract event block diff logic 2019-06-18 18:10:48 -07:00
Kurt
1b028198ad
Split gen5-7 saves with inheritance (#2319)
refer to pull request comments for summary
2019-06-08 19:56:11 -07:00
Kurt
2b8ef9236a use some explicit dex numbers as enum 2019-06-01 10:22:49 -07:00
Kurt
36114e6ff9 Update checksum on templating
pk3 loading tries to decrypt shuffle or something; this makes it work
2019-05-29 22:50:34 -07:00
Kurt
9cdbc46740 Relocate apply basic template out of gui 2019-05-29 22:40:39 -07:00
Kurt
a9152d36a4 Minor tweaks
make some enums non-int (in favor of byte etc)
return current nickname if desired
clamp nature top bound too
2019-05-29 22:40:07 -07:00
Kurt
5879cc8a18 Extract some pkm gui logic
probably won't stay this way if things are eventually rewritten; too
much business logic in the pkmeditor.cs, would need a ton of abstraction
2019-05-29 21:35:52 -07:00
Kurt
4b770e62d9 Simplify and relocate wurmple evo logic 2019-05-11 14:25:58 -07:00
Kurt
be50830975 Relocate method to extension logic class
GetLocationString is now right below GetPotentialString
PKX no longer has extension methods aside from the two CopyTo sugar
2019-04-29 17:36:29 -07:00
Kurt
3d60bea245 Add savefile-wide pkm legality checks
clone checks, duplicate PID/EC/TID
untested & no gui access for now
2019-04-14 01:06:34 -07:00
Kurt
bb8cf5d3d8 Simplify get/decrypt pkm access 2019-03-29 19:43:33 -07:00
Kurt
9ca4ef1e09 Move pkx hidden power logic to HiddenPower.cs 2019-03-16 12:07:22 -07:00
Kurt
28823bd437 Split optional into overload 2019-02-24 22:16:30 -08: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
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
ba65580a8c Rename parameter names for consistency
pkm->pk
2019-02-20 22:23:54 -08:00
Kurt
f30b2766cb Use Heal methods 2019-02-20 22:16:38 -08:00
Kurt
d3dd4fb2a5 Track slot modified count on sort/delete/mod
Sorting will always show multiples of boxcount since it repositions
empty slots
2019-02-20 17:59:54 -08:00
Kurt
fdc97885c5 Speed up clone detection purge
override Execute's default behavior to use a HashSet
2019-02-18 17:19:25 -08:00
Kurt
98b21eaaa8 Add clone deletion quick action
kinda slow, if a save has 900 mons, it has to check 900*900 which is
O(n^2), takes a few seconds
as opposed to just doing a hashset checking contains, would be O(n)
gotta do some fun stuff to make it faster
2019-02-18 17:00:16 -08:00
Kurt
9171055fd4 Add box sort by encounter type
grabs encounter name and orders by that (Egg/Static/Wild etc)
2019-02-18 15:34:55 -08:00
Kurt
e7486e4534 Update gender check
showdownset now no longer leaks nulls
2019-02-13 15:50:48 -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
dc5cdc34d7 Remove FieldsInitialized and rename check method 2019-02-09 17:07:44 -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
59b41937e1 Misc variable name changes
readability++
2019-02-06 23:28:02 -08:00
Kurt
29253ed636 More cleaning 2019-02-03 20:28:03 -08:00
Kurt
893f98d667 Misc clarity
no functional change
make batch editor prefix list readonly
2019-02-03 10:28:33 -08:00
Kurt
2eef523475 Misc clean
meh
2019-02-02 15:20:08 -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
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
ab33f7123b add null check for invalid relearn scenarios
Closes #2245
2019-01-14 16:39:11 -08:00
Kurt
41a3989b53 Consolidate encounterlink into mysterygift
use synthetic wondercards to match link gifts
2019-01-12 23:50:31 -08:00
Kurt
f60926d200 Add slotview stuff
future implementation
2019-01-12 20:53:50 -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
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
3e05e9655e Store hidden power type 2018-12-28 16:54:01 -08:00
Kurt
d5a8d29088 Misc updates
reduce some allocs, clearer names/enum usage
2018-12-27 20:24:24 -08:00
Kurt
950d0a8525 Add nature bounds check & legality
expand string array check to cast and check against length; batch editor
Nature>=25 causes problems in hover tooltips. Previous commit fixed for
pb7 stat calcs for invalid natures, pretty sure the actual game is
exploitable for stat calcs and invalid natures (bad access), but isn't
exploitable as it's only used to retrieve an enum to switch against.
2018-12-25 22:59:52 -08:00
Kurt
ff649009ca Misc tweaks
misc perf adjustments
add utility for slot locked check (without box argument, absolute slot
index)
localize dragdrop strings
increase dragdrop file delete delay (dropping files into discord waits
until you confirm; 10s gives enough time to hit confirm)
2018-12-17 11:17:19 -08:00
Kurt
f6da84b699 add batch editor cp/h/w suggest routes
https://projectpokemon.org/home/forums/topic/48773-problem-with-lets-go-pikachueevee-batch-editor/
2018-12-11 22:27:42 -08:00
Kurt
71fab815bf Provide more slot information
remove lockedslots, store & save all teamslots for sav7
differentiate locked slots from overwrite protected slots by emitting an
enum containing info about the slot

locked = can't be replaced, period.
starter/battleteam = can't be pasted over by bulk-pastes

can eventually show more specific sprite layers to denote party
indexes/team#/starter
2018-12-04 22:59:28 -08:00
Kurt
1d76d799fd Add stats get/set and batch editor suggest
Closes #2196
2018-12-03 20:53:37 -08:00
Kurt
9e23ca6efd Add met location to version sort chain
Closes #2189
2018-12-02 08:55:32 -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
f27816e622 Add party pointer sort
Pulls party members (and follower index if not already in party?) to the
first slot(s) in the (current/all) box.
2018-11-22 23:02:57 -08:00
Kurt
03dd61bc58 Reset CP on common modifications 2018-11-21 12:31:05 -08:00