Created
July 24, 2016 06:39
-
-
Save kozaru/81cb0bc7177cd89605233303f3e396d1 to your computer and use it in GitHub Desktop.
JSWarrior 途中 kazutake
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
jsWarrior.turn = function(warrior) { | |
// 前に敵がいたら | |
if(warrior.check() == "enemy") { | |
// 敵をアタック | |
warrior.attack(); | |
// 前に敵がいなかったら | |
} else { | |
//ヒットポイントが19より小さかったら | |
if( warrior.getHealth() < 19){ | |
// 後ろにあるく | |
warrior.walk('backward'); | |
//それ以外 | |
} else { | |
// 休む | |
warrior.rest(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment