Jump to content

Damage formula


thankforpie
 Share

Recommended Posts

With a quick lookup

If ranged:

/**
* Take damage according to the entity's armor.
* @param {Object} strengths - { "hack": number, "pierce": number, "crush": number } or something like that.
* @param {number} multiplier - the damage multiplier.
* Returns object of the form { "killed": false, "change": -12 }.
*/
Armour.prototype.TakeDamage = function(strengths, multiplier = 1)
{
    if (this.invulnerable)
        return { "killed": false, "change": 0 };
 
    // Adjust damage values based on armour; exponential armour: damage = attack * 0.9^armour
    var armourStrengths = this.GetArmourStrengths();
 
    // Total is sum of individual damages
    // Don't bother rounding, since HP is no longer integral.
    var total = 0;
    for (let type in strengths)
        total += strengths[type] * multiplier * Math.pow(0.9, armourStrengths[type] || 0);
 
    // Reduce health
    var cmpHealth = Engine.QueryInterface(this.entity, IID_Health);
    return cmpHealth.Reduce(total);
};

strengths[type] *multiplier *(0.9^armourStrengths)

Edited by nani
  • Like 3
Link to comment
Share on other sites

If you select a unit and hover the mouse over the sword and shield icon you can see the armor values of that unit for each damage types (hack, pierce and slash) and the corresponding rounded relative damage reduction in % (1/100) behind that in brackets.

Considering a unit is hit the damage formula that is calculated here is:

[current health reduction of attacked unit] = [damage of attacking unit] * 0.9^[armor of attacked unit]

So the damage reduction shown in the game is: round(0.9^[armor of shown unit] / 100).

  • Like 2
Link to comment
Share on other sites

5 hours ago, FeXoR said:

If you select a unit and hover the mouse over the sword and shield icon you can see the armor values of that unit for each damage types (hack, pierce and slash) and the corresponding rounded relative damage reduction in % (1/100) behind that in brackets.

Considering a unit is hit the damage formula that is calculated here is:

[current health reduction of attacked unit] = [damage of attacking unit] * 0.9^[armor of attacked unit]

So the damage reduction shown in the game is: round(0.9^[armor of shown unit] / 100).

yeah i already calculated using nani's formula. but I didnt know that theres number showed in brackets. will help a lot lol. thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...