lib/GameApp.rb
# Presents the player with options for a journey. If the player chooses to fight, it will defer to instance methods of @journey which handle fight logic.
Presents the player with options for a journey. If the player chooses to fight, it will defer to instance methods of @journey which handle fight logic.
Presents the player with options for a journey . If the player chooses to fight it will defer to instance methods of @journey which handle fight logic .
def go_on_a_journey
    spooky_monster_generator
    Journey.start(@hero)
    @journey = Journey.last
    @monster = @journey.monster
    @hero = @journey.hero
    while @hero.current_health > 0 && @monster.current_health > 0
      display_title
      display_journey_text
      choice = @@prompt.select("What will you do now?", %w(Fight Flee))
      case choice
      when "Fight"
        puts "\n\n"
        @journey.fight
      when "Flee"
        flee
      end
      system("clear")
    end
    @monster.reset
    game_over if @hero.current_health == 0
    current_game
  end
def go_on_a_journey spooky_monster_generator Journey . start ( @hero ) @journey = Journey . last @monster = @journey . monster @hero = @journey . hero while @hero . current_health > 0 && @monster . current_health > 0 display_title display_journey_text choice = @@prompt . select ( "What will you do now?" , %w( Fight Flee ) ) case choice when "Fight" puts "\n\n" @journey . fight when "Flee" flee end system ( "clear" ) end @monster . reset game_over if @hero . current_health == 0 current_game end
Presents the player with options for a journey.
Presents the player with options for a journey .
# Initialize a journey for the hero. # Iterate in the journey unless hero dies, monster dies, or flee. # Reset the monster and return to current game menu, unless hero died.