Commit graph

1057 commits

Author SHA1 Message Date
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
Kurt
3bb4553b24 Disallow encounter edge case moves when battleversion reset 2021-01-30 13:15:21 -08:00
Kurt
4f7faf9c85 Moveset generator tweaks, dexnav move logic 2021-01-30 10:15:38 -08:00
Kurt
1e86fdcea8
Fracture the encounter matching checks to allow progressive validation (#3137)
## Issue

We want to discard-but-remember any slots that aren't a perfect fit, on the off chance that a better one exists later in the search space. If there's no better match, then we gotta go with what we got.

## Example:
Wurmple exists in area `X`, and also has a more rare slot for Silcoon, with the same level for both slots. 
* We have a Silcoon that we've leveled up a few times.

Was our Silcoon originally a Wurmple, or was it caught as a Silcoon? 
* To be sure, we have to check the EC/PID if the Wurmple wouldn't evolve into Cascoon instead.
* We don't want to wholly reject that Wurmple slot, as maybe the Met Level isn't within Silcoon's slot range.

---

Existing implementation would store "deferred" matches in a list; we only need to keep 1 of these matches around (less allocation!). We also want to differentiate between a "good" deferral and a "bad" deferral; I don't think this is necessary but it's currently used by Mystery Gift matching (implemented for the Eeveelution mystery gifts which matter for evolution moves).

The existing logic didn't use inheritance, and instead had static methods being reused across generations. Quite kludgy. Also, the existing logic was a pain to modify the master encounter yield methods, as one generation's quirks had to not impact all other generations that used the method.

---

The new implementation splits out the encounter yielding methods to be separate for each generation / subset. Now, things don't have to check `WasLink` for Gen7 origin, because Pokémon Link wasn't a thing in Gen7.

---

## Future
Maybe refactoring yielders into "GameCores" that expose yielding behaviors / properties, rather than the static logic. As more generations and side-gamegroups get added (thanks LGPE/GO/GameCube), all this switch stuff gets annoying to maintain instead of just overriding/inheritance.

## Conclusion

This shouldn't impact any legality results negatively; if you notice any regressions, report them! This should reduce false flags where we didn't defer-discard an encounter when we should have (wild area mons being confused with raids).
2021-01-29 17:55:27 -08:00
Kurt
f7b703626c Only import gbera statics for Generation >0
GO requests would have Generation=-1 (no met location to differentiate 7/8).
2021-01-29 11:32:51 -08:00
Kurt
6c1b6a269d Pass gender when creating static entry 2021-01-27 12:29:49 -08:00
Kurt
511797c1f9 Fix gen4 hm indexing 2021-01-25 20:58:56 -08:00
Kurt
acfbef6cfa Disallow raids matching if has mark
Closes #3133
not an ideal solution, but the encounter matching API is kinda limited in deferred-invalid vs deferred-notIdeal.

probably need to unify the match logic and generators so they can cache one secondary-check invalid
2021-01-22 20:28:54 -08:00
Kurt
5f8e2b13c5 Simplify headbutt tree pivot check
See the EncounterSlotDumper with the memoization logic & json tree listing.

Simplifies things a lot, and improves checking speed. Unreachable trees are now treated the same as no-trees maps.

ez 1.5KB reduction in file size :P
2021-01-22 19:20:18 -08:00
Kurt
944ff107b0 Add new distribution raids 2021-01-21 16:30:07 -08:00
Kurt
fbc089e7eb Minor tweaks
Remove gen3 egg location hashset; only paths that reach it are for hatched eggs or current breed-eggs. Check breed eggs with the singular met location.
Simplify some logic flow
2021-01-20 12:37:51 -08:00
Kurt
9964c91dc6 Remove static init of yancy/curtis names
static constructor ran after the initializer; flip it and remove the unnecessary all-set
2021-01-20 12:36:46 -08:00
Kurt
bfd948ee2b Update pget binaries, check gender
yay single gender availability! (frillish/jellicent being male only)
2021-01-16 18:29:27 -08:00
Kurt
bb1d23e112 Minor clean
Use some enums, save a few virtual/static fetches
2021-01-16 12:01:40 -08:00
Lusamine
15da92f9bc
Document weather for static encounters (#3127)
This only matches the weather table with the Pokemon and does not fully
account for whether a location can spawn a particular weather.

Additional minor changes:
- Adds ScriptedNoMarks to Regis and Glimwood Tangle static encounters
- Corrects a few version-specific Pokemon such as Ludicolo/Shiftry
- Removes erroneous encounters such as Milotic in East/West Lake Axewell
- Removes an unused Motostoke Stadium encounter
2021-01-16 09:31:21 -08:00
Kurt
8eb499c4d0 Update EncounterStatic5.cs
Use base deferral method which only checks fateful flag.
2021-01-14 22:51:01 -08:00
Kurt
c32b38a53c Minor annotation tweaks
no functional change
2021-01-12 22:26:08 -08:00
Kurt
2d3d6b49da Force bad vc1 (should be vc2) to be vc2 templates 2021-01-11 17:47:25 -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
3e0b52195a Minor clean 2021-01-08 13:17:59 -08:00
Kurt
4a3a8dd090 Add japanese blue encounter tables (unique to jp_blue)
When creating a new pk1 for the slot->pkm, get it as a pk1-japanese.
Export the gameversion when in pk1/2 format (same as VC).
2021-01-08 11:29:00 -08:00
Kurt
d2d2be899b Critical typo fix
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2021-01-07 21:30:39 -08:00
Kurt
92c9e9897a Add latest dist raid changes
Same as 11/20, with one swap. Only the swap is kept (because duplicate encounters don't matter).
2021-01-07 21:27:57 -08:00
Kurt
118e1266a6 Swap lgpe sandshrew/vulpix version restrictions
Closes #3122 ty @FeralFalcon !
2021-01-05 17:30:14 -08:00
Kurt
9d7c9929b4 Minor tweaks
should be it :( :(
2021-01-05 09:58:33 -08:00
Kurt
373aecdf7c Merge GO IV checks, behavior is now correct
Rename IV1/2/3 to HP/ATK/DEF in gp1 structure
2021-01-05 09:39:50 -08:00
Kurt
cc43550357 Simplify more expressions 2021-01-04 17:31:43 -08:00
Kurt
730640decc Minor clean 2021-01-03 16:53:13 -08:00
Kurt
33ad654be6 Mark encstatic version on init rather than post-init 2021-01-03 16:49:49 -08:00
Kurt
1f3d3112d3 Move some future-evolution tables to separate class 2021-01-02 19:11:46 -08:00
Kurt
77a784a881 Move Stadium static encounter junk to event list
Charmander has Leer at level 5, which makes it a special move (can't learn it normally that low).
2021-01-02 14:48:11 -08:00
Kurt
7a4d8925f2 Update EncounterStaticGenerator.cs 2021-01-02 13:53:25 -08:00
Kurt
c432a15a20 Relocate some tables to a location closer to where they're used 2021-01-02 00:46:09 -08:00
Kurt
a7b9fafb69 Remove unnecessary logic
Encounters are thoroughly checked for their origins; don't need to check again if it's possible to have it in an egg.
2021-01-01 19:45:40 -08:00
Kurt
2648560684 Invert breeding method result returns
clean:
if (!logical) return;

Existing logic had methods named to return true if fail, now method checks for passing, thus the logic now follows the above pattern.
2021-01-01 19:36:54 -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
04f8efec4f Move more breeding logic to Breeding
Simplify some method signatures, reduce checks for MoveEgg.GetEggMoves

ran legality checks for 100,000 pkm, no more exceptions (Internal Error) -- added a "CanGameGenerateEggs" which filters out unused gameIDs
2021-01-01 15:01:22 -08:00
Kurt
7523e0e200 Make ContestStat fields byte (from int) 2021-01-01 13:39:08 -08:00
Kurt
f6d4d93613 Inline some logic for contest stats 2021-01-01 12:21:46 -08:00
Kurt
e2c1a3045a Extract gen2 egg generator, simplify can be egg checks
Optional parameters were never passed; force Min Level to 5 to match egg level.

Tried removing it completely but it still allowed Charizard eggs (no)
2021-01-01 11:27:45 -08:00