any contest stat sum above 73 can have any sheen if you really give it trash blocks, lol
not trying to bruteforce the exact combination of consumed blocks/poffins, so these clamps may permit impossible intermediate values, but these are infrequent and meh.
Closes#3325
Can't lower contest stats, but there's no cases of them giving a pkm with contest stats in a game that can't obtain contest stats -- let's just reset instead of zero for futureproofing.
Make them extension methods too; add an overload if you want to purposefully maximize them.
0 is legal in most cases except for Gen2 and BDSP!
...it's technically possible to get 0 in BDSP if you have autosave turned on and have an Egg in your party after hatching one before it, but it will hatch immediately on your next game startup, so disallow it anyway.
Closes#3318
Gen8: if held item, only give if can be legally held; if dmax crystal, only give if available.
Gen8b: if held item, only give if can be legally held
Others: unimplemented; pull requests accepted.
verify BDSP legality restrictions
Enforce nonzero TID/SID in Trainer Editor window (can use Block Data editor to set whatever without restriction, idc).
#3305
They didn't reference the TamagoWazaIgnore table until v1.1 lmao
mimic BDSP's index fetching and just grab the array of eggmoves directly to avoid the abstraction method's overhead
set evotree back to private because don't need direct access anymore
shininess unrelated to your trainer ID, lol
probably also applies to other predetermined encounters like underground and radar, but those aren't EC-seed regenerated (?)
Remove unused interface declaration
because people couldn't hacc responsibly, I might as well give them a nudge in the right direction.
Doesn't mean I won't check your "random" choices distribution.
Yay abstractions to hide away the quirks.
BDSP traded eggs set HT_Friendship and the CurrentHandler flag, but the HatchCounter is always the OT_Friendship value.
Trades always receive BaseFriendship, instead of a hardcoded 50. Necessary to not hardcode because it's immutable for eggs.
Clicking the hatch counter label now sets it to the legal minimum hatch counter (best), and control clicking sets it to the max (worst). Check the encounter template for the true maximum.
Big thanks to @SciresM @sora10pls @Lusamine @architdate @ReignOfComputer for testing and contributing code / test cases. Can't add co-authors from the PR menu :(
Builds will fail because azure pipelines not yet updated with net6.
* Providing pkm/sav files via command line (dragging files onto exe / associated file launched) will more intelligently source a partner sav/pkm object if not provided.
* Gen1/2 mainline save files now indicate if they are VC era or GB era (legality implications) in the program title bar.
* Fixes loading VC era save backups not being recognized as VC era (`.bak` extension hides `.dat`)
* Export BAK moved to the SAV tab, which allows Export main to be deleted and Export SAV to be used as the single-click for exporting saves. `CTRL-E` is still the hotkey.
Hope this doesn't regress for stadium tutoring moves
RB eevee with special 2-move set was being flagged (wanted 4 moves cuz the base 2 aren't the normal levelup moves)
capture references for more concise expressions
Should have been "UTC+12"
We can just inline the shifting since it'll always add 12 hours to the current UTC time, thus that's the maximum date value possible
per the personal data in emerald, they are the only species that go from 2 distinct abilities to 1; since the game does not update the abilityNumber on evolution, it has the second ability being the same as the first, instead of the usual [ability,none] for all other single ability species.
Transfers use local date rather than UTC date, so we gotta allow dates up to kiribati's current date :)
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
#3260 part 1
I searched for more instances of the phantom character, and found the one instance in gen7 zh flags :D
Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
They cannot be given to a Pokémon to hold in-game. Also label new Pikachu/Eevee Dynamax Crystals.
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
For BigEndian we don't have to invert the array access if we just iterate backwards :)
Fix xmldoc for gen1 trades ampersand
Add xmldoc for enc trade classes
No functional change.
* Add more memory legality checks
Includes the following new memory checks:
- 4: met in link-trade, allows all possible genlocs except dangerous place
- 7: successful fishing, allows fishable species in gen 6 and 8
- 9: paying attention to another mon, allows only available species for gen 8
- 29: encountering legendary Pokémon, only seen on Zacian, Zamazenta, Calyrex so far
- 32: riding a bike, only in genlocs where biking is possible
- 75: taken to Nursery and placed with a mon, allows only available species for gen 8
Unstubs lotto check and applies it to gen 6.
Co-Authored-By: Skadiv <62726360+Skadiv@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
* Loto-ID only has one t
* Crown Shrine has another genloc outside
* Consistent Loto name for array
Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
Co-authored-by: Matt <17801814+sora10pls@users.noreply.github.com>
Iterate over all possible seed frames that yield the IV pattern; nature is right before IV rands (PID is algorithmic from gender ratio and prior nature call).
Split up GetFrames into stepwise methods, clean up parameter passing
Refer to previous commit, the apply-memory has a 1% chance of failing for 100% memories, resulting in the ability to have 0-memory HT via link trades.
In-game trades caused the previous logic, as those forget to set the HT memory (likely the same logic flaw as skipping the nickname check via game settings).
The middle table in poke_memory.prmb contains the analogue of Gen6's memory table data. All existing memory data is the same, with 20 memories added.
Feeling bitflags are the same as before, but as we've noticed, feeling 0 is not obtainable. All the feelings are value upshifted by 1. This is why the game shows a blank line for Gen6 Feeling-0, as that game was [0,23] not [1,24] for the span of feeling strings.
Memories with 1% chance are actually 0% due to how they if-abort in the game code. Nice bug, GameFreak! @Lusamine had previously committed the unobtainable memories, derived from the community's empirical data.
The Hexagon Brothers can be rematched in Phenac City if their shadows aren't snagged at the Cipher Lab, but Seedot, Houndour, Gulpin, and Spheal are all encountered outdoors (Phenac City (XD) [100]). Mareep and Baltoy are both encountered downstairs in the Mayor's House (Phenac City (XD) [096]).
Relevant .xk3 files: https://cdn.discordapp.com/attachments/537784151970021376/880816626176495626/Phenac_Rematches.zip
Apparently they don't use the bit-permission table in Bank to get a random feeling, and instead just do rand(0,10).
Our logic to set a random feeling for bank transfers is still fine, because we set [0,10) within the bit table.
must have been an oopsie they reverted for international releases
Thanks @liketolike !
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
#3242
Can definitely be refined as these memories can restrict to capture/hatch/gift encounters. The multi-value arrays can also be restricted for non-hatches too (maybe first element if WasEgg?)
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Since we have more metadata with move learn sourcing, we can check if it was traded to gen2 to get new moves / deleted.
Adjust call sites appropriately
might have some issues, to be ironed out maybe
Slap on interface for EntreeSlot
De-magic some 💯 numbers to indicate what they're doing
Improve perf of move-match-relearn check
Add an "else" as valid is never both values (history verifier)
The Encounter verifier method rarely rejects as our inner encounter matching methods are all-or-nothing. Don't bother keeping references for this bloat.
Ran the unit tests and nothing hit this logic.
Old: when an encounter is found, we copied the contents of the list into our analysis list.
Since we stop when we find a suitable encounter, the old list is useless. By sharing the same list, there's no consequence. Reduces allocation by ~56B each analysis object!
Simplification reduces the amount of method calls by 1
Might result in some illegal matches as it includes it for all evolutions in the chain, but whatever. Could probably rewrite the generator to only generate for different starting-species, but it's fine now.
Inline the max level calc
Invert check for crossover to disallow hidden (there are more symbol
tables). Galar Mine No. 2 has hidden fishing slots as well as curry.
HiddenMain3 SlotType was never used so it was removed.
Updates pkl to remove HiddenMain3.
We don't do it for inaccessible static encounters in gen7/8, so anyone glitching/cheating will get an unrecognized encounter instead of "hey this exists, but you can't access it" error.
* Add weather types by location
Creates a dictionary of possible weather types for each SWSH location.
Unlisted locations may only have Normal weather or do not have any
encounter slots.
* Prune unused weather from static encounters
Some encounters were too permissive with weather, e.g. Sandstorm in
Fields of Honor and Challenge Beach; Snowstorm at Dyna Tree Hill.
A few crossover areas that would have limited the possible weathers were
marked with a "(c)". An example is Nidorina from Giant's Bed crossing
to Frostpoint Field, where Raining and Thunderstorm do not occur.
This additionally organizes encounters by location.
* Move location-weather dictionary to EncounterArea8
* Verify weather marks on encounterslot/static encounters
* Adds some static encounters available through weather bleed
Weathers aren't normally available, but these static encounters are
close enough to the boundary that the weather in an adjacent area can be
used to spawn them.
- Frostpoint Field Snorlax with Raining/Thunderstorm from Giant's Bed
- Snowslide Slope Amaura with Raining/Thunderstorm from Giant's Bed
- Frigid Sea Carracosta with Intense_Sun from Three-Point Pass
- Frigid Sea Magmortar with Intense_Sun from Three-Point Pass
- Ballimere Lake Corviknight with Snowstorm from Giant's Bed
- Ballimere Lake Cryogonal with Snowstorm from Giant's Bed
- Ballimere Lake Tyrunt with all weather from Giant's Bed
- Lakeside Cave Ferrothorn with all weather from Ballimere Lake
- Tunnel to the Top Golbat with all weather from Path to the Peak
* Defer weather marks if incompatible, enforce encounterslot weather
This uses the area weather to check fishing slots and tentatively adds
some tables for weather bleed encounterslots.
* Warm-Up Tunnel gets weather bleed from Training Lowlands
* Update for base PKHeX
* Handle weather bleed for SWSH encounter slots
Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
* Minor clean
Having duplicate weather marks is illegal, so just auto-partial match them instead of checking the other marks.
* Rearrange slot weather check logic
* Claim reserved byte in SWSH pkl
* No need for two variable names now
* Valid weather marks on tree/fishing should return with main weather
* Fix tree/fishing deferral and add another surf slot weather bleed
* Disallow tree/fishing encounters from using bleed tables
None are currently known at this time, and only hidden grass encounters
have a weather bleed table
* Condense bleed expression, combine tree/fish flag check
* Move weather-bleed check into EncounterArea8
Makes the dictionaries private instead of internal.
Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
Check per-evolution min level rather than basing it on the original encounter data.
Correctly parses stuff like a captured level 23 Nidorina that immediately evolves into Nidoqueen, then learns Body Slam.
Passing zero is better than passing 1, as 0 requires no value pushing.
tidy up method signatures in MoveLevelUp so that species is followed by form, and the lookups are textually aligned. Clarify "maxLevel" instead of max/lvl, same as min.
Currently, HOME gifts present in wc8.pkl will not be flagged for invalid dates due to them missing their respective Card IDs. This will be fixed with the next stable release, so this works for now.
EncounterArea now stores a more specific type'd array for encounter slots. Better iteration and less casting, as the nonspecific `Slots` fetch is rarely referenced.
EncounterType renamed to GroundTile to reflect how it actually works in Gen4. Was previously an ambiguous field that was clarified a little; we can describe it a little better now. Keep the GUI the same to not scare the end users.
Change Trash Byte properties to get/set a Span. Trash Byte legality checking easier on the garbage collector?
The sav.ApplyTo call above tries to set the current savefile language, but gen3 savs do not have a Language ID saved.
Just mimic what the encounter slots/static/etc do.