How damage is calculated
The formula, the modifiers in order, and one worked example.
In short
- Base damage comes from level, move power, the attacker's Attack and the defender's Defence.
- Then every modifier multiplies in: spread, weather, critical hit, a random roll, STAB, type, burn, abilities, items, screens.
- The multipliers are applied together and floored once at the end. A resisted hit never does less than 1.
- Physical moves use Attack against Defence, special moves Special Attack against Special Defence.
The base
PokeRival uses the Generation 9 equation:
base = floor( ( (2 × Level ÷ 5 + 2) × Power × Attack ÷ Defence ) ÷ 50 + 2 )
Attack and Defence are the stats after stat stages, abilities and items. A physical move reads Attack and Defence, a special move reads Special Attack and Special Defence. Psyshock and Psystrike are special but hit Defence. A burned Pokemon's physical attacks are halved, unless it has Guts or is using Facade.

The modifiers
Every modifier is a multiplier, and they are applied in this order:

| Modifier | Value |
|---|---|
| Spread move hitting several targets | 0.75 |
| Weather: sun on Fire, rain on Water | 1.5 |
| Weather: sun on Water, rain on Fire | 0.5 |
| Critical hit | 1.5, or 2.25 with Sniper |
| Random roll | 0.85 to 1.00 |
| STAB | 1.5, or 2 with Adaptability |
| Type effectiveness | 0, ¼, ½, 1, 2, 4 |
| Burn on a physical move | 0.5 |
| Attacker's ability, such as Technician or Tough Claws | varies |
| Defender's ability, such as Thick Fat or Multiscale | varies |
| Held item, such as Life Orb or a type gem | varies |
| A resist berry on the defender | 0.5 |
| Reflect, Light Screen or Aurora Veil | 0.5 |
The result is never below 1 unless the type multiplier is 0. A Pokemon that resists a move four times over still loses a point.
Critical hits
The chance comes from a stage. Stage 0 is 1 in 24, stage 1 is 1 in 8, stage 2 is 1 in 2, and stage 3 or more always crits. High-crit moves such as Slash add a stage, Scope Lens and Razor Claw add one, Focus Energy adds two, Super Luck adds one. Battle Armor and Shell Armor make a Pokemon immune to crits, and Lucky Chant protects a side. A critical hit ignores the defender's positive stat stages, the attacker's negative ones, and goes straight through screens.
Accuracy
Before damage, the move must hit. Move accuracy is multiplied by the attacker's accuracy stage over the defender's evasion stage, then by each of these in turn, flooring to a whole percent at every step: Sand Veil and Snow Cloak in their weather (0.8), Compound Eyes (1.3), Hustle on physical moves (0.8), Victory Star (1.1), Wide Lens (1.1), Zoom Lens when moving second (1.2), a triggered Micle Berry (1.2), Bright Powder (0.9), Lax Incense (0.95). Thunder and Hurricane never miss in rain and drop to 50 in sun; Blizzard never misses in snow. Moves with no accuracy value, like Swift, cannot miss.
A worked example
A level 50 Charizard (Special Attack 159) uses Flamethrower (power 90) on a level 50 Venusaur (Special Defence 120).
base = floor( ( (2×50÷5 + 2) × 90 × 159 ÷ 120 ) ÷ 50 + 2 )
= floor( ( 22 × 90 × 1.325 ) ÷ 50 + 2 )
= floor( 52.47 + 2 ) = 54
Flamethrower is Fire, Charizard is Fire: STAB 1.5. Venusaur is Grass/Poison: Fire is ×2 on Grass, ×1 on Poison, so ×2. No weather, no crit, no items. With a random roll of 0.92:
damage = floor( 54 × 0.92 × 1.5 × 2 ) = floor( 149.04 ) = 149
Venusaur at level 50 has about 187 HP, so that is most of its bar. The same move under rain would be halved to 74.

Moves with no printed power
Some moves compute power on the spot: Low Kick and Grass Knot from the target's weight, Gyro Ball from the speed difference, Electro Ball the other way round, Return and Frustration from friendship, Flail and Reversal from the user's remaining HP, Psywave from level and a roll. Their pages say so, and the engine owns a table for every one of them so none deals zero.