class Town

Public Class Methods

new() click to toggle source
# File lib/places.rb, line 8
def initialize
  # Town is only available as an option in the Dungeon (to return to)
  # initialize is only called the first time, so this greeting is only seen once
  puts "These things always start the same way and your adventure is no exception..."
  puts "You walk into town, scanning each nook and cranny. Most faces are friendly,"
  puts "some are not..."
end

Public Instance Methods

choices() click to toggle source
# File lib/places.rb, line 16
def choices
  move = 0
  until move == "3"
    begin
      load_data
      puts # formatting
      puts bar_top.yellow
      puts stat_bar(@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana)
      puts bar_low.yellow
      puts # formatting
      c = Choice.new "Please choose where you will head next:",
        {
          "1" => "The Dungeon",
          "2" => "Ye Old Tavern",
          "3" => "Exit Game"
        }
      move = c.prompt
    end while not (move == "1" or move == "2" or move == "3")
    case
    when move == "1"
      Dungeon.new.choices
    when move == "2"
      Tavern.new.choices
    when move == "3"
      # save the player's stats before exit
      save_data
      exit
    end
  end
end