Commit graph

126 commits

Author SHA1 Message Date
Kurt
2e20e75168 Temp handling for bdsp case 2021-12-09 19:53:43 -08:00
Kurt
88ddc5822e c#10: readonly record structs
Reduces some boilerplate constructors/equality compares
2021-12-04 18:32:35 -08:00
Kurt
1c82b707f3 Add xmldoc, add egglevel get central location 2021-11-30 17:09:46 -08:00
Kurt
3e677bf6c0 Add elemental beam type tutors for BDSP 2021-11-20 16:50:44 -08:00
Kurt
723514e89c
Update 21.11.19 - Brilliant Diamond & Shining Pearl (#3289)
Big thanks to @SciresM @sora10pls @Lusamine @architdate @ReignOfComputer for testing and contributing code / test cases. Can't add co-authors from the PR menu :(

Builds will fail because azure pipelines not yet updated with net6.
2021-11-19 18:23:49 -08:00
Kurt
2874f6fc69 Revise pichu volt tackle egg handling
Clean up ParseMovesWasEggPreRelearn as only EncounterEgg call into it, and no EncounterEgg has a special moves interface implemented.
2021-09-15 18:43:18 -07:00
Kurt
17c32db8b5 Minor fixes
Replace hardcoded move int with enum val
Lillipup->Rockruff
personal_swsh: remove pledge bitflags (missed in CT update)
2021-09-06 18:04:14 -07:00
Kurt
c65fda5e7d Allow HM moves in gen2-4 eggs
Yay silly inheritance
ty atrius
2021-08-28 13:54:58 -07:00
Kurt
28e7473f1a Condense some expressions 2021-08-22 01:26:28 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
Kurt
c6342a163f Minor clean
variable swaps, simplifications
2021-08-20 13:42:25 -07:00
Kurt
24e77e7382 Handle form changing for move memories
Doesn't invalidate any of the statements made today.

ty @Lusamine for identifying these cases.
2021-08-14 20:20:13 -07:00
Kurt
9793e9f1a0 Minor clean
Slap on interface for EntreeSlot
De-magic some 💯 numbers to indicate what they're doing
Improve perf of move-match-relearn check
Add an "else" as valid is never both values (history verifier)
2021-08-13 15:36:30 -07:00
Kurt
cad09e68bb Fix source string returns
I blame the goofy "move egg" names confusing me
Reorder some so that the switch case is sequential and can be optimized by jit as a jumptable
2021-08-12 17:32:25 -07:00
Kurt
5c472a400d Expand shorthand parameters
int i => int index, or whatever the value is representing.
2021-08-05 20:33:25 -07:00
Kurt
c9640f8561 Comments: forme->form 2021-07-26 14:14:39 -07:00
Kurt
7bd844d5c5 Move min level check for gen1/2 closer to move adder
Check per-evolution min level rather than basing it on the original encounter data.

Correctly parses stuff like a captured level 23 Nidorina that immediately evolves into Nidoqueen, then learns Body Slam.

Passing zero is better than passing 1, as 0 requires no value pushing.

tidy up method signatures in MoveLevelUp so that species is followed by form, and the lookups are textually aligned. Clarify "maxLevel" instead of max/lvl, same as min.
2021-07-22 21:25:15 -07:00
Kurt
6029c15521 Fix incorrect GameVersion reference 2021-06-09 22:56:19 -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
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
8e52d2fddb Xmldoc updates 2021-04-17 13:07:28 -07:00
Kurt
8b180c3122 Fix egg move source indications (were defaulting to gen2)
Switch expression had an issue with interpreting the object's type (unboxing, yay)

should probably just return a typed object from the parse, but nah, this is a quick fix.
2021-04-16 17:57:48 -07:00
Kurt
e9c9627ad5
Relearn suggestions + Headbutt Slot Fix (#3190)
This change revises the logic for an Egg Move's RelearnMoves.

Removes a class that is no longer used
Passes the large value-passing struct byref via in keyword
Revises handling so that early-returned results from the MoveBreed processing are marked with their move source rather than leaving them unvisited.
The moveset processor uses depth search recursion, and returns false if the move that it is processing is not possible for the hatched moveset. If the depth search never reaches the check for base moves, all moves won't be marked for their origins, resulting in the result array not being accurate to use for suggestion purposes.

Yay multi-purpose logic (validation w/early returns & fixing needing fully processed data).
2021-04-08 15:58:09 -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
ba5bf463e0 Convert static dictionary to switch
probably ends up as a jumptable via jit, so better perf?
2021-04-02 16:47:37 -07:00
Kurt
8705c26adc Bake cosplay moves into the encounter template
yay records `with` syntax
don't bother specifying form6's moves, they're all levelup moves.
2021-02-02 09:40:58 -08:00
Kurt
7833d12f95 Simplify shared egg move array get 2021-01-31 23:07:14 -08:00
Kurt
a524032f61 Add TR flags to emoveset generator 2021-01-30 21:49:45 -08:00
Kurt
511797c1f9 Fix gen4 hm indexing 2021-01-25 20:58:56 -08:00
Kurt
3c42978afa Use IndexOf instead of FindIndex when possible 2021-01-16 12:47:02 -08:00
Kurt
c32b38a53c Minor annotation tweaks
no functional change
2021-01-12 22:26:08 -08:00
Kurt
890ce9ea4e Simplify some expressions
Search array for index rather than loop and check; gives early-break too -- was O(n) now is O(<~n)
2021-01-12 22:25:30 -08:00
Kurt
e663ffdd35 Fix comparison 2021-01-02 20:52: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
04f8efec4f Move more breeding logic to Breeding
Simplify some method signatures, reduce checks for MoveEgg.GetEggMoves

ran legality checks for 100,000 pkm, no more exceptions (Internal Error) -- added a "CanGameGenerateEggs" which filters out unused gameIDs
2021-01-01 15:01:22 -08:00
Kurt
080f6f827d Replace pkm.GG references with direct version checks
No longer tied to met location
2020-12-31 17:45:11 -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
93910df2c6 Use new switch statements 2020-12-23 17:14:38 -08:00
Kurt
324ce9d6ac Minor clean 2020-12-23 09:34:29 -08:00
Kurt
e34c8df044 Revise some method signatures 2020-12-22 20:50:33 -08:00
Kurt
d288a32ef5 Permit TR flags for "Can Relearn", split branching for TR checks 2020-12-22 09:10:10 -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
98be0f6739 Target type'd new 2020-12-21 17:17:56 -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
ebc1cec3da Extract breeding info to separate class
Remove splitbreed check in encounteregg2 generator; gen is always 2, never >=3, so the splitbreed check is never executed
2020-12-07 20:54:55 -08:00
Kurt
0af0c05bac Update go slot list yield and move fetch 2020-11-18 21:34:40 -08:00
Kurt
7cb6ee0060 Move some static arrays closer to where they're used
Split EvolutionRestrictions to its own class
Can probably refine things further to clamp down access to these arrays
2020-11-02 13:11:51 -08:00
Kurt
d257ad1b1a Update MoveTutor.cs 2020-11-01 19:59:26 -08:00
Kurt
2303077ed1 Expose move source classes for api purposes
Not guaranteeing the method signature will be stable forever, but allows people to reference the public methods inside.

Closes #3056
2020-10-27 09:25:33 -07:00
Kurt
2e4af1afc5 Update legality comparisons for Crown Tundra
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-10-24 11:16:01 -07:00