Last active
December 28, 2015 13:39
-
-
Save zachwhalen/7508906 to your computer and use it in GitHub Desktop.
The core combat code for the MaryWashemon battle function
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
// left attacks right | |
// this is from patrick's code | |
// the 10 value below acts as the gas peddle | |
var modifier = Math.floor((Math.random() * ((left.attack - right.defense) + 10))); | |
var rightDamage = modifier * left.lvl + 1; | |
// right takes damage | |
right.hp -= rightDamage; | |
// right attacks left | |
var modifier = Math.floor((Math.random() * ((right.attack - left.defense) + 10))); | |
var leftDamage = modifier * right.lvl + 1; | |
// left takes damage | |
left.hp -= leftDamage; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment