wynnbuilder-forked-for-changes/build_utils.js

42 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-01-19 17:32:27 +00:00
/*Turns the input amount of skill points into a float precision percentage.
* @param skp - the integer skillpoint count to be converted
*/
function skillPointsToPercentage(skp){
2021-02-12 17:00:06 +00:00
/*if (skp<=0){
2021-01-19 17:32:27 +00:00
return 0.0;
}else if(skp>=150){
return 0.808;
}else{
return (-0.0000000066695* Math.pow(Math.E, -0.00924033 * skp + 18.9) + 1.0771);
//return(-0.0000000066695* Math.pow(Math.E, -0.00924033 * skp + 18.9) + 1.0771).toFixed(3);
2021-02-12 17:00:06 +00:00
}*/
//return Math.min(Math.max(0.00,(-0.0000000066695* Math.pow(Math.E, -0.00924033 * skp + 18.9) + 1.0771)),.808);
return clamp((-0.0000000066695* Math.pow(Math.E, -0.00924033 * skp + 18.9) + 1.0771), 0.00, 0.808);
2021-01-19 17:32:27 +00:00
}
/*Turns the input amount of levels into skillpoints available.
*
* @param level - the integer level count to be converted
2021-01-19 17:32:27 +00:00
*/
function levelToSkillPoints(level){
if(level < 1){
return 0;
}else if(level >= 101){
return 200;
}else{
return (level - 1) * 2;
}
}
/*Turns the input amount of levels in to base HP.
* @param level - the integer level count to be converted
*/
function levelToHPBase(level){
if(level < 1){ //bad level
return this.levelToHPBase(1);
}else if (level > 106){ //also bad level
return this.levelToHPBase(106);
}else{ //good level
return 5*level + 5;
}
}