use trainerstat editor control in gen6 editor
fill in some details from the disassembly via setrecord usages
still slightly fuzzy on some:
fureai (based on usum idb name, similar logic)
soaring sky counts
looks like there's some other usages of the fields which were outside
the stat range, throwing an exception when loading to NumericUpDown,
added bypass logic
Thanks Holla!
calling Japanese ? X : Y on every single access is too excessive, just
compute one layout for each type whenever the first sav1 requires it.
could probably reduce the amount of properties by reusing others + shift
value; offsets are different due to string lengths being different
Logic is essentially identical; implement a base class and have the
generation specific structures implment the differences.
Reduce the verbosity a little
pk1 boxdata stores current level & current hp, which is only present in
pk2 party data.
if the user drops in pk2(boxdata), the transfer leaves 0 for both
values, which isn't correct.
detect stat_level to determine if values should be regenerated or not.
Thanks HaxAras for finding this :)
some cards may permit being recieved on incorrect games
some wcxfulls permit games they shouldn't (tapu koko flags permit USUM
but games released after the distribution window)
lots of wcx lacking restrictions completely
tested flagging USUM rockruff & zeraora
might be worth discarding MysteryGiftVerifier and instead just using
unused fields for prior formats to supply the data.
use some close synonyms (Reiniciar -> Borrar)
omit some words (potential / training) to keep layout compact
capitalize Equipado to match main window
Closes#2080
Remove unnecessary floor operation, don't fetch stat arrays for each
stat
Current HP is a box stat in pk1 format (offset 0x1), which isn't stored
in box pk2's. If the hp is zero, set it to the current HP.
Thanks HaxAras for the conversion tip!
utilize unchecked byte overflow
remove unnecessary zeroing -- t's immediately after the checksummed
region. even if it was included, chk += 0 is still 0.
extract GetFormDuration to method, remove unused GetIsCompatible
specialized variant (there's a generalized version in SAVUtil.cs,
IsPKMCompatible -- might do another round of WinForms->Core absorption
Closes#2065 Thanks @WEERSOQUEER !
Single evo species weren't getting flagged in the evolution verification
as they early returned (species matched), just move the sanity check
before that
orderby consumes the entire input enumerable in 'sorting' the list;
since we don't care about the order besides a yes/no, just manage the
yield order ourselves.
don't bother using this method more than the spot it's in; was a fun
exercise but other spots are set up for easier debugging
(overall flow is where->deferby->yield), could make things easier to
read but meh
original file path is not saved with the two listed properties, add
FileFolder and relcoate existing FilePath functions to that field
move some GetVariantSAV usages to the string method instead of byte[]
max IVs use flawless method directly with 6 IVs specified
move color blend/stat calc to ImageUtil
move potential string to commonedits
expose color properties for pkmeditor
don't constantly create/dispose brushes for drawing legal moves
bulbapedia is wrong, first 4 bytes are info values:
0x0 = dex order (alphabetical, numerical), unused in frlg
0x1 = mode (unused in frlg), regional vs national
0x2 = national magic rse (always set in frlg)
0x3 = national magic frlg (never set in rse)
refer to disassembly (pokefirered isn't too helpful, less developed.
just compare save files & edit ram!)
the other 2 values being set are the eventflag & event const, could use
the abstraction for those rather than direct ofs writes
convert all dictionaries to char-byte instead of string (saves 50KB on
compressed dll, lul)
update OT string comparison for pre/post transfer specimens
Showing "TRAINER" for all languages isn't correct, just show a mapped
character
Closes#2049 , thanks @egzonqj & @WEERSOQUEER !
Closes#20454ac92b9418
had added it; assuming to undo lvl-1 => lvl for gen3/4.
Level Up, Learn Nincada Move, Evolve to Ninjask & spawn Shedinja, then
learn any Ninjask Moves. Gen3 reverses the spawn&learnNinjask steps,
which is handled separately
Thanks @XxPhoenix1996xX !
tfw they store full egg data there too -- show that in the sidebar
Tested on C & GS (english), assumedly works fine for other languages
(based on the disassembly?)
according to the disassembly it all makes more sense; a small block and
a large block are stored in RAM
util calc helps convert between contiguous section offset to a chunked
offset
eg: emerald daycare starts at large 0x3030, which converts to
chunk4@0x1B0
reduce pk3/ck3/xk3 logic, share AbilityBit property within _K3, and when
loading, type check (favored over hardcoding individual load cases)
pull some non-gui code from PKMEditor to core/etc for general data
fetching
Yeah forgot that extremely bad RNG rolls (0,0,0,0,0) leaves 510
remaining, and the last EV can't have that much
rework loop to be simpler & quicker by checking the last IV for validity
only
(don't bother keeping it unrolled
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)
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
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
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.
This commit implements IsDaycareOccupied for generation 1 saves. The
byte which tracks if the daycare is occupied should normally only be
0x01 or 0x00, so I decided that all other values mean that the daycare
is probably corrupted and thus not occupied. SetDaycareOccupied is not
implemented, since I am not sure what other flags the game normally sets
in this scenario and daycare is read-only anyway.
The GUI displays the Pokemon's index to the right for some reason, but I
don't have saves to test this for other generations, so it might be
unrelated to this change.
gender: take top 4 bits of gr:
31 = 0x1F = 1
63 = 0x3F = 3
127 = 0x7F = 7
191 = 0xBF = 11
See the pattern? If we change the compares from >= to >, we -1. All
numbers match except for the 25/75 ratio pkm... which unveils the
problem.
Simplify the calc for these using the logic above, which fixes the error
and makes the code easier to read!
Thanks SystemError for assisting :)
easy modification which isn't 'random' resulting in a slightly higher
chance of retaining the current gender if possible. threshold values can
change genders (1f:7m), but is slicker overall
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
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...
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
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
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
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.
#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.
Rework box fetch in SaveFile to be a little more flexible, can now fetch
a single box
Hold control to... export all boxes :)
I wonder if there's a decorator that showdown skips when importing lines
that can help differentiate the boxes since there's the potential for
hundreds output (ie comments in a showdown set?) doubt it.
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.
Fixed gender PCD with dynamic PID needs to check gender validity (some
korean card had it)
Fixed wc3 generated force-hatching to unflag fateful for non-frlg and to
hatch on the designated game just in case
stuck on a PGF issue where ability doesn't match PID, need to revisit
that PID creation...
Card #: 0002 - がくえんさい×ポケモンプレゼント
bypass savefile language checks if no language set
fix gen2 static gift egg that is really a wild encounter -- egg flag was
set & not cleared -> no wild pkm, bad! Adds test case for this.
(probably isn't a better place to clear, enforces only once per
generation rather than on every yield/end of every static yield)
Closes#2004
no changes had been submitted since originally committed on 3/5/2015; 3y
of inactivity.
users can always place "lang_en" to replace the english translation with
their own GUI strings; not worth maintaining non-series language
support.
Although Pokémon Ruby, Sapphire, and Emerald include a location pointer
for "Mirage Island", any Wynaut caught here will simply display "Met on
Route 130" in their summary. This is because the player is technically
still on Route 130's map.
Can't get anything with that location ID as an egg or as wild
egg fetch returns array, need to add to the collection
force everything as readonly to prevent adds outside of the constructor
Closes#1988
Thanks @iiippppk !
fix b2w2 egg base levelup reference (not bw, b2w2!), doesn't really
matter much except for better indication (possibly?)
remove some unnecessary linq ToArray() calls
continue relocating code out of Core
Closes#1986 , was missing a check if there were any lines in the list.
Calling the method with an empty line set would have yielded an empty
set (behavior unknown). Although calling the method without lines is
unintended, should handle behavior correctly now.
Fix yielding an empty set if the first line(s) are empty.
Add test to verify parsing works for multiple lines.
Add test to verify parsing yields nothing for no lines.
Add test to verify parsing yields nothing for empty lines.
pull out some move data fetching to separate class
add methods to quickly fetch if the move is learnable via that method
eventual plan is this:
replace
'fetch all possible moves then look within' move validation
with:
'peek if learnable, and get info how' move validation
advantages:
- returns game the move was learned in and the level (if appropriate)
- infinitely less object creation (garbage collection)
- only looks for a given move, doesn't have to fetch everything before
checking
- faster than full fetch, can be made even faster by optimizing lookups.
subject to change :)
Closes#1317
Needs the events crew to produce serialized binaries with hash-flag data
for each generation before proceeding any further. I'm not really
interested in doing all the work for events since it doesn't impact
battle legality.
nickname reset clears except for encountertrades (some have fixed
nicknames).
remove untraded check for HT memory verification, has to be traded if it
has a HT memory.
clamp species list based on savefile
fix form control index set
remove slot from list (avoid duplicates, there's 530 slots and both
games have more than that available).
Closes#1974
stored as wc3's, make "Version" from IVersion rather than int so that
"WasXD" recognizes it.
Update handling for fateful encounter trade-away cases.
#1970
7ef8a88678 (commitcomment-29123689)
A better fix may be to just make all line endings consistent ('\n'), but
string resource loading time is negligible
swallow error for invalid filenames in saveutil -- don't bother
detecting those files.
on fail to getmoveset, return the current moves instead of null.
Gen7 weavile can exist in gen4 as sneasel; existing code had pruned it
from gen4. Skip pruning for this case
probably overdid the checks but whatever. works.
Thanks /u/ThrowawayReddNinja for pointing out this false flagged case
with an example!
Had relearnmoves defined but no current moves; better for generator to
spit out all moves rather than the special move (hold back)
store current moves for all link gifts
move distinct filter to reflectutil as it is spitting out
inherited(overriden) property names after the current class' property
name.
remove original (default) memory strings; had removed Items.Clear()
earlier (why would I need to clear if there was nothing there?) but
there was something there needing to be cleared. Remove the useless
initialization to fix that :)
Thanks Davil!
https://projectpokemon.org/home/forums/topic/45321-distsupertrain/
remove todo comment
fix exception when refreshing slot coloring
update box when saveslot index changed, not validated.
update boxviewers when saveslot changes
Too many classes in the same file, break up.
simplify things a little in EncounterArea (remove passing thru nulls,
should throw excpetion immediately if misconfigured).
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.
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
1123c24b0c
had addressed the loading, however, it did not address the saving
update pkx to not create a new array every time IsPKM is called
(possibly a lot)
reference PKHeX.Core, main window loads assemblies & initializes
providing an ISaveProvider and the menustrip control (to insert controls
into)
pretty rough but should allow for inserting external control buttons &
allowing it to edit the UI a little
example: https://github.com/kwsch/PKHeXPluginExample
feedback is appreciated
using keyboard instead of mouse can change box without moving mouse
outside the slot picturebox
trigger an update when the box is changed, but only if the updating
parent has the hovered child (ie a boxviewer changing box while hovering
the main window won't re-cry the main window slot since it wasn't
updated)
Closes#1940
add some gender threshold properties to personalinfo
* Fix minlevel of Pangoro/Tyrantrum/Aurorus in gen6
30: level + dark type in the party
32: level + day
33: level + night
34: level + female
Note Meowstic isn't affected due to another entry of level + male (23)
* Minor text usage fix
* Fix xorPID flipping in TransferEC check