10 releases (5 breaking)

0.6.2 Oct 24, 2024
0.6.1 Oct 19, 2024
0.5.0 Sep 28, 2024
0.4.1 Aug 10, 2024
0.1.0 Oct 14, 2023

#2 in #battle

Download history 215/week @ 2024-07-23 63/week @ 2024-07-30 199/week @ 2024-08-06 29/week @ 2024-08-13 1/week @ 2024-09-17 182/week @ 2024-09-24 27/week @ 2024-10-01 10/week @ 2024-10-08 276/week @ 2024-10-15 177/week @ 2024-10-22 8/week @ 2024-10-29 23/week @ 2024-11-05

487 downloads per month

MIT license

1.5MB
39K 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.

All moves, abilities, and items through Generation 3 have been implemented and validated to work on the battle engine.

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.
  • Abilities.
  • Items.
    • Held items.
    • Berries.
    • Gems.
  • Forme changes.
  • Status conditions (burn, paralysis, sleep, freeze, poison, bad poison).
  • Volatile conditions (e.g., confusion, partially-trapped, flinch, recharge, and more).
  • Side conditions.
  • Entry hazards.
  • Slot conditions (e.g., Future Sight).
  • Weather.
  • Pseudo-weather.
  • Terrains.
  • Battle environments.
  • Single-player mechanics.
    • Experience.
    • Level up and move learning.
    • Fleeing.
    • Affection.
    • Disobedience.
    • Bag items.
    • Catching.
  • Horde battle support.

Dependencies

~7.5–10MB
~179K SLoC