Commit graph

36 commits

Author SHA1 Message Date
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
b64edb751d More xmldoc 2021-04-20 01:50:04 -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
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
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
8546ecaf46 Fix suggested moveset 2021-01-21 09:27:33 -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
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
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
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
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
fa36b70b29 Split Analysis into two separate classes
Will rename in next commit
2020-11-27 12:00:49 -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
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
706618d331 Force Hidden Power IVs for format2 imports
Closes #3019
2020-10-09 09:52:29 -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
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
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
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
33bdacebe8 Minor tweaks
Handle some compiler/extension suggestions
2020-04-12 16:07:59 -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
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