Created
May 17, 2021 15:51
-
-
Save musou1500/9d38030177e4cc2123979e21224c3f29 to your computer and use it in GitHub Desktop.
Genshin Swirl Damage Calculator
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
export const debuffResistance = (orig: number, debuff: number) => { | |
if (orig < debuff) { | |
return -(debuff - orig) / 2; | |
} else { | |
return orig - debuff; | |
} | |
}; | |
export const swirl = ( | |
char: { | |
level: number; | |
em: number; | |
reactionBonus: number; | |
}, | |
enemy: { resistance: number; level: number } | |
) => { | |
const baseDmg = [10, 20, 48, 82, 124, 194, 294, 432, 568, 722]; | |
if (char.level <= 0 || char.level % 10 !== 0) { | |
throw new Error("invalid char level"); | |
} | |
const levelMultiplier = baseDmg[char.level / 10]; | |
const emBonus = (6.66 * char.em) / (char.em + 1400); | |
const resMultiplier = 1 - enemy.resistance; | |
return ( | |
levelMultiplier * | |
(1 + emBonus + char.reactionBonus) * | |
resMultiplier | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment