Commit graph

342 commits

Author SHA1 Message Date
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
Kurt
705822c965 Abstract some gen1/2 encounter types from their parent class 2020-07-18 15:36:30 -05:00
Kurt
e04b96a9b3 Fix dizzy punch egg recognition & gen2 hatch conter verification
Closes #2939
Fixes #2938

Inline some logic where appropriate for egg levels
2020-07-12 20:58:07 -05:00
Kurt
255498b2f8 Allow chatelaine memory ^ skillful check on format >= 8
Check the memory for RibbonTowerMaster; if the memory is present, permit the lack of ribbon if it was granted via past gen and has the other ribbon.

Simplify !(x || !y) to !x && y

Closes #2926 ty @randomdice101
2020-07-09 22:53:57 -05:00
Kurt
993673f0de Minor clean
no functional change
2020-06-27 23:36:53 -05:00
Kurt
a7ba178005 Remove unreachable/const logic
Earlier compares result in some logic being unnecessary

The Gen7 level up move compare was actually an oversight, so it's a worthwhile fix :)
2020-06-27 22:44:14 -05:00
Kurt
ce5a09055a Merge branch 'master' of https://github.com/kwsch/PKHeX 2020-06-24 18:59:30 -05:00
Kurt
1ae9cb7602 Handle pika/meow soup evolutions
Can lose gmax flag if its current species is able to eat soup, or its origin species could eat soup

this handles stuff like charmander->charizard, as charmeleon would not pass

hopefully there's never a mid-stage evo that has a gmax form, and its final evo doesn't... (don't get any ideas, gamefreak)
2020-06-24 18:59:26 -05:00
Matt
a5b72bd1ce
Update VerifyVersionEvolution for Gen 8 Lycanroc (#2903)
SWSH changed Rockruff->Lycanroc to only depend on time of day, not Version as well. Cosmoem still needs both, though.
2020-06-24 07:34:55 -05:00
Kurt
17f8ad97a9 Fix neutral mint index
hardy is index 0. and isn't a mint
2020-06-20 15:05:34 -05:00
Chris
63add7d929
Fix Master Rank Ribbon (#2874) 2020-06-19 23:20:19 -05:00
Kurt
6002dfb739 Revise master rank ribbon again
ty terry & chris
2020-06-19 21:51:57 -05:00
Kurt
69dbde1bb4 Check battleversion state for past-gen master rank ribbon 2020-06-19 21:24:58 -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
27cce4dcd2 Disallow galar master rank ribbon on legends
Closes #2858
2020-06-16 22:16:21 -05:00
Kurt
f51e3673da Update AbilityVerifier.cs
incorrectly edited (ability number needs to be bit0/1/2 not none/any other permutation)
Closes #2860
2020-06-16 22:13:21 -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
ff849b9c5b Allow fullness values for format8
ty anubis
this totally isn't fullness, but the toys increase the value (saturation?)
2020-05-31 13:29:13 -07:00
Kurt
3fcb29e68a Remove some reliance on GenNumber 2020-05-31 12:12:48 -07:00
Kurt
7c6ea78c63 Add fullness legality check
Closes #2836

Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
2020-05-24 20:00:32 -07:00
Kurt
d8cd75908b Handle gen2 gift egg collision with low hatch cycle req
Closes #2824
ty @KR1dude !

change miscverifier to use OT_Friendship instead of CurrentFriendship.
2020-05-24 10:46:08 -07:00
Kurt
6164884700 Merge IGeneration into IEncounterable
all but egg exposed it; now, just make egg expose it and remove the unnecessary interface

we still need to Set generation for non-eggs/mgift, so have a separate Settable interface for internal purposes.
2020-05-17 12:32:28 -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
9b0e74dd2a Update ContestStatVerifier.cs 2020-05-11 16:51:10 -07:00
Kurt
4decaa73f7 Verify Contest stats on gen5 origin
extract to separate logic class; only gen3+ call this (was originally called by gen6+); only really needs to include gen5
2020-05-09 20:47:32 -07:00
Kurt
8650b5ceb2 Verify g4 tower ribbons as invalid on >=g5 origin
https://projectpokemon.org/home/forums/topic/57026-gen-5-contest-stats-ribbons-bugissue/
2020-05-09 20:45:19 -07:00
Kurt
3100471299 Strip out some unnecessary logic
notnull => no need to check for null manually
2020-04-16 12:58:48 -07:00
Kurt
b8814d2448 Split GG into LGPE (GP/GE), GG (LGPE||GO)
Update usages
2020-04-16 12:48:18 -07:00
Kurt
40d000fdce Extract reusable method 2020-04-14 10:08:02 -07:00
Kurt
0ada4cbd77 Remove some unnecessary null checks 2020-04-12 13:20:40 -07:00
Kurt
a94c754c3f More shedinja edge cases
Don't allow shedinja evolution moves if it wasn't evolved in that generation
2020-04-12 11:28:03 -07:00
Kurt
8ac61d7ff7 Allow antishiny CXD spreads for some checks 2020-04-11 23:14:16 -07:00
Kurt
4d061c561a Add initial marking checks 2020-04-06 16:32:23 -07:00
Chris
f6ad77ab04
Fix item check for silvally (pixie plate)
Remove the comparison, was a copy/paste from Arceus 3y ago
a7339ae26f
2020-03-27 12:15:22 -07:00
Kurt
9e8858ac51 Allow traded gen8 eggs to have OT linktrade mem
Stupid lacking game checks
2020-03-25 19:18:52 -07:00
Kurt
aaf6642d31 Rename Data -> BinLinker 2020-03-20 15:18:59 -07:00
Kurt
799e4852cf Minor clean 2020-03-20 13:33:15 -07:00
Kurt
27d1feafd7 Revise egg wc3 fateful check to return instead of break
Emerald has the same met locations too, which doesn't clear fateful. So if it was hatched in an RS(E) location, we can't know for sure.

Closes #2790 , but keep in mind the posted file is illegal anyways -- can't get egg move aromatherapy with wish.
2020-03-19 17:05:16 -07:00
Kurt
3aaf318035 Update event database, handle HOME gifts horribly 2020-03-14 14:22:45 -07:00
Kurt
b5f1fc71c4 Use original PID for xor flip check
swap pkm.PID -> pkm.EncryptionConstant, simplify comparison

Co-Authored-By: Lusamine <lusamine@users.noreply.github.com>
2020-03-11 20:09:09 -07:00
Kurt
eccfb61839 Update BallVerifier.cs 2020-03-10 22:59:46 -07:00
Kurt
9dbc3cd418 Permit galar native species to inherit past-gen balls 2020-03-10 17:53:56 -07:00
Kurt
ee38e6890b Disallow gen7 ribbons on lgpe origin 2020-02-16 17:41:38 -08:00
Kurt
0d4cff81c6 Clean 2020-02-15 14:29:23 -08:00
Kurt
5e65df6758 Update egg ball check for galar non-natives
pretty rough check, but flags the old starters in bad balls now
2020-02-15 14:22:37 -08:00
Kurt
21eb9cb499 Remove gen7b trade evo if HT present requirement
lgpe->HOME->lgpe can set the HT details, but it isn't a trade.
2020-02-15 13:43:58 -08:00
Kurt
3e4bb9f320 Ignore keldeo resolute form check on gen8+
can mismatch in gen8+ as the form activates in battle when knowing the move; outside of battle can be either state.
2020-02-15 13:30:50 -08:00
Kurt
9e16df4970 Only check g6 contest ribbon affection in g6/7
Affection is discarded on PK7->PK8 in favor of friendship, which can be lowered.
2020-02-15 11:43:21 -08:00