pfrpg_core 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pfrpg_core/skills.rb +12 -2
- data/lib/pfrpg_core/version.rb +1 -1
- data/test/skills_test.rb +14 -0
- data/test/test_helper.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46b77135cb44d70be9a7a8016e3a16332b9e32e8
|
4
|
+
data.tar.gz: 1bd21a26bdd7b4f585ac9b7b1179f577f4dbef5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a89d1996ccfab038905f889af7c36a9d22dadc5b5034740f6eeb056916a72bd8c6411ffd487475b6ce545c3861725556c3bdd3ee3562e36774aac80108ece26
|
7
|
+
data.tar.gz: a7128e64b9ad51529775096d1d20972af547cd1e98870c0baafc4978e112656ad066fad618a6a10b3b6207e035deb1f425b2294c142b670fb1a873cb6ae248b5
|
data/lib/pfrpg_core/skills.rb
CHANGED
@@ -42,11 +42,21 @@ module PfrpgCore
|
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
45
|
+
def professional(class_skills, skill)
|
46
|
+
class_skills.find { |x| x.to_s.downcase['profession']} &&
|
47
|
+
skill[:skill].to_s.downcase['profession']
|
48
|
+
end
|
49
|
+
|
50
|
+
def crafty(class_skills, skill)
|
51
|
+
class_skills.find { |x| x.to_s.downcase['craft']} &&
|
52
|
+
skill[:skill].to_s.downcase['craft']
|
53
|
+
end
|
54
|
+
|
45
55
|
def is_class_skill?(skill, character)
|
46
56
|
found = character.levels.any? do |l|
|
47
57
|
(l.heroclass.skills.find { |x| x.to_s == skill[:skill].to_s } ||
|
48
|
-
|
49
|
-
|
58
|
+
professional(l.heroclass.skills, skill) ||
|
59
|
+
crafty(l.heroclass.skills, skill))
|
50
60
|
end
|
51
61
|
found ||= class_skill_bonuses(character).find do |x|
|
52
62
|
if x
|
data/lib/pfrpg_core/version.rb
CHANGED
data/test/skills_test.rb
CHANGED
@@ -125,4 +125,18 @@ class SkillsTest < Minitest::Test
|
|
125
125
|
assert s.is_class_skill?({ skill: MockSkill.new('profession - Nonsense (wis)')}, @c)
|
126
126
|
end
|
127
127
|
|
128
|
+
def test_all_crafts_are_class_skills
|
129
|
+
c = plain_wizard
|
130
|
+
c.base_skills = make_skills
|
131
|
+
skills = PfrpgCore::Skills.new(c)
|
132
|
+
|
133
|
+
assert s = skills.get_skill('Acrobatics')
|
134
|
+
|
135
|
+
assert s.is_class_skill?({ skill: MockSkill.new("Craft Alchemy (int)") } , @c)
|
136
|
+
assert s.is_class_skill?({ skill: MockSkill.new('Craft Armor (int)') }, @c)
|
137
|
+
assert s.is_class_skill?({ skill: MockSkill.new('Craft Locks (int)')} , @c)
|
138
|
+
assert s.is_class_skill?({ skill: MockSkill.new('craft Anything I want (int)')} , @c)
|
139
|
+
assert s.is_class_skill?({ skill: MockSkill.new('Craft Weapons (int)')}, @c)
|
140
|
+
end
|
141
|
+
|
128
142
|
end
|
data/test/test_helper.rb
CHANGED
@@ -62,6 +62,10 @@ module TestHelper
|
|
62
62
|
[ PfrpgCore::Level.new(Le.new('Fighter', 10, true))]
|
63
63
|
end
|
64
64
|
|
65
|
+
def wizard_levels
|
66
|
+
[ PfrpgCore::Level.new(Le.new('Wizard', 10, true))]
|
67
|
+
end
|
68
|
+
|
65
69
|
def plain_character
|
66
70
|
@bonuses = PfrpgCore::Bonuses.new
|
67
71
|
@attributes = PfrpgCore::Attributes.new(basic_attributes, @bonuses)
|
@@ -75,4 +79,18 @@ module TestHelper
|
|
75
79
|
@bonuses,
|
76
80
|
@saves)
|
77
81
|
end
|
82
|
+
|
83
|
+
def plain_wizard
|
84
|
+
@bonuses = PfrpgCore::Bonuses.new
|
85
|
+
@attributes = PfrpgCore::Attributes.new(basic_attributes, @bonuses)
|
86
|
+
@saves = PfrpgCore::SavingThrows.new(basic_saves, @bonuses, @attributes)
|
87
|
+
@levels = wizard_levels
|
88
|
+
|
89
|
+
return MockCharacter.new(PfrpgUtility::Alignment.new("CN"),
|
90
|
+
PfrpgRaces::Race.fetch('Human'),
|
91
|
+
@attributes,
|
92
|
+
@levels,
|
93
|
+
@bonuses,
|
94
|
+
@saves)
|
95
|
+
end
|
78
96
|
end
|