A turn-based Pokemon battle simulator with authentic Nintendo-style UI and official game mechanics
- Official Pokemon Formulas - HP and stats calculated using Gen 3+ formulas
- Physical/Special Split - Uses correct Attack/Defense or Sp.Atk/Sp.Def
- STAB Bonus - 1.5x damage for same-type moves
- Type Effectiveness - Full type chart from PokeAPI
- Critical Hits - 1/16 chance for 1.5x damage (ignores stat drops)
- Speed-Based Turn Order - Faster Pokemon attacks first
- Move Priority - Quick Attack, etc. go first regardless of speed
- Burn - 1/16 HP damage per turn, halves physical attack
- Poison - 1/8 HP damage per turn
- Paralysis - 25% chance to skip turn, 50% speed reduction
- Sleep - Can't move for 1-3 turns
- Freeze - Can't move, 20% thaw chance per turn
- -6 to +6 stages for Attack, Defense, Sp.Atk, Sp.Def, Speed
- Accuracy/Evasion stages affect hit chance
- Moves like Swords Dance, Growl affect stats
- Sprite shake when hit
- Flash effects on damage
- Critical hit screen shake
- Faint animation when defeated
- Victory bounce for the winner
- Type-based VFX - Fire glows orange, Electric flickers, etc.
- Pokemon Cries - Click the speaker button on any Pokemon card
- Authentic cries from PokeAPI
- Rain - Boosts Water moves, weakens Fire
- Sun - Boosts Fire moves, weakens Water
- None - Normal battle conditions
- Nintendo-style UI with Press Start 2P font
- Live sprites from PokeAPI (front/back views)
- Animated HP bars with color transitions
- Progressive Web App (PWA) - Install as desktop/mobile app
- Automatic balance for mismatched battles
- Weaker Pokemon get higher levels, stronger get lower
- Shows matchup tier indicator before battle
- Example: Pikachu (Lv61) vs Snorlax (Lv39) = fair fight!
# Clone the repo
git clone https://github.com/ericmaddox/pokemon-battle.git
cd pokemon-battle
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the GUI
python app.pyOpens automatically at http://localhost:7860
- Python 3.10+
- gradio
- httpx
Install with:
pip install -r requirements.txt- Select your Pokemon from the dropdown (all 151 Gen 1 Pokemon!)
- Click RANDOM for an opponent (or select one)
- Click the speaker button to hear their cries
- Click START BATTLE!
- Choose a move from the 4 buttons
- Watch the turn play out with animations!
- Repeat until one Pokemon faints!
| Feature | Description |
|---|---|
| HP Formula | ((2*Base + IV + EV/4) * Lv)/100 + Lv + 10 |
| Stat Formula | ((2*Base + IV + EV/4) * Lv)/100 + 5 |
| Damage Formula | ((2*Lv/5+2) * Power * Atk/Def / 50 + 2) * modifiers |
| Speed | Higher SPD attacks first (unless priority moves) |
| STAB | 1.5x damage if move type matches Pokemon type |
| Critical | 1/16 chance for 1.5x damage |
| Weather | Rain boosts Water 1.5x, Sun boosts Fire 1.5x |
pokemon-battle/
├── app.py # Gradio GUI application
├── pokemon_battle.py # CLI version
├── theme.css # Nintendo-style CSS + animations
├── requirements.txt # Dependencies
└── README.md
- Status effects (Burn, Poison, Paralysis, Sleep, Freeze)
- Stat stages (+6/-6)
- Move priority
- Official HP/stat formulas
- Battle animations
- Pokemon cries
- PWA support
- Level scaling for balanced battles
- Abilities (Intimidate, Levitate, etc.)
- Held items
- Multi-hit moves (Fury Attack, etc.)
- Healing moves (Recover, etc.)
- Team battles with switching
- Multiplayer mode
Contributions welcome! Open an issue or submit a PR.
MIT License - see LICENSE
- PokeAPI for Pokemon data and cries
- Gradio for the GUI framework
- The Pokemon Company for the franchise

