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>
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
So I said that 0xF26B9151 was the first Max Lair Pokemon entry saved in my previous commit which turned out to be wrong and was in fact the Pokemon that is to be hinted by Peonia. Apologies for that mess up.
Closes#3040
Ty @Atrius97 !
"The Japanese Aurora Ticket was only distributed in Summer 2004, before Emerald (Sept 16th 2004) was released. The software at that time had no support for Emerald games."
Alakazam in the Insular Sea (on the Isle of Armor)
Zapdos at Watchtower Ruins (in a Wild Area)
Zapdos at West Lake Axewell (in a Wild Area)
Moltres in the Soothing Wetlands (on the Isle of Armor)
Moltres on Challenge Beach (on the Isle of Armor)
Moltres in Loop Lagoon (on the Isle of Armor)
Dragapult in the Giant’s Bed (in the Crown Tundra)
Nidorina in Frostpoint Field (in the Crown Tundra)
Glalie on Snowslide Slope (in the Crown Tundra)
GUI: Ctrl click star to get shiny1, shift click for shiny0, any-click to get random
make Alt click modify the SID instead of PID
add SetShinySID shiny type
Add documentation comments, because changing species names is so weird.
ty anubis for confirming the game resets the old-nickname to new-nickname even without transferring to HOME.
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Handle all warnings
obviously the usage of null! could potentially be avoided if the object init wasn't such garbage, but here we are with years of old junk and lack of abstraction in the GUI project
Closes#3028
Thanks @CarlosofKalos !
Setting 9999 for both on Rattata; capturing the 10,000th didn't increment, but transferring the 10,000th did.
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
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
This format won't be supported cleanly, so let's just try to allow language detection to work as best as it can without storing metadata in the SK2 bytes.
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
Extract common abstract class for shared logic
Clean up property/field/method ordering to be consistent and logical (roughly: attributes, constructors, state management, retrievable values, static methods)
Apply default language OT name
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.
Readonly slots
Things could be expanded on to use interfaces and wrappers for a "SlotReference" and properties for readonly.
But that's kinda unnecessary
Detects the language of the currently loaded save file, and passes that info to the blank sav creator
Use a trainer name of "1337" instead of PKHeX for any Japanese save file, because Gen1/2(/3?) character tables don't have regular ascii chars.
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...?
SWSH is the first common savefile type that has different revisions after official patches. We want to indicate in the Program Title which revision we're currently editing, because people still are not editing latest-format saves and complaining y no urshifu.
Use short descriptions to indicate revision (Base, IoA, CT), rather than magic numbers (v0/v1) or 1.X or 1.X.Y+, because GameFreak can't follow semver rules.
go away ranch platinum update, i might handle you another time
now matches all other personal table formats
var data = File.ReadAllBytes(path);
for (int i = 0; i < data.Length; i += PersonalInfoBW.SIZE)
{
if (data[i + 0x19] == 0) // Ability2
data[i + 0x19] = data[i + 0x18];
if (data[i + 0x1A] == 0) // AbilityH
data[i + 0x1A] = data[i + 0x18];
}
File.WriteAllBytes(path, data);
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.
* Fix broken hidden power power calculation
* Fix broken Gen 2 Hidden Power calculation
* Add parentheses
* WIP UI
* Finalize UI, only show on gens 1-5
* Inline some logic to reduce allocations
* Add unit tests for both hidden power calculation cases
Co-authored-by: Kurt <kaphotics@gmail.com>
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.
Was previously showing RaidArmor for pre-Armor saves, as the reference of a zero-length array was the same as the bools. Just sanity check since all block chunks have length.
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.
Revise some logic flow and add comments indicating why
There is no wc.Gender==3 for any gift; that's not how things are specified in GameFreak's internal tool (suspected).
* Gen 4 French Egg Fix
Mauvais œuf, je le réparerai. Bon appétit!
Fixes Gen 4 edge case reported by Taya on Discord.
* Tweak flow to handle gen2
Add a comment to indicate why this special handling is required
The game also stores the Gender ID, Form ID, Encryption Constant, and Alcremie Sweet ID per block for each PKM's slot.
As for Sweet ID it is stored for all Types. However, since you obviously can't use Alcremie in non-Fairy Sparring they go unused. (They are the Int32 blocks you'll notice with a -1 value.)
- Changed suggested hyper training logic to not hyper train over some possibly intentional unusual speed IVs
- Showdown import will not do any hyper training on pokemon encountered in gen 8, because with Hidden Power removed from the game in gen 8, all specified IVs in the showdown format are guaranteed to be deliberate for stat purposes.
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)
Add SIZE_BOXSLOT and update usages
Make SIZE_STORED protected like SIZE_PARTY
probably need to redesign how slot metadata is presented within the savefile...
Closes#2961 ty @Kermalis !
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?)
* Added PokeWalker Courses, Watts, and Steps editing
* Use util method for getting bitflags
* Keep old cheat method
Change signature so that the default value passed is to unlock all; can pass 0 instead to lock all
* Pass reference to derived sav4-type object
Wev'e already type-tested once, capture the reference and pass it into the appropriate load/save methods.
* Add control anchoring for window resizing
Also widen the labels for localization (longer strings possibly)
Gigantamax: Yes is now in a new line instead of -Gmax. Have maintained legacy support since showdown is supporting legacy as well. Set the export to the newer format.
Can't correlate the structure to the data it's reading, so don't modify the values until someone figures out how the data is stored & how it should be manipulated.
Closes#2941
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.