Combat Formulas
Damage Calculation:
If the damage is dealt by an NPC or Player pet, each step will also check for the pet's owner Minion Stats such as added minion damage, critical chance and so on.
You can have as many stats as you wish serving the same function or having the same type, while calculating damage or heal, every stat is looped through and will be properly added to the total amount.
- The initial damage is equal to the effect Damage Value
- If the damage effect has a main type such as physical or magical, we check every stat that has the matching function, and the full amount is added to the damage.
- We now apply the physical or magical resistances from the target, and reduce the damage amount accordingly.
- If the damage effect has a secondary damage type such as fire or any custom type you added, we check all the attacker's stats to find matching ones and we add their values to the damage.
- We apply the secondary resistances from the target such as fire resistance, as well as applying the penetration stats from the attacker, and adjust the damage amount accordingly.
- We add the skill modifier from the effect, based on the skill level.
- We now calculate if this damage should be critical or not based on the critical hit chance from the attacker.
- The max health modifier of the damage effect is added.
- The missing health modifier of the damage effect is added.
- If the effect is a damage over time and not instant, we add the Dot Damage modifier from the stats to the damage.
- We now apply the current damage dealt & taken from the attacker and target respectively. Coming from the stats.
- If the main damage type is physical, we calculate the block/dodge/Glancing Blow chance from the target.
- At this point, if the damage is above 0, we proceed with triggering the on hit effects as well as the combat text event.
- The final damage amount is returned and processed by the CombatManager.
Damage Example:
Let's say that we have a fireball ability. This ability has a fireball Damage effect, of type instant damage with a base value of 100.
Total Damage: 100
The fireball effect is of type magical damage, and we have a Intellect Stat of type Base Damage Type. Our character has 15 intellect, and each point gives 1 extra magical damage.
Total Damage: 115
The fireball effect is of type fire too, and our character currently has 20 fire damage.
Total Damage: 135
The target is a fire elemental, and have 40% fire resistance. 8 is removed from the 20 fire damage.
Our character has 10% fire penetration, so only 30% of the target's fire resistance is effective, so we only reduce the fire damage by 6.
Total Damage: 129
The fireball effect has the Alchemy skill attached to it, with a modifier of 1. Our character's alchemy skill level is 11, so we now add 11 extra damage.
Total Damage: 140
The fireball effect has a max health modifier of 10%. Our character's current max health is 100, so we add an extra 10 damage points.
Total Damage: 150
The fireball effect also has a missing health modifier of 0.1%. Our character's current health is 50. We add 0.1 damage point per percent of missing health.
Total Damage: 155
The current damage dealt modifier of our character is 120%, which means we add an extra 20% damage to the total amount. But first, we need to check the target's current damage taken modifier, and in this case it is 90% so it takes 10% reduced damage. We only increase our damage dealt by 10%.
Total Damage: 170