Commit graph

61 commits

Author SHA1 Message Date
Kurt
3e7775fc44
Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately (#3222)
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately

Don't store within the object, track the slot origin data separately.

Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.

- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code

* Remove WasLink virtual in PKM

Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.

* Use Fateful to directly check gen5 mysterygift origins

No other encounter types in gen5 apply Fateful

* Simplify double ball comparison

Used to be separate for deferral cases, now no longer needed to be separate.

* Grab move/relearn reference and update locally

Fix relearn move identifier

* Inline defog HM transfer preference check

HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.

* Extract more met location metadata checks: WasBredEgg

* Replace Console.Write* with Debug.Write*

There's no console output UI, so don't include them in release builds.

* Inline WasGiftEgg, WasEvent, and WasEventEgg logic

Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
2021-06-22 20:23:48 -07:00
Kurt
138501da2f Minor clean
Condense some expressions
Use less linq
Rename some fields
2021-05-29 15:31:47 -07:00
Kurt
45f12bd924 Update FormVerifier.cs 2021-04-18 21:22:58 -07:00
Kurt
aaa1fd1b4f Remove obsolete legality checks for safari
Hard matches for encounter slot result in these never being executable.
2021-02-21 15:22:10 -08:00
Kurt
0121028a6b Furfrou Bank edge cases
lmao nice meme
2021-02-16 21:22:20 -08:00
Kurt
2ee88ee010 Update FormVerifier.cs 2021-02-08 23:18:45 -08:00
Kurt
37cb15749e Update FormArgument handling for gen6/7
Disassociate pk4/pk6 backing byte[] when converting to pk5|pk7, as we no longer make a copy of the byte[] in the pkm's constructor.

Change UpdatePKM to include isParty, as we want it optional to update FormArgument too.

Change FormArgument saving to be handled by FormConverter; kinda not really good to have it there, but nothing else is handling FormArgument values.

Expand IFormArgument to have all FormArgument values exposed. "Maximum" is furfrou only.
PK6: Max is in the "FormArgument" u32, and the remain/elapsed is in party stats (hence the reverting when boxed)
PK7: u8 remain, u8 elapsed, u8 max, u8 unused.
PK8: assumedly the same as PK7, given the disassembly hints that it's the same as past games (even though Furfrou and Hoopa are not in SWSH).
2021-02-08 20:26:53 -08:00
Kurt
5bb4c9e7fe Update FormVerifier.cs 2021-02-05 17:25:13 -08:00
Kurt
a7f65554ad Update formarg handling 2021-02-05 16:52:46 -08:00
Kurt
4bbe9dec96 Update FormVerifier.cs 2021-01-26 16:23:26 -08:00
Kurt
621e708d23 Minor clean 2021-01-10 18:15:33 -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
97be69bca1 Use EncounterMatch when EncounterOriginal doesn't matter 2021-01-02 14:47:39 -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
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
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
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
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
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
edd9ace51e More pogo rules 2020-11-11 21:03:47 -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
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
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
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
27f15d2f20 Split Country/Region/ConsoleRegion to interface 2020-07-31 11:17:31 -07: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
40d000fdce Extract reusable method 2020-04-14 10:08:02 -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
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
0c83c48cef Add MrMime-1 check for past gen origin
permit mime jr evolving to mr mime-1
2020-02-13 20:00:41 -08:00
Kurt
f62b6e33f3 handle alolan meowth origin in gen8
https://projectpokemon.org/home/forums/topic/56267-checks-associated-with-events-or-forms/
2020-02-13 17:05:06 -08:00
Kurt
d97db1cc40 Allow pk7->pk8 pikachu cap transfer 2020-02-11 20:36:10 -08:00
Kurt
ebf20d927b More transfer implications
Totems are downsized to regular
araquanid, togedemaru, and ribombee totems can't transfer (at the moment)
2020-02-11 20:11:33 -08:00
Kurt
4656978a43 Enforce toxtricity encounters to have restricted nature 2020-02-08 15:08:12 -08:00
Kurt
8e5876b96f Expose item->form methods 2020-02-07 21:34:25 -08:00
Archit Date
c8a16a1f71
fix yamask/runerigus form handling (#2669)
fixes #2668
2020-01-29 16:11:56 -08:00
Kurt
baf46f9a3a cache form/species/format on first get
very minor perf consideration, since those values are immutable (except for cross thread shenanigans)
2020-01-16 19:23:29 -08:00
Kurt
3b5c7062ac Minor perf improvement
pass in, don't constantly fetch
helps generated IL code be slightly more efficient
2020-01-12 16:49:12 -08:00
Kurt
a8c28369b6 Add Yamask-1 max hp calc for formArg compare
Closes #2632 ty @CanoeHope
2020-01-12 16:22:56 -08:00
Kurt
d3f6d5935f Add form argument legality checks
Closes #2611 (Alcremie)
Closes #2604 (Runerigus)
2020-01-10 16:33:40 -08:00
Kurt
3d581283c2 Minor clean
move Text.cs manual Courier new() to the designer, have it dispose when form is disposed. Set it as the numericupdown's font and just reuse that :)
2020-01-05 18:46:30 -08:00
Kurt
a368b81519 Minor clean 2019-11-18 22:48:03 -08:00
Kurt
2b76fe148d Fix property reference for Darmanitan-G
lul
Closes #2453
2019-11-18 19:29:05 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00