Created
July 7, 2014 13:49
-
-
Save cromulus/c5d5e84b29ca7e47efee to your computer and use it in GitHub Desktop.
Ethan's Ruby Warrior
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
class Player | |
attr_accessor :previous_health | |
def play_turn(warrior) | |
#warrior.walk!(:forward) | |
if warrior.health < 15 and warrior.feel.empty? | |
warrior.rest! | |
elsif warrior.feel.empty? | |
warrior.walk!(:forward) | |
else | |
warrior.attack!(:forward) | |
end | |
@previous_health=warrior.health | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment