shared-code-crit

This commit is contained in:
Victor Piousbox
2016-04-11 00:28:33 +00:00
parent 2f4f62f342
commit 2d69285080
3 changed files with 20 additions and 10 deletions

View File

@@ -1,12 +1,6 @@
module.exports = function(user, stat, chance) {
var s;
if (stat == null) {
stat = 'str';
}
if (chance == null) {
chance = .03;
}
s = user._statsComputed[stat];
module.exports = function crit (user, stat = 'str', chance = 0.03) {
let s = user._statsComputed[stat];
if (user.fns.predictableRandom() <= chance * (1 + s / 100)) {
return 1.5 + 4 * s / (s + 200);
} else {