Battle Flow
The battle system is implemented inengine/battle/core.asm and coordinates all aspects of combat from battle initialization to victory conditions.
Battle Initialization
When a battle starts,
StartBattle initializes battle variables and determines which Pokémon are active:Visual Transition
The
SlidePlayerAndEnemySilhouettesOnScreen function creates the iconic battle transition by sliding silhouettes onto the screen:Turn Processing
Each turn processes player and enemy actions, applies move effects, and checks for battle end conditions.
Battle Types
The game supports three distinct battle types defined inconstants/battle_constants.asm:
- Normal Battles: Standard wild encounters and trainer battles
- Old Man Tutorial: The catching tutorial at the start of the game
- Safari Zone: Special battles with limited turns and bait/rock mechanics
Stats and Modifiers
Base Stats
Each Pokémon has five core stats:Stat Modifications
During battle, stats can be temporarily modified:Stat modifications range from -6 to +6 stages, with stage 0 being the base value. Each stage multiplies the effective stat by a factor defined in the game’s stat calculation routines.
Damage Calculation
Damage calculation uses several constants and formulas:The
MORE_EFFECTIVE constant (15) exists in the code but is not used in Generation I. Type effectiveness is binary: super effective (2x), normal (1x), not very effective (0.5x), or no effect (0x).Move Structure
Each move in the game is defined with six properties:Move Examples
Fromdata/moves/moves.asm:
Status Conditions
Non-Volatile Status
Status conditions that persist outside of battle:Battle Status Flags
Temporary conditions during battle are tracked with bit flags:Battle Status 1 Flags
Battle Status 1 Flags
Battle Status 2 Flags
Battle Status 2 Flags
Battle Status 3 Flags
Battle Status 3 Flags
STAB and Effectiveness
The damage multiplier system combines STAB (Same Type Attack Bonus) and type effectiveness:- Bit 7 indicates STAB (1.5x damage when move type matches user’s type)
- Bits 0-6 store type effectiveness multiplier
Trainer Data
Trainer-owned Pokémon use standardized DVs (Determinant Values) for stats:DVs (now called IVs in later generations) are hidden values from 0-15 that determine individual Pokémon stats. Trainer Pokémon use fixed DV values, while wild Pokémon have random DVs.
Battle AI
The game includes a sophisticated AI system inengine/battle/trainer_ai.asm that evaluates moves based on:
- Type effectiveness
- Status effects
- Remaining HP
- Move power and accuracy
- Special trainer AI modifications per class
Pokémon Stats
Stat calculation and growth
Trainers
Trainer AI and party data
Items
Battle items and TMs
Reference
Battle constants and data structures
Key Files
engine/battle/core.asm- Main battle loopengine/battle/effects.asm- Move effect handlersengine/battle/trainer_ai.asm- AI decision makingconstants/battle_constants.asm- All battle-related constantsdata/battle/- Battle data tablesdata/moves/moves.asm- Move definitions