Last active
August 12, 2019 08:11
-
-
Save fenying/c410101ec385dbd44dcc5ad93d355e26 to your computer and use it in GitHub Desktop.
[MapleStory] Calculate ignore ratio of monster defense.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculate the ignore ratio of monster defense. | |
* | |
* @param base The base ignore ratio, (Value: 0 ~ 1) | |
* @param ignoreItems The items of ignore addition to be added, (Value: 0 ~ 1) | |
*/ | |
function calcIgnoreMobDefnese(base, ignoreItems) { | |
return Math.floor(ignoreItems.reduce((p, v) => p + (1 - p) * v, base) * 100) / 100; | |
} | |
/** | |
* e.g. Now my ignore-ratio is 63%, If I get a new armors that add 45% and 15% ignore-ratio. | |
*/ | |
console.log(calcIgnoreMobDefnese(0.63, [0.45, 0.15])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment