Commit graph

169 commits

Author SHA1 Message Date
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
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
450d40535d Relocate hypertraining properties to interface
lessen temp array creation, speed++
2018-06-05 21:31:42 -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
95b4d0820d Minor reorganization
amount of pkm obj classes is pretty high, move the static utility
classes to another folder

breaks usage of pkm.ShowdownText; removes a dependency from PKM.
2018-05-18 19:33:11 -07:00
Kurt
d772a82953 Move batch editor logic to core
previous hurdle a year ago was propertyinfo fetching not looking at the
base class's properties; dig deeper for all properties to mimic existing
code for netframework

end result is batch editing now possible without gui
2018-05-17 22:43:07 -07:00
Kurt
99005d8fc0 Refactoring
more discards & simplifications
2018-05-12 12:28:48 -07:00
Kurt
5a3c8f4147 Remove trailing whitespace 2018-05-12 08:41:29 -07:00
Kurt
815705bc5e Fix gender handling
Closes #1933

if not allowed to be genderless, flag as invalid gender
only permit valid genders after genderless is ruled out
(both done by checking the low bit)
2018-05-10 18:53:23 -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
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
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
71faaee31c Refactor savefile tid/sid to int
can now use TrainerID editor control on a savefile... soon?
2018-04-28 11:06:58 -07:00
Kurt
3f6b1acc93 Add fixed gender checks for non-GBA/NDS games
Closes #1912 , genderless ~= fixed gender I guess; shouldn't get these
gender-errors unless it's manually tampered data/ShowdownSet

remove unnecessary code in:
* PKMEditor (>=255 is already covered by == 255 and the fact that gt is
always <= 255)
* VerifyGender (3 <= x <= 5) check is already early-returned via
PIDGender check above

Update IsGenderValid knowing that VC mons have a gennumber <= 2
2018-04-23 19:58:29 -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
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
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
4cc31ea5e2 Standardize move setter
no longer allow passing null, if array is too small, set zero instead.
2018-03-28 20:34:12 -07:00
Kurt
a6977af19a Pull out Contest Stat logic to interface 2018-03-24 10:36:48 -07:00
Kurt
d58278d170 Pull out stat modification logic 2018-03-22 22:43:56 -07:00
Kurt
0d69e803e1 Add gen4/5 synthetic trade logic
was previously present for gen6 and gen7 only, resulting in eggs in
gen4/5 not getting link trade values applied. that's really all.

https://projectpokemon.org/home/forums/topic/44437-bug-eggs-transfer-for-gen-4-dppt-and-hgss/
2018-03-21 21:10:23 -07:00
Kurt
2bd9d99d9e Refactoring
WinForms->Core logic absorbing (CommonEdits)
loading ShowdownSet now applies properties to PKM instead of PKMEditor
Contest/IVs for Static/Trades are no longer set by default (less object
allocations), and are now checked by the encounter generator
2018-03-10 18:03:09 -08:00
Kurt
e4210e2b3e Misc api improvements
extract common nature amp logic
generic ienumerable copyto which now returns count of elements copied
(maybe useful later). prior usages never tried to copy an enumerable
larger than the dest array (now length checked).
2018-02-28 21:50:50 -08:00
Kurt
1411933e27 Relocate pkm stat controls to separate usercontrol
splits the logic up
change hypertrain from ctrl (prevents 30/31 setting) to shift (allows)
2018-02-26 21:22:35 -08:00
Kurt
033d5baa06 Check EC-PID same for gen1/2 transfers
Fix PID->EC on gen<3 transfers

https://projectpokemon.org/home/forums/topic/43779-about-vc-pokemons-pid-and-encryptionconstant/
2018-02-08 18:47:52 -08:00
Kurt
118a213b6c Fix backwards conversion copy order
reflection (now only used for backwards conversion) will use destination
order instead of source order so that the destination can order itself
for quirks

redo method call (probably breaks someone if they update, maybe pk2pk)
2018-02-03 15:32:45 -08:00
Kurt
c5655166bf Add shared pk3/xk3/ck3 class
standard generation 3 pkm content & interactions
generic inter-converter (more efficient than reflection)

update conversion methods; specific format conversion is now in the
object's src file now.

may be worth doing for gen4 pk4<->bk4
2018-02-03 12:42:06 -08:00
Kurt
9085dfd950 Allow backwards conversion on hax
works somewhat on drag&drop individual files, not guaranteed to work for
all pkm formats
https://i.imgur.com/v3i3ON9.png

Closes #1792
2018-01-28 22:47:03 -08:00
Kurt
c751c987a9 Add DebutGeneration get
https://projectpokemon.org/home/forums/topic/43378-generation-search-in-pkmdb-andor-batch-editor/

(less than) < and (greater than) > not currently supported (no plan to
add, would need to rewrite value eval logic)
2018-01-10 15:40:33 -08:00
Kurt
a9ff74059a Misc perf tweaks
checking untraded should just check for the first character (rather than
creating string object)
hashset for wild6 balls
2017-12-13 16:12:53 -08:00
Kurt
f9946368a0 Remove usage of LegalityAnalysis from PK*
CK3<->XK3 transfers to PK3 first now (no direct transfer legally)
2017-12-06 21:28:34 -08:00
Kurt
f7e20a3c43 Misc tweaks
fix roamer3 not setting IVs
fix usum z items rightmost pixel getting chopped off
use Gen* instead of GenNumber for specific cases (faster)
add WasGiftEgg location case for Gen7
remove some unnecessary array allocations
2017-11-17 22:19:23 -08:00
Kurt
a00f3ed894 random IVs with specified count
Closes #1553
removes duplicate logic in batch editor
2017-11-02 09:05:44 -07:00
Kurt
69cf1eaa9c add more pkhex.core xml documentation
adds a bunch of documentation useful for those unfamiliar with the core
library
2017-10-23 23:12:58 -07:00
Kurt
515a694afa Add LanguageID enum
no functional change, just less-magic-numbers for easier to understand
src
2017-10-22 21:01:08 -07:00
Kurt
886b2ef632 misc refactoring
simplification / splitting, also more usum prep and other readability
updates
2017-10-17 23:19:34 -07:00
Kurt
762b55e957 handle invalid nature stat amps
natures (>25) are invalid and causes IndexOutOfRangeException due to
being greater than the length of the array.
sanity check array length and amped stat prior to applying amplification
Closes #1515
2017-10-06 18:44:14 -07:00
Kurt
ea751e26b1 Convert chinese string only if species name
Resolves charmap duplications in the chinese char tables:
多边兽Z (Porygon-Z)
属性:空 (Type Null)
谜拟Q (Mimikyu)
卡璞・鸣鸣 (Tapu-Koko)

Games cannot have a nickname/OT in chinese as of current date... I
assume this will be fixed down the road
2017-10-03 18:15:15 -07:00
Kurt
ed1b934374 Misc refactoring
expose some useful IEnumerable methods (sorting / bin->pkm / copy) to
simplify some common operations
change some explicit arrays to IList for flexibility
remove old memecrypto bool (no longer necessary as XP is not supported)
rename some methods for more clarity
2017-09-28 22:20:27 -07:00
Kurt
c270479bf9 Show SID7 on hover
Closes #1494
2017-09-26 23:14:29 -07:00
javierhimura
f3743e490b Korean language restrictions
Restriction happens because Korean can not trade with non-Korean GB era games
- There is no Korean release for gen 1 pokemon, included VC
- With no gen1 pokemon means any Korean gen2 is Gen2_NotTradeback, that means no gen1 origin nor moves are Legal
- Crystal was never released in Korean
- Pokemon Stadium 2 was never released in Korean, that means no move reminder for gen 2 korean pokemon

- Generation 4 can not trade between Korean and not Korean games, but Korean games can use the palpark with any language

Chinese language restrictions
There is no Chinese release for gen 1 and 2 pokemon games, VC Chinese games are in Japanese
2017-09-23 20:46:10 +02:00
Kurt
c23cc81212 More usum prep
I think egg hatch location checking is wrong for traded eggs (see gen3
vs future games, origin game shouldn't change but could hatch ORAS egg
on XY at XY location?)
2017-09-19 21:35:30 -07:00
Kurt
ad69420ad9 Update gen5 shiny PID generating
Closes #1460
https://pastebin.com/GgcMjmwd
2017-09-17 14:43:28 -07:00
Kurt
84cc366803 Swap markings in gen3
Closes #1463
2017-09-17 13:07:12 -07:00
Kurt
aa3393e5b2 Misc languageID legality checking update
Checks for max language ID on transferred pkm (gen5 pkm on gen7 can't
have CHS/CHT etc)
handles edge case for JPN B/W ingame trades
update pk5->pk6 transfer logic to bump langID 0 to 1.
Thanks HaxAras & Britty for providing samples!
2017-09-15 17:43:31 -07:00
Kurt
cbda637981 Remove old (GF fixed) shiny correlation
Transporter was updated
2017-09-06 09:12:56 -07:00
Kurt
47ca69f92b Legality edge case fixes
Some incorrect IDs, some additions (unbreedable hidden abilities in
genV)

https://projectpokemon.org/forums/forums/topic/41407-pkhex-legality-errors-on-gen-6-updated/?tab=comments#comment-219459
2017-09-05 18:28:38 -07:00
Kurt
b9a9b6db32 Add gen2 iv reroll for shiny
#1419
2017-08-25 18:57:17 -07:00
Kurt
183164a197 Add batch edit pk1/2 .PID=$shiny
Closes #1419
2017-08-25 17:44:15 -07:00
Kurt
a91764b283 Add hot springs as valid egg location for gen6
split table references, remove per-format calculations as they all
behaved the same as the main method
2017-07-10 18:56:13 -07:00
Kurt
267de164f4 Set pkm Stat Level when transferred to CK3/XK3
Closes #1302
Box structure in CK3/XK3 stores stats AND level, as battle stats are a
part of the box structure. There's no party/box differentiation!
2017-07-06 17:47:38 -07:00
Kurt
fd1c7419b1 Set fateful for xd pkm transferred away
Only way to know if it originated in XD is to check the matched
encounter data

Closes #1290
2017-07-04 13:24:18 -07:00
Kurt
86d39f2c81 Tweak level/origin check for moves
Valid species/movepools are already determined via the dexlevel and
prior methods, no need to check again with current species.

edge case: sing froslass from CXD won't check gen3 moves (ie, sing)
2017-06-26 20:30:44 -07:00
Kurt
9b76d9b214 Next round of ribbon checking
Returned messages are slightly misleading since missing/invalid are
mixed together with the static method.

#1250
~322 lines to check ribbons, on top of the interface abstraction... so
much required... kinda understandable as there's over 100 ribbons to
check.
2017-06-20 21:57:03 -07:00
Kurt
3f38b123a3 Refactoring
mostly renaming things, includes a little bit of added sugar and
splitting methods to simplify the codebase.

all methods are now PascalCase
2017-06-17 18:37:19 -07:00
Kurt
991978dab6 Ensure cleared move pkms have at least 1 move
#1214
user may not be checking legality (bulk transfer)
2017-06-10 08:39:04 -07:00
Kurt
d19b83000d Clear gen2 exclusive moves on pk2->pk1
Closes #1214
2017-06-10 08:31:31 -07:00
Kurt
32deb3879a Simplify Shiny SID creation
calculates a passing SID and applies random bits to not be too
predictable
no need to bruteforce
2017-06-03 08:58:30 -07:00
javierhimura
814e63aa1c Add Control key modifier to set shiny button to change the pokemon SID instead of the PID, that allow the change shiny of gen 3/4 pokemon without turn the pokemon in illegal because PID/IV mistmatch
Added Cherrygrove City to surf headbutt encounter locations, the upper right trees on the map can be reach from the water in route 30
2017-06-03 12:02:22 +02:00
Kurt
b8a799f7ed Fix gender ratio comparison
http://bulbapedia.bulbagarden.net/wiki/Personality_value#Gender
For a Pokémon with a 50/50 male/female gender ratio, there is actually a
129/256 (50.390625%) chance for the Pokémon to be male and 127/256
(49.609375%) chance for the Pokémon to be female.

remove unnecessary parameter passing

#1163
2017-05-23 18:48:16 -07:00
Kurt
11b2dc35d7 Refactor main form into smaller pieces
pkm editor, sav editor, menus, and a manager to glue the storage slots
together
decouples the pkm/sav editors from a static savefile reference.

improves dragdrop/click view/set/delete indication, hides unavailable
contextmenuitems, and fixes a few incorrect references. Box Subviewer
slots now have all the indication/events that the main save editor slots
have.

pls report behavior bugs 👍
2017-05-22 21:55:12 -07:00
Kurt
63b3c8b020 Fix gen1/2 moves with 40 pp given 3 ppups
cap is 61:
http://bulbapedia.bulbagarden.net/wiki/Power_Point#Base_value_alteration

cap forced maximum at 63
2017-05-19 09:22:12 -07:00
Kurt
483998d930 Change gen4 (egg) met location setter
Closes #1135
clear both if zero
set value to dp location if a valid dp location, else set faraway place
set value to pthgss location if originated from pthgss
2017-05-18 22:40:38 -07:00
Kurt
84d901f647 Simplify PID gender checking
don't have multiple locations where comparisons are done, just generate
the gender and compare
only fetch gender once from getter
2017-05-18 19:16:11 -07:00
Kurt
a415ca78df Fix folder location fetch & x/c/bk# extension fetch
Closes #1149
2017-05-17 20:39:10 -07:00
Kurt
a70a4d5e3f Switch to c# 7 get/set expressions
Add gen5 battle box locked flags
no functional change otherwise, just shorter
2017-05-12 20:32:43 -07:00
Evan Dixon
52c4fbbe97 Converted PKHeX.Core to .Net Standard
Refactored and rearranged things as needed to allow the change
2017-05-11 23:34:18 -05:00
Renamed from PKHeX/PKM/PKM.cs (Browse further)