6 releases (3 breaking)

0.4.1 Aug 10, 2024
0.4.0 Aug 10, 2024
0.3.1 Jul 28, 2024
0.2.0 Jul 7, 2024
0.1.0 Oct 14, 2023

#3 in #battle

Download history 80/week @ 2024-07-01 46/week @ 2024-07-08 169/week @ 2024-07-22 109/week @ 2024-07-29 173/week @ 2024-08-05 55/week @ 2024-08-12

179 downloads per month

MIT license

1.5MB
33K SLoC

battler

battler is battle engine and simulator based on the Pokémon games, written in Rust.

The battle engine is designed off of a few principles:

  1. Self-contained solution for controlling battles. A battle can easily be run with the engine and required effect data.
  2. Separation between battle engine and battle clients. This engine is focused on generating a battle log, which can be easily displayed and replayed by battle clients.
  3. Support for high level of customization for all sorts of effects through an interpreted language written directly on effect data.

Features

  • Battle types.
    • Single battles.
    • Double battles.
    • Triple battles.
    • Multi battles.
  • Team validation.
  • Team Preview.
  • Switching.
  • Moves.
    • Priority and speed ordering.
    • PP checking and deduction.
    • Damage calculation and modifiers.
    • Type effectiveness and immunity.
    • Critical hits.
    • Evasion and accuracy checks.
    • OHKO.
    • Self-destruct.
    • Self switch (including Baton Pass).
    • Recoil.
    • Multi-hit.
    • User and target effects.
    • Stat boosts.
    • Healing.
    • Draining.
    • Force switching.
    • Secondary effects against user and target.
    • Two-turn moves (e.g., Fly, Dig).
    • Multi-turn moves (e.g., Bide).
    • Locked moves (e.g., Thrash, Petal Dance).
    • Custom damage calculations (e.g., Low Kick, Psywave).
    • Using moves within moves (e.g., Mimic, Mirror Move, Metronome).
    • Custom move volatile conditions.
    • Move disabling.
    • Transformation.
    • Substitute.
    • Protection.
  • Status conditions (burn, paralysis, sleep, freeze, poison, bad poison).
  • Volatile conditions (e.g., confusion, partially-trapped, flinch, recharge).
  • Side conditions.
  • Entry hazards.
  • Slot conditions (e.g., Future Sight).
  • Weather.
  • Single-player mechanics.
    • Experience.
    • Level up and move learning.
    • EVs.
    • Fleeing.
    • Affection.
    • Disobedience.
  • Horde battle support.

Roadmap

  • Catch mechanics.
  • Abilities.
  • Field effects.
  • Items.

Dependencies

~7–9.5MB
~175K SLoC