cinch-dicebag 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cinch/plugins/dicebag.rb +1 -1
- data/lib/cinch/plugins/dicebag/bag.rb +8 -8
- data/lib/cinch/plugins/dicebag/version.rb +1 -1
- data/spec/cinch-dicebag_spec.rb +18 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cadf85224bd800c25264d54cfee7bd153439006
|
4
|
+
data.tar.gz: aaa7727e81fd0826c4dff26ccd2bf0e530d4fdbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58eb0f35068118884637e3d32f89bdf49271899127fd137f1fe88b2eaadaa14f2eca75cff847b7bd8ac5304f157c1e578ce4516e62e30d1dc96f9ece2aa7e722
|
7
|
+
data.tar.gz: c10fafc541bba7b8f6817c01c17667d2e527fae5139ccf447993c0437c7e2c8cc9f819b5596917fce21ab7b39cfecb0ebb22f9fee87e74260673e412b339d4e3
|
@@ -27,7 +27,7 @@ module Cinch
|
|
27
27
|
def initialize(*args)
|
28
28
|
super
|
29
29
|
@storage = Cinch::Storage.new(config[:filename] || 'yaml/dice.yml')
|
30
|
-
@bag = Bag.new(4 => 250, 6 =>
|
30
|
+
@bag = Bag.new(4 => 250, 6 => 750, 10 => 1200, 20 => 1000)
|
31
31
|
end
|
32
32
|
|
33
33
|
# Roll a random assortment of dice, total the rolls, and record the score.
|
@@ -28,13 +28,13 @@ module Cinch
|
|
28
28
|
# @param [Fixnum] size The number of dice in the dicebag.
|
29
29
|
# @return [String] Description of the size of the bag.
|
30
30
|
def size
|
31
|
-
case count
|
32
|
-
when 0..
|
33
|
-
when
|
34
|
-
when
|
35
|
-
when
|
36
|
-
when
|
37
|
-
else '
|
31
|
+
case @count
|
32
|
+
when 0..1000 then 'tiny'
|
33
|
+
when 1001..1500 then 'small'
|
34
|
+
when 1501..2500 then 'medium'
|
35
|
+
when 2501..3500 then 'large'
|
36
|
+
when 3501..4500 then 'hefty'
|
37
|
+
else 'massive'
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -42,7 +42,7 @@ module Cinch
|
|
42
42
|
|
43
43
|
def die_array
|
44
44
|
@dice.keys.map do |sides|
|
45
|
-
"#{sides}d#{
|
45
|
+
"#{rand(@dice[sides])}d#{sides}"
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/spec/cinch-dicebag_spec.rb
CHANGED
@@ -172,7 +172,7 @@ describe Cinch::Plugins::Dicebag do
|
|
172
172
|
|
173
173
|
it 'should return \'huge\' for out of bounds queries' do
|
174
174
|
@bag.count = 50000
|
175
|
-
expect(@bag.size).to eq('
|
175
|
+
expect(@bag.size).to eq('massive')
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'should return the proper size for tiny range' do
|
@@ -181,83 +181,83 @@ describe Cinch::Plugins::Dicebag do
|
|
181
181
|
end
|
182
182
|
|
183
183
|
it 'should return the proper size for small range' do
|
184
|
-
@bag.count = rand(
|
184
|
+
@bag.count = rand(1000)
|
185
185
|
expect(@bag.size).to eq('tiny')
|
186
186
|
end
|
187
187
|
|
188
188
|
it 'should return the proper size for small range' do
|
189
|
-
@bag.count =
|
189
|
+
@bag.count = 1000
|
190
190
|
expect(@bag.size).to eq('tiny')
|
191
191
|
end
|
192
192
|
|
193
193
|
it 'should return the proper size for small range' do
|
194
|
-
@bag.count =
|
194
|
+
@bag.count = 1001
|
195
195
|
expect(@bag.size).to eq('small')
|
196
196
|
end
|
197
197
|
|
198
198
|
it 'should return the proper size for small range' do
|
199
|
-
@bag.count = rand(399) +
|
199
|
+
@bag.count = rand(399) + 1001
|
200
200
|
expect(@bag.size).to eq('small')
|
201
201
|
end
|
202
202
|
|
203
203
|
it 'should return the proper size for small range' do
|
204
|
-
@bag.count =
|
204
|
+
@bag.count = 1500
|
205
205
|
expect(@bag.size).to eq('small')
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'should return the proper size for medium range' do
|
209
|
-
@bag.count =
|
209
|
+
@bag.count = 1501
|
210
210
|
expect(@bag.size).to eq('medium')
|
211
211
|
end
|
212
212
|
|
213
213
|
it 'should return the proper size for medium range' do
|
214
|
-
@bag.count = rand(499) +
|
214
|
+
@bag.count = rand(499) + 1501
|
215
215
|
expect(@bag.size).to eq('medium')
|
216
216
|
end
|
217
217
|
|
218
218
|
it 'should return the proper size for medium range' do
|
219
|
-
@bag.count =
|
219
|
+
@bag.count = 2500
|
220
220
|
expect(@bag.size).to eq('medium')
|
221
221
|
end
|
222
222
|
|
223
223
|
it 'should return the proper size for large range' do
|
224
|
-
@bag.count =
|
224
|
+
@bag.count = 2501
|
225
225
|
expect(@bag.size).to eq('large')
|
226
226
|
end
|
227
227
|
|
228
228
|
it 'should return the proper size for large range' do
|
229
|
-
@bag.count = rand(499) +
|
229
|
+
@bag.count = rand(499) + 2501
|
230
230
|
expect(@bag.size).to eq('large')
|
231
231
|
end
|
232
232
|
|
233
233
|
it 'should return the proper size for large range' do
|
234
|
-
@bag.count =
|
234
|
+
@bag.count = 3500
|
235
235
|
expect(@bag.size).to eq('large')
|
236
236
|
end
|
237
237
|
|
238
238
|
it 'should return the proper size for hefty range' do
|
239
|
-
@bag.count =
|
239
|
+
@bag.count = 3501
|
240
240
|
expect(@bag.size).to eq('hefty')
|
241
241
|
end
|
242
242
|
|
243
243
|
it 'should return the proper size for hefty range' do
|
244
|
-
@bag.count = rand(499) +
|
244
|
+
@bag.count = rand(499) + 3501
|
245
245
|
expect(@bag.size).to eq('hefty')
|
246
246
|
end
|
247
247
|
|
248
248
|
it 'should return the proper size for hefty range' do
|
249
|
-
@bag.count =
|
249
|
+
@bag.count = 4500
|
250
250
|
expect(@bag.size).to eq('hefty')
|
251
251
|
end
|
252
252
|
|
253
253
|
it 'should return the proper size for huge range' do
|
254
|
-
@bag.count =
|
255
|
-
expect(@bag.size).to eq('
|
254
|
+
@bag.count = 4501
|
255
|
+
expect(@bag.size).to eq('massive')
|
256
256
|
end
|
257
257
|
|
258
258
|
it 'should return the proper size for huge range' do
|
259
259
|
@bag.count = 20001
|
260
|
-
expect(@bag.size).to eq('
|
260
|
+
expect(@bag.size).to eq('massive')
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-dicebag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Haberer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|