Created
November 24, 2019 09:47
-
-
Save fenying/3fec951c5d05fccab27505a2c47ec9b4 to your computer and use it in GitHub Desktop.
[MapleStory] Calculate the average ATTACK added in a weapon by scrolls
This file contains 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
/** | |
* Calcuate the used scrolls of a weapon. | |
* | |
* @param baseAttack The base attack | |
* @param totalAttack The total attack | |
* @param sparkAttack The ATTACK added by spark | |
* @param appliedScrolls The quantity of scrolls applied. | |
* @param appliedStars The quantity of stars applied. | |
*/ | |
function calcWeaponScroll( | |
baseAttack: number, | |
totalAttack: number, | |
sparkAttack: number, | |
appliedScrolls: number, | |
appliedStars: number | |
): number { | |
totalAttack -= sparkAttack; | |
while (appliedStars-- > 0) { | |
totalAttack -= Math.floor(totalAttack / 50); | |
} | |
return (totalAttack - baseAttack) / appliedScrolls; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment