Created
June 2, 2016 09:51
-
-
Save cornman0101/2003e014cb1e328203301ee30a5ab9b7 to your computer and use it in GitHub Desktop.
macros for destiny infusion calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void statFinal(int defense_initial, int stat_initial, int stat_min_max[2],int defense_final); | |
float fitValue(int defense); | |
void statFinal(int defense_initial, int stat_initial, int stat_min_max[2], int defense_final=335) | |
{ | |
stat_min_max[0] = floor((stat_initial+1.0)*fitValue(defense_final)/fitValue(defense_initial)); //max | |
stat_min_max[1] = floor((stat_initial)*fitValue(defense_final)/fitValue(defense_initial)); //min | |
}; | |
float fitValue(int defense) | |
{ | |
if(defense>300) | |
return(0.2546*defense-23.825); | |
if(defense>200) | |
return(0.1801*defense-1.4612); | |
else | |
return(-1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int statFinalMax(int defense_initial, int stat_initial,int defense_final); | |
int statFinalMin(int defense_initial, int stat_initial,int defense_final); | |
float fitValue(int defense); | |
int statFinalMax(int defense_initial, int stat_initial,int defense_final=335) | |
{ | |
return(floor((stat_initial+1.0)*fitValue(defense_final)/fitValue(defense_initial))); | |
}; | |
int statFinalMin(int defense_initial, int stat_initial,int defense_final=335) | |
{ | |
return(floor((stat_initial)*fitValue(defense_final)/fitValue(defense_initial))); | |
}; | |
float fitValue(int defense) | |
{ | |
if(defense>300) | |
return(0.2546*defense-23.825); | |
if(defense>200) | |
return(0.1801*defense-1.4612); | |
else | |
return(-1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lightweight should be slightly faster but the user could cause a memory leak if the user doesn't know how to safely pass by reference.
Safe should be fine for most people use cases.
There's a third option which I didn't include, basically, if you'll be making multiple calls (maybe 100?) to this for many armor pieces at the same time, it's better to drop the function "fitValue()" and replace it by loading into memory an array with the fit values for each defense. Then you replace the calls "fitValue(defense_final)" with fitValue[defense -199](details depend on array size). It requires an somewhat more advanced user. If someone doesn't know how to implement this safely and thinks they could benefit, leave a comment.