mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Use es2015 default args
This commit is contained in:
@@ -21,20 +21,11 @@ import t from '../helpers/translator';
|
|||||||
Note, user.stats.mp is docked after automatically (it's appended to functions automatically down below in an _.each)
|
Note, user.stats.mp is docked after automatically (it's appended to functions automatically down below in an _.each)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function diminishingReturns(bonus, max, halfway) {
|
function diminishingReturns(bonus, max, halfway=max/2) {
|
||||||
if (halfway == null) {
|
|
||||||
halfway = max / 2;
|
|
||||||
}
|
|
||||||
return max * (bonus / (bonus + halfway));
|
return max * (bonus / (bonus + halfway));
|
||||||
};
|
};
|
||||||
|
|
||||||
function calculateBonus(value, stat, crit, stat_scale) {
|
function calculateBonus(value, stat, crit=1, stat_scale=0.5) {
|
||||||
if (crit == null) {
|
|
||||||
crit = 1;
|
|
||||||
}
|
|
||||||
if (stat_scale == null) {
|
|
||||||
stat_scale = 0.5;
|
|
||||||
}
|
|
||||||
return (value < 0 ? 1 : value + 1) + (stat * stat_scale * crit);
|
return (value < 0 ? 1 : value + 1) + (stat * stat_scale * crit);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user