pfrpg_core 0.1.3 → 0.1.4
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/class_feature.rb +9 -0
- data/lib/pfrpg_core/derived/misc.rb +2 -2
- data/lib/pfrpg_core/feat_finder.rb +1 -1
- data/lib/pfrpg_core/feat_totaler.rb +11 -11
- data/lib/pfrpg_core/inventory.rb +2 -2
- data/lib/pfrpg_core/version.rb +1 -1
- data/test/feat_totaler_test.rb +2 -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: 610d988da2ebe77fd60c1f8ad1904f26a947d8df
|
4
|
+
data.tar.gz: 4601365c45fca1f5742d52005524ae05473eaa2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a21797c54385926b80bab3fad41628ce71ab8579b7eb29d7cd20fcc94cb9ac49cbb0a0cb112d9f241ad3f95c878ed208161995ec548e7d63ce9d306818b93ab8
|
7
|
+
data.tar.gz: eb5788cf0fef4992fff0f257a19ddee691d527bce3c09ab257b1ce07c2d33b3b5c6a703b594de8e3ed18d3411106e2528ba286118bc520c3772adbfaada23456
|
@@ -27,5 +27,14 @@ module PfrpgCore
|
|
27
27
|
name: @name
|
28
28
|
}
|
29
29
|
end
|
30
|
+
|
31
|
+
|
32
|
+
def self.granted_feature(feature_name, class_name)
|
33
|
+
c = PfrpgClasses::Heroclass.by_name(class_name)
|
34
|
+
f = Object::const_get("#{c.feature_type}").new()
|
35
|
+
f.ability_name = feature_name
|
36
|
+
f.class_name = class_name
|
37
|
+
f
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
@@ -5,7 +5,7 @@ module PfrpgCore
|
|
5
5
|
def level_string
|
6
6
|
str = "#{@alignment} :"
|
7
7
|
@levels.each do |l|
|
8
|
-
str += "#{l.
|
8
|
+
str += "#{l.classname}/#{l.rank}"
|
9
9
|
str += "*" if l.favored
|
10
10
|
end
|
11
11
|
str
|
@@ -97,7 +97,7 @@ module PfrpgCore
|
|
97
97
|
def misc_json
|
98
98
|
{
|
99
99
|
:initiative => initiative,
|
100
|
-
:alignment => @alignment,
|
100
|
+
:alignment => @alignment.alignment,
|
101
101
|
:speed => speed,
|
102
102
|
:hit_points => hit_points,
|
103
103
|
:feats => @feats,
|
@@ -3,7 +3,8 @@ module PfrpgCore
|
|
3
3
|
attr_reader :entity, :levels
|
4
4
|
def initialize(entity)
|
5
5
|
@entity = entity
|
6
|
-
@levels =
|
6
|
+
@levels = entity.levels
|
7
|
+
@total_level = levels.inject(0) { |sum, x| sum + x.rank }
|
7
8
|
end
|
8
9
|
|
9
10
|
def total
|
@@ -11,16 +12,16 @@ module PfrpgCore
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def level_granted
|
14
|
-
i = (1
|
15
|
+
i = (1..@total_level).inject(0) do |sum, x|
|
15
16
|
choices = PfrpgTables::Tables::LevelTable.for_level(x)[:choices]
|
16
|
-
sum
|
17
|
+
sum + (choices.select { |c| choice_is_feat(c) }).size
|
17
18
|
end
|
18
19
|
return i
|
19
20
|
end
|
20
21
|
|
21
22
|
def race_granted
|
22
23
|
i = entity.race.bonus_choices.inject(0) do |sum, x|
|
23
|
-
sum
|
24
|
+
sum + 1 if choice_is_feat(x)
|
24
25
|
end
|
25
26
|
return i
|
26
27
|
end
|
@@ -29,7 +30,7 @@ module PfrpgCore
|
|
29
30
|
i = entity.class_features.inject(0) do |sum, x|
|
30
31
|
if x.respond_to? 'granted_choice'
|
31
32
|
choices = [x.granted_choice].flatten
|
32
|
-
sum
|
33
|
+
sum + (choices.select { |c| choice_is_feat(c) }).size
|
33
34
|
end
|
34
35
|
end
|
35
36
|
return i || 0
|
@@ -37,14 +38,13 @@ module PfrpgCore
|
|
37
38
|
|
38
39
|
def choice_granted
|
39
40
|
choices = []
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
level = lvls[hc]
|
44
|
-
(1..level).each do |l|
|
41
|
+
@levels.each do |level|
|
42
|
+
clazz = PfrpgClasses::Heroclass.by_name(level.classname)
|
43
|
+
(1..level.rank).each do |l|
|
45
44
|
clazz.bonuses_for_level(l)[:choices].each do |choice|
|
46
45
|
if (choice_is_feat(choice))
|
47
|
-
|
46
|
+
#TODO : this wont support another object
|
47
|
+
choice.npc_id = entity.character_id
|
48
48
|
choices << choice
|
49
49
|
end
|
50
50
|
end
|
data/lib/pfrpg_core/inventory.rb
CHANGED
data/lib/pfrpg_core/version.rb
CHANGED
data/test/feat_totaler_test.rb
CHANGED