Commit graph

54 commits

Author SHA1 Message Date
Kurt
e961694bdb Minor tweaks
Pass evo chain to memory learning machine move
Pass minimum level for GB encounters if present, rather than enc min level
2021-07-22 19:08:56 -07:00
Kurt
9e665034b7 Implement "Can Buy Item" memory check
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
2021-07-03 13:12:46 -07:00
Kurt
f2183f985f Tighten up memory 71 permissions 2021-06-30 15:56:08 -07:00
Kurt
600f4a550a Allow urshifu for gen8 dynamax memory 2021-06-30 13:37:40 -07:00
Kurt
401ab98f42 Fix inlined check 2021-06-22 23:30:40 -07:00
Kurt
3e7775fc44
Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately (#3222)
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately

Don't store within the object, track the slot origin data separately.

Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.

- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code

* Remove WasLink virtual in PKM

Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.

* Use Fateful to directly check gen5 mysterygift origins

No other encounter types in gen5 apply Fateful

* Simplify double ball comparison

Used to be separate for deferral cases, now no longer needed to be separate.

* Grab move/relearn reference and update locally

Fix relearn move identifier

* Inline defog HM transfer preference check

HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.

* Extract more met location metadata checks: WasBredEgg

* Replace Console.Write* with Debug.Write*

There's no console output UI, so don't include them in release builds.

* Inline WasGiftEgg, WasEvent, and WasEventEgg logic

Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
2021-06-22 20:23:48 -07:00
Kurt
138501da2f Minor clean
Condense some expressions
Use less linq
Rename some fields
2021-05-29 15:31:47 -07:00
Kurt
862403858b Refactoring
no functional change
2021-02-03 11:33:09 -08:00
Kurt
62bf1c2755 Add stubs for verifying memories regarding items
Not implementing these, but at least setting up a clean area for anyone else to implement the logic
2021-01-30 19:15:39 -08:00
Kurt
ff21d63d16 Update MemoryVerifier.cs 2021-01-29 14:34:45 -08:00
Kurt
697a9fc668 Permit 80-89 memories on eggs
nice logic ya got there, GameFreak
2021-01-29 13:47:31 -08:00
Kurt
acf811f5c1 Permit all generations prior to requested generation for know move check 2021-01-04 15:38:30 -08:00
Kurt
de840f40d4 Invert some "!is" to "is not" 2020-12-29 00:58:08 -08:00
Kurt
a4ccca7980 Add battle-only known move memory bypass 2020-12-26 09:27:41 -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
93910df2c6 Use new switch statements 2020-12-23 17:14:38 -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
cd76e49388 Strengthen know move check 2020-12-21 19:50:56 -08:00
Kurt
351637900f Downgrade swsh move memory verification severity
Some special encounters don't set the Relearn Moves, so we can't really check the memory-moves unless we somehow late-reject a matching encounter. Not really worth the effort to try and verify cosmetic mismatches; just tag them as Fishy.
2020-12-21 19:20:11 -08:00
Kurt
b71df7b064 Allow shared moves from daycare as "can know move"
See b58f3bbc22
2020-12-21 16:49:42 -08:00
Kurt
b58f3bbc22 Add memory checks for GO->HOME transfers
Also add checks for the new memory types introduced in swsh
2020-12-21 14:22:24 -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
ad6728fb5c Minor tweaks
Check egg encounter for state rather than re-deriving some properties on the fly
Only check memories if memories are exposed
Remove debug assert (not always true?)
2020-08-04 22:56:55 -07:00
Kurt
e84ce77008 Split memories from main pkm class to interface
pk6/7/8, not pb7
2020-07-31 17:25:14 -07:00
Kurt
acd97c6287 Pass evolution chain for generation memory check
chain details are already computed; pass them in
2020-07-18 21:57:15 -05:00
Kurt
a7ba178005 Remove unreachable/const logic
Earlier compares result in some logic being unnecessary

The Gen7 level up move compare was actually an oversight, so it's a worthwhile fix :)
2020-06-27 22:44:14 -05:00
Kurt
9e8858ac51 Allow traded gen8 eggs to have OT linktrade mem
Stupid lacking game checks
2020-03-25 19:18:52 -07:00
Kurt
3e9262efbb Only check memory feeling restriction if gen6
dunno restrictions for gen8 memories.
2020-02-11 22:25:50 -08:00
Kurt
fdd321dd8c Make memory 6 fishy if textvar present
Closes #2621
2020-01-10 16:08:34 -08:00
Kurt
d7bc68d7a5 Add HT case for capture memory check
#2570
https://github.com/kwsch/PKHeX/issues/2570#issuecomment-568149050
2019-12-20 19:47:40 -08:00
Kurt
506e64186a Rearrange & re-do "CanHaveMemory" value check
Closes #2581
2019-12-11 19:37:57 -08:00
Kurt
281c1ae744 Skip SWSH untraded link trade eggs if trade-memory
just read the comments & code, this one is an annoying oversight
untraded pkm /should/ never have HT memory data, but sometimes it do be
like that

Closes #2571
2019-12-09 16:23:29 -08:00
Kurt
4611146807 Update memory verifier
Adds handling for SW/SH quirks
Closes #2545
2019-12-07 23:36:39 -08:00
Kurt
19b1564eb2 Split history and memory verifiers
Rewrite a bunch of the history verification stuff
Fix a few test cases with incorrect OT Friendship (transferred), and
missing GeoCountry

Need to rewrite memory verification next
(All test cases currently pass)
#2545
2019-12-07 18:12:31 -08:00
Kurt
d3f7e7bf07 Minor simplifications
format >= 6 is always true (early return in entry)
don't double-flag/check memory presence in OTs from gen5 and below (hist
and OT verifier)

rename method; I'll probably rework the flow of things for gen6
verification and gen8 verification since the rules are slightly
different
2019-12-02 16:36:53 -08:00
Kurt
f5307c142b Use format sensitive move knowable check
Closes #2534
2019-11-27 23:07:41 -08:00
Kurt
907f036956 Disregard OT memory values on gen7 origin 2019-11-27 16:01:12 -08:00
Kurt
15ef6555a8 Add WC8 memory & fix fallthrough
ty @sora10pls
2019-11-26 11:22:01 -08:00
Kurt
ef425af835 Add memory / console region checks for pb7/pk8
yeah your initial hacks were hacks

It appears there's a bug (in the game) for link trade memories --
applied to the OT memory instead of HT memory?? Fun!
2019-11-26 11:01:09 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00
Kurt
02420d3e93
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases

Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization

* Handle bits more obviously without null

* Make SaveFile.BAK explicitly readonly again

* merge constructor methods to have readonly fields

* Inline some properties

* More nullable handling

* Rearrange box actions

define straightforward classes to not have any null properties

* Make extrabyte reference array immutable

* Move tooltip creation to designer

* Rearrange some logic to reduce nesting

* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum

* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case

* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable

* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator

* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever

* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)

* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-16 18:47:31 -07:00
Kurt
332784d34b Misc updates
parameter name lowercase
simplify some comparisons/calcs
reuse comparison methods
wrap memory dump into readonly struct
2019-05-11 00:59:07 -07:00
Kurt
41a3989b53 Consolidate encounterlink into mysterygift
use synthetic wondercards to match link gifts
2019-01-12 23:50:31 -08:00
Kurt
76a2e4f527 Add AltForm parameter to exp/level fetch
Starter Pikachu & Eevee have different growth rates than their base
forms (seriously WHY?)

remove old api surface in PKX as a breaking change as adding the
parameter is necessary.
2018-11-26 16:55:16 -08:00
Kurt
b7acb7fa1d Add memory rarity table 2018-10-12 17:45:52 -07:00
Kurt
ce9d3abbe4 Misc reorganization
Move logical checks using encounter data out of Core.cs

might be possible to excise legality checking objects from
Legal/PKHeX.Core so that a 'slimmer' core can be made
2018-10-04 18:52:00 -07:00
Kurt
91c37ab573 Update legality check message string style
V### names weren't enjoyable to work with; use similar verbose style as
the program message strings.

updating the translation files with the remapped variable names shortly

remap list: https://pastebin.com/jybkVDAK
2018-09-01 14:11:12 -07:00
Kurt
c8563a3737 Respacening
Style guidelines, handle a bunch of files
no functional change
2018-07-26 19:34:27 -07:00
Kurt
625a77589b Extract geolocation logic to interface
mixins would be nice but I guess extensions cover this
2018-07-14 10:34:34 -07:00
Kurt
e4e5018aa7 Extract some methods 2018-07-11 19:13:09 -07:00