Commit graph

111 commits

Author SHA1 Message Date
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
1af27516e6 pid encounter type mismatch: returns
Keeping the cryptic message for now :)
2021-02-14 10:20:35 -08:00
Kurt
3876b3b1fa Allow traded egg while still egg
Closes #3144
2021-02-08 08:29:18 -08:00
Kurt
230073876f Add catch rate for staticencounter1 2021-02-03 15:22:48 -08:00
Kurt
ac464e0c57 Update EncounterStatic2E.cs 2021-02-03 13:49:14 -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
78cc0098b3 Update EncounterStatic2.cs 2021-02-02 10:41:28 -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
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
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
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
6c1b6a269d Pass gender when creating static entry 2021-01-27 12:29:49 -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
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
33ad654be6 Mark encstatic version on init rather than post-init 2021-01-03 16:49:49 -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
09089da14e Use more expression return style
Reduces indentation & bracketing, a bit more concise
2021-01-01 17:08:49 -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
4058d44229 Fix inverted check 2020-12-31 12:14:24 -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
e4c391dc01 Move nest downlevel checks into specific encounter type
Distribution nests are checked for 1/3 badge restrictions similar to regular nests; crystal nests are not. Thanks @Lusamine!
2020-12-26 09:31:21 -08:00
Kurt
ee5349ff98 moar is or 2020-12-25 12:30:26 -08:00
Kurt
43dd390f21 Split IContestStats, mark trades as records 2020-12-24 00:06:40 -08:00
Kurt
afdd2bd57e Mark EncounterSlot/Static types as immutable record types 2020-12-23 20:40:59 -08:00
Kurt
736564be8c Merge EncounterStatic4 back together 2020-12-23 12:15:49 -08:00
Kurt
105e8b3818 Move version forcing for unavailable encounters to es4 2020-12-22 20:15:56 -08:00
Kurt
2bc7110884 Remove unnecessary overrides 2020-12-21 23:40:58 -08:00
Kurt
997e0751f3 Minor clean
Handle remainder of c#9 sugar
Fix some spelling mistakes
2020-12-21 23:37:07 -08:00
Kurt
514b60b447 Merge type check with usage in if statements
if x is y with z property true, then :D
2020-12-21 22:33:48 -08:00
Kurt
594db92ad0 Minor clean
Handle some stragglers
2020-12-21 17:48:08 -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
1854d172bd Add missing property set
lol oops
2020-12-21 17:12:21 -08:00
Kurt
68ee8cfcc4 Change setters to init only 2020-12-21 17:05:05 -08:00
Kurt
133b8e6ba0 Rework Pokewalker/Dream Radar static encounters to own class 2020-12-21 17:04:09 -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
7c4c1e0913 Minor prep clean 2020-12-10 19:49:53 -08:00
Kurt
3d87070cc8 Require strict match for hidden ability encounters
Metagross collision with wild beldum

deferral API is kinda crude, hence these janky workarounds. Was originally intended to hold onto close matches when there's no more possible matches to check.
I think a priority-deferral while only retaining a single encounter bad (instead of a list of retries) may work better than the current setup, but that would require more abstraction
2020-12-02 21:39:45 -08:00
Kurt
26d6143325 Indicate static encounters disallowed from marks
Includes gifts by default
2020-11-27 12:48:47 -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
227efc1fc3 Only allow checking if lvl60 when lvl<60 2020-11-05 21:17:13 -08:00
Kurt
51c872f4e1 Move more logic closer to where it's used 2020-11-02 14:46:26 -08:00