Class: Core::Game::Skills

Inherits:
Object show all
Defined in:
lib/game/skills.rb

Overview

skills and their respective levels, instanced once for every character

Instance Method Summary collapse

Constructor Details

#initializeSkills

Returns a new instance of Skills.



27
28
29
30
31
32
# File 'lib/game/skills.rb', line 27

def initialize
  @skills = {}
  Core::Game.skills.each { |skill|
    @skills.store(skill, 0)
  }
end

Instance Method Details

#advance(skill) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/game/skills.rb', line 38

def advance(skill)
  @skills.each { |s|
    if skill.class == s.class
      @skills[s] += 1
    end
  }
end

#level_to_s(skill) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/game/skills.rb', line 46

def level_to_s(skill)
  lvl = @skills[skill]
  case lvl
  when 0
    return Core::Trans.menu(:xp_none)
  when 1
    return Core::Trans.menu(:xp_vlittle)
  when 2
    return Core::Trans.menu(:xp_little)
  when 3
    return Core::Trans.menu(:xp_mediocre)
  when 4
    return Core::Trans.menu(:xp_experienced)
  when 5
    return Core::Trans.menu(:xp_vexperienced)
  end
end

#listObject



34
35
36
# File 'lib/game/skills.rb', line 34

def list
  return @skills
end