Commit graph

433 commits

Author SHA1 Message Date
Kurt
49c36e2173 Misc legality gen tweaks
bypass savefile language checks if no language set
fix gen2 static gift egg that is really a wild encounter -- egg flag was
set & not cleared -> no wild pkm, bad! Adds test case for this.
(probably isn't a better place to clear, enforces only once per
generation rather than on every yield/end of every static yield)
2018-06-15 18:47:17 -07:00
Kurt
cb5e1239ae Refactoring
Extract game value limits
Rearrange GameVersion util logic extensions
add better gameversion fetch for generator (equivalent to pkmeditor)
2018-06-15 16:00:28 -07:00
Kurt
b9652a835d Weaken gen2 egg species checks for pre-evos in gen1
VC can inhabit both gens

Add Tradeback setting setter for legality tests
Add GBCartEra setting setter for legality tests

Thanks @iiippppk !
2018-06-12 18:46:31 -07:00
Kurt
64a64b8ce1 Add special handling for gen1 encounter move fetch
Begin splitting of GetMovesLevelUp per-gen into per-version
2018-06-12 18:35:56 -07:00
Kurt
242fc295b4 Handle smeargle egg case
#1993
Just use precomputed array since it can only know sketch
2018-06-11 08:03:10 -07:00
Kurt
e105f2b589 Refactoring
fix b2w2 egg base levelup reference (not bw, b2w2!), doesn't really
matter much except for better indication (possibly?)
remove some unnecessary linq ToArray() calls
continue relocating code out of Core
2018-06-10 17:55:03 -07:00
Kurt
3f1195a2d4 Refactoring
Remove duplication of levelup fetch
relocate some stuff to a more appropriate area
2018-06-10 10:44:05 -07:00
Kurt
3b84f33776 Misc changes
Revert linq chain
Closes #1987

change encountermatch comparison (never null), add comparison for vc
output
remove unused strings (will get removed from translation files in later
update)
2018-06-10 00:26:33 -07:00
Kurt
021ac7c54f Refactoring
where!contains -> except
relocate special tutor
2018-06-09 16:04:06 -07:00
Kurt
ee3fda46f2 fix method name typo 2018-06-09 08:04:40 -07:00
Kurt
a494a6b37a Don't generate move check order for an invalid ver 2018-06-08 20:36:52 -07:00
Kurt
1202474cd5 Defer & flag VC korean unobtainable encounters
Closes #1985
2018-06-06 21:49:30 -07:00
Kurt
e52ae06721 Add version check
16 bits for version flags, should be more than enough.

should probably rework it from a packed ushort to a class...
2018-06-05 22:20:30 -07:00
Kurt
323db29374 Handle volt tackle special egg move
edge case turns the [] into an ienumerable, better than calling another
to-list.
2018-06-05 21:38:38 -07:00
Kurt
e7fc30ac7a Add mysterygift region/language restriction code
Closes #1317
Needs the events crew to produce serialized binaries with hash-flag data
for each generation before proceeding any further. I'm not really
interested in doing all the work for events since it doesn't impact
battle legality.
2018-06-05 18:27:08 -07:00
Kurt
ae3b6a7fa1 Simplify IContestStats usage
remove new[] creating for checking if any contest stats exist
(HasContestStats)
2018-06-02 21:19:03 -07:00
Kurt
15b5de11c0 Handle hatched wc3 metlevel oddballs
Closes #1978

Met Level at 5, when hatched ingame is reset to 0.
2018-06-02 07:50:48 -07:00
Kurt
f237476ccc Add nickname reset modify
nickname reset clears except for encountertrades (some have fixed
nicknames).

remove untraded check for HT memory verification, has to be traded if it
has a HT memory.
2018-05-31 19:49:47 -07:00
Kurt
4b8cb9b8fb Add entree forest editor & randomizer
ezpz

(clear trailing spaces from entree forest comments)
2018-05-28 08:26:52 -07:00
Kurt
c31ab63a1a Initialize mgdb for tests that need it initialized
don't initialize multiple times
2018-05-27 15:57:28 -07:00
Kurt
a57cdb5f48 Update fateful handling
#1970
add files as test cases
2018-05-27 14:38:03 -07:00
Kurt
4c1e014a53 Fix mgdb viewing cxd gifts
Closes #1972
2018-05-27 14:16:56 -07:00
Kurt
ae27c10dc2 Misc cxd fixes
#1970
2018-05-27 12:18:27 -07:00
Kurt
6a3b422a14 Fix xd fateful gift pkm
stored as wc3's, make "Version" from IVersion rather than int so that
"WasXD" recognizes it.

Update handling for fateful encounter trade-away cases.

#1970
2018-05-27 10:11:01 -07:00
Kurt
f7a61cf72c Flag version exclusive trades with incorrect ver
Closes #1969
2018-05-27 06:59:27 -07:00
Kurt
e6765d3691 Flag langid=0 when appropriate
only jpn bw ingame trades can lack a languageID.

skip language checks for pk1/pk2 as they have no language stored.
2018-05-26 14:40:02 -07:00
Kurt
407cca38dd Update generator to handle link celebi
Had relearnmoves defined but no current moves; better for generator to
spit out all moves rather than the special move (hold back)

store current moves for all link gifts
2018-05-20 09:06:32 -07:00
Kurt
cd3b24c122 Handle smeargle generating
Needed moves is essentially none (unless you have invalid sketch moves).
2018-05-20 08:19:03 -07:00
Kurt
1f8c72af5a Handle EncounterTrade without moves specified
Similar to EncounterStatic handling
Thanks @architdate for pointing this out
2018-05-19 21:49:26 -07:00
Kurt
0e6db90de2 more minor tweaks
add 2 overloads for encounter generator
more simplifications
2018-05-12 18:11:47 -07:00
Kurt
99005d8fc0 Refactoring
more discards & simplifications
2018-05-12 12:28:48 -07:00
Kurt
e2f11edc43 Refactoring
discards, Array.Find over FirstOrDefault
2018-05-12 08:41:29 -07:00
Kurt
5a3c8f4147 Remove trailing whitespace 2018-05-12 08:41:29 -07:00
Kurt
9fb7056837 Add test living dex generator
doesn't generate everything due to the evo chain not being 'full'
(instead is unevolved singular pkm), nor does it evolve pkm
2018-05-09 21:02:35 -07:00
Kurt
79b2576c31 add overloads for GetPossible
Remove edge case handling for level 2 blissey; updates over the past 2
(yay 2 years of legality checking) can now handle that case without
special handling.
2018-05-09 20:37:11 -07:00
Kurt
9f8e86b2b5 Finish rough generator
* handle gen6+ egg case where egg move count < 4 (cannot displace
Levelup lvl1 moves)
* handle minior altform case

generates all species/encounters possible, yielding 144,094 pkm files
(all detected as legal!)
2018-05-09 19:21:44 -07:00
Kurt
16ed4353b2 More generator updates
Store 4g giratina held item for enc->pkm legality
revise usages of GetSaneGender
Rearrange some logic
Better handle impossible version encounters (gen4)

gen 1-5 done, stuck on 659 - bunnelby egg...?
2018-05-09 17:50:56 -07:00
Kurt
4913ef9647 More generator updates
* B2 has an error in the encounter table for Route 3 Corphish Special
water encounter; GF edited from Basculin-1 to Corphish-1 and forgot to
update the form to 0.
* Ranch Trade egg locations
* Trade gender-PID set correctly
* static roamer glitch does not apply for emerald
* Mirage Island wild Wynaut case now allowed (collision with Gift Wynaut
egg hatched on Mirage Island?)

gen1-3 done; now at 413 (Wormadam) which currently yields an
EncounterEgg AS wormadam, which isn't right...
2018-05-08 21:17:31 -07:00
Kurt
c21f8bf45f More generator updates
Blazing past 251, now stopped at 280 (trade ralts, gender mismatch??)
2018-05-08 20:13:55 -07:00
Kurt
4d60a5a64e More generator updates
* first case of EncounterLink, now works (version, ability, OT memory)
* handle gen2 gb events (not even sure if they pop up, just in case)
* handle gen3 ereader shadow mons
* handle gen4 spiky pichu PID type
* handle gen2 crystal egg met level
2018-05-07 22:53:36 -07:00
Kurt
8902e9662c Add exclusive encounter handling
Handle Faraway Island Mew, handle DP Darkrai/Shaymin & Arceus, handle
not-distributed WC3s.

Now stopping at dex 154 -- one full generation of PKM species IDs can be
completely spawned directly from IEncounterable data!
2018-05-07 22:12:12 -07:00
Kurt
3c31d5798f Continued pkmgen updates
* adds g4 forced shiny seed->pid (Chain Shiny Lake of Rage Gyarados)
* adds cxd starter pid generating handling
* adds g5 forced shiny seed->pid (MG5Shiny Shiny gift Dratini)
* excludes gen4 route45 surf impossible encounters
* actually use ingame trade edge case handler

Up to dragonair (147) yay; yellow dragonair is likely the catch rate
edge case.
2018-05-07 21:16:54 -07:00
Kurt
86bf4201e2 Remove encounterstatic-encounterslot collision case
Exeggutor Island has wild & one static with a fixed ability; the fixed
ability is returned first which causes wild lv40 exeggutors with
ability2 (1/2/H) to be flagged as illegal.
2018-05-07 21:12:42 -07:00
Kurt
ea2c6260fa Prevent providing beta safari zone encounters
Fixes Krabby / etc.
Fix genderless encounterstatic gender set (Voltorb)

Now at 103, Exeggutor
pretty cool that over 100 species can have every single encounter
generate a legal pkm ;)
might be useful to add metrics to count how many encounters are
generated in a session
2018-04-29 21:56:12 -07:00
Kurt
ab71ea2d8b More generator updates
Graveler (SM Trade) -> Force applying handling trainer details for
ingame trades
Ponyta (Ranch Trade) Apply correct ability for encountertradePID

Up to 98 : Wild Gen2 Krabby (safari zone impossible location needs to
get filtered from possible encounters)
2018-04-29 21:29:34 -07:00
Kurt
997ca29fe6 More generator updates
Checks.cs : fix duplicate analysis result (encountertrade machoke is
legal & illegal), nope, legal.
Core.cs : Add version bypass if none assigned.
EncounterSlot.cs: Handle yellow kadabra
EncounterTrade: Handle must-evolves.

now at 75: graveler (SM trade)
2018-04-29 21:08:49 -07:00
Kurt
1c3a330ab2 Remove clefable from non-obtainable encounters
Can be obtained via game corner
update possible games of origin
clear wasegg flag for next iteration

now at species 64: Kadabra.
2018-04-29 20:04:13 -07:00
Kurt
50d390bd4e Fix gen1 trade version overwrite
only noticable when generating from

up to dex 35, clefairy now. I expect things to ramp up soon...
2018-04-29 19:03:55 -07:00
Kurt
daf093879b More generator updates
all the way up to nidorina

extract some reusable methods
exclude invalid headbutt encounters
use built in randomgender
2018-04-29 18:26:36 -07:00
Kurt
b1549837b1 Update gen2 ingame-trade met location handling 2018-04-29 11:46:49 -07:00
Kurt
b353701d3e More generator updates
adds pokewalker handling

now stuck on GSC Trade Spearow (likely not setting OT details as needed)
2018-04-29 11:33:35 -07:00
Kurt
4214b1be7b More generator fixes/improvements
Fix/add missing gameversion references (BU instead of BW,
pokewalker=HGSS)
increase reuse of pidgenerator & add more generating methods.

seems like it's generating pkm fine besides the PID edge cases, which is
nice
2018-04-29 09:31:13 -07:00
Kurt
08603c5664 Fix xd miror b encounters not receiving versionID
version was set to Encounter_XD, which did not contain the miror b
encounters.

simplify XD check to be O(1) now that version is stored in the encounter
obj
2018-04-29 08:31:57 -07:00
Kurt
120f5380c9 Rework some more pkm generating logic
can get all the way to caterpie
- gen3/4 needs an antishiny,
- gen5 needs shiny&antishiny mech
- else case needs both as well.
2018-04-28 22:56:10 -07:00
Kurt
70992138e2 Misc encounter->pkm generating fixes
eggs for Gen1 must be generated in Gen2
gen1 wild encounter initial moves
gen4 abilities have 0 for single ability mons
2018-04-28 16:30:56 -07:00
Kurt
55f0143400 Handle generating gb2 events & eggs
restrict the simple encounter provider to not spit out cart era only
gifts.
2018-04-28 15:59:33 -07:00
Kurt
af8084fd34 Rework cosplay pikachu static encounter population
Now IV3, thanks @wwwwwwzx for finding the hard-coded case (Lati@s is
already IV3).

https://projectpokemon.org/home/forums/topic/45011-illegal-cosplay-pikachu/?tab=comments#comment-230318

remove SkipFormCheck, and just have all 6 populated (so that Form0
pikachu doesn't slip through).
2018-04-27 21:53:00 -07:00
Kurt
1b4ec11335 Add rebattleable Miror B locations to xd shadows
https://projectpokemon.org/home/forums/topic/44957-bug-pokemon-xd-post-game-shadows-flagged-illegal/

if shadow lock sets are ever implemented, would need to update this as
well to 'clone' with the different shadow teams available.
2018-04-23 17:14:52 -07:00
Kurt
a48c70ccf2 Add evolution minbound check
https://projectpokemon.org/home/forums/topic/44834-bugabout-event-evolution/?do=findComment&comment=229887

(espeon at level 50 originating from a level 50 eevee gift is not valid)
2018-04-17 20:06:23 -07:00
Kurt
fef1d6e0dd de-linq some evolution dexlevel fetch
use shared IList interface instead of IEnumerable
2018-04-17 19:56:43 -07:00
Kurt
f767b2db0f Differentiate WasEgg (any egg location) from bred
https://projectpokemon.org/home/forums/topic/44838-buggen5-egg/

WasEgg is used for other encounter based checks, so can't reduce the
logic usage
2018-04-17 18:54:38 -07:00
Kurt
7a77b4524f Add b2w2 route 23 amoonguss
https://projectpokemon.org/home/forums/topic/44798-bug-report-amoonguss-encount-error-b2w2/
Thanks smileynation!
2018-04-14 08:47:02 -07:00
Kurt
b8a5ccdf7d Simplify shedinja evo move check
Closes #1895 , re-verified with pkm provided in #1805
there's no shedinja gift, always is an evolution

seal some forms to remove virt call in constructor warning
2018-04-10 17:00:28 -07:00
Kurt
be285917b9 Update ingame trade data
https://projectpokemon.org/home/forums/topic/44726-bug-in-game-trader-pokemon-flagged-illegal/

Thanks Jimmy Cerno!
2018-04-07 12:34:06 -07:00
Kurt
547c799eeb Handle gen1/2 static encounters
levelup starts after initial moves
2018-04-02 17:51:37 -07:00
Kurt
39f1805940 Fix gen2 met data setting 2018-04-01 20:25:40 -07:00
Kurt
d4e38dded0 Refactor time of day check/validate
Fixes time of day flitering property reference (met_day is always 0, so
it never reached)
2018-04-01 20:22:10 -07:00
Kurt
867c705597 Fix broken gen2 tests
add oddish to the mix
2018-04-01 15:51:55 -07:00
Kurt
d42eb4372f Fix 4 egg move gen2 oddish
egg moves also can be taught in gen1, which causes the learn source to
be locked to a tradeback (removing egg moves that have IDs greater than
RBY's moves). Simplify gen<=2 parse preference ordering with this
addition to force egg moves to be acknowledged.
2018-04-01 15:04:53 -07:00
Kurt
07b2568b1f Fix g2 caterpie generating
has no egg moves -> no moves generated!
2018-04-01 15:02:27 -07:00
Kurt
5e55b916fa Handle fixed gender statics
Seems like a PID/Nature/Gender/Ability smart-setter is necessary for
other encounters
2018-03-31 21:55:59 -07:00
Kurt
ba4c911566 Refactoring & finish eevee test case
generates a legal pk* for every possible encounter; there's likely other
scenarios and more roughness to smooth out, but seems legit for now
2018-03-31 20:37:36 -07:00
Kurt
32f9f806db Add other iencounterable->pkm generators
not tested
2018-03-31 00:43:41 -07:00
Kurt
0b4adf9763 Sync missing content
fixes tests
2018-03-30 22:11:24 -07:00
Kurt
0597833899 Track version of slots/static/trades
I think I set the version at the appropriate times to get all encounter
objects
2018-03-30 21:38:57 -07:00
Kurt
a89c0c3312 Rename egg game->version
add more gameversions (soon)
2018-03-30 21:37:01 -07:00
Kurt
b38abc22e2 Refactoring
add IVersion interface with common interactions
2018-03-30 16:31:40 -07:00
Kurt
537ad33229 Add encounterlink gen
not tested
2018-03-30 01:02:37 -07:00
Kurt
d03ff147d4 Add template -> pkm method
fix signature if no versions are provided (empty params is [0], not
null)
2018-03-29 21:04:05 -07:00
Kurt
2ea1fea5f5 Refactoring
add GameVersion to generation
fix generating pk2 eggs
relocate some logic
2018-03-29 21:00:38 -07:00
Kurt
e74e7878cd Lower dragonair encounter level req for trade
https://projectpokemon.org/home/forums/topic/44555-gen2-legality-issue-with-in-game-trade/
Thanks Bumidek !
2018-03-29 08:50:23 -07:00
Kurt
e5ccae906a misc quality of life improvements
set egg friendship
allow SetRandomIVs to use a minimum fixed IV count
2018-03-28 20:56:58 -07:00
Kurt
76b4db1477 Add egg converter & test
only tested for gen7 egg->pkm (not to eventual set)

pretty sure a good chunk of the egg generation logic can be pulled out
for reuse in other IEncounterable generators (IEncounterable
extensions?)
2018-03-28 20:40:07 -07:00
Kurt
6333c42cf1 Add more suggestions for eggs 2018-03-28 20:38:21 -07:00
Kurt
1e13220e6e Add IEncounterable -> pkm interface method
egg,slot,static,link,trade need to be implemented later

remove IEncounterable from PL6
2018-03-28 20:38:07 -07:00
Kurt
78616e1ad5 Add showdownset -> pkm encounter fetch test case
Test parsing glaceon, input must equal output
Test generating encounters for a specific version (exists only on Moon)
Test generating encounters for the same version (add handling trainer
data to permit Tutors)

fixes error in VC generations-present fetch which allowed movesets from
generations 3-6 lul
exclude negative/invalid gameversions
2018-03-27 19:45:22 -07:00
Kurt
1ca69965bf store encountertrade nick/ot within object
allows for ot/nick fetch for a given language
2018-03-26 22:23:11 -07:00
Kurt
4d3877bf7f Add EncounterMovesetGenerator
lack of a better name; generates IEncounterable list.
2018-03-25 22:50:32 -07:00
Kurt
99a4c55579 Relocate some logic to core
party stats set when setting a slot to a save file
simplify set/delete slotchange duplicate logic
suggest better met locations beyond VC transfers
hatching a gen6 egg applies memories automatically
2018-03-25 19:05:49 -07:00
Kurt
a24e5aa742 Update personalinfo usages
less temp array usages, add methods for cleaner understanding
2018-03-25 13:54:30 -07:00
Kurt
1e708a2102 Simplify default met location fetch
now that IGeneration is available, don't call pkm.GenNumber (slower)
2018-03-24 17:28:56 -07:00
Kurt
a6977af19a Pull out Contest Stat logic to interface 2018-03-24 10:36:48 -07:00
Kurt
d1cfdd782e Rework ball / frame check passing
Two checks are performed for Gen 3 & 4:
A: Encounterability (wurmple, ball, ability)
B: RNG Compatibility (frame)

Original code only checked 'A'
Recent code ordered by 'A', but returned anything that matched 'B'. If
'B was not satisfied, an 'A' match would get deferred, allowing for an
eventual B & !A to be returned before a A & !B being returned.

yay bool logic

we want to prefer a RNGFrameMatch as well as a SlotCompatible match
original code (no RNG checks) retrieves with SlotCompatible just fine
recent adding in framematch resulted in deferring compatible if not RNG
frame, yielding !A matches before A & !B

maintain 3 queues (A & B get yielded immediately) to track A!B, !AB, and
!A!B
not necessary to check unown case anymore as it'll fall into the A!B
group. better performant to skip that check in favor of only adding for
fail.

thanks theSlayer!
2018-03-21 20:19:54 -07:00
Kurt
636736c3fa Add g3 safari ball wild deferrals
Pineco is valid but also can be sourced to altering cave
similar for sandslash
Thanks theSlayer!
2018-03-21 17:30:19 -07:00
Kurt
2c4e3358e4 Fix ninjask evo move comparison
https://projectpokemon.org/home/forums/topic/44413-bug-information-about-bug-found-on-the-new-version-180319/
2018-03-18 15:30:19 -07:00
Kurt
88ce27f26b Add R/S roamer data offset
is different from emerald

Thanks TetsuyaGR!

https://projectpokemon.org/home/forums/topic/44407-bug-rubysapphire-roamer-bug/

(use concatall in encounters4)
2018-03-18 08:37:40 -07:00
Kurt
e9a3b4acf1 Merge PIDType and bool? shiny property
Gen5 does not follow the same convention, 0 = non, 1 = rnd, 2 = always;
not gonna bother updating for just that one

bool? occupies 2 bytes; enum:byte is 1 byte.

should probably move validity checking logic into the IEncounterable
objects instead...
2018-03-16 19:35:55 -07:00
Kurt
1cdbe6f4f8 Fix ditto5 IV order
closes #1863
2018-03-12 19:34:54 -07:00
Kurt
aa65d88d3d Cache pressure slot instead of saving all to list
faster to do:
null check & comparison for each
vs
collection add (especially if growing collection)

don't evaluate all slots (faster), capturing the dexlevel[] object is
fine until the enumerable is discarded
2018-03-11 11:02:02 -07:00
Kurt
5148fd2c4e Add minimally filtered encounter generators
Filters by species at most, resulting in something that can be scanned
for a preferred encounter.
2018-03-11 00:29:31 -08:00