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) !
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
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.
A Gen3 level 26 sylveon with a met level of 25 in Generation 8:
Transferred as Eevee at level 25, and leveled up to 26=>Sylveon
If we use met_level (25), we need to decrease 1 as we evolve. No, use Current Level and ensure the max isn't above the bare minimum (met level)
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.
The game uses 0x5E if 0x5A+everstone, otherwise it uses 0x58
For determining the seed species-form, we want to use everstone breeds as that resolves to the correct species-form values.
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Co-Authored-By: Marty-D <1645989+Marty-D@users.noreply.github.com>
Handle yielding in the moveset generator as well
Future commits will trim down unused values/abstractions; probably can get all the stadium stuff handled innately
Revises the tradeback status to remove any index that could have been sourced from egg moves instead.
really should refactor this TradebackStatus away, but Move validation still remains one of the un-refined parts of the legality checks :P
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
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.
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.
Introducing a new PKM format: SK2
Split ICaughtData2 off of PK2 so it can be shared with SK2 when type-checks occur
Add conversion for PK2<->SK2
Split the split-buffer handling for GBPKM to GBPKML (what a name), so that I can reuse shared accessor logic for SK2.
Move Home8 location to Locations.cs for documentation
Move FestaFacility to correct folder
Remove unnecessary public modifier on interface method
Pass the program's Version to any loaded plugins, if they wanted to check compatibility...?
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.
Closes#2984
ty atrius & matt via discord
Co-Authored-By: Atrius97 <39707481+Atrius97@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
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.
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
Gen1: all are Trade1 objects, and all get the values set; just set the value in the object initializer
Gen2: all are Trade2 objects, set the same version
Gen2 all static encounters already have a version marked. Only thing remaining is to set the language.
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
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
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
precompute result size
set Gen5 as lumped group for common encounters
remove linq usage (besides Sum call, whatever)
GetEncounters now only filters the in-game static encounters rather than the dreamworld too, as those are already filtered by separate arrays.
Get the variable rather than indexing into the array each time
Simplify some expressions in sav7 for readability
Make SAV_EventFlags use comboitem explicitly by type rather than an anonymous type with same member names
Check successive move slots after the current index rather than doing a count eq >= 2.
Flag all empty slots prior to a filled move slot, rather than flagging a full slot as invalid because "empty move".
* 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
Thanks MrPerson0 on discord for notifying us of this mechanic. Stadium 2 can utilize Gen1 learnset data while keeping them in PK2 format, retaining the met data.
Adjust EggItemShift to account for using the big Egg sprite
Add Marowak to non-transferrable Totems (none of the USUM Totems can be transferred to SWSH)
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?)
Only check player ID
Closes#2952
Had originally intended to just recognize the PIDIV and check it in the lock verifier, but this is more straightforward since we don't have to check CPU TSV.
GO Fest 2020 made Alolan Marowak available in wild spawns, and further testing has proved that Raid/Research PKM can be downleveled to 15 after trading to low-level accounts.
This'll probably end up being deprecated in the future when we have GO->HOME transfer checks, in addition to IV checking.
verify relearn: move split check before method call
movelist: don't capture pkm in local method; meowstic ID
pkm: flip argument for easier understanding
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
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
Some zone names were mislabeled in pkNX -- Staryu are not scripted encounters!
Remove altform specific moves from distro/static Rotom, which would erroneously allow illegal mismatches (e.g. Hydro Pump Rotom-1); thanks Abyzab (Discord)!
no change in species/form from the crownite ore one afaik; common for both games???
fix type of rigel encount so it shows up in block editor, with correct name (ty matt)
vs -> chain (clarity on what it is; an evolution chain, rather than e.v.o.s - vs)
Clamp origin chain for transferred where we can use the max origin level
things shouldn't be this way, but encounterstatic doesn't currently accept a SpeciesForm evolution link in the matching function, so we can't know when the form changed legally.
Encounter Slots do it fine for the most part... might need to refactor the matching API so that it behaves a little smarter
Closes#2912
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)
invert ability index favoring so that the first ability index is most favored
ability num:
-1=>0/1/2
0=>0/1,
1=>0
2 =>1
4=>2
Ability Type:
0,1,2=>0,1,2
3=>0/1
4=>0/1/2
Should probably get rid of AbilityNumber definition usage but it's so entwined in the trade/static definitions...
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>
(for good? pls)
https://i.redd.it/7g2c4d3kisc41.png
ty anubis
remove GetMinimalLevel override, as it's doing the same thing as LevelMin. When regenerating the pkm, we aren't doing anything downlevel related.
Downleveled shared nest can't go below 20
Downleveled self nest can only happen for 1 or 3 badges and certain star counts, and the result can't be shiny