Created
January 17, 2022 13:54
-
-
Save isidore/44fd16b85d8b28052fea38a0e6b4421c to your computer and use it in GitHub Desktop.
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
public static int calculateDamageForDice(Character atk, Character def, int dice) | |
{ | |
boolean hits = def.getArmorClass() < atk.getForce() + dice; | |
if (hits && dice != 1) | |
{ | |
int modifier = dice == 20 ? 2 : 1; | |
return atk.getWeaponDamage() * modifier; | |
} | |
else | |
{ | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment