新手问题 一个需要靠写 Ruby 通关的小游戏 遇到个问题

drine · September 26, 2013 · Last by luikore replied at September 26, 2013 · 2243 hits
class Player
 @health = 0

  def play_turn(warrior)
  @health = warrior.health
    if(warrior.feel.empty?)
      if(warrior.health < 15 && (@health < warrior.health))
        warrior.rest!
        @health = warrior.health
      else
        warrior.walk!
         @health = warrior.health
      end
    else
      warrior.attack!
    end
  end
end

为什么杀了那个弓箭手后不原地执行加血啊,哪里出问题了。。 https://www.bloc.io/ruby-warrior/#/warriors/51156/levels/4 传送门

&& (@health < warrior.health) ---> && (@health == warrior.health)

You need to Sign in before reply, if you don't have an account, please Sign up first.