A worked example, rendered from real sample data. Sign in to run the tool on your own input.
atk=150
def=60
crit_rate=0.25
crit_mult=2.0
element_bonus=0.3
level_diff=5Formula Softened subtraction — damage = atk − def × 0.5
Attacker atk 150
Defender def 60 · 1000 HP
Normal hit 156
Crit hit 312 (25% chance, ×2)
Average hit 195
Hit range 156 – 312
DPS 195 at 1 attack/s
Hits to kill 6
Time to kill 5.13s
Defence curve (damage as the defender armours up)
def 0 195 ████████████████████████████
def 37.5 170.63 █████████████████████████
def 75 146.25 █████████████████████
def 112.5 121.88 ██████████████████
def 150 97.5 ██████████████
def 187.5 73.13 ███████████
def 225 48.75 ███████
def 262.5 24.38 ████
def 300 1.3
→ damage never reaches the 1-damage floor in this range
C# (Unity)
int damage = Mathf.Max(1, Mathf.RoundToInt(attack - defense * 0.5f));
if (Random.value < critRate) damage = Mathf.RoundToInt(damage * critMult);
Calculate RPG damage with attack, defense, crit, elemental modifiers. Part of the DevTools Surf developer suite. Browse more tools in the Game Dev collection.