I think I have finally decided on the damage formula I am going to use for my game. It is a low-powered game, so stats and HP are scale low. I am also using SRD_TimeAttacks to add in more variations and give combat something more inspired than click, wait, click, wait.
Explanation:
Flipping the stats above results in the following damage for enemies to actors.
*This is all based on level 1 stats*
Code:
Math.max(((a.level + 5) * (a.atk / a.mat) * (5 / (b.def / b.mdf))) * $gameTemp.tas_power, Math.floor(Math.random() * 3) + 1)
- Math.max(..., Math.floor(Math.random() * 3) + 1): Ensures the damage is at least a random number between 1 and 3.
- Math.floor(Math.random() * 3) + 1 generates a random number between 1 and 3.
Attacker Stats
- Level (a.level): 1
- Attack (a.atk): 2
- Magic Attack (a.mat): 3
Enemy Stats
- Defense (b.def): 100
- Magic Defense (b.mdf): 120
Step-by-Step Calculation
- Level and Constant Addition:
- a.level+5=1+5=6a.level + 5 = 1 + 5 = 6a.level+5=1+5=6
- Attack to Magic Attack Ratio:
- a.atka.mat=23≈0.67\frac{a.atk}{a.mat} = \frac{2}{3} \approx 0.67a.mata.atk=32≈0.67
- Defense to Magic Defense Ratio:
- b.defb.mdf=100120≈0.833\frac{b.def}{b.mdf} = \frac{100}{120} \approx 0.833b.mdfb.def=120100≈0.833
- Inverse of Defense to Magic Defense Ratio:
- 50.833≈6\frac{5}{0.833} \approx 60.8335≈6
- Combine Level, Attack Ratio, and Defense Ratio:
- 6×0.67×6≈24.126 \times 0.67 \times 6 \approx 24.126×0.67×6≈24.12
Worst Damage (worst timing, tas_power = 0)
- Worst Damage: Random value between 1 and 3 (1, 2, or 3)
Average Damage (average timing, tas_power = 0.5)
- Average Damage: 12.06
Best Damage (perfect timing, tas_power = 1)
- Best Damage: 24.12
Attacker Example Stats (Hero Lv.1)
- Level (a.level): 1
- Attack (a.atk): 2
- Magic Attack (a.mat): 3
- Defense (a.def): 4
- Magic Defense (a.mdf): 4
- HP (a.hp): 30
- Speed (a.spd): 50
Enemy Example Stats (Lv.1)
- Attack (b.atk): 2
- Defense (b.def): 100
- Magic Attack (b.mat): 3
- Magic Defense (b.mdf): 120
- HP (b.hp): 60
- Speed (b.spd): 50
Code:
Math.max(((b.level + 5) * (b.atk / b.mat) * (5 / (a.def / a.mdf))) * 0.5, Math.floor(Math.random() * 3) + 1)
Flipping the stats above results in the following damage for enemies to actors.
Worst Damage
- Worst Damage: Random value between 1 and 3 (1, 2, or 3)
Average Damage
- Average Damage: 6.03
Best Damage
- Best Damage: 12.06