Commit graph

3196 commits

Author SHA1 Message Date
Lusamine
b915f3c363
Tower of Waters / Tower of Darkness are valid Met Locations (#2996) 2020-09-23 09:15:49 -07:00
Matt
185c499bff
Unban GO Shiny Doduo (#2994)
Mega Buddy Challenge
2020-09-22 09:23:58 -07:00
Matt
150ff88235
Unban GO Shiny Porygon (#2993)
September 2020 Community Day
2020-09-19 17:27:25 -07:00
Kurt
9f4b18119e Propagate ability1 to empty ability slots
now matches all other personal table formats

var data = File.ReadAllBytes(path);
for (int i = 0; i < data.Length; i += PersonalInfoBW.SIZE)
{
	if (data[i + 0x19] == 0) // Ability2
		data[i + 0x19] = data[i + 0x18];
	if (data[i + 0x1A] == 0) // AbilityH
		data[i + 0x1A] = data[i + 0x18];
}
File.WriteAllBytes(path, data);
2020-09-19 07:53:25 -07:00
Kurt
b039dd28b6 Use reference to personal info rather than fetching again 2020-09-19 07:52:50 -07:00
Kurt
76b704cfe1 Fix g1 yellow personal table in binary rather than while running 2020-09-19 07:52:35 -07:00
Kurt
2b7e06e217 Refactoring
Extract some logic, suppress some compiler messages
2020-09-18 22:11:13 -07:00
Lusamine
b90419ba63
Akala Meadow does not exist (#2992) 2020-09-18 19:50:10 -07:00
Kurt
416f5fe183 Check Winning/Victory ribbons for gen3 origin based on encounter
Closes #2990 ty @Atrius97 !

Remove the `object Content` accessor only used for Mystery Gifts (used to trickle up the PKM object since the two ribbon interfaces weren't implemented on the IEncounterable). Just make PCD/PGT implement the ribbon interfaces and delegate the get/set to PKM directly.

Rewrite the national ribbon check for clarity
Optimize invalid/missing ribbon string replace to operate on the final string rather than do linq and replace each input. With this we make 1 temp string only, rather than 1-per-ribbon.

Replace hardcoded "Ribbon" strings to use a shared const string in a central spot.
2020-09-18 16:23:17 -07:00
Kurt
1a6f5163a4 Add mid-september raids 2020-09-17 18:16:16 -07:00
Kurt
7a1c438b74 Minor tweaks
add method to randomize AVs from interface extension method
revise stat presence check to check ATK since HP is stored in gen1 format
2020-09-17 18:13:08 -07:00
soopercool101
1a1cfbda4a
Fix Hidden Power Power calculations (and add to UI) (#2989)
* Fix broken hidden power power calculation

* Fix broken Gen 2 Hidden Power calculation

* Add parentheses

* WIP UI

* Finalize UI, only show on gens 1-5

* Inline some logic to reduce allocations

* Add unit tests for both hidden power calculation cases

Co-authored-by: Kurt <kaphotics@gmail.com>
2020-09-14 20:06:11 -07:00
Kurt
e125424423 Refine zygarde encounter form checking logic
Closes #2984
ty atrius & matt via discord

Co-Authored-By: Atrius97 <39707481+Atrius97@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2020-09-13 15:45:15 -07:00
Egzon
4b1a9a89da
Add support for reading and editing Underground Items (#2987)
Adds a sub-editor with localized support for editing Underground Items.
2020-09-13 14:55:50 -07:00
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
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
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