Commit graph

420 commits

Author SHA1 Message Date
Kurt
2c820bfbe9 Minor tweaks 2021-05-18 13:29:55 -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
f66662b8db More deferral tweaks for non-HA having HA 2021-04-22 13:47:33 -07:00
Kurt
8483dc241d Update MarkVerifier.cs 2021-04-21 19:12:50 -07:00
Kurt
7256ff0a7f Check if the Shedinja's encounter can have marks
Not all gen8 encounters can have marks (nest, go), so use the regular method.
2021-04-21 18:52:24 -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
45f12bd924 Update FormVerifier.cs 2021-04-18 21:22:58 -07:00
Kurt
f61108ac4e Check gen1/2 female OTs a little more thoroughly
https://github.com/kwsch/PKHeX/issues/2687#issuecomment-822072999

celebi is a es2e, so just filter on specified TID

Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
2021-04-18 19:31:22 -07:00
Kurt
f35a3ce03c Add overload for Totem check, simplify some flow 2021-04-17 13:24:57 -07:00
Kurt
16406d7bba Allow Strongest Trainer memory on gen6-visitors banned from Maison
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=265898

End result is only gen7-origin-in-gen7 are disallowed.

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2021-04-16 08:53:50 -07:00
Kurt
758b6e6770 Remove '<->’ aliasing
Farfetch’d uses the non-vertical apostrophe, still.

Showdown is consistent with their usage (in/outputting ’), but we'll keep the '->’ for that sanitization just in case other services/users enter the wrong char.

Closes #3185
2021-04-12 17:04:02 -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
aaa69eac15 Rename Gen3 Champ ribbon to be more accurate
been like this since mid 2016

this ribbon can be obtained in either Hoenn or Kanto within Gen3
https://bulbapedia.bulbagarden.net/wiki/List_of_Ribbons_in_the_games#League_Ribbons
2021-04-10 12:09:43 -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
5ce3d64996 Disallow lang=2 for dp trades
DP English origin are Japanese language; since we 1=>2, we still needed to disallow 2.
2021-03-21 10:34:00 -07:00
Kurt
012f6678ba Check for dual ability =>evo w/single ability capsule 2021-03-20 17:49:16 -07:00
Kurt
a71d7d1950 Handle gen3 mismatched ability
ty Breil --
https://projectpokemon.org/home/forums/topic/58665-makuhita-in-game-trade-bug-sapphire/
2021-03-20 11:22:56 -07:00
Kurt
1acefbcf93 Remove sigilyph from g5 breed HA banlist
https://projectpokemon.org/home/forums/topic/58657-sigilyph/?do=findComment&comment=265330
2021-03-17 20:20:54 -07:00
Kurt
c27697c919 Flag contest stats if sheen is present on gen5+ origin 2021-02-27 20:02:18 -08:00
Kurt
aaa1fd1b4f Remove obsolete legality checks for safari
Hard matches for encounter slot result in these never being executable.
2021-02-21 15:22:10 -08:00
Kurt
31245d0e37 Add mythical table, allow non-mythical legends in latest ruleset (master ribbon) 2021-02-16 21:42:36 -08:00
Kurt
0121028a6b Furfrou Bank edge cases
lmao nice meme
2021-02-16 21:22:20 -08:00
Kurt
b82b0da7d9 Add checks for fishing mark 2021-02-14 22:25:59 -08:00
Kurt
ebb4e2a56a Defer curry mark static encounters, flag as invalid
Closes #3001 as all marks that can be checked are checked.

Promote trades above static encounters, as it's just met location.
2021-02-14 21:24:31 -08:00
Kurt
927c83d660 Show seed in output, flag correlations that shouldn't 2021-02-14 16:00:43 -08:00
Kurt
5949c3b57e Minor clean 2021-02-14 15:14:45 -08:00
Kurt
1af27516e6 pid encounter type mismatch: returns
Keeping the cryptic message for now :)
2021-02-14 10:20:35 -08:00
Kurt
2ee88ee010 Update FormVerifier.cs 2021-02-08 23:18:45 -08:00
Kurt
37cb15749e Update FormArgument handling for gen6/7
Disassociate pk4/pk6 backing byte[] when converting to pk5|pk7, as we no longer make a copy of the byte[] in the pkm's constructor.

Change UpdatePKM to include isParty, as we want it optional to update FormArgument too.

Change FormArgument saving to be handled by FormConverter; kinda not really good to have it there, but nothing else is handling FormArgument values.

Expand IFormArgument to have all FormArgument values exposed. "Maximum" is furfrou only.
PK6: Max is in the "FormArgument" u32, and the remain/elapsed is in party stats (hence the reverting when boxed)
PK7: u8 remain, u8 elapsed, u8 max, u8 unused.
PK8: assumedly the same as PK7, given the disassembly hints that it's the same as past games (even though Furfrou and Hoopa are not in SWSH).
2021-02-08 20:26:53 -08:00
Kurt
5bb4c9e7fe Update FormVerifier.cs 2021-02-05 17:25:13 -08:00
Kurt
a7f65554ad Update formarg handling 2021-02-05 16:52:46 -08:00
sora10pls
eab75b7cba Update HOME date legality
Update dictionary to use proper format (yyyy-mm-dd), as well as verifier to properly check met year.
Also updated IsValidDateWC8 to clamp latest met date based on UTC, like with GO encounters.
2021-02-04 09:12:47 -05:00
Kurt
f6f81ec782 Add initial date checks for HOME gifts 2021-02-03 22:57:59 -08:00
Kurt
5745f8b44e Update AbilityVerifier.cs 2021-02-03 22:57:23 -08:00
Kurt
335ba2447e Default parsesettings tradeback to true 2021-02-03 15:39:30 -08:00
Kurt
862403858b Refactoring
no functional change
2021-02-03 11:33:09 -08:00
Kurt
33fc33a165 Add more nickname logic checks
Variant nicklang OT can nickname if it's the handler
2021-02-02 22:12:36 -08:00
Kurt
fa09c6bc25 Update NicknameVerifier.cs 2021-02-02 19:21:17 -08:00
Kurt
3d99902023 Add HOME nickname verification rules 2021-02-02 19:14:38 -08:00
Kurt
5ef1850e46 Disallow marks on GO encounters 2021-02-01 20:34:04 -08:00
Kurt
9124a3c62b Improve handling of multi-nicknamed mystery gifts 2021-02-01 18:35:37 -08:00
Kurt
2dbdd83952 Update NicknameVerifier.cs 2021-01-31 21:43:33 -08:00
Kurt
fa3fe0a380 Invert check, fix xmldoc descriptions 2021-01-31 20:12:46 -08:00
Kurt
4456a9dc7a Update nickname rules for gen8/=>gen8
Add a setting so that can flag deceptive species nicknames (even though it may be possible).
2021-01-31 12:37:03 -08:00
Kurt
09e5dde609 Add gen6 key item arg logic 2021-01-31 10:53:41 -08:00
Kurt
62bf1c2755 Add stubs for verifying memories regarding items
Not implementing these, but at least setting up a clean area for anyone else to implement the logic
2021-01-30 19:15:39 -08:00
Kurt
1e86fdcea8
Fracture the encounter matching checks to allow progressive validation (#3137)
## Issue

We want to discard-but-remember any slots that aren't a perfect fit, on the off chance that a better one exists later in the search space. If there's no better match, then we gotta go with what we got.

## Example:
Wurmple exists in area `X`, and also has a more rare slot for Silcoon, with the same level for both slots. 
* We have a Silcoon that we've leveled up a few times.

Was our Silcoon originally a Wurmple, or was it caught as a Silcoon? 
* To be sure, we have to check the EC/PID if the Wurmple wouldn't evolve into Cascoon instead.
* We don't want to wholly reject that Wurmple slot, as maybe the Met Level isn't within Silcoon's slot range.

---

Existing implementation would store "deferred" matches in a list; we only need to keep 1 of these matches around (less allocation!). We also want to differentiate between a "good" deferral and a "bad" deferral; I don't think this is necessary but it's currently used by Mystery Gift matching (implemented for the Eeveelution mystery gifts which matter for evolution moves).

The existing logic didn't use inheritance, and instead had static methods being reused across generations. Quite kludgy. Also, the existing logic was a pain to modify the master encounter yield methods, as one generation's quirks had to not impact all other generations that used the method.

---

The new implementation splits out the encounter yielding methods to be separate for each generation / subset. Now, things don't have to check `WasLink` for Gen7 origin, because Pokémon Link wasn't a thing in Gen7.

---

## Future
Maybe refactoring yielders into "GameCores" that expose yielding behaviors / properties, rather than the static logic. As more generations and side-gamegroups get added (thanks LGPE/GO/GameCube), all this switch stuff gets annoying to maintain instead of just overriding/inheritance.

## Conclusion

This shouldn't impact any legality results negatively; if you notice any regressions, report them! This should reduce false flags where we didn't defer-discard an encounter when we should have (wild area mons being confused with raids).
2021-01-29 17:55:27 -08:00
Kurt
ff21d63d16 Update MemoryVerifier.cs 2021-01-29 14:34:45 -08:00
Kurt
697a9fc668 Permit 80-89 memories on eggs
nice logic ya got there, GameFreak
2021-01-29 13:47:31 -08:00