A combatant's ATB timer is set to 120 + equipment weight ÷ 8 − agility, at least 1, adjusted for haste or slow, and UpdateTimer counts it down by one each tick and flags it when it reaches 0, when the turn comes due. The battle speed setting sets a wait of 0, 15, 30, 60, 120, or 240 when a character's turn arrives. | src/battle/battle-main.asm L5397–5416src/battle/battle-main.asm L4721–4748src/battle/battle-main.asm L11470–11473src/battle/battle-main.asm L5336–5349src/battle/battle-main.asm L24789–24792 | Code |
A physical attack first rolls 0–99 against its hit % (100 where the attack type calls SetHit100andTargetEvade, as fists and katanas do) and misses on a roll at or above it; a target that can dodge then rolls 0–99 against its evade %, and a roll under it is a miss, or a shield block when the target carries a shield. | src/battle/battle-main.asm L19091–19122src/battle/battle-main.asm L18698–18705src/battle/battle-main.asm L16363–16369src/battle/battle-main.asm L16574–16582 | Code |
Three attack types call CheckCrit: fists (type 30), katanas (type 37), and type 36, which the source comments as bows with an element and which uses the knife damage formula, after moving its crit % from its second parameter to the first. CheckCrit makes a critical when a roll of 0–99 is under that crit %, and a critical doubles Attack and sets Defense to 0. | src/battle/battle-main.asm L20794–20812src/battle/battle-main.asm L16363–16382src/battle/battle-main.asm L16574–16592src/battle/battle-main.asm L16542–16564 | Code |
| Physical damage is (Attack − Defense) × M, at most 9,999, and 0 when Defense is at least Attack. For swords, Attack is the weapon's attack power plus a random 0 to an eighth of it, and M is Level × Strength ÷ 128 + 2. | src/battle/battle-main.asm L22910–22945src/battle/battle-main.asm L19430–19467 | Code |
While FleeSuccess is nonzero, CheckFlee counts a flee ticker up each pass; on the 20th it rolls 0–99 and escapes when the roll is under the encounter's flee chance, and otherwise the ticker restarts. A flee chance with the high bit set shows the can't-run message instead, and a FleeSuccess of $80 (the Exit spell) escapes at once. The source doesn't show what sets FleeSuccess for ordinary running; its RAM notes only guess that holding L and R does. | src/battle/battle-main.asm L13368–13397src/battle/battle_ram.inc L1662–1663src/battle/battle-main.asm L16011–16018 | Code |
| Each step on a normal map adds the map's rate to a random-battle counter ($E0 at the normal rate; $40, $180, or $200 at the others), and a battle starts when a byte from the random table, plus an offset that grows by $11 each time its pointer wraps, is under the counter's high byte. | src/field/field-main.asm L21620–21670src/field/field-main.asm L21700–21701src/field/field-main.asm L21861–21873 | Code |
| Final Fantasy IV and V both give each combatant a timer that counts down to its turn. Final Fantasy IV sets its length from a ratio, 50 times a reference party member's agility over 10 times the combatant's; Final Fantasy V sets it to 120 plus equipment weight ÷ 8 minus agility. | src/battle/battle-main.asm L5405–5416 | Code |
| Final Fantasy IV counts a weapon attack's hits from a loop of percentage rolls, one per point of the attack multiplier, less the target's evade rolls; Final Fantasy V's physical check makes one hit roll and one evade roll, and the attack either lands or misses. | src/battle/battle-main.asm L19092–19122 | Code |
| Final Fantasy V counts each combatant's ATB timer down by one per tick from 120 + weight ÷ 8 − agility; Final Fantasy VI instead adds a constant built from speed to a gauge every 2 frames and gives the turn when the gauge overflows. | src/battle/battle-main.asm L5405–5416src/battle/battle-main.asm L4740–4745 | Code |
| Final Fantasy VI keeps Final Fantasy V's random-battle counter, which each step raises by the map's rate and which a byte from the random table, offset each time its pointer wraps, is tested against; it halves the normal rate from $E0 to $70 per step and changes the high one from $180 to $160. | src/field/field-main.asm L21700–21701src/field/field-main.asm L21658–21670 | Code |
| In Final Fantasy V only three weapon attack types roll for a critical (fists, katanas, and type 36), at the crit % the attack type carries; in Final Fantasy VI an attack that can crit does so on a random byte under 8, 1 in 32, whatever the weapon. | src/battle/battle-main.asm L20794–20803src/battle/battle-main.asm L16363–16382src/battle/battle-main.asm L16574–16592src/battle/battle-main.asm L16542–16564 | Code |