Overview
Starting from version 1.3.2, the “Attack Settings” execution action allows you to customize the damage calculation formula.
You can set separate formulas for normal damage and critical damage.
Explanation of Custom Damage Formulas
Custom damage formulas can be written using variables from both the attacker and the defender.
You can write them in the format a(Attacker).{Attacker Variable Name} * b(Defender).{Defender Variable Name}. In addition to variables, you can use special reserved expressions.
Reserved expressions are derived from parts of the default (LEGACY) damage calculation formula and include the following:
- attack: The attack value after applying basic calculations, attack randomness, AttackSettings multiplier, and critical multiplier.
- attack_base: The raw attack value drawn between the minimum and maximum attack power.
- attack_rate: The attack multiplier in [AttackSettings]. If 100%, this is 1.0.
- critical_multiplier: The multiplier during critical hits. If not a critical hit, this is 1.0.
- attribute_damage_rate: The attribute damage reduction rate in [TakenDamageSettings]. If 100%, this is 1.0.
- base_damage_rate: The base damage rate of the damage recipient. If 100%, this is 1.0.
- damage_rate: The damage multiplier after basic calculations, calculated as
attribute_damage_rate * base_damage_rate.
Examples of Damage Formula Writing
Default (LEGACY) Formula
a.attack * b.attribute_damage_rate * b.base_damage_rate
This formula represents:
(The attacker’s attack value after applying attack randomness, AttackSettings multiplier, and critical multiplier)
*
(The defender’s attribute damage reduction rate from [TakenDamageSettings])
*
(The defender’s base damage rate from [BaseSettings])
Custom Example 1: Adding Defense
- Add a new variable named “def” to the defender’s [VariableSettings].
- Use the following formula:
a.attack * b.attribute_damage_rate * b.base_damage_rate - b.def/2
This formula subtracts half of the defender’s defense value from the base damage calculation.
Custom Example 2: Using Attacker’s Defense for Attack
- Add a new variable named “def” to the attacker’s [VariableSettings].
- Use the following formula:
a.def * a.critical_multiplier * b.attribute_damage_rate * b.base_damage_rate
In this case, the damage amount is determined by the attacker’s defense value multiplied by the critical multiplier.