arkaan 1.2.10 → 1.2.11
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 +4 -4
- data/lib/arkaan/campaigns/messages/diceroll.rb +12 -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: 82aa68bb4f6bce232d42d45f87f6c14c0e07440c
|
4
|
+
data.tar.gz: bb2a4b384892b5e13b79ff0cd9e381ce5adf9c5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecdcac9b934815ea41f52afc3be2c6fb600fde45b69cf9eeb10e16994512d1a130d8c3ca48820f2b8c921f7786aca122cc717c91add76837c0507efda85f9938
|
7
|
+
data.tar.gz: 906e1b8c58df10283f679f1f4933948da640a4e00db46f95459b60e557f200d8a0efdec0252cda2c2dc349d72b10ae3087cb833b72532b34187f33b01eea648b
|
@@ -15,6 +15,18 @@ module Arkaan
|
|
15
15
|
# @!attribute [rw] modifier
|
16
16
|
# @return [Integer] the value added to the sum of all dices to get the final result.
|
17
17
|
field :modifier, type: Integer, default: 0
|
18
|
+
# @!attribute [rw] results
|
19
|
+
# @return [Array<Integer>] an array of integers, each one of them representing the result for one of the dices.
|
20
|
+
field :results, type: Array, default: []
|
21
|
+
|
22
|
+
# Computes the results before saving the document, the first time it's saved.
|
23
|
+
before_save do |document|
|
24
|
+
if !document.persisted?
|
25
|
+
number_of_dices.times do
|
26
|
+
results << rand(document.number_of_faces) + 1
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
20
32
|
end
|