You will probably not understand the script code (no offense) but here are the algorithems in words:
RPGXP's default battle system uses the following formulas.
The active battler is represented by A, where the battler who is the target for A's actions is represented by B.
First HitNormal attacks:>> First hit rate = Hit rate of A's state
Skills:- Attack power F is 1 or greater (physical attack)
>> First hit rate = Skill's hit rate × hit rate of A's state ÷ 100 - Attack power F is 0 (non-physical attack)
>> First hit rate = Skill's hit rate
Items:>> First hit rate = Item's hit rate
- If A's condition is normal, the state hit rate is 100.
Critical HitNormal attacks:>> Critical hit rate = 4 × A's dexterity ÷ B's agility
Skills and Items:>> Critical hit rate = 0
Calculating DamageNormal attacks:Power = A's attack power - (B's physical defense ÷ 2)
Rate = 20 + A's strength
Variance = 15
Skills:Rate = 20
+ (A's strength × skill's strength F ÷ 100)
+ (A's dexterity × skill's dexterity F ÷ 100)
+ (A's agility × skill's agility F ÷ 100)
+ (A's intelligence × skill's intelligence F ÷ 100)
Variance = Skill's variance
Items:Rate = 20
Variance = Item's variance
Damage = force × multiplier ÷ 20 × elemental modifier × critical modifier × defense modifier (± variance %)
- Elemental modifier: The weakest of B's effective elements corresponding to the action's element(s). A: 200%, B: 150%, C: 100%, D: 50%, E: 0%, F: -100% Reduced by half if B's armor or state has a defending (opposing) element. When there are more than one of the same defending elements, the damage may be halved multiple times.
- Critical modifier: Equals 2 when the damage is positive and a critical hit is made.
- Defense modifier: Equals 1/2 when the damage is positive and B is defending.
Second Hit- Damage is positive:
- B's condition is normal:
Evasion = 8 × B's agility ÷ A's dexterity + B's evasion modifier
- Normal attacks:
Second hit rate = 100 - evasion - Skills:
Second hit rate = 100 - (evasion × skill's evasion F ÷ 100) - Items:
Second hit rate = 100
- B has "Can't Evade" state:
Second hit rate = 100
- Damage is negative (recovery):
Second hit rate = 100
Successful EscapeSuccessful escape rate = 50 × actors' average agility ÷ enemies' average agility
Me™