PK9 and PA9 Classes
Generation 9 introduces the latest Pokémon data formats: PK9 for Scarlet/Violet and PA9 for Z-A (Legends Z-A).PK9 Class
Namespace:PKHeX.Core
File: PKHeX.Core/PKM/PK9.cs
Format Specifications
| Property | Value |
|---|---|
| SIZE_STORED | 328 bytes (0x148) |
| SIZE_PARTY | 344 bytes (0x158) |
| Generation | 9 |
| Context | EntityContext.Gen9 |
| Games | Scarlet, Violet |
Key Features
Terastallization
Gen 9’s main battle mechanic:- TeraTypeOriginal: Natural Tera Type (based on species)
- TeraTypeOverride: Changed Tera Type (0x19 = no override)
Obedience Level
Scale System
Data Structure
Same block structure as PK8:- 4 blocks of 80 bytes each
- 8-byte header
- Total: 328 bytes stored, 344 party
Important Properties
Tech Records Continued
Battle Version
HOME Tracker
Tera Type System
Relearn Move Management
PA9 Class
Namespace:PKHeX.Core
File: PKHeX.Core/PKM/PA9.cs
Format Specifications
| Property | Value |
|---|---|
| SIZE_STORED | 328 bytes (0x148) |
| SIZE_PARTY | 344 bytes (0x158) |
| Generation | 9 |
| Context | EntityContext.Gen9a |
| Games | Legends: Z-A |
Key Features
Alpha Pokémon (Returning)
Plus Records
New learning system:Data Structure
Same size as PK9 but with different internal structure:- Modified block layout for Alpha support
- Plus Record flags replace some PK9 features
- Different PersonalInfo table (PersonalTable.ZA)
Differences from PK9
Added Features
- Alpha Pokémon
- Plus Records system
- Possibly modified battle mechanics
Removed Features
- Terastallization (may not be in Z-A)
- Some SV-specific marks/ribbons
Modified Features
- Uses PersonalInfo9ZA instead of PersonalInfo9SV
- Different move pools and availability
Comparison Table
| Feature | PK9 | PA9 |
|---|---|---|
| Size (Stored) | 328 bytes | 328 bytes |
| Size (Party) | 344 bytes | 344 bytes |
| Block Size | 80 bytes | 80 bytes |
| Terastallization | Yes | No |
| Alpha | No | Yes |
| Plus Records | No | Yes |
| Tech Records | Yes | Yes |
| Scale System | Yes | Yes |
| Obedience Level | Yes | Yes |
| Contest Stats | No | Yes |
Code Examples
Creating a PK9 with Tera Type
Checking Tera Type
Creating an Alpha PA9
Setting Scale Values
Fixing Relearn Moves
Handler Update System
New Gen 9 Features
Unhatched Eggs
Enhanced Shiny Calculation
Characteristic
Migration from Gen 8
When migrating from Gen 8 to Gen 9:- Encryption Constant preserved
- PID preserved
- IVs preserved
- Tera Type assigned based on species
- Obedience Level set based on current level
- Scale values generated
- Tech Records preserved
- Ribbons preserved where applicable