mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
* wip: add task scoring and persist checklist items * remove unused files, fix checklist scoring and start adding support for groups tasks * amke group and challenge tasks not scoreable
14 lines
348 B
JavaScript
14 lines
348 B
JavaScript
import predictableRandom from './predictableRandom';
|
|
import statsComputed from '../libs/statsComputed';
|
|
|
|
function crit (user, stat = 'str', chance = 0.03) {
|
|
let s = statsComputed(user)[stat];
|
|
if (predictableRandom(user) <= chance * (1 + s / 100)) {
|
|
return 1.5 + 4 * s / (s + 200);
|
|
} else {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
module.exports = { crit };
|