Created
April 22, 2016 05:05
-
-
Save TheRealNOIG/3dda4ddb63d0595aba2567cd456ef58b 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 @shotNextTime == true | |
warrior.shoot! | |
if !warrior.look.any? { |space| space.enemy? } | |
@shotNextTime = false | |
end | |
elsif warrior.look(:backward).any? { |space| space.enemy? } | |
warrior.pivot! | |
@shotNextTime = true; | |
elsif warrior.look.any? { |space| space.enemy? } | |
warrior.shoot! | |
elsif warrior.feel.wall? | |
warrior.pivot! | |
elsif warrior.feel.empty? && warrior.health <= 18 && warrior.health >= @health | |
warrior.rest! | |
elsif warrior.feel.empty? | |
warrior.walk! | |
elsif warrior.feel.captive? | |
warrior.rescue! | |
elsif warrior.feel.wall? | |
warrior.pivot! | |
else | |
warrior.attack! | |
end | |
@health = warrior.health | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment