screab Posted September 19, 2017 Report Share Posted September 19, 2017 Hello, I can't really understand how does armor works. Can anyone explain to me the mechanics behind damage/armor so I can adjust my armor levels in a realistic way ? Thank you Quote Link to comment Share on other sites More sharing options...
rolf.sievers Posted September 19, 2017 Report Share Posted September 19, 2017 (edited) Quote Disregard the link (..), that is outdated information (last updated more than a decade ago...). Read through https://trac.wildfiregames.com/wiki/XML.Entity.Traits.Armour It provides a description and an example how Armor works. Edited September 20, 2017 by rolf.sievers Pull in a relevant quote. Quote Link to comment Share on other sites More sharing options...
Grugnas Posted September 19, 2017 Report Share Posted September 19, 2017 (edited) 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 September 19, 2017 by Grugnas Quote Link to comment Share on other sites More sharing options...
leper Posted September 19, 2017 Report Share Posted September 19, 2017 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). 1 2 Quote Link to comment Share on other sites More sharing options...
screab Posted September 24, 2017 Author Report Share Posted September 24, 2017 (edited) What does this code do from line 65 of https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/components/Armour.js#L46 strength = +this.template[type]; Edited September 24, 2017 by screab My bad Quote Link to comment Share on other sites More sharing options...
leper Posted September 25, 2017 Report Share Posted September 25, 2017 Get the strength of a specific damage type specified in the template as a number. + converts to a number in JS., this.template is a JS object representation of the given components data (obtained from the XML files). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.