Overview
ThePBMoveData class loads and stores static data about moves from the game’s binary move database (Data/moves.dat). This class is used to retrieve move properties like damage, type, accuracy, PP, and battle effects.
Unlike PBMove which represents a move instance on a Pokémon, PBMoveData provides read-only access to the move’s base properties.
Source: Data/EditorScripts/016_PBMove.rb:20-61
Class Attributes
All attributes are read-only (attr_reader).
The move’s function code, which determines its battle effect.Example:
0 for standard damage, 1 for Sleep, etc.The base power of the move.Example:
80 for Thunderbolt, 0 for status movesThe move’s type (see
PBTypes constants).Example: 13 for Electric typeThe move’s base accuracy.Range:
0-100 or 0 for moves that never missThe base PP (Power Points) of the move without PP Ups.Example:
15 for Thunderbolt, 5 for BlizzardThe chance of the move’s additional effect occurring.Example:
10 for 10% chance, 0 for no additional effectDefines which Pokémon the move can target in battle.Values:
0- Single adjacent opponent1- User2- Single adjacent ally4- All opponents- And more…
The move’s priority bracket.Range:
-6 to +5Example: 1 for Quick Attack, 0 for normal priority, -5 for CounterBitfield containing various move flags.Flags include:
- Contact move
- Protect-able
- Magic Coat-able
- Snatch-able
- Mirror Move-able
- And more…
The move’s damage category.Values:
0- Physical1- Special2- Status
Methods
initialize
The ID of the move to load data for
- Opens
Data/moves.dat(using cached data from$PokemonTempif available) - Seeks to the move’s data position (moveid * 14 bytes)
- Reads 14 bytes of move data:
function(2 bytes)basedamage(1 byte)type(1 byte)category(1 byte)accuracy(1 byte)totalpp(1 byte)addlEffect(1 byte)target(2 bytes)priority(1 byte, signed)flags(2 bytes)
- Closes the file
016_PBMove.rb:41-60
Data Loading System
PokemonTemp Helper
ThePokemonTemp class provides caching for move data to improve performance:
016_PBMove.rb:1-16
Legacy Format
TheinitializeOld method supports the older RSATTACKS.dat format:
016_PBMove.rb:26-39
Usage Examples
Loading Move Data
Checking Move Properties
Move Type Checking
Calculating Damage Range
Priority Move Detection
Move Targeting
Performance Notes
- Caching: The
PokemonTemp.pbOpenMoveDatamethod caches move data in memory to avoid repeated file I/O - Creation Cost: Creating a new
PBMoveDataobject involves file I/O; cache results if querying the same move repeatedly - Read-Only: All attributes are read-only; move data cannot be modified at runtime
File Format
Move data is stored in binary format inData/moves.dat:
| Offset | Size | Field | Type |
|---|---|---|---|
| 0 | 2 | function | Unsigned 16-bit |
| 2 | 1 | basedamage | Unsigned 8-bit |
| 3 | 1 | type | Unsigned 8-bit |
| 4 | 1 | category | Unsigned 8-bit |
| 5 | 1 | accuracy | Unsigned 8-bit |
| 6 | 1 | totalpp | Unsigned 8-bit |
| 7 | 1 | addlEffect | Unsigned 8-bit |
| 8 | 2 | target | Unsigned 16-bit |
| 10 | 1 | priority | Signed 8-bit |
| 11 | 2 | flags | Unsigned 16-bit |
Related Classes
- PBMove: Represents a move instance on a Pokémon
- PBMoves: Constant module with move ID definitions
- PokemonTemp: Provides move data caching
See Also
- PBMove - Move instances
- Pokémon Classes - Move usage in battles