Jump to content

How does the armour work ?


screab
 Share

Recommended Posts

here you go:

Spoiler

 

EDIT: i just noticed that moving the code into the spoiler in order to shorten the message just removed the paste.

here you go:
 

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);
};

 

Edited by Grugnas
Link to comment
Share on other sites

Disregard the link above, that is outdated information (last updated more than a decade ago...).

https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/components/Armour.js#L46

If you want to know exactly.

Damage strength * 0.9^armour_strength

And the whole thing possibly multiplied by some multiplier (from damage bonuses, etc).

  • Like 1
  • Thanks 2
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...