-
Notifications
You must be signed in to change notification settings - Fork 838
JimzBeginner
Daniel Hug edited this page Apr 8, 2015
·
4 revisions
Sorry for the messiness and Yes, I am a dirty programmer... I just learn ruby for a day only.
class Player
def play_turn(warrior)
# add your code here
@backward ||= 0
if warrior.look(:backward)[0].to_s == "nothing"
if warrior.look(:backward)[1].to_s == "nothing"
if warrior.look(:backward)[2].to_s == "Wizard" or warrior.look(:backward)[2].to_s == "Thick Sludge" or warrior.look(:backward)[2].to_s == "Archer" or warrior.look(:backward)[2].to_s == "Sludge"
warrior.shoot!(:backward)
@backward = 1
elsif warrior.look(:backward)[2].to_s == "Captive"
warrior.walk!(:backward)
@backward = 1
end
elsif warrior.look(:backward)[1].to_s == "Wizard" or warrior.look(:backward)[1].to_s == "Thick Sludge" or warrior.look(:backward)[1].to_s == "Archer" or warrior.look(:backward)[1].to_s == "Sludge"
warrior.shoot!(:backward)
@backward = 1
elsif warrior.look(:backward)[1].to_s == "Captive"
warrior.walk!(:backward)
@backward = 1
end
elsif warrior.feel(:backward).enemy?
warrior.attack!(:backward)
@backward = 1
elsif warrior.feel(:backward).captive?
warrior.rescue!(:backward)
@backward = 1
end
if @backward == 0
if warrior.look[0].to_s == "nothing"
if warrior.look[1].to_s == "nothing"
if warrior.look[2].to_s == "Wizard" or warrior.look[2].to_s == "Thick Sludge" or warrior.look[2].to_s == "Archer" or warrior.look[2].to_s == "Sludge"
warrior.shoot!
else
warrior.walk!
end
elsif warrior.look[1].to_s == "Wizard" or warrior.look[1].to_s == "Thick Sludge" or warrior.look[1].to_s == "Archer" or warrior.look[1].to_s == "Sludge"
warrior.shoot!
else
warrior.walk!
end
elsif warrior.feel.captive?
warrior.rescue!
elsif warrior.feel.enemy?
warrior.attack!
elsif warrior.feel.wall?
warrior.pivot!
end
end
@backward = 0
end
end