Commit graph

48 commits

Author SHA1 Message Date
Kurt
2d18440445 Fix wurmple evo gen3/4
yeah it was never the lowest 16 bits as every-internet-source claims.

1D9C9130 silcoon => 3716[8] = cascoon (nope)
#1330 was correct!
2017-07-17 15:58:15 -07:00
Kurt
2f3c56e7c5 Update gen4/5 mg generators
PGF for movie victini has OTgender=3; only eggs are supposed to set OT
details from the SAV.

update pattern matchers to abuse this fact.

Thanks @odaxis !
2017-07-14 22:50:12 -07:00
Kurt
dce42195e5 Add static encounter deferrals
Rarely ever used, the only case where an unfavorable match is returned
first is Emerald Lati@s transferred to a future generation, as there are
2 encounters (one with and one without Fateful).

Closes #1326
Thanks @sora10pls !
2017-07-13 23:12:30 -07:00
Kurt
08ca4dd147 Fix gen3 static encounter eggs
add exclusions for egg data, fixes wynaut and togepi ingame gift eggs.
Closes #1322
2017-07-12 09:02:54 -07:00
Kurt
1d93c5836e Tweak egg detection
Remove hot springs from general egg list, add bypass to static encounter
check
a91764b283
2017-07-10 21:45:37 -07:00
Kurt
cb76d51e38 Simplify vc transfer checks
supply met level so the static encounter has a level to work with
instead of 0
Closes #1316

in other areas:
level 48 charizard VC1 transfer changed to mewtwo causes minlvl >
maxlevel, handle instead of throwing exception.
2017-07-09 08:47:17 -07:00
Kurt
a653363a16 Simplify wc3 checking
all branches did similar checks, so I pulled them out

Added TID bypass for PCNY incremental TID pkm
#1313
2017-07-06 20:22:54 -07:00
Kurt
ca04abfca6 Refactoring
misc cleanup/breaking up large methods from recent PR
2017-07-06 17:01:29 -07:00
javierhimura
461fb70f90 Generation 1/2 Legal improvements (#1310)
* Added location to encounter slot to make verification againts the location of the encounter when the pokemon has lost met location, like generation 2 heabutt tree, jhoto surfing in route 45 and in the future generation 4 munchlax tree

Added version to generation 1 and 2 encounter locations to filter by catch rate based of the version of the encounter and check initial moves of the encounter only for the game that match the encounter

Filter generation 2 pokemon for crystal who have met location based of the time of day when it was captured

Completed version to static and traded encounters for gen 1 pokemon, to avoid check a red encounter with yellow initial moves, if an encounter is possible in both games with diferent moves it is duplicated (like eevee), if it is possible in both games with the same moves is left as RBY, the encounter will only use red/blue moveset

Verify some invalid gen 2 encounters. Crystall heabutt encounters based on the TID, using the tree selection algorithm of the game to determine if the encounter is possible for the TID (implemented base on https://bulbapedia.bulbagarden.net/wiki/Headbutt_tree#Mechanics). Coordinates of Crystal trees obtained with the programa G2Map

Added checks for fishing encounters for unreacheable water tiles in gen 2, route 14, national park and the beta safari zone.

* Fix gen 1 static encounters and trade encounters filter by version

* Missing strings
2017-07-06 16:03:41 -07:00
Kamron Batman
0a2245b55c Fixes various gen 3 event templates. (#1309)
* Fixes various gen 3 event templates.

* Adds more checks to PokePark 2005 eggs for DS Download Play.

* Fixes various gen 3 event checks. Still missing japanese events, but will add those another time.

* Adds 10 ANIV Celebi.

* Fixes PCJP 2003 eggs. Still doesn't use the exact formula though, but BACD-R is something to start with.
2017-07-06 09:45:41 -07:00
Kurt
502093b8b2 Misc tweaks
fix pcd detection (yield brewk needed to be inside brackets
remove brackets from single line lambda expressions
2017-07-05 23:05:49 -07:00
Kurt
0c23881f65 Add manaphy egg PIDIV check
slightly different from hatched in that it can't be shiny as an egg as
the ID/SID doesn't change until hatched.

move Ranger check to utility
2017-07-05 17:47:48 -07:00
sora10pls
cad24744ef Manaphy Egg fixes 2017-07-05 15:31:41 -04:00
Kurt
b760509fcb Misc gen3 event updates
Add special ribbon detection (for wc3),
speed up seeds from IVs calc (flip top bit of seed to get the result for
other iteration)
Add a bunch of gen3 event data
2017-07-01 16:50:45 -07:00
Kurt
5476b86a11 Misc performance tweaks
Switch encounter slot generator to yield style to not require the entire
method to finish iterating
Although the pressure slot may be best-matching, it isn't the typical
match. Defer pressure slot clone to the end (defers the orderby
calculation)

There's probably a better way to do the pre-work (gen 5+ only operate
off one encounterarea... usually. Past Gens end up repeating the same
work for each area tested

slot matching runs slightly faster now due to the deferred execution
2017-06-30 00:37:17 -07:00
Kurt
b71485c0a3 Misc tweaks for encounter generation
reduce 'as' usages for pk1 (cast & check once)
reorder some slot generation checks (early return prior to slot
filtering; not crucial as the linq wasn't evaluated yet).
2017-06-29 23:50:24 -07:00
Kurt
90693a2a76 Don't generate egg encounters if species cant exist
Closes #1286
2017-06-29 20:12:40 -07:00
Kurt
2546ddfd8e Misc gen3 related updates
detect gen3 event eggs better
2017-06-28 22:09:26 -07:00
Kurt
e1d0867a51 Misc egg related additions
Closes #1257
Disallow static encounters that aren't eggs or are for eggs (mismatch)
Check egg encounter level for IsWithinRange
Check egg met level while still is egg
2017-06-27 22:08:16 -07:00
Kurt
e635755dfd Add SID bypass for cxd random SID gifts
For XD Trade Gifts, the SID matches player's SID (not 0).
2017-06-26 20:29:22 -07:00
Kurt
ac16492daa update abilityflip g5mgshiny checks
Closes #1269
Also adds pokewalker PID check (don't think it works correctly but close
enough for now)
2017-06-24 17:24:36 -07:00
Kurt
b6d266824e Filter crystal statics in matching, not table fetch
Eggs from crystal traded to GS can hatch with no met location; skip
crystal-only encounters unless they are non-eggs

Closes #1245
2017-06-18 16:40:23 -07:00
Kurt
a16aa827e4 Add mysterygift version receivability check for PCD
Closes #1242
2017-06-17 23:09:00 -07:00
Kurt
7b2e3c59bf Add gsc goldenrod / fix mania shuckie 2017-06-17 22:44:05 -07:00
Kurt
3faecaf6d5 Prevent eggs from generating nonstatic encounters
Closes #1239 indirectly; anything gen5+ which was an egg can only be
Daycare or EncounterStatic
2017-06-17 19:08:40 -07:00
Kurt
3f38b123a3 Refactoring
mostly renaming things, includes a little bit of added sugar and
splitting methods to simplify the codebase.

all methods are now PascalCase
2017-06-17 18:37:19 -07:00
Kurt
84d3247b75 Add "Can't Tell" recognition for gen2 ingame trades
Fix xatu's IVs, dodrio's gender
why bulba, yes serebii
2017-06-16 23:14:22 -07:00
Kurt
2064779d91 Add gsc bug catching contest slots
surfing still looks a little wonky, fixed fishing slots
2017-06-15 22:21:02 -07:00
Kurt
9e3ee6eacb Update gen4 gift PIDIV checks
fix method1 PIDIV creation, check for antishiny manaphy gift
2017-06-15 18:34:03 -07:00
Kurt
2979c4f7ec Misc gen2 fixes
still a few problems left:
surf encounters
roamer met locations
national park encounters
lake of rage all-gyarados encounters (?)

#1221
2017-06-12 22:16:20 -07:00
Kurt
7b874757f7 Change gen1/2 encounter preference
Previous approach was 'most likely to find valid', this approach is a
little greedier to try to find a more fitting match. Will result in a
small increase in computation time, but trying out EncounterTrades and
static encounters first is preferred.

Fix Rhydon ingame trade gender. Bulbapedia is wrong, that's a Male
Rhydon with those IVs.
2017-06-12 21:05:04 -07:00
Kurt
8a4c40908b Enforce met location matching for crystal data
Only while format == 2
improve detection for gen1/2 ingame trades
2017-06-12 18:15:26 -07:00
Kurt
bb6c5e3dbb Add static encounter egg edge case handling
Closes #1219
reject the eevee case if any relearn moves are present

allow traded eggs to be matched
2017-06-11 18:39:19 -07:00
Kurt
45ff41ca48 Add more gen2 hypothetical handling
won't be active until VC2 release
2017-06-10 15:48:18 -07:00
Kurt
94a315aa6d Speculation++
As if I would have insider knowledge...
┬┴┬┴┤ ͡° ͜ʖ ͡°)├┬┴┬┴

Prepping core for eventual VC2 support where Crystal data is not
retrievable.
2017-06-06 21:59:29 -07:00
Kurt
234a3d2ed8 Simplify egg game generation
All gens that store version number do not change the version ID on
trade/hatch; this info is preserved and can directly imply which game
generated the egg.

the 'version' is ignored anyway, just useful to track for gen2 eggs.
2017-06-06 18:28:21 -07:00
Kurt
7c4092e1c5 Misc updates
More elegant handling for PKM without nicknames that have another
language species name; use that language ID instead of the pkm's
language ID. Since ToLower is not called, Ho-Oh from 3/4->6 now
transfers correctly.

fix gen3 encounterstatic eggs while still on gen3 games; only check the
egg location if still an egg

tighten up gen3 PIDIV compatibility checks, roamer glitch is fixed on
Emerald, and static encounters can't get method 2, and can only have
method 4 if under software emulation (RS Box) since the emu speed is
faaaaast 🚤 /s
2017-06-03 17:49:37 -07:00
Kurt
4201e10a0e Misc cleanup
Add PCD fixed PID check
improve PID matching for CXD pkm
hide no-pidiv match seed (00000000)
fix matching fateful for wild pokespot pkm
don't generate eggs for c/xd
2017-06-03 15:16:27 -07:00
Kurt
5823425f42 Add PIDIV checking for encounters
Fixes HGSS egg moves, and improves encounter detail detection.
example: togepi from FRLG transferred up, old detection couldn't
differentiate the gift egg from a regular egg; however, PIDIVs can lend
a hand -- eggs don't have a PIDIV!

fixed shiny BACD spread detection (in regards to antishiny rerolls).
Shiny WISHMKR now detected correctly.
2017-06-03 00:12:05 -07:00
Kurt
03f42ee19c Split gen3/4 encounter generators from default
Add exclusion for gen3/4 balls since met location requires a less
precise match; static encounters will never be in safari/sport balls.

Fix wurmple species ref, isn't smeargle
2017-06-02 16:56:38 -07:00
Kurt
f70bd02d69 Fix wurmple evo lockup
while loop wasn't checking the modified EC value, thus looping forever
standardize usage across core
2017-06-01 18:41:22 -07:00
ReignOfComputer
8f951211b4 Fix Link Gift Check if not Gen 6 (#1184)
* Skip Link Gift Check if not Gen 6

Prevents NullReferenceException if location is set in other Gen.
Reference:
https://projectpokemon.org/forums/forums/topic/40749-beautifly-and-dustox-re-roll-pidencryption-pkhex-becomes-unresponsive/

* Change Additional Pokemon Link Check

Based on @evandixon's direction :)
2017-06-01 18:10:19 -07:00
Kurt
92ca1e2263 Fix eevee static encounter collision scenario
eevee gen7 egg has no moves; always generate eggs first for gen4+

Closes #1179
Closes #1176 (prior commit)

there's probably a better way to optimize this (don't check wild
encounters if 100% sure it's an egg); best left for future optimization
since it's working fine atm.
2017-05-30 18:42:50 -07:00
Kurt
82750de1b8 Add initial gen3 event detection
egg events supported, only some gen3 event distros supported
will eventually flag for PIDIV type mismatching

@kamronbatman
2017-05-29 00:48:25 -07:00
Kurt
9a7dc9998c Misc fixes
Track gen1/2 origin game as well  as generation
fix pk2 gender setting (incorrect bitmask & wasn't set from tabs)
extend female gender check for gen2 to apply to GS encounters -- if met
location is missing, was traded to gen1 which clears gender.
2017-05-28 16:56:51 -07:00
Kurt
e01c8a5786 Misc gen3 related legal check fixes 2017-05-28 15:49:20 -07:00
Kurt
cbfa38b131 Rework encounter slot generating
Closes #1171

Calculate rejection scenarios, store rejected slots to spit out at the
end rather than returning them early.
2017-05-28 11:10:01 -07:00
Kurt
858aa50689 Refactor encounter matching
exercise in deferred execution/state machine, only calculate possible
matches until a sufficiently valid match is obtained. Previous setup
would try to calculate the 'best match' and had band-aid workarounds in
cases where a subsequent check may determine it to be a false match.

There's still more ways to improve speed:
- precalculate relationships for Encounter Slots rather than iterating
over every area
- yielding individual slots instead of an entire area
- group non-egg wondercards by ID in a dict/hashtable for faster
retrieval

reworked some internals:
- EncounterMatch is always an IEncounterable instead of an object, for
easy pattern matching.
- Splitbreed checking is done per encounter and is stored in the
EncounterEgg result
- Encounter validation uses Encounter/Move/RelearnMove/Evolution to
whittle to the final encounter.

As a part of the encounter matching, a lazy peek is used to check if an
invalid encounter should be retained instead of discarded; if another
encounter has not been checked, it'll stop the invalid checks and move
on. If it is the last encounter, no other valid encounters exist so it
will keep the parse for the invalid encounter.

If no encounters are yielded, then there is no encountermatch. An
EncounterInvalid is created to store basic details, and the parse is
carried out.

Breaks some legality checking features for flagging invalid moves in
more detail, but those can be re-added in a separate check (if
splitbreed & any move invalid -> check for other split moves).

Should now be easier to follow the flow & maintain 😄
2017-05-27 21:17:57 -07:00