module TreasureHunt::GameTurn

Public Class Methods

take_turn(p) click to toggle source
# File lib/treasure_game/game_turn.rb, line 8
def self.take_turn(p)
  treasure = TreasureHunt.random
  die = Die.new
  number_rolled = die.roll
  case number_rolled
    when 1..2
      p.hit
      puts "#{p} got hit."
      p.found_treasure(treasure)
    when 3..4
      puts "(#{p.name}) was skipped"
    else
      p.heal
      puts "#{p} drank a potion."
      p.found_treasure(treasure)
  end
end