Skip to content

Instantly share code, notes, and snippets.

@fenying
Created November 24, 2019 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fenying/3fec951c5d05fccab27505a2c47ec9b4 to your computer and use it in GitHub Desktop.
Save fenying/3fec951c5d05fccab27505a2c47ec9b4 to your computer and use it in GitHub Desktop.
[MapleStory] Calculate the average ATTACK added in a weapon by scrolls
/**
* 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