pfrpg_utility 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92b320e2b683f526e24cc6de80b9cbb3d7e8f40f
|
4
|
+
data.tar.gz: 55aa60507d42a21cbf0ab9c7ea7b7f184bed2958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8f887daead6e47bf6178f5d7eb0931c00c0ccc482c641d3f29a61598fb11c77501068f8e2ef0b8a89804df19b5d32d0d45b152c0afecd84d0016a1b6cefa9ec
|
7
|
+
data.tar.gz: 6ad3fcc1ed98dfab90291a86aff93c67c990a969105bad7ceb6bd99a5b7848faf0ed196b7568a3b099c32e0f508c7e974d4b6a8fc4da3eeea46681fc7d84905b
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module PfrpgUtility
|
2
2
|
class Alignment
|
3
3
|
|
4
4
|
attr_reader :alignment
|
5
5
|
def initialize(alignment)
|
6
|
-
@alignment =
|
6
|
+
@alignment = PfrpgUtility::Alignment.parse(alignment)
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.filter_by_character(character)
|
data/lib/pfrpg_utility/dice.rb
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
# # => Dice.new(4, 6, 2)
|
35
35
|
# 4.d6 * 10 # => Dice.new(4, 6) * 10
|
36
36
|
# # => Dice.new(4, 6, 0, 10)
|
37
|
-
class
|
37
|
+
class PfrpgUtility::Dice
|
38
38
|
attr_reader :sides, :count, :increment, :multiplier
|
39
39
|
|
40
40
|
def initialize(count, sides, increment=0, multiplier=1)
|
@@ -45,13 +45,13 @@ class PfrpgCore::Dice
|
|
45
45
|
# Return a new Dice object, with the given multiplier. If the dice already
|
46
46
|
# have a multipler, it accumulates.
|
47
47
|
def *(n)
|
48
|
-
|
48
|
+
PfrpgUtility::Dice.new(count, sides, increment, multiplier * n)
|
49
49
|
end
|
50
50
|
|
51
51
|
# Return a new Dice object, with the given increment. If the dice already
|
52
52
|
# have an increment, it accumulates.
|
53
53
|
def +(n)
|
54
|
-
|
54
|
+
PfrpgUtility::Dice.new(count, sides, increment+n, multiplier)
|
55
55
|
end
|
56
56
|
|
57
57
|
# Same as adding a negative increment.
|
@@ -129,6 +129,6 @@ class Integer
|
|
129
129
|
# I'm aware of). Also, the optimist in me likes to think this is more
|
130
130
|
# efficient than method_missing, though I haven't done any benchmarks. :)
|
131
131
|
[4,6,8,10,12,20].each do |sides|
|
132
|
-
define_method("d#{sides}") {
|
132
|
+
define_method("d#{sides}") { PfrpgUtility::Dice.new(self, sides) }
|
133
133
|
end
|
134
134
|
end
|
data/lib/pfrpg_utility/effect.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class PfrpgUtility::Effect
|
2
2
|
attr_accessor :type, :key, :value, :affect
|
3
3
|
def initialize(type, key, value, affect=nil)
|
4
4
|
# standard effect proc; add a value
|
@@ -14,7 +14,7 @@ class PfrpgCore::Effect
|
|
14
14
|
|
15
15
|
def self.load(effects_string)
|
16
16
|
return effects_string if effects_string.instance_of? Array
|
17
|
-
return [ effects_string ] if effects_string.instance_of?
|
17
|
+
return [ effects_string ] if effects_string.instance_of? PfrpgUtility::Effect
|
18
18
|
return [] if effects_string.nil? || effects_string.empty?
|
19
19
|
unless effects_string.instance_of? String
|
20
20
|
ap "Error effect: "
|
@@ -29,7 +29,7 @@ class PfrpgCore::Effect
|
|
29
29
|
type = p[0]
|
30
30
|
key = p[1]
|
31
31
|
value = p[2]
|
32
|
-
|
32
|
+
PfrpgUtility::Effect.new(type, key, value)
|
33
33
|
end
|
34
34
|
|
35
35
|
def apply(character)
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module PfrpgUtility
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.1"
|
3
|
+
end
|