Commit graph

796 commits

Author SHA1 Message Date
Kurt
fe82fe8eab Show language name instead of index
prefer to keep the '0' case as zero
2018-07-06 17:22:56 -07:00
Kurt
397de97f3c Remove excessive references to Util.Rand32()
all usages besides fetching a 32bit random value should use rand.next
remove unnecessary do-while loop for calculating random EVs (always
returns 510 in total)
2018-07-04 11:30:43 -07:00
Kurt
326522c76f Misc simplifications
cache splitbreed species as another class
reduce linq usage in evolution validity check
reuse egg hatch method
2018-07-04 09:15:20 -07:00
Kurt
fdc4dd2811 Fix encounter ability comparison
-1 is the 'no fixed ability parameters defined'

Closes #2041
(optimize abilitynumber check for early return)
2018-07-03 18:43:11 -07:00
Kurt
8e950e83b3 Rewrite ability verification
Closes #2040 , adds test cases:

invalid bulbasaur.wc3: hidden ability
invalid charmander.pcd: hidden ability
valid camerupt: gen3->4 unevolved mismatch
valid leafeon: pcd mismatch -> evolved now matching

should be much easier to maintain; methods are reused with less overall
nesting
2018-07-02 20:34:41 -07:00
Kurt
d11a89d52d Move relearn required flag to checkmoveresult
reduce usage for non gen6+ relearn move cases
save contains result for later usage instead of recomputing the inverse
2018-07-01 21:34:17 -07:00
Kurt
7f6f7a7bad Misc simplifications
reduce nesting (evo.RequiresLevelUp is checked twice, only check once
and handle path)
compact some methods
seal some classes
add a little xmldoc to exposed members
2018-07-01 19:55:23 -07:00
Kurt
c40a284174 Misc simplifications / xmldoc 2018-07-01 19:17:37 -07:00
Kurt
3674a11cfe Misc simplifications
absorb verifier calls into the parsing methods
2018-07-01 17:07:29 -07:00
Kurt
bc6c361746 Reduce linq usage
reuse variables instead of re-fetching (pkm.Species)
add overload for HashSet<int> contains vs ICollection
merge BattleOnly to one hashset
2018-07-01 10:49:11 -07:00
Kurt
e5ac193e8e Remove unused field
Encounter used to be used to determine if the original encounter was
valid; we now store the encounter object and checking is fast enough --
we don't really care to short-circuit individual verification steps
anymore.
2018-07-01 10:15:10 -07:00
Kurt
d477e19cf0 Simplify ball/catchrate lineage checks
should speed up egg ball checking a bit since we've already computed the
original species
gen1 catch rate, just move the chain fetch there.
2018-07-01 10:15:10 -07:00
Kurt
177604e2cb Refactoring
Simplify some verifier logic
2018-06-30 15:01:16 -07:00
Kurt
aa3b64dc6d Simplify ball check logic
fetch a single result and add it to the analysis

can probably remove the GetLineage call since the encountermatch stores
the original species
2018-06-30 10:34:09 -07:00
Kurt
77aed3ea14 Adjust levelmin on single evochain
Early return wasn't adjusting the minimum level; closes #2035
2018-06-27 17:41:53 -07:00
Kurt
3cf78ff3a2 Permit metronome for Pokewalker Cleffa
Closes #2033
2018-06-25 19:15:37 -07:00
Kurt
fba8adb32f Add XY wild undiscovered egg group IV check
Closes #2025
add misc updates/simplifications (personal stuff used in pkNX)
2018-06-24 21:55:00 -07:00
Kurt
09c96558ea Disable gen2 chain clamp
not sure of the implications, but fixes #2031
might have to rework this method to clean up the optional params if
things are misbehaving
2018-06-24 08:02:22 -07:00
Kurt
e29cf2a903 Rework secondary check flow
Checks.cs initially started out small, but over the years it has grown
to handle multiple types of checks. With all these checks next to
eachother, it's hard to see the overall groups. Splitting them up
(potentially further?) allows for more focused maintenance &
understanding.

Not sure if I'm happy with the overall bandaids used (checks no longer
done within LegalityAnalysis so variable repointing is excessively
used), but I'm happier the way it is now compared to the huge Checks.cs
2018-06-23 22:00:01 -07:00
Kurt
ea6842e5eb Refactoring
improve readability
2018-06-23 12:37:01 -07:00
Kurt
0d3c6eef74 Refactoring
Relocate fixed OTs to core (iencounterable & checks now reference same
values)
2018-06-23 09:49:04 -07:00
Kurt
7a0b65e74f Add low bound range check for species not in chain
Closes #2028

Thanks @iiippppk !
2018-06-23 08:23:05 -07:00
Kurt
173c9f7904 Update evo chain trim for transfer
Now trims correctly for g3 sneasel -> weavile (gen4 having both) at
level = met level
2018-06-22 23:18:52 -07:00
Kurt
5dd58c7197 Update gen1 evo chain detect
Closes #2017
2018-06-22 22:48:10 -07:00
Kurt
b502d11428 Replace evolution check
already have evolution obj from parsing moves, use it instead
2018-06-22 21:40:41 -07:00
Kurt
76e52fa2cd Simplifications
Rearrange some logic, track decrement, remove unnecessary checks
2018-06-22 20:16:31 -07:00
Kurt
3000a8d007 Reduce linq usage
No longer recreates collections with ToArray/ToList by instead altering
the original chain
2018-06-22 19:40:17 -07:00
Kurt
346c401727 Rework initial evochain trim
push unsaved IVTotal/EVTotal stuff from prior commit
rework exposed types for evo chain
initial trim now uses much less linq

can probably redo the get initial chain to provide a species to break
on...
2018-06-22 17:59:02 -07:00
Kurt
7591f54de3 Misc updates
Add safari min flawless IVs to reroll (can expand if #2025 is required
for egg group15)
Use EV/IVTotal (faster, not linq array based)
Fix missing pumpkaboo form regression, Closes #2026
Relocate swapbits to appropriate class, unneeded in PKM.cs
2018-06-22 06:24:33 -07:00
Kurt
eb35d71fcc Flag East Gastrodon from Friend Safari... correctly
Closes #2023
2018-06-21 20:26:21 -07:00
Kurt
8387da64fb Disallow East Gastrodon friendsafari
Closes #2023
2018-06-21 20:22:14 -07:00
Kurt
c1f4e2a9ff Refactoring
Relocate & simplify some logic
2018-06-21 20:13:41 -07:00
Kurt
1db41c8b21 Add vc2 evo chain check
queue should be checking against none left rather than any left.
Add test cases
2018-06-20 21:43:54 -07:00
Kurt
ce667729f3 More simplifications
Can't have species == 0 or invalid gameversion; check for
EncounterInvalid instead.
Egg chain is always valid (since it is not EncounterInvalid) thus always
provide the chain.
Since these 2 are the same, simplify the logic to be shared.

rearrange some parameters for easier flow
2018-06-20 21:38:56 -07:00
Kurt
47d8220915 Evo chain Simplifications
Rename "Flag" to "Method"; isn't used besides for indicating the evo
Method.
Remove some unnecessary duplicate checks
- always >=1 in chain at start
- mostEvolved already checked for > maxspeciesgen
2018-06-20 19:42:45 -07:00
Kurt
bfdd7247ba Rewrite most evolved species check loop
Use queue collection rather than rebuilding with .Skip(1).ToArray()
move size checks to dequeue location
2018-06-20 18:25:23 -07:00
Kurt
2ef12f635f Continued refactoring
move sylveon check to requireslevelup
need to make this generic for transfer species gaps
2018-06-20 15:59:57 -07:00
Kurt
c5ea35a1a1 Continued refactoring
Move chain prune from Analysis to evochain spawn
2018-06-19 17:50:10 -07:00
Kurt
f10cc183a7 Refactoring
Relocate Evolution Chain logic
minor reorg of check arguments for nesting / grouping
2018-06-19 17:14:22 -07:00
Kurt
f3ef122214 Refactoring
continued simplification

core.cs is pretty much the following:
misc one-off junk
moveset fetch
encounter table fetch
evo chain fetch

might eventually move things around a bit further for cleanliness so
that misc meta junk is the only thing that remains in core.
2018-06-18 21:56:30 -07:00
Kurt
c6e968c77d Only generate encounter moves if species unmodified
Closes #2020
2018-06-18 21:54:32 -07:00
Kurt
0c06506a8d Refactoring
remove some unneeded logic
moves in gen1/2 can be reordered, sequence match should be intersect
(full) contains match.
2018-06-18 19:57:32 -07:00
Kurt
2e1081086d Refactoring
Split evolution data specific DexLevel properties from DexLevel

use IReadOnlyList instead of IList for covariant collection
2018-06-18 19:10:21 -07:00
Kurt
bff5a3cd9a Add altform permissive checks for gen1/2
Should always be zero, but necessary for regional variant evolutions
needing to be excluded
#2018 (not fixed yet)
2018-06-17 21:54:04 -07:00
Kurt
7791020cb4 Check format before trim
Closes #2016
2018-06-17 21:01:07 -07:00
Kurt
33eded08d1 Add missing learn/personal references for pairs
Closes #2019
2018-06-17 20:49:03 -07:00
Kurt
e91cfeb707 Handle pre-VC2 era tradeback status for suggestions
#2015

Can't get a shiny female 1:7 f:m gender ratio transfer after the VC2
bank update; need to respect that when generating random moves for the
pkm by removing any gen2 evo chain data.
2018-06-17 09:55:07 -07:00
Kurt
dd57558e98 Update moveset suggestion for vc origin
Closes #2014
2018-06-17 09:39:01 -07:00
Kurt
c3cbb0fc44 Fix gen2 vc1 evo prune
https://github.com/kwsch/PKHeX/issues/1999#issuecomment-397818377

evo chain had already pruned tyrogue due to level 20 transfer level
(lvl19 tyrogue not possible), can't just remove last entry. Remove any
entry after the g1 species.
2018-06-16 09:06:12 -07:00
Kurt
f8a1d26694 Fill empty ability values with ability1
update handling that checked for this case to instead check for
equivalence to ability1 instead of 0

was generating a PGF with ability[1] = 0, which is not correct. Just fix
the binaries to behave and get rid of all the workarounds since future
tables don't have missing values.
2018-06-15 23:41:07 -07:00