Commit graph

7084 commits

Author SHA1 Message Date
Kurt
2e6d1fce1f Flag non-Poké Ball XD teddiursa
Closes #2983 , nice catch @soopercool101 !

Co-Authored-By: soopercool101 <soopercoolstages@gmail.com>
2020-09-13 14:43:48 -07:00
Kurt
7fc8001806 Continued refactoring
EncounterTrade: don't init Location to -1; keep as default 0 and use that as the pivot for default met location. Move Fateful property to the sub-type that uses it (EncounterTrade4, for Ranch).
Move some EncounterStatic->PKM logic that is per-type to the associated type overloaded methods. Rearrange order of properties to be more consistent with interfaces
Gen3: Initialize some classes without using post-constructor setters. The `init` setter functionality coming in c#9 won't be usable as the net46 runtime/netstandard2 doesn't support it on current previews. Do it this way so we can explicity initialize some required properties rather than apply version on a second iteration.
2020-09-13 14:40:10 -07:00
Kurt
346c284994 Allow pkrs on gen2 eggs
See #1257 item 7; it appears this info on Bulbapedia is incorrect -- disassembly does not care if the pkm slot is an egg or not.

5f197c53f4/engine/events/pokerus/pokerus.asm (L7)
2020-09-10 21:53:43 -07:00
Kurt
0a6d53dc0d
Make IsHomeGift a public get property 2020-09-10 11:25:29 -07:00
Kurt
507c913451
Invert early return bool for sav1stadium recognition
oops
2020-09-10 11:24:16 -07:00
Kurt
741fbd5296 Add stadium sav readonly support of registered teams
no checksum logic performed, just a WIP preview
2020-09-09 22:44:46 -07:00
Kurt
ec16202f73 Check for missing gen1 OT names
oops
2020-09-09 22:43:32 -07:00
Kurt
407c986c89 Update netcore target from 3.0 to 3.1
.NET 5 is in 2 months, might as well bump things to the current LTS
2020-09-09 18:27:12 -07:00
Kurt
01fb233e48 Minor tweaks
Extract some interfaces
Suppress some warning messages with commented reasons if appropriate
2020-09-09 12:47:24 -07:00
Kurt
5d3bc289b6 seal hunting
Mark things as sealed as they shouldn't be inherited from or overriden in a derived class.
2020-09-07 13:51:13 -07:00
Kurt
0111c3dd6f Set Max EVs for ShowdownSet`s imported onto GBPKM with unspecified EVs
https://github.com/architdate/PKHeX-Plugins/issues/48
2020-09-07 10:56:25 -07:00
Kurt
0b8989e4ce Make EV_SPC a shared property for GBPKM derived classes
seal up some properties that aren't overriden in the derived classes; could do more but meh
2020-09-07 10:55:15 -07:00
Kurt
03e227c744 Allow steel-typed magnemite for gbera
ty MrPerson0!
2020-09-06 18:36:37 -07:00
Kurt
187ed9775a Use trainer details for manaphy egg if possible
https://projectpokemon.org/home/forums/topic/57790-bug-manaphy-egg-shown-illegal-wrong-egg-met-date-if-i-import-directly-the-pgt/?tab=comments#comment-260826
2020-09-06 11:34:50 -07:00
Kurt
9191f023a3 Minor clean
Nullability annotations and some logic simplification
2020-09-06 11:24:54 -07:00
Kurt
1114b97c4b Fix bool value naming for gen8 block editor
Was previously showing RaidArmor for pre-Armor saves, as the reference of a zero-length array was the same as the bools. Just sanity check since all block chunks have length.
2020-09-06 11:21:23 -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
39e5c9000d Set Egg Met date for eggs rather than met date
This only applies to Manaphy
remove Nickname/Met Location set as it's handled in the SetUnhatchedEggDetails

precompute some default values
2020-09-05 13:11:16 -07:00
Kurt
8a3804e4b3 Reduce static constructor requirements
Gen1: all are Trade1 objects, and all get the values set; just set the value in the object initializer
Gen2: all are Trade2 objects, set the same version

Gen2 all static encounters already have a version marked. Only thing remaining is to set the language.
2020-09-05 13:06:08 -07:00
Kurt
81e98b5549 Update EncounterStatic7.cs 2020-09-05 12:33:00 -07:00
Kurt
079ceb2752 Disallow forms completely in gen2 2020-09-05 12:25:32 -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
cf67d156ad Move Gen1/2 Encounter yielding to separate class
Specialize some of the methods so that Korean and non-tradeback cases are handled with simplified logic.
2020-09-05 10:07:02 -07:00
Kurt
6b472ffd62 Misc iencounterable->pkm generator fixes
Still some pending stuff like bad mystery gifts

gen2 static encounters on g/s applying met level and not location
gen6 ralts trade (no nickname) being flagged as nicknamed when it shouldn't
gen4 manaphy egg not having a hatch location (worked fine if you transferred it up)
gen3 antishiny gifts not setting their PIDs (jirachi WC3)
gen5 N's pkm gifts setting the wrong nature
gen3 unown not being generated correctly, cosplay pikachu being allowed form0, non-BugCatchingContest no longer require Sport ball, oras dexnav marill now uses the azurill eggmove table
2020-09-03 19:00:46 -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
b03a5f2818 Fix pika beach score reading
fix reads as little endian instead of big endian
fix truncation if editor value from byte => ushort
Closes #2976
2020-09-01 16:05:52 -07:00
Kurt
90f2ea1749 8/31 - Electric Grass 2020-08-31 18:09:15 -07:00
Kurt
ad4b560071 Minor clean
Remove RibbonWishing as property, just calc on the fly since it's a single case
Update type info for vc transfer to indicate it's an es7
Split up dreamworld encounters as intended, fix logic lol
2020-08-30 22:37:14 -07:00
Kurt
adb74ffed0 Update Trainer Name verifier with template TID/SIDs
might be better to just have a HashSet<int> and use id32, but eh this isn't some blacklist-checker.
2020-08-30 19:59:21 -07:00
Kurt
9667e86446 Simplify dreamworld encounter init
precompute result size
set Gen5 as lumped group for common encounters
remove linq usage (besides Sum call, whatever)
GetEncounters now only filters the in-game static encounters rather than the dreamworld too, as those are already filtered by separate arrays.
2020-08-30 19:51:44 -07:00
Kurt
bd11affa13 Minor clean 2020-08-30 19:24:40 -07:00
Kurt
e3ad6ec55d Make multiple-met locations a single object instance
make trade have Any again; it's a marker to apply the gameversion since we're lazy
2020-08-30 19:24:24 -07:00
Kurt
b5677758be Change default TID/SID for gen7+ 2020-08-30 17:54:58 -07:00
Kurt
9ce09c8b1b Minor clean 2020-08-30 16:16:22 -07:00
Kurt
5a391bc20c Make EncounterStatic abstract, make Generation property abstract
Merge EncounterGift8 with EncounterStatic8 since there isn't much need to have two separate classes
2020-08-30 16:10:24 -07:00
Kurt
c146e9402f Reduce visibility of internal legality enum 2020-08-30 15:48:34 -07:00
Kurt
75da70069c Remove access to modified captured variable
Get the variable rather than indexing into the array each time

Simplify some expressions in sav7 for readability
Make SAV_EventFlags use comboitem explicitly by type rather than an anonymous type with same member names
2020-08-30 15:48:11 -07:00
Kurt
13ee3745f2 Remove some unecessary setter requirements 2020-08-30 15:44:13 -07:00
Kurt
1bc7994137 Remove usage of linq for duplicate count
Check successive move slots after the current index rather than doing a count eq >= 2.

Flag all empty slots prior to a filled move slot, rather than flagging a full slot as invalid because "empty move".
2020-08-30 15:43:29 -07:00
Kurt
81a693bafe Make Generation property get-only per class
don't need to store an int since it's a const-per-class
2020-08-30 15:35:59 -07:00
Kurt
ce5897ff94 Move version value from Slot to Area to reduce member size & value passing
Restrict some setters to protected only
2020-08-30 11:08:21 -07:00
Kurt
6ee7a8724b
Offload EncounterSlot loading logic to reduce complexity (#2980)
* Rework gen1 slot loading

Slot templates are precomputed from ROM data and just loaded straight in, with tight coupling to the encounter area (grouped by slot types).

* Revise fuzzy met check for underleveled wild evos

Example: Level 23 poliwhirl in RBY as a level 50 poliwhirl, will assume the chain is 25-50 for poliwhirl (as poliwag evolves at 25). Instead of revising the origin chain, just ignore the evo min level in the comparison.

Previous commit fixed it for gen1.

* Rework gen2-4 slot loading

Gen4 not finished, Type Encounter data and some edge encounters not recognizing yet...

* Add feebas slots for old/good encounters

* Begin moving properties

Great news! Gen5-7 need to be de-dumbed like Gen1-4.

Then I can remove the bang (!) on the Area accessor and ensure that it's never null!

* Split off XD pokespot slot encounter table type

* Set area in constructor

* Deduplicate g3 roaming encounters

* Deduplicate xd encounter locations (rebattle)

Only difference is met location; no need to create 500 extra encounter objects. A simple contains check is ok (rarely in gen3 format).

* Make all slots have a readonly reference to their parent area

* Minor clean

* Remove "Safari" slot type flag

Can be determined via other means (generation-location), allows us to reduce the size of SlotType member to a byte

Output of slot binaries didn't preserve the Safari flag anyway.

* Update SlotType.cs

* Handle type encounters correctly

* Merge safari area into regular xy area

* Merge dexnav accessor logic

* fix some logic so that tests pass again

rearrange g5 dw init to be done outside of static constructor (initializer instead)
PIDGenerator: friend safari slots now generate with required flawless IV count

* Add cianwood tentacool gift encounter

* Remove unnecessary abstractions

Fake area just returned a slot; since Slots have a non-null reference to the area, we can just return the slot and use the API to grab a list of possible slots for the chain.

Increase restrictiveness of location/type get-set operations

* Minor tweaks, pass parameters

DexNav observed state isn't necessary to use, only need to see if it's possible to dexnav. Now that we have metadata for slots, we can.

* Remove unused legality tables
2020-08-30 10:23:22 -07:00
Kurt
c1bc371d76 Update EncounterGenerator.cs 2020-08-29 23:50:59 -07:00
Kurt
e532a29e72 Allow gen1 moves on gen2 met data pk2's
Thanks MrPerson0 on discord for notifying us of this mechanic. Stadium 2 can utilize Gen1 learnset data while keeping them in PK2 format, retaining the met data.
2020-08-29 23:47:03 -07:00
Kurt
6e409f288e Use version on clone so that we don't have to detect again
Matches gen1/gen3 clone
2020-08-29 23:39:14 -07:00
Kurt
a09bac5976 Prevent gmax cap pika
silly stuff indeed

there aren't any other formed-only-mons in the gmax list
2020-08-29 15:09:37 -07:00
Kurt
c738857010 Handle KOR Arcanine with PID=1 type
Revise some logic flow and add comments indicating why
There is no wc.Gender==3 for any gift; that's not how things are specified in GameFreak's internal tool (suspected).
2020-08-29 14:33:51 -07:00
Kurt
1ee459a46c Use language for checking IsNicknamed flag 2020-08-29 10:40:41 -07:00
Kurt
dc9aa7b1df Update extra byte list
0x90 is for dynamax level
2020-08-27 08:37:23 -07:00
Kurt
5a78c5799c Fix text formatting for G5 Victory road met location string
Noticed on a separate fork ; should have a space before the (
2020-08-26 19:50:48 -07:00