Merge branch 'shared-code-random-drop' of https://github.com/piousbox/habitrpg into piousbox-shared-code-random-drop2

This commit is contained in:
Matteo Pagliazzi
2016-04-19 12:07:18 +02:00
8 changed files with 271 additions and 58 deletions

View File

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