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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d0aa9c4483f81b38ceb0950944e233824899b35
4
- data.tar.gz: 1a5bd90ae1c93c8fe7215552d9b60217499a3b4e
3
+ metadata.gz: 46b77135cb44d70be9a7a8016e3a16332b9e32e8
4
+ data.tar.gz: 1bd21a26bdd7b4f585ac9b7b1179f577f4dbef5b
5
5
  SHA512:
6
- metadata.gz: a3d1101669ad750e0fd80ade484096476a9eda65b4c08e46469355d2272186a72e33ec17b42922ad38e78651b5a02bafe727e655ad218b6566fe1a59c3eed60b
7
- data.tar.gz: 9b79de53a5b8f8005704d94d89b29678938f2b8501c7139e5ed1ae0a1753825c968c171efe6f64a9b3967b2608e3e3d83e005d9f08c3132c427c65c354a81d93
6
+ metadata.gz: 4a89d1996ccfab038905f889af7c36a9d22dadc5b5034740f6eeb056916a72bd8c6411ffd487475b6ce545c3861725556c3bdd3ee3562e36774aac80108ece26
7
+ data.tar.gz: a7128e64b9ad51529775096d1d20972af547cd1e98870c0baafc4978e112656ad066fad618a6a10b3b6207e035deb1f425b2294c142b670fb1a873cb6ae248b5
@@ -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
- (l.heroclass.skills.find { |x| x.to_s.downcase['profession']} &&
49
- skill[:skill].to_s.downcase['profession']))
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
@@ -1,3 +1,3 @@
1
1
  module PfrpgCore
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pfrpg_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan OMara