Class: Partyhat::Skill
- Inherits:
-
Stat
- Object
- Stat
- Partyhat::Skill
show all
- Defined in:
- lib/partyhat/skill.rb
Constant Summary
Constants inherited
from Stat
Partyhat::Stat::ActivitiesList, Partyhat::Stat::CombatSkillsList, Partyhat::Stat::HumanNames, Partyhat::Stat::List, Partyhat::Stat::SkillsList
Instance Method Summary
collapse
Methods inherited from Stat
human_name_for
Constructor Details
#initialize(name, level, experience, rank) ⇒ Skill
Returns a new instance of Skill.
8
9
10
11
12
13
14
15
16
|
# File 'lib/partyhat/skill.rb', line 8
def initialize name, level, experience, rank
raise ArgumentError, 'Invalid skill name "' + name.to_s + '"' unless (SkillsList+[:overall]).include? name
@name = name
@level = level < 0 ? nil : level
@experience = experience < 0 ? nil : experience
@rank = rank < 0 ? nil : rank
end
|
Instance Method Details
#compare_to(another_skill) ⇒ Object
38
39
40
|
# File 'lib/partyhat/skill.rb', line 38
def compare_to another_skill
Partyhat::SkillComparison.new(self, another_skill)
end
|
#experience ⇒ Object
30
31
32
|
# File 'lib/partyhat/skill.rb', line 30
def experience
@experience
end
|
#level ⇒ Object
26
27
28
|
# File 'lib/partyhat/skill.rb', line 26
def level
@level
end
|
#name ⇒ Object
18
19
20
|
# File 'lib/partyhat/skill.rb', line 18
def name
@name
end
|
#rank ⇒ Object
34
35
36
|
# File 'lib/partyhat/skill.rb', line 34
def rank
@rank
end
|