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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...