Commit graph

111 commits

Author SHA1 Message Date
Kurt
730640decc Minor clean 2021-01-03 16:53:13 -08:00
Kurt
1f3d3112d3 Move some future-evolution tables to separate class 2021-01-02 19:11:46 -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
080f6f827d Replace pkm.GG references with direct version checks
No longer tied to met location
2020-12-31 17:45:11 -08:00
Kurt
de840f40d4 Invert some "!is" to "is not" 2020-12-29 00:58:08 -08:00
Kurt
c119f18af3 spec->species 2020-12-28 22:22:52 -08:00
Kurt
ee5349ff98 moar is or 2020-12-25 12:30:26 -08:00
Kurt
4a8a495d04 Condense some switch expressions
Should be it for now; exhaustively searched for all that made sense to change
2020-12-25 10:58:33 -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
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
c2867f7899 Move EvoBase to Evolutions folder 2020-11-27 12:06:52 -08:00
Kurt
4a8ad8b149 Expose raw evolution chain methods 2020-11-17 14:23:15 -08:00
Kurt
51c872f4e1 Move more logic closer to where it's used 2020-11-02 14:46:26 -08:00
Kurt
7cb484834c Handle max possible level for transferred & evolved-to-new-species
A Gen3 level 26 sylveon with a met level of 25 in Generation 8:
Transferred as Eevee at level 25, and leveled up to 26=>Sylveon
If we use met_level (25), we need to decrease 1 as we evolve. No, use Current Level and ensure the max isn't above the bare minimum (met level)
2020-10-08 15:35:50 -07:00
Kurt
ea9076ad4c Account for revised evolution conditions for gen4 new-evos in gen8+ 2020-10-08 14:28:34 -07:00
Kurt
52a67f2425 Add Stadium2 Support
Introducing a new PKM format: SK2
Split ICaughtData2 off of PK2 so it can be shared with SK2 when type-checks occur
Add conversion for PK2<->SK2
Split the split-buffer handling for GBPKM to GBPKML (what a name), so that I can reuse shared accessor logic for SK2.
2020-10-02 18:08:40 -07:00
Kurt
cf9e5ec37f Minor refactoring
Change Ability array to IReadOnlyList, add method to check ability index in personal data
Suppress some message warnings
Change EvolutionChain short-circuit for VC to jump from gen6 directly down to gen2. There aren't any notradeback 1 situations, so a notradeback1 will always start with g=1, so no need for the other if-continue.

Simplify pk5 conversion
2020-09-06 10:53:13 -07:00
Kurt
c1adab9703 Refactoring
Move logic closer to where it is used rather than in larger static classes

EncounterStatic(7): move VC transfer template creation to class, simplify some sanity checks
EvoChain: g==2 case is never hit as the generation check at the top of the loop already skips
2020-09-05 12:11:43 -07:00
Kurt
c2ec4d55e4 Minor clean
Add some xmldoc, remove some empty lines, move some small logic pieces to a better spot
2020-09-03 14:28:51 -07:00
Kurt
a62324a5a1
Refactoring some IEncounterable-type'd object initialization and original-generation evo chain (#2974) 2020-08-21 16:35:49 -07:00
Kurt
adb55c9e7b Make CanToggleGigantamax have a form argument
no more meowth-1/2 and or perrserker
Closes #2973
2020-08-16 23:06:49 -07:00
Kurt
56d1eed483 Ban alolan split evolutions for lgpe origin in gen8 2020-08-06 18:21:40 -07:00
Kurt
eb7ed44b29 Finish splitting gen1/2 encounter types from parent class
Results in a little more code, but each path is less tangled
simplify some expressions
remove RBDragonair content in favor of a strict filter for catch rate

Move gen1 trade trainer names to stringconverter, since pk1/pk2 shouldn't refer to legality classes
2020-07-19 13:32:40 -05:00
Kurt
35435b539e Refactoring
move some logic around
2020-07-18 21:51:38 -05:00
Kurt
3138fb20c6 Refactor some method signatures
vs -> chain (clarity on what it is; an evolution chain, rather than e.v.o.s - vs)
Clamp origin chain for transferred where we can use the max origin level
2020-06-27 22:18:29 -05:00
Kurt
36dd5ece21 Initial Isle of Armor support
Co-Authored-By: sciresm <sciresm@users.noreply.github.com>
Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
Co-Authored-By: Archit Date <architdate@gmail.com>
2020-06-19 18:51:15 -05:00
Kurt
3fcb29e68a Remove some reliance on GenNumber 2020-05-31 12:12:48 -07:00
Kurt
a55b4da05c Add evo data for mimejr-0 => mrmime-0 (no gen8) 2020-04-26 12:00:45 -07:00
Kurt
ee1cfa8912 Hanle some compiler messages 2020-04-14 10:52:19 -07:00
Kurt
fdc174ea99 Fix raichu-a banned evolution in g7 s/m
add a comment and parenthesis in something unrelated

Closes #2807 ty @MichiS97 !
2020-04-06 08:10:49 -07:00
Kurt
aaf6642d31 Rename Data -> BinLinker 2020-03-20 15:18:59 -07:00
Kurt
509e2f1fa3 Handle more evolution/form checks
Closes #2726
1. Add variant evolutions to form-match cases
2. Ban LGPE origin alolan raichu
3. Add egg form check for unavailable regional forms
4. Previous commit fixed mew (remove ribbon interface from WB7)

Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
2020-02-20 22:11:48 -08:00
Kurt
0e2734d2d5 Add evo data for alolan raichu / weezing
Ban the evolution methods since they can't be triggered in-game
allows the gen8 evo tree to reverse evolve past gen specimens
2020-02-16 18:16:22 -08:00
Kurt
3813d5dba9 Readonly init EvolutionMethod
Add xmldoc
2020-01-25 15:42:17 -08:00
Kurt
f6fb54aecc Move shedinja/egg evo chain short circuit
Some routes use the evolutiontree directly instead of this method (with the same name); should probably consolidate but meh

This causes Shedinja to yield the correct evolution chain when called directly (because nothing naturally evolves to shedinja; it's created out of thin air as a clone)

Take the egg short circuit with it to keep things simple
2020-01-11 21:43:58 -08:00
Kurt
be92d4436e Rearrange argument check order
USUM evo table has Meowstic with Arg=-1, which early aborted.
Closes #2627
2020-01-10 16:02:22 -08:00
Kurt
7caeebd772 Add formcount for scatterbug/spewpa
USUM had 20 for both, but XY/AO/SM had only 1 (vivillon had 20); make
them consistent so that our generated evolution paths behave correctly

Add meowstic specific evolution form modifier... so silly
simpler to have it inlined with the sSpecies, for jit optimization

could probably do this with silvally but meh, things work fine now

Closes #2603
2020-01-04 22:31:46 -08:00
Kurt
308e6fa291 Add temp workaround for version encounter fetch
PKX.Generation is 8, which returns SWSH evo tree; evo tree doesn't have
non-galar-native species data, so stuff like Ambipom don't get reversed
properly.

use math.max for tree fetch when appropriate:
- egg generator: pre-evolutions like pichu should be allowed if pk1
- don't fetch format twice, just do math.max
2020-01-04 11:14:25 -08:00
Kurt
d08e3a3f81 Fix form change evolution linking
GetDestinationForm for gen7+ is fine
gen7 and gen8 use the "form" argument as the destination form; -1 means
don't change
espurr-F just gets forced to 1 in gen7 since it's -1

Closes #2564 ty @iiippppk
2019-12-06 19:31:18 -08:00
Kurt
862a446eb3 Fix form sanitization for de-evolution
Better to handle things this way, we know for sure the form it HAS to
originate as.
Closes #2565
ty @iiippppk !
2019-12-06 19:00:41 -08:00
Kurt
be38a60267 Fix handling for get evolutions method
only used for Zukan7b, but add in handling so that it works for <=gen6
games, and supports form alterations too!

update style to match GetPreEvolutions

could probably update this to yield tuples (species, form) but LGPE/SWSH
only needs species. If there's the need for tuples later, should be ez
tweak.
2019-12-06 18:16:11 -08:00
Kurt
314d8f6b58 Update form destination handling
espurr-F evolves to form-1 from form0, even tho the form arg is -1 (gen7
consideration)
gen8 has 0/1 for the two evolutions, dictating the destination form
2019-12-06 17:36:36 -08:00
Kurt
eac3804c7b Clean up dexlevel/evocriteria constructor usage
DexLevel was the initial abstraction, which was expanded/reused for
evolution details

I should probably merge the two classes since everything is passed as
EvoCriteria
The encounter generators do some silly form fuzzy match which can now be
more accurately checked since I've moved Form to DexLevel... maybe a
future commit can clean that up.

encounterarea2 was reusing this class, just use a throwaway readonly
struct as our temp value storage
2019-12-05 23:04:24 -08:00
Kurt
b49c5a5a8a Rewrite evolution lineage generating
- Use tail recursion and a lookup table (species | form) for reversing
- generate the reversal lookup by extrapolating all species-form
destination values (EvolutionLink)
All tests pass, and no special handling for forms is required. Kinda
suspicious that it works this simply...

Redo evolution banning (no wormhole for non-Alolan evolutions in SM), in
a style that we can ban the Gigantamax event evolutions
(pika/meowth/eevee). Their evolutions can't be resulted from a pre-evo,
because the in-game routine early aborts if the gigantamax flag is set
for those species.

Update gen4 personal tables (formCount was 0, needs to be a minimum of 1
by default)

Closes #2537
2019-12-05 22:32:47 -08:00
Kurt
5883acd5b9 Fix florges/floette evo tree
No personal stats for those evos different from main species
2019-11-26 16:12:35 -08:00
Kurt
e8f5ac8a00 Minor clean 2019-11-25 22:51:07 -08:00
Kurt
aeb3ee6cec Fix shedinja evo chain logic
#2416
2019-11-24 09:49:54 -08:00