Commit graph

1397 commits

Author SHA1 Message Date
Kurt
2874f6fc69 Revise pichu volt tackle egg handling
Clean up ParseMovesWasEggPreRelearn as only EncounterEgg call into it, and no EncounterEgg has a special moves interface implemented.
2021-09-15 18:43:18 -07:00
Kurt
63580a2835 Minor tweaks
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.
2021-09-15 18:13:17 -07:00
Lusamine
a779000097 Include Thunderstorm for Honeycalm Sea Seadra 2021-09-12 16:14:22 -05:00
Kurt
1d00e17217 Add properties for cleaner interaction 2021-09-07 15:31:54 -07:00
Kurt
2575d73144 Add IFixedAbilityNumber, hide vivillon region flags
tfw can't using static a private class in the file, gotta be explicit.
2021-09-06 18:11:32 -07:00
Kurt
41b1aaeb19 Search mystery gift relearn moves for needed moves
Add to encountertrades searcher, for futureproofing

solves gen8 mg searching volt tackle pikachu
2021-09-06 11:43:42 -07:00
Lusamine
9751a75f59 Free Sgr7121 GMax Duraludon 2021-09-06 13:26:18 -05:00
sora10pls
9bd0104954 Add new distribution raids 🧹 2021-09-02 20:04:14 -04:00
Kurt
348fa4c9fa Force Gen2 Red Gyarados to be male only, fixed IVs
Closes #3251

Uses fixed IVs to force shininess (rather than mutating DVs)
1f9e688b76/engine/battle/core.asm (L6103-L6110)

Co-Authored-By: CanoeHope <43196464+CanoeHope@users.noreply.github.com>
2021-08-29 13:23:34 -07:00
Kurt
7434af48bf Fix HT know move memory deferral
Checks if it can know the move up until the current format, rather than origin game
2021-08-28 13:44:10 -07:00
LegoFigure11
eeaf19f1c2
Fix incorrect met locations in XD GoD (#3250)
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
2021-08-27 07:33:12 -07:00
Kurt
0e2dac3ff6 Minor tweaks
Empty return for invalid species encountertemplate fetch
Expose property for ck3 @ 0xD7
show legal memory context items rather than gen8 always
2021-08-25 19:23:15 -07:00
Kurt
c1a7d04c5c Fix ck3 fateful read
Hope 555e81205d was actually incorrect and that this is finally correct
2021-08-24 22:23:45 -07:00
Kurt
ffcd2e96e0 Fateful Mattle Ho-oh on japanese colosseum
must have been an oopsie they reverted for international releases
Thanks @liketolike !

Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
#3242
2021-08-24 19:29:51 -07:00
Kurt
6e3bcd5b66 Encounter visualization: Show ball and differentiate visually 2021-08-24 14:03:20 -07:00
Kurt
28e7473f1a Condense some expressions 2021-08-22 01:26:28 -07:00
Kurt
92d1666970 Make PIDIV a readonly struct
Add tests to ensure the optimization remains in effect later
2021-08-21 18:24:38 -07:00
Kurt
ae0ca49628 Arrange CXD Shadow encounters, add ShadowID documentation 2021-08-21 17:01:50 -07:00
Kurt
cd12962a50 Remove Tradeback state caching in PKM data
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
2021-08-20 15:59:54 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
sora10pls
5379bad7ff Add new distribution raids 👻 2021-08-19 21:20:56 -04:00
Kurt
934628b077 Pre-filter memory mismatch on moves
All over the place with prior commits; everything should be correct (and more robust) now.
2021-08-15 14:23:15 -07:00
Kurt
31ddaf2bc4 Don't defer on ability mismatch 2021-08-15 11:07:59 -07:00
Kurt
42330eb771 Memories and special moves, bite the bullet
Allocate a list :(
We need to keep all the secondary deferred around, since they have special movepools.
2021-08-15 09:47:31 -07:00
Kurt
7c60363b38 Rework match ranking to have multi levels of deferral 2021-08-15 09:28:47 -07:00
Kurt
db1cbf8cce Handle raids with specific TR moves tripping memory checks
Defer the ones that have the memory and don't have the move; we'll likely find another match else settle for this one.
2021-08-14 19:47:52 -07:00
Kurt
b8e203bdef Remove invalidmatch tracking
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.
2021-08-06 15:38:39 -07:00
Kurt
9f8642f7d2 Hide Generation/Game setters behind mutation method 2021-08-06 15:35:49 -07:00
Kurt
70e10478dd Extract fog boost location check 2021-08-06 14:54:32 -07:00
Kurt
c126cd968a Only boost templates to 60 in wild area
No functional change for legality checks, so should be fine unless you're trying to get tiny edge case stuff.
2021-08-06 09:42:27 -07:00
Kurt
0f3e5095c5 Replace more linq usage 2021-08-05 22:39:38 -07:00
Kurt
e18c2d8fa4 Replace linq with similar but faster logic 2021-08-05 20:47:32 -07:00
Kurt
5c472a400d Expand shorthand parameters
int i => int index, or whatever the value is representing.
2021-08-05 20:33:25 -07:00
sora10pls
2766c2c900 Add new distribution raids
Apparently the theme is summer
2021-08-05 20:03:56 -04:00
Kurt
2f9a60b5e6 Organize byte resources into subfolders 2021-08-05 15:35:29 -07:00
Kurt
cc0397f087 Misc tweaks
Improved readability
2021-08-05 15:18:43 -07:00
Kurt
ab3795abaa Handle enc->pk7 form-random vivillon Island Scan static 2021-08-05 12:36:47 -07:00
Kurt
0a74f6c33d Ignore species for rby if not present
encounter moves not present for those, lol
2021-08-05 12:36:19 -07:00
Kurt
616acc8bbd Misc fixes 2021-08-04 19:54:04 -07:00
Kurt
83a72df7cc Include gen1 encounter moves in not-needed list
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
2021-08-04 19:07:20 -07:00
Lusamine
2858c6636d Minor adjustments to area slot extensions
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.
2021-08-03 13:03:04 -05:00
Kurt
277b1b658d Un-nest 3ds console region bitflags
Insert 3DS into the name to indicate that it's for the 3DS
2021-08-02 20:59:40 -07:00
Kurt
66f1b23dc6 Consider the "SkipFormCheck" for gen7 scatterbug static
Rework to match the encounter slot form-ambiguous checks
2021-08-02 20:45:52 -07:00
Kurt
140f814f90 Update EncounterMovesetGenerator.cs 2021-08-02 20:25:16 -07:00
Kurt
1efebe51d3 Simplify Country/Region/ConsoleRegion to byte from int
Only exists in gen6/7 games.
2021-08-02 19:43:57 -07:00
Kurt
c1f13923c8 Update EncounterSlot7.cs 2021-08-02 08:57:03 -07:00
Kurt
846f9506fb Misc form handling update (EncounterSlots)
Mark gen7 Minior slots with 31
Mark gen2 Unown slots with 31
Mark gen4 Unown slots with 31
2021-07-31 22:41:52 -07:00
Kurt
1bc5cb1113 Handle special form cases for IsSane 2021-07-31 20:50:29 -07:00
Kurt
e2db713621 Update EncounterSlot8.cs 2021-07-31 00:01:55 -07:00
Kurt
de94876822 Minor tweaks
no functional change
2021-07-30 16:22:10 -07:00
Kurt
7c697a519e Make EncounterArea parent reference protected, expose properties 2021-07-30 14:05:23 -07:00
Kurt
34f750d519 Remove unobtainable static encounters from gen4 tables
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.
2021-07-30 13:09:26 -07:00
Kurt
a57e12db59 Remove unobtainable encounter slots from gen4 tables 2021-07-30 13:06:15 -07:00
Kurt
a159da0abf Reduce allocations of default valid/invalid
Condense some expressions, make some comments/params clear and consistent.
2021-07-30 13:05:34 -07:00
Lusamine
535b63f613 Add Frigid Sea weather bleed for Roaring-Sea Caves Hydreigon/Tyranitar
Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
2021-07-29 15:20:22 -05:00
Kurt
a64782d313 Prevent fog slots/statics from being valid when not boosted to 60
Flag Misty(fog) mark as invalid when pkm is from Main wild area && not boosted
^ Check before the slot/static specific methods to have a one-liner :)
2021-07-26 15:01:21 -07:00
Kurt
d8b8b622cf Only allow brilliant boost if max level for slot
https://discord.com/channels/401014193211441153/805157881501450270/869223485795336232
2021-07-26 14:33:41 -07:00
Lusamine
ab33df2fc9
Enforce weather legality for SWSH (#3221)
* 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>
2021-07-26 14:28:05 -07:00
Kurt
7bd844d5c5 Move min level check for gen1/2 closer to move adder
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.
2021-07-22 21:25:15 -07:00
Kurt
e961694bdb Minor tweaks
Pass evo chain to memory learning machine move
Pass minimum level for GB encounters if present, rather than enc min level
2021-07-22 19:08:56 -07:00
sora10pls
ee004865bd Add fossil distribution raids 2021-07-22 20:08:14 -04:00
Kurt
8e5e4487ba Change interface for method call to less restricted
Don't need "Name" or "LongName" for these methods.
2021-07-13 18:22:04 -07:00
sora10pls
34c401b7a0 Revise IsHOMEGift, check Card ID for gift date range
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.
2021-07-13 18:22:04 -07:00
Kurt
aeb83c8269 Update EncounterSlot8.cs
Closes #3232
2021-07-09 10:09:57 -07:00
sora10pls
85c500529e Add Curry distribution raids 2021-07-08 20:06:30 -04:00
Kurt
103aa9aa4b
Revise EncounterArea and EncounterType for clarity (#3228)
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?
2021-06-29 20:58:06 -07:00
Kurt
764e506ab5 Set language for gen3 eggs prior to applying nickname
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.
2021-06-27 15:43:35 -07:00
sora10pls
285f86d7b2 Add squid distribution raids
You're a kid now, you're a squid now
2021-06-24 20:04:07 -04:00
Kurt
a10b35190c Minor tweaks
off by 1 max range for gen2 slot -> pk2
SetRandomIVs already sets IVs inside the method, retval is for knowing what the new value sare
show WC8 restricted version rather than defaulting to SH
pass the rand object rather than fetching for the current thread every loop for Unown & random IV shuffling
Use ToLowerInvariant for resource fetching, should resolve the turkish issue
Check typeof(T) first, not that we check for ToolStripItem or ContextMenuStrip with this function.
2021-06-24 00:36:04 -07:00
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
87ac1cbcc9 Unban Sgr7348 encounter 2021-06-18 22:07:27 -07:00
Kurt
6029c15521 Fix incorrect GameVersion reference 2021-06-09 22:56:19 -07:00
Kurt
f984862f48 Extract catchrate check 2021-06-09 22:54:21 -07:00
Kurt
2abf95cdf8 Minor clean
expand some expressions, extract some methods, add comments
2021-06-08 20:14:55 -07:00
Kurt
a07549f013 Extract sketch valid check
GetCanKnowMove should be checking for Smeargle knowing thousand arrows/waves.
GetNeededMoves should also return 1ka/1kw for needed moves, and then no encounters.

All uses of InvalidSketch are behind that method, so any future Smeargle modifications (like sketching a dummied move) will be checked (yay BDSP considerations).
2021-06-06 23:36:59 -07:00
Lusamine
e66d5eaad5 Remove another duplicated distribution index
Index 24 is the same as 26, but they cross epochs from base to DLC1.
Keep the later one since it encompasses all legal Wild Areas.
2021-06-06 21:46:23 -05:00
Kurt
bf400f27fe Add optional form param for learn check 2021-06-06 11:49:13 -07:00
Kurt
200bdbd553 Sanity check form prior to yield checks 2021-06-06 11:48:54 -07:00
Lusamine
72b4975429 Remove inaccessible water nest encounters 2021-06-05 18:11:19 -05:00
Lusamine
aee35cbe81 Clean up duplicated distribution indices
Removes duplicates if every encounter in the same index is the same as a
previous index. The following were affected, and only the first index
was retained.

- 5, 7 (Index 2 has 1 move different on 1 mon)
- 3, 4
- 11, 13
- 16, 18
- 27, 28, 30, 32
- 33, 35
- 36, 38
- 42, 44
- 45, 47
- 48, 50, 52
- 53, 55, 57
- 59, 61
2021-06-05 16:33:41 -05:00
Kurt
ad79833420 Update EncounterEvent.cs 2021-06-04 13:53:02 -07:00
Kurt
8222297da8 Remove enumerating when loading event templates
Just allocate the parent array and pass it to HashSet; having an ICollection, prevents resizing repeatedly and gc'ing the temp array is cheap.

Actually, only create a hashset if we're adding a gift from external DB. Saves on that allocation, and keeps the final result as an array (fastest iterating).
2021-06-04 13:48:02 -07:00
Kurt
64039b4070 Force shiny state of raids
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2021-06-03 17:50:48 -07:00
sora10pls
a2492eddd9 Add Frog distribution raids 2021-06-03 20:07:07 -04:00
Kurt
8c970ec991 Minor tweaks
no functional change, readability++
add more xmldoc
2021-06-03 12:04:19 -07:00
Kurt
b81df689e6 Pass gender to moveset dreamworld entries
Oops.
ty anubis for notifying me
2021-06-01 13:54:43 -07:00
Kurt
138501da2f Minor clean
Condense some expressions
Use less linq
Rename some fields
2021-05-29 15:31:47 -07:00
Kurt
54611032c9 Refine crystal egg checks
Disallow crystal eggs if met data is not present
Set crystal met location more fluidly
2021-05-23 12:50:42 -07:00
Kurt
2c9b82824a Check static as-egg locations accurately
Thanks @sora10pls
2021-05-21 13:57:07 -07:00
sora10pls
3fb4bd7db2 Add Wooloo distribution raids
Nice
2021-05-20 20:16:13 -04:00
Kurt
a03f5dcc9d Make EncounterTrade met location use inheritance
hovering would grab ILocation, which didn't use the flexible met location fetch.

Just repoint stuff and have it as a virtual call, since most of these are fixed values, there's no point increasing the size of the classes besides those for gen4.
2021-05-18 17:14:17 -07:00
Kurt
99f0978630 Extract random date to util 2021-05-18 16:58:53 -07:00
Kurt
25fa52e597 Use correct SID
lol I had copied from VC->gen7
2021-05-18 13:33:36 -07:00
Kurt
2c820bfbe9 Minor tweaks 2021-05-18 13:29:55 -07:00
Kurt
565f161226 Show shiny state of encounter in db
Force shiny state for GO encounters

For encounters, this interface property is mainly just for exposing metadata for sprites.
2021-05-18 10:36:45 -07:00
Kurt
0e2f070510 Clean up know-move-evolution checks
Looks like Mr. Rime case wasn't being handled, so I rewrote it. Better performance, less complexity. No need to double-reference the moves.

Cache a single Valid evolution result; every parse can reuse that object.
2021-05-15 21:41:04 -07:00
Kurt
e31980d15e Clean up nickname parsing, make Gender an int type
Breaking change for anyone using IBattleTemplate (alm)
2021-05-14 23:41:14 -07:00
Kurt
50b15cd740 Use range/index
More in line with modernizing the codebase with latest c# syntax

improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
2021-05-14 15:30:55 -07:00
Kurt
96ea7f0b39 Fix toxtricity neutral StatNature generating 2021-05-08 08:29:20 -07:00
Kurt
a7f3ce5766 Leak mismatched forms thru the possible check
The EncDB doesn't specify form; the encounter methods verify Form.

This is actually a fix; pkm that can change forms aren't really encounter trades, but we shouldn't be strict matching here.
2021-05-08 08:13:27 -07:00
Kurt
31142ee297 Replace some linq usage with direct logic 2021-05-06 23:26:38 -07:00
Kurt
fa5bc0d634 Set friendship after form set
Resolves GO galarian stunfisk, ty matt
2021-05-05 08:43:32 -07:00
sora10pls
6ed6e60840 Add PogoType + Requirements for Strange Egg encounters
Rationale behind this is explained in the accompanied commit in PGET: 7c2575d8a8

Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2021-04-30 21:13:28 -04:00
sora10pls
e330eb5cfc Add current Meowth Distribution Raids 2021-04-29 20:08:16 -04:00
Kurt
91557d0180 Don't defer on hidden ability change 2021-04-25 00:11:15 -07:00
Lusamine
eceb498da3 Fix Gen 2 roamer locations 2021-04-23 15:52:54 -05:00
sora10pls
00e88b2abd Add World Penguin Day distribution Raids 2021-04-23 11:39:20 -04:00
Kurt
e36fdd3cb6 Update EncounterStatic8ND.cs 2021-04-22 22:32:17 -07:00
Kurt
efb3d9aeac Add inaccessible den-rank checks
Rotom Bike water upgrade isn't available until you have sufficient progress, so you can't get these dens with the lowest rank.

Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2021-04-22 21:47:25 -07:00
Kurt
f66662b8db More deferral tweaks for non-HA having HA 2021-04-22 13:47:33 -07:00
Kurt
2aed4c3118 Add shedinja dropped ribbons/marking considerations
Nice bug ya got there, gamefreak.

Coulda cleared the AffixedRibbon value instead of copying it on Shedinja creation, and it would have made this unnecessary.

Please ditch the Affixed Ribbon gimmick for future games, thanks!
2021-04-21 15:20:16 -07:00
Kurt
f61108ac4e Check gen1/2 female OTs a little more thoroughly
https://github.com/kwsch/PKHeX/issues/2687#issuecomment-822072999

celebi is a es2e, so just filter on specified TID

Co-Authored-By: FeralFalcon <33670476+FeralFalcon@users.noreply.github.com>
2021-04-18 19:31:22 -07:00
Kurt
0e4848ad82 minor clean 2021-04-18 18:18:09 -07:00
Lusamine
f2c2a77cfe
Check nest distribution encounters by patch epoch (#3195)
Distribution raid encounters from before each of the DLC patches can only be captured in existing Wild Area locations.
Store the BCAT index in the encounter details and use it to compare when the BCAT was available.
2021-04-18 11:01:42 -07:00
Kurt
0719320e33 Eggs: explicitly pass generation instead of calculating 2021-04-17 20:09:02 -07:00
Kurt
9171d7f87e move property to class that uses it 2021-04-17 20:08:20 -07:00
Kurt
f35a3ce03c Add overload for Totem check, simplify some flow 2021-04-17 13:24:57 -07:00
Kurt
5635e8f345 Unroll some loops, reduce allocations a little for hacked eggs 2021-04-17 13:13:03 -07:00
Kurt
893f22a664 Extract generation traversal list fetch to static class 2021-04-17 13:09:09 -07:00
Kurt
8b180c3122 Fix egg move source indications (were defaulting to gen2)
Switch expression had an issue with interpreting the object's type (unboxing, yay)

should probably just return a typed object from the parse, but nah, this is a quick fix.
2021-04-16 17:57:48 -07:00
Kurt
aaae94b739 Fix Gen2 roamer location check
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=265885

Location=>pkm.Met_Location

Change the array search for a bitwise and check, for muh efficiency
2021-04-14 13:29:23 -07:00
Kurt
e9c9627ad5
Relearn suggestions + Headbutt Slot Fix (#3190)
This change revises the logic for an Egg Move's RelearnMoves.

Removes a class that is no longer used
Passes the large value-passing struct byref via in keyword
Revises handling so that early-returned results from the MoveBreed processing are marked with their move source rather than leaving them unvisited.
The moveset processor uses depth search recursion, and returns false if the move that it is processing is not possible for the hatched moveset. If the depth search never reaches the check for base moves, all moves won't be marked for their origins, resulting in the result array not being accurate to use for suggestion purposes.

Yay multi-purpose logic (validation w/early returns & fixing needing fully processed data).
2021-04-08 15:58:09 -07:00
Kurt
4579a66a38 Fix deferral for wild slots
Base method checks wurmple (not available in swsh), removed.
Hidden ability check returns Partial for any species that cannot be patched, and Deferred for any patched; we don't care, because there aren't any wild species that can't be patched in swsh.
2021-04-04 21:54:24 -07:00
Kurt
63639a1ec8 Add latest distribution raid templates 2021-04-04 20:38:26 -07:00
Kurt
0ad06c6359 Disallow Thousand Arrows/Waves for Format6 Smeargle
moves unavailable in that format, same as light of ruin

Closes #3182 ty @DaWoblefet
2021-04-04 19:39:31 -07:00
Kurt
0626b0c29b
Add Breeding move ordering logic, and use in legality analysis (#3183)
* Initial bred moveset validation logic

Unpeel the inheritance via recursion and permitted moves

* Volt tackle considerations

* Optimize out empty slot skips

* Add tests, fix off-by-one's

* Require all base moves if empty slot in moveset

* Add test to prove failure per Anubis' provided test

* Tweak enum labels for easier debugging

When two enums share the same underlying value, the ToString/name of the value may be either of the two (or the last defined one, in my debugging). Just give it a separate magic value.

* Fix recursion oopsie

Also check for scenario where no-base-moves but not enough moves to push base moves out

* Add Crystal tutor checks

* Add specialized gen2 verification method

Game loops through father's moves and pushes in one iteration, rather than checking by type.

* Add another case with returning base move

* Add push-out requirement for re-added base moves

* Minor tweaks

Condense tests, fix another off-by-one noticed when creating tests

* Disallow inherited parent levelup moves

Disallow volt tackle on Gen2/R/S

* Split MoveBreed into generation specific classes

Gen2 behaves slightly different from Gen3/4, which behaves slightly different from Gen5... and Gen6 behaves differently too.

Add some xmldoc as the api is starting to solidify

* Add method overload that returns the parse

Verify that the parse order is as expected

* Add reordering suggestion logic

Try sorting first, then go nuclear with rebuilding.

* Return base moves if complete fail

* Set base moves when generating eggs, only.

* Use breed logic to check for egg ordering legality

Don't bother helping for split-breed species
2021-04-04 18:30:01 -07:00
Lusamine
d3059218c9
Remove gen 8 static encounters from DB if no location (#3181) 2021-04-01 15:09:26 -07:00
Kurt
9881beea1e Update EncounterStaticGenerator.cs 2021-04-01 13:51:00 -07:00
Kurt
75fb704658 Use already allocated result array
All operations overwrite all 4 entries of the result array, so no need to forcibly reallocate the array.
2021-03-30 20:27:40 -07:00
Kurt
5c9ce494cf Minor perf improvements
Defer some value assignments
Pass already known values directly
Pass static references to reduce allocating small duplicate objects
2021-03-30 18:51:53 -07:00
Kurt
4daf225379 Add location for colo ereader shadows 2021-03-27 20:32:52 -07:00
Kurt
53d3dba74e Reorder array for ordered search 2021-03-27 20:32:25 -07:00
Kurt
4bb95e0bd3 Spring raids 2021-03-25 18:28:17 -07:00
Kurt
3822981590
Rework EncounterCriteria to be ability indexed rather than direct ability (#3179)
* Exploration: rework ability criteria to ability numbers desired

* Sync remaining changes

* Update EncounterCriteria.cs

* Add xmldoc

* Improve speed of IsDualGender check

* More xmldoc updates

Should be doing this on main but meh, this branch is gonna get merged later

* Fix typo

* Update WC7.cs

* Update PersonalInfo.cs
2021-03-23 17:05:15 -07:00
Kurt
f86291cc1c Split gen3 encounter listing to have CXD separate 2021-03-21 19:52:48 -07:00
Kurt
8020a44961 Minor simplification
All slots are now initialized via constructor, property can now be init!
Optimize some value fetching for gen7b, as the input data has features that can be abused
2021-03-17 22:40:37 -07:00
Kurt
71d355804a Move enc7b sky encounter fudging to reformatter project
50c53d6b33
2021-03-17 21:59:00 -07:00
Kurt
b4f763f7ef Move bridge-stony copy logic to pkNX
Also trims out empty slots (species=0), less size!

49efb96db9
2021-03-17 18:11:07 -07:00
Kurt
535f464b61 Update EncounterSlot7.cs
Closes #3176
2021-03-16 23:49:04 -07:00
Kurt
6bce4eea14 Minor clean
Annotations (nullable), some switch cases for readability
2021-03-14 16:16:55 -07:00
Kurt
2e10e0757a Check gen5 egg met location rather than gen6
Override the base impl in encstatic, swap const refs
2021-03-03 18:35:26 -08:00
sora10pls
08ecac8cb3 Update upcoming Dynamax Crystal encounters 2021-03-02 11:21:56 -05:00
Kurt
eba704a46b Add March raid data
Wonder if they'll fix the gmax Hattrem ;)
2021-02-28 17:19:17 -08:00
Kurt
7afd2ec351 Add Pika 2/25 raids 2021-02-25 16:27:05 -08:00
Kurt
0ba029226c Add more xmldoc 2021-02-24 18:08:03 -08:00
Kurt
89cc722cd2 Add missing met location bypass for pokewalker xfr's 2021-02-21 18:41:42 -08:00
Kurt
c8b12a9ddc Add safari slots for floette 2/3
Move the array into the constructor; let it get garbage collected rather than leaving it as static
2021-02-21 15:18:58 -08:00
Kurt
d61e646ca9 Minor tweaks 2021-02-18 17:26:06 -08:00
Kurt
83c61a2515 Update EncounterGenerator6.cs 2021-02-17 08:49:32 -08:00
Kurt
165a0f3956 Update EncounterSlot8.cs 2021-02-16 09:54:47 -08:00
Kurt
f5b47f9116 Update EncounterGenerator6.cs
Closes #3153
wc6 is the only one with deferred cards that matter
2021-02-16 07:35:55 -08:00
Kurt
f63654d5ae Force curry mark for generated galar mine hidden slots 2021-02-15 15:21:10 -08:00
Kurt
6088a95421 Location specific restrictions 2021-02-15 10:31:07 -08:00
Kurt
bfe411d503 Update EncounterSlot8.cs 2021-02-15 10:19:52 -08:00
Kurt
74a5c03cd2 Clean check for overworld IVs
Closes #3150

Still need to remove some symbol encounter tables that are unused
2021-02-15 09:04:47 -08:00
Kurt
b82b0da7d9 Add checks for fishing mark 2021-02-14 22:25:59 -08:00
Kurt
ebb4e2a56a Defer curry mark static encounters, flag as invalid
Closes #3001 as all marks that can be checked are checked.

Promote trades above static encounters, as it's just met location.
2021-02-14 21:24:31 -08:00
Kurt
927c83d660 Show seed in output, flag correlations that shouldn't 2021-02-14 16:00:43 -08:00
Kurt
5949c3b57e Minor clean 2021-02-14 15:14:45 -08:00
Kurt
267613270e Generate slots/static per correlation if appropriate
Relocate the SetRandomEC at the tail end of the generator into the specific classes that set EC, so that our correlation generators don't have their EC overwritten at the end.
2021-02-14 12:27:14 -08:00
Kurt
884cd70d43 Minor clean 2021-02-14 10:23:53 -08:00
Kurt
1af27516e6 pid encounter type mismatch: returns
Keeping the cryptic message for now :)
2021-02-14 10:20:35 -08:00
Lusamine
205cf481b0
Add Gyarados/Milotic crossover & disallow marks in Motostoke Gym (#3149)
* Add a Gyarados crossover & disallow marks in Motostoke Gym

* Milotic can be lured across boundary too
2021-02-14 10:13:45 -08:00
Kurt
a65ab2accc Flag wild slots that don't match 32bit correlation 2021-02-13 22:45:07 -08:00
Kurt
f583cdd385 Add valentines milcery def
nonshiny is dupe with prior enc
2021-02-12 20:21:13 -08:00
Lusamine
c0b73575e6
Moltres-1 can be caught at Honeycalm Sea (#3147) 2021-02-10 21:02:29 -08:00
Kurt
3876b3b1fa Allow traded egg while still egg
Closes #3144
2021-02-08 08:29:18 -08:00
sora10pls
eab75b7cba Update HOME date legality
Update dictionary to use proper format (yyyy-mm-dd), as well as verifier to properly check met year.
Also updated IsValidDateWC8 to clamp latest met date based on UTC, like with GO encounters.
2021-02-04 09:12:47 -05:00
Kurt
f6f81ec782 Add initial date checks for HOME gifts 2021-02-03 22:57:59 -08:00
Kurt
51bc48a6a8 Add Cramorant raids 2021-02-03 22:44:15 -08:00
Kurt
230073876f Add catch rate for staticencounter1 2021-02-03 15:22:48 -08:00
Kurt
5350cb4ab6 Update EncounterTradeGenerator.cs 2021-02-03 14:50:15 -08:00
Kurt
ac464e0c57 Update EncounterStatic2E.cs 2021-02-03 13:49:14 -08:00
Kurt
862403858b Refactoring
no functional change
2021-02-03 11:33:09 -08:00
Kurt
9d9eb935b1 Improve partial match bleed through
Checks partial matches in the loop rather than outside; it'll only settle on the partial match if there's nothing else to settle on.

Gen1/2 generators can have partial matches bubble up before actual matches (gen1 fighting gen2).
2021-02-02 22:40:06 -08:00
Kurt
2b00e310ae Handle some gen1/2 static generating easier
I should probably have slot1/2 and static1/2 and trade1/2 implement GetBlank so that they can flexibly return a japanese/int/(kor) from template rather than default int, but eh
2021-02-02 22:14:33 -08:00
Kurt
e33468db96 Mark (JP-BU)/(JP-GN)(EN-BU) as RB
BU is only Japanese
2021-02-02 22:13:24 -08:00
Kurt
cd286d6923 Yield specific static encounters for rby/gsc for moveset gen 2021-02-02 20:25:59 -08:00
Kurt
630d84c8b6 Check encounter moves for gen1/2 (no relearner) 2021-02-02 15:39:56 -08:00
Kurt
78cc0098b3 Update EncounterStatic2.cs 2021-02-02 10:41:28 -08:00
Kurt
f7f8597281 Handle game-specific slot fetch for gen1/2 more explicitly 2021-02-02 10:20:30 -08:00
Kurt
8705c26adc Bake cosplay moves into the encounter template
yay records `with` syntax
don't bother specifying form6's moves, they're all levelup moves.
2021-02-02 09:40:58 -08:00
Kurt
48c2c43293 Re-dump slots with revised SlotType definitions 2021-02-01 23:43:52 -08:00
Kurt
e55dae8f7b Remove headbutt available check; already pruned
The Encounter dumper project already excluded all headbutt tree areas that can't be accessed. Every slot that is present in this project can be accessed.

Move the tree check to the eslot2 object

Check all gen2 slots regardless of crystal origin, since we now tag all of them with location IDs.
2021-02-01 21:22:58 -08:00
Kurt
a7afa58156 Rework partialmatch hidden check
Want to check if it has been evolved from the original species, and the current species is a non-changeable hidden ability
2021-02-01 20:45:48 -08:00
Kurt
4e9908a53d Remove unnecessary logic 2021-02-01 20:17:17 -08:00
Kurt
8a2d115df3 Sanity check nature for Criteria parameter 2021-02-01 10:45:53 -08:00
Kurt
afbf1d997b Try to detect vc transferred species, don't assume most evolved 2021-02-01 09:52:25 -08:00
Kurt
7833d12f95 Simplify shared egg move array get 2021-01-31 23:07:14 -08:00
Kurt
a43f6aa71a Add february dist raids 2021-01-31 22:40:47 -08:00
Kurt
f3ef88a5e9 Respect ability from criteria 2021-01-31 21:53:11 -08:00
Kurt
34ac8167f2 Update EncounterSlot.cs 2021-01-31 21:42:24 -08:00
Kurt
1ece844f78 Partial match HA species without a HA possible
A captured metapod cannot have hidden ability via ability patch, but a captured caterpie evolved into metapod can, assuming it existed as caterpie.
2021-01-31 13:05:36 -08:00
Kurt
d8e75ee85a Force Japanese language for JP-BU safe language fetch 2021-01-31 10:19:12 -08:00
Kurt
4d25214c8d Update EncounterEgg.cs 2021-01-31 01:20:35 -08:00
Kurt
332449f53d Fix erroneous yield counter increments
https://projectpokemon.org/home/forums/topic/58492-possible-legality-error-for-the-mon-from-pokemon-bank-using-ability-patch-with-the-new-update/
2021-01-31 01:12:20 -08:00
Kurt
a7f6c212f9 Permit gen2 moves on a vc1 transfer
feels dirty
2021-01-30 22:03:41 -08:00
Kurt
a524032f61 Add TR flags to emoveset generator 2021-01-30 21:49:45 -08:00
Kurt
6089268b53 Set valid nature for generated toxtricity 2021-01-30 19:58:05 -08:00
Kurt
09bfe5bd95 Enforce shadow locks when generating a ck3/xk3 from criteria 2021-01-30 19:42:58 -08:00