Commit graph

489 commits

Author SHA1 Message Date
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
Kurt
4bbe9dec96 Update FormVerifier.cs 2021-01-26 16:23:26 -08:00
Kurt
68673cf671 Flag all marks, unlike prior commit
oops, unnecessary simplification
2021-01-22 21:17:41 -08:00
Kurt
acfbef6cfa Disallow raids matching if has mark
Closes #3133
not an ideal solution, but the encounter matching API is kinda limited in deferred-invalid vs deferred-notIdeal.

probably need to unify the match logic and generators so they can cache one secondary-check invalid
2021-01-22 20:28:54 -08:00
Kurt
bb1d23e112 Minor clean
Use some enums, save a few virtual/static fetches
2021-01-16 12:01:40 -08:00
Kurt
621e708d23 Minor clean 2021-01-10 18:15:33 -08:00
Kurt
76ae6b2b3d Minor tweaks
Disallow OT handling when originated gen is 1/2
Cast the input not the const
Hide HighestGameID (Use the method instead)
2021-01-09 21:25:28 -08:00
Kurt
c83208c915 Rename CheckIdentifier.Move to CheckIdentifier.CurrentMove 2021-01-09 13:05:56 -08:00
Kurt
1bd60ba6f9 Check original species in the event of VC transfers 2021-01-05 16:36:16 -08:00
Kurt
9d7c9929b4 Minor tweaks
should be it :( :(
2021-01-05 09:58:33 -08:00
Kurt
23b5aebe05 Update IndividualValueVerifier.cs 2021-01-05 09:56:19 -08:00
Kurt
373aecdf7c Merge GO IV checks, behavior is now correct
Rename IV1/2/3 to HP/ATK/DEF in gp1 structure
2021-01-05 09:39:50 -08:00
Kurt
6fc8779aaa Revert "Add vc shiny female gender ratio check"
This reverts commit d5a1283585.
2021-01-04 17:31:56 -08:00
Kurt
cc43550357 Simplify more expressions 2021-01-04 17:31:43 -08:00
Kurt
acf811f5c1 Permit all generations prior to requested generation for know move check 2021-01-04 15:38:30 -08:00
Kurt
d5a1283585 Add vc shiny female gender ratio check 2021-01-03 18:08:31 -08:00
Kurt
4a52b349ff Minor clean 2021-01-02 19:11:34 -08:00
Kurt
97be69bca1 Use EncounterMatch when EncounterOriginal doesn't matter 2021-01-02 14:47:39 -08:00
Kurt
699a598227 Update NicknameVerifier.cs
Nickname AND Trainer Name are verified in that method; we still want to execute it. If it has a fixed nickname, we can skip the wordfilter since it's already been checked.
2021-01-02 01:02:59 -08:00
Kurt
401add520a Check nickname of non-nicknamed in-game trades 2021-01-02 00:48:58 -08:00
Kurt
c432a15a20 Relocate some tables to a location closer to where they're used 2021-01-02 00:46:09 -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
11a2a7a318 Condense expression to use bitflags
from 2 cmp to just 1
2021-01-01 16:25:48 -08:00
Kurt
f4bf9dd208 Minor clean
add download count to changelog
move 2019 changelog to uncompiled resource (for record)
2020-12-31 10:36:09 -08:00
Kurt
6a9aa891f1 Validate VC transfer consoleregion-language relationship 2020-12-30 15:30:50 -08:00
Kurt
24332b6979 Minor tweaks 2020-12-30 13:08:15 -08:00
Kurt
206a05082b Update HistoryVerifier.cs 2020-12-30 09:55:41 -08:00
Kurt
6071834d4f Fix gender ratio comparison for Colo starters
LockFinder:
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=263736

CXDVerifier:
Use a switch expression for a more concise representation of logic
2020-12-29 20:25:05 -08:00
Kurt
b19688b13d Defer go slots with IV sets as there might be other encs
Move the logic to the class
Update go binaries
2020-12-29 16:07:29 -08:00
Kurt
de840f40d4 Invert some "!is" to "is not" 2020-12-29 00:58:08 -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
c119f18af3 spec->species 2020-12-28 22:22:52 -08:00
Kurt
a4ccca7980 Add battle-only known move memory bypass 2020-12-26 09:27:41 -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
749fef0ac6 Minor clean 2020-12-24 15:23:38 -08:00
Kurt
afdd2bd57e Mark EncounterSlot/Static types as immutable record types 2020-12-23 20:40:59 -08:00
Kurt
0a3f45218f Add OT gender check for N's Pokemon
Closes #3110 ty @FeralFalcon !
2020-12-23 18:03:05 -08:00
Kurt
93910df2c6 Use new switch statements 2020-12-23 17:14:38 -08:00
Kurt
736564be8c Merge EncounterStatic4 back together 2020-12-23 12:15:49 -08:00
Kurt
53e0046a48 SWSH has some form entries with different base friendship (stunfisk) 2020-12-22 09:09:49 -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
cd76e49388 Strengthen know move check 2020-12-21 19:50:56 -08:00
Kurt
351637900f Downgrade swsh move memory verification severity
Some special encounters don't set the Relearn Moves, so we can't really check the memory-moves unless we somehow late-reject a matching encounter. Not really worth the effort to try and verify cosmetic mismatches; just tag them as Fishy.
2020-12-21 19:20:11 -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
b71df7b064 Allow shared moves from daycare as "can know move"
See b58f3bbc22
2020-12-21 16:49:42 -08:00
Kurt
b58f3bbc22 Add memory checks for GO->HOME transfers
Also add checks for the new memory types introduced in swsh
2020-12-21 14:22:24 -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
e72c80613e Extract metadata/state tracking from SaveFile obj 2020-12-05 05:36:23 -08:00
Kurt
9cd6d34f1d Disregard ability bit checks if was shadow
only really pertains to xk3/ck3 and this doesn't really impact legality once transferred
2020-12-02 21:40:35 -08:00
Kurt
d5bd36143e Add language check for jp-blue gameversion, non-crystal female
Closes #3099
Ty @CarlosofKalos !
2020-12-01 16:55:10 -08:00
Kurt
5e32e64ac8 Handle MANôA and FALCçN SPA->FRE Gen2 Trades
Transporter remaps certain locale specific chars depending on the source ROM's version.
Since VC can trade between languages, there are 2 Spanish in-game trades that have glyphs subject to remapping, if it's transferred from a French game.

If the spanish trade is transferred from a french game, it must match the mutated string.

ty @Lusamine & helpers :D
2020-11-29 18:17:15 -08:00
Kurt
016ebb86ad Update AbilityVerifier.cs 2020-11-27 20:44:44 -08:00
Kurt
8eb582c997 Move species/move names to parsesettings 2020-11-27 18:45:06 -08:00
Kurt
26d6143325 Indicate static encounters disallowed from marks
Includes gifts by default
2020-11-27 12:48:47 -08:00
Kurt
fa36b70b29 Split Analysis into two separate classes
Will rename in next commit
2020-11-27 12:00:49 -08:00
Kurt
9b178fefe2 Xmldoc, minor tweaks
Move form-info logic from FormConverter to AltFormInfo; now FormConverter is entirely form=>string[]
Add a bunch of xmldoc
Make pogo no-end-date cmp agaisnt UTCnow rather than local now.
2020-11-27 11:51:02 -08:00
Kurt
771086a222 Show all valid yamask-1 formarg values
from 319 (max HP-1) to 9999 (max saved value).

Causes a little bit of GUI lag when loading 10k items to the combobox; could be a number entry but meh. Lazily allocate the 10k strings; wait until it's requested.
2020-11-24 12:40:56 -08:00
Kurt
37782f0ce4 Consolidate EncounterTrade1 level objects
Adds Nickname checks, thanks @ShadowMario3 for grabbing these into separate text files from Bulbapedia.

I reordered all the encounters to match Bulbapedia; each level is denoted if different if it can be sourced from RBY.
2020-11-22 16:19:03 -08:00
Kurt
037db7b8a3 Add xmldoc for new obj/func related to GO legality 2020-11-16 21:17:45 -08:00
Kurt
377ec02c9b Minor clean
Remove GoPark as a "Type" since it is now baked into the encounter object type
2020-11-14 12:55:30 -08:00
Kurt
ad9e9ddfa0 Relocate go encounter maintenance outside of pkhex.core
PKHeX.Core now accepts generated pkl binaries from PoGoEncounterTool (PGET).

Refer to pporg's repo. This will be treated like event data; occasionally updated.
2020-11-14 12:51:24 -08:00
Kurt
01c597cba7 GO checks round 2 2020-11-12 20:41:01 -08:00
Kurt
98f602fc87 Require tracker for HOME gifts too 2020-11-11 21:27:33 -08:00
Kurt
72e209a156 Split some methods, handle flow for go enc 2020-11-11 21:22:13 -08:00
Kurt
edd9ace51e More pogo rules 2020-11-11 21:03:47 -08:00
Kurt
ae85097c2d Allow go shiny xor!0
Thanks @Lusamine for bruteforce testing to confirm
2020-11-04 20:55:47 -08:00
Kurt
c5b6c20c7b Update MarkVerifier.cs 2020-11-04 12:58:56 -08:00
Kurt
8b25af5f85 Enforce xor=0 for go shiny transfers
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-11-03 18:56:58 -08:00
Kurt
d78424a3ad Hande Ability Patch edge case
4 legends have A/A/H on form-0, and B/B/B on form-1. You can get a form-1 by applying the patch on the form-0, and changing it to form-1 will retain the AbilityNumber=4.

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-11-03 18:48:29 -08:00
Kurt
c60ae57ab0 Handle Ranked Battle Series 7 permissions
Closes #3070
Exclude all classified as Legends; everything else is permitted assuming it can exist in SW/SH.

Co-Authored-By: Chris <28743231+Bappsack@users.noreply.github.com>
2020-11-02 16:38:00 -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
4db6661ffd Handle JP-Blue trade quirks + stadium2 trade bypass
Co-Authored-By: ShadowMario3 <36941677+ShadowMario3@users.noreply.github.com>
2020-11-01 15:27:54 -08:00
Kurt
15348d3fdd Bypass crustle flag 2020-10-31 11:43:17 -07:00
Kurt
975c4f8a4a Prevent nickname change for fateful encounter trades
Handle empty nickname trades for gen6+ assuming there's a nickname
2020-10-30 20:31:12 -07:00
Kurt
bb60b140e2 Allow Gen8 balls on gen3-species eggs originating in Gen8 2020-10-25 18:07:13 -07:00
Kurt
2bb399c8e7 Check egg state before allowing gmax toggle
eggs can't toggle gmax state
2020-10-25 13:41:49 -07:00
Kurt
36051e0f82 Minor clean 2020-10-25 10:02:52 -07:00
Kurt
691f12ae72 Extract battle form logic into a separate class
format is included in the method call to futureproof, not currently necessary
2020-10-25 09:15:16 -07:00
Kurt
90b760b9bf Unban porygon capture-breed ball for eggs
Shows up in dynamax adventures for capture

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-10-24 20:46:43 -07:00
Kurt
6079f53d9a Handle unfused Calyrex with fused-TR flags
Thanks CC6174 # 4880 (Discord) !
2020-10-24 19:10:59 -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
Kurt
799dbde1a2 Add Nest Data for Crown Tundra
Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
2020-10-24 11:06:05 -07:00
Kurt
24bd796302 Fix erroneous legality message with 0IV
Revised string now uses string format, will be in the new localization text update.
2020-10-24 10:52:22 -07:00
Kurt
3dd47dc898 Check ability bit for gen3 based on PID 2020-10-19 11:36:57 -07:00
Kurt
1524093099 Revise g5 pid bit check for forced PID statics
Closes #3027

Roamers: Get PID generated externally
NPokemon: Get PID from a fixed value
Forced (Anti)Shiny: Get PID altered

Thanks @LegoFigure11 && Princess Emily (discord 4650) !
2020-10-12 11:04:29 -07:00
Kurt
a0a8dd0f91
Handle Ability Patch changed abilities (#3024)
Handles conditions when Ability Patch has been used to modify the PKM's ability => hidden ability.

Per the description, it goes 1/2=>H, not the other way around.

Verify ability bit first, as mystery gift case handling skips the bit check logic :P
2020-10-10 12:30:57 -07:00
Kurt
944c47326e Exclude unobtainable SOS encounters
Rather than do backtracking logic to see if the slot can be yielded, don't acknowledge the slot exists if it can't be yielded.
See pk3DS commit where we check EscapeRate for the base wild slot prior to adding it to the exported slot list.
2020-10-10 00:29:53 -07:00
Kurt
dfbafee506 Add call rate check for SOS hidden ability
Probably could just yeet the encounter data for these impossible-to-reach SOS's since they're duplicate with the non-SOS slots, but whatever.
2020-10-09 15:38:23 -07:00
Kurt
9e4ec32e94 Revise nickname check; language-source retained in gen8+ 2020-10-08 14:14:59 -07:00
Kurt
b4eeaf847c Disallow lang-traded eggs mismatching nickname on gen8+
Starting in Generation 8, hatched language-traded eggs will take the Language from the trainer that hatched it.
Transferring from Gen7->Gen8 realigns the Nickname string to the Language, if not nicknamed.
2020-10-08 14:01:36 -07:00
Kurt
6616996905 Relocate N OT logic
Make Legal.cs not care about encounter data :)
2020-10-06 20:09:14 -07:00
Kurt
fe7a4df17e Clean out some gb era version flagging 2020-10-06 20:05:38 -07:00
Kurt
aa43904869 Add stad2 boxnames, registered flag handling 2020-10-05 08:29:17 -07:00
Kurt
6938d2f94d Split VivillonTables into two classes
Indicate that the content is for 3DS specific logic
Reduce restriction for parameters requiring IGeoTrack => IRegionOrigin
2020-10-04 14:15:13 -07:00
Kurt
f8de9fe1bf Minor tweaks
now that stadium saves all expose registered teams, can just call from the parent class
rental sk2's have no TID; add that to the requirement to not get flagged for missing OT
2020-10-04 09:26:15 -07:00
Kurt
d13b893351 Use PKHeX as blanksav language
Closes #3009

Make QRPK7 implement IEncounterable and remove hardcoded PKHeX strings
Let force hatching for WC3 eggs try to hatch from the savefile's language, then revert to english if failed to set an OT.
2020-10-04 08:59:33 -07:00
Kurt
5853888020 Minor Stadium behavior enhancements
Use underscores for enum for ToString replacing with spaces
Don't flag empty-OT as SK2; Stadium0/1 use the "TRAINER" as rental, but leave it blank for SK2.
Don't set any terminators for an OT string if the string is empty; just wipe the buffer.
2020-10-03 21:56:57 -07:00
Kurt
cafcd3df2e Change affixed ribbon-mark check to also consider ribbons 2020-09-27 18:19:10 -07:00
Kurt
7b19e3fb7f Add affixed ribbon legality check
https://github.com/kwsch/PKHeX/issues/3001#issuecomment-698749761
2020-09-25 19:37:38 -07:00
Kurt
6ed60fd35d Flag suspicious PIDs for shiny VC transfers
Configurable setting

Closes #3002
2020-09-25 18:04:44 -07:00
Kurt
fd5e38fdda Remove artist ribbon restriction requiring master ribbon
Closes #2997 ty @sarahlicity for an interesting bypass mechanic :P
2020-09-23 20:47:48 -07:00
Kurt
b039dd28b6 Use reference to personal info rather than fetching again 2020-09-19 07:52:50 -07:00
Kurt
416f5fe183 Check Winning/Victory ribbons for gen3 origin based on encounter
Closes #2990 ty @Atrius97 !

Remove the `object Content` accessor only used for Mystery Gifts (used to trickle up the PKM object since the two ribbon interfaces weren't implemented on the IEncounterable). Just make PCD/PGT implement the ribbon interfaces and delegate the get/set to PKM directly.

Rewrite the national ribbon check for clarity
Optimize invalid/missing ribbon string replace to operate on the final string rather than do linq and replace each input. With this we make 1 temp string only, rather than 1-per-ribbon.

Replace hardcoded "Ribbon" strings to use a shared const string in a central spot.
2020-09-18 16:23:17 -07:00
Kurt
7fc8001806 Continued refactoring
EncounterTrade: don't init Location to -1; keep as default 0 and use that as the pivot for default met location. Move Fateful property to the sub-type that uses it (EncounterTrade4, for Ranch).
Move some EncounterStatic->PKM logic that is per-type to the associated type overloaded methods. Rearrange order of properties to be more consistent with interfaces
Gen3: Initialize some classes without using post-constructor setters. The `init` setter functionality coming in c#9 won't be usable as the net46 runtime/netstandard2 doesn't support it on current previews. Do it this way so we can explicity initialize some required properties rather than apply version on a second iteration.
2020-09-13 14:40:10 -07:00
Kurt
346c284994 Allow pkrs on gen2 eggs
See #1257 item 7; it appears this info on Bulbapedia is incorrect -- disassembly does not care if the pkm slot is an egg or not.

5f197c53f4/engine/events/pokerus/pokerus.asm (L7)
2020-09-10 21:53:43 -07:00
Kurt
ec16202f73 Check for missing gen1 OT names
oops
2020-09-09 22:43:32 -07:00
Kurt
01fb233e48 Minor tweaks
Extract some interfaces
Suppress some warning messages with commented reasons if appropriate
2020-09-09 12:47:24 -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
03e227c744 Allow steel-typed magnemite for gbera
ty MrPerson0!
2020-09-06 18:36:37 -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
c1adab9703 Refactoring
Move logic closer to where it is used rather than in larger static classes

EncounterStatic(7): move VC transfer template creation to class, simplify some sanity checks
EvoChain: g==2 case is never hit as the generation check at the top of the loop already skips
2020-09-05 12:11:43 -07:00
Kurt
6b472ffd62 Misc iencounterable->pkm generator fixes
Still some pending stuff like bad mystery gifts

gen2 static encounters on g/s applying met level and not location
gen6 ralts trade (no nickname) being flagged as nicknamed when it shouldn't
gen4 manaphy egg not having a hatch location (worked fine if you transferred it up)
gen3 antishiny gifts not setting their PIDs (jirachi WC3)
gen5 N's pkm gifts setting the wrong nature
gen3 unown not being generated correctly, cosplay pikachu being allowed form0, non-BugCatchingContest no longer require Sport ball, oras dexnav marill now uses the azurill eggmove table
2020-09-03 19:00:46 -07:00
Kurt
c2ec4d55e4 Minor clean
Add some xmldoc, remove some empty lines, move some small logic pieces to a better spot
2020-09-03 14:28:51 -07:00
Kurt
ad4b560071 Minor clean
Remove RibbonWishing as property, just calc on the fly since it's a single case
Update type info for vc transfer to indicate it's an es7
Split up dreamworld encounters as intended, fix logic lol
2020-08-30 22:37:14 -07:00
Kurt
adb74ffed0 Update Trainer Name verifier with template TID/SIDs
might be better to just have a HashSet<int> and use id32, but eh this isn't some blacklist-checker.
2020-08-30 19:59:21 -07:00
Kurt
6ee7a8724b
Offload EncounterSlot loading logic to reduce complexity (#2980)
* Rework gen1 slot loading

Slot templates are precomputed from ROM data and just loaded straight in, with tight coupling to the encounter area (grouped by slot types).

* Revise fuzzy met check for underleveled wild evos

Example: Level 23 poliwhirl in RBY as a level 50 poliwhirl, will assume the chain is 25-50 for poliwhirl (as poliwag evolves at 25). Instead of revising the origin chain, just ignore the evo min level in the comparison.

Previous commit fixed it for gen1.

* Rework gen2-4 slot loading

Gen4 not finished, Type Encounter data and some edge encounters not recognizing yet...

* Add feebas slots for old/good encounters

* Begin moving properties

Great news! Gen5-7 need to be de-dumbed like Gen1-4.

Then I can remove the bang (!) on the Area accessor and ensure that it's never null!

* Split off XD pokespot slot encounter table type

* Set area in constructor

* Deduplicate g3 roaming encounters

* Deduplicate xd encounter locations (rebattle)

Only difference is met location; no need to create 500 extra encounter objects. A simple contains check is ok (rarely in gen3 format).

* Make all slots have a readonly reference to their parent area

* Minor clean

* Remove "Safari" slot type flag

Can be determined via other means (generation-location), allows us to reduce the size of SlotType member to a byte

Output of slot binaries didn't preserve the Safari flag anyway.

* Update SlotType.cs

* Handle type encounters correctly

* Merge safari area into regular xy area

* Merge dexnav accessor logic

* fix some logic so that tests pass again

rearrange g5 dw init to be done outside of static constructor (initializer instead)
PIDGenerator: friend safari slots now generate with required flawless IV count

* Add cianwood tentacool gift encounter

* Remove unnecessary abstractions

Fake area just returned a slot; since Slots have a non-null reference to the area, we can just return the slot and use the API to grab a list of possible slots for the chain.

Increase restrictiveness of location/type get-set operations

* Minor tweaks, pass parameters

DexNav observed state isn't necessary to use, only need to see if it's possible to dexnav. Now that we have metadata for slots, we can.

* Remove unused legality tables
2020-08-30 10:23:22 -07:00
Kurt
a62324a5a1
Refactoring some IEncounterable-type'd object initialization and original-generation evo chain (#2974) 2020-08-21 16:35:49 -07:00
Kurt
adb55c9e7b Make CanToggleGigantamax have a form argument
no more meowth-1/2 and or perrserker
Closes #2973
2020-08-16 23:06:49 -07:00
Kurt
67cea47b56 Fix move record flag check overflow to tracker
Would return true if tracker is set; this bool is only checked if is egg.
Add a check for eggs with home tracker.
2020-08-11 19:42:40 -07:00
Kurt
71456d98fb Handle unhatched manaphy egg
Closes #2965
2020-08-09 20:02:28 -07:00
Kurt
6645481829 Flag gen3 world ribbon as invalid
Closes #2963
not like anyone actually has this ribbon
2020-08-08 22:55:44 -07:00
Kurt
ad6728fb5c Minor tweaks
Check egg encounter for state rather than re-deriving some properties on the fly
Only check memories if memories are exposed
Remove debug assert (not always true?)
2020-08-04 22:56:55 -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
27f15d2f20 Split Country/Region/ConsoleRegion to interface 2020-07-31 11:17:31 -07:00
Kurt
a6a3c6eaaa Refactoring
change some expressions for better perf/readability
2020-07-19 17:48:45 -05:00
Kurt
eb7ed44b29 Finish splitting gen1/2 encounter types from parent class
Results in a little more code, but each path is less tangled
simplify some expressions
remove RBDragonair content in favor of a strict filter for catch rate

Move gen1 trade trainer names to stringconverter, since pk1/pk2 shouldn't refer to legality classes
2020-07-19 13:32:40 -05:00
Kurt
e4092e64df Relocate gen3 ereader berry logic 2020-07-18 22:51:55 -05:00
Kurt
acd97c6287 Pass evolution chain for generation memory check
chain details are already computed; pass them in
2020-07-18 21:57:15 -05:00