-
-
Save marcamillion/0f0677f012e82fc75b77 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
class Player | |
def play_turn(warrior) | |
if warrior.feel.empty? && !taking_damage?(warrior) && warrior.health < 20 | |
warrior.rest! | |
elsif warrior.feel.empty? | |
warrior.walk! | |
else | |
warrior.attack! | |
end | |
@health = warrior.health | |
end | |
def taking_damage?(warrior) | |
warrior.health < @health | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment