rollio 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/data/defy_danger.json +2 -2
- data/lib/rollio/cli.rb +16 -2
- data/lib/rollio/table_set.rb +7 -3
- data/lib/rollio/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18e2047afe90b85e9b68760f3786f6a9622f1f875c7a49c4afe578aa7b2bb3d8
|
4
|
+
data.tar.gz: 492ff64e298d773f3565b9f822b25cabfcd9bc7adb3206ae917ca3dcd7ccd630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21a3d3dc85ede1f4c1b8d5e2cb0b1fceb052e3ff6c92d9ba846b03a7989f7a6b01377eb4c583e2521787acfa4027ac48b4734616520a1dd08d9bbf90fbceeff0
|
7
|
+
data.tar.gz: 864d63a163d2c23cb56f6ead5957c8ce04c9867786698a5c5cedfb83413a66f7c01fb00df1105641a36920a4bb46b6b6f67542132b2a81c910bee2d9297d2f50
|
data/README.md
CHANGED
@@ -14,6 +14,7 @@ A tool for loading random tables, rolling on those tables, and rendering the out
|
|
14
14
|
- [X] Roll on tables (e.g. `rollio roll background`)
|
15
15
|
- [ ] Create structure for SWN batch of tables to roll at once
|
16
16
|
- [ ] Add ability to roll a dice expression via `rollio roll`
|
17
|
+
- [X] Add parameter -w to `rollio roll` that allows override
|
17
18
|
|
18
19
|
\* - By inner table logic I'm referring to "On a d10 table, when you roll a 9 or 10, roll on this table twice using a d8"
|
19
20
|
|
data/data/defy_danger.json
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
"label": "Defy Danger",
|
4
4
|
"roll": "2d6",
|
5
5
|
"entries": [
|
6
|
-
{ "range": [-1,0,1,2,3,4,5,6], "result": "You
|
6
|
+
{ "range": [-1,0,1,2,3,4,5,6], "result": "You flounder: the GM will make a hard move" },
|
7
7
|
{ "range": [7,8,9], "result": "You stumble, hesitate, or flinch: the GM will offer you a worse outcome, hard bargain, or ugly choice." },
|
8
|
-
{ "range": [10,11,12,13,14,15,16], "result": "You
|
8
|
+
{ "range": [10,11,12,13,14,15,16], "result": "You do it"}
|
9
9
|
]
|
10
10
|
}
|
data/lib/rollio/cli.rb
CHANGED
@@ -36,9 +36,23 @@ module Rollio
|
|
36
36
|
|
37
37
|
desc "roll <table>", "Roll on the given table"
|
38
38
|
option(:help, aliases: '-h')
|
39
|
+
option(
|
40
|
+
:with,
|
41
|
+
aliases: '-w',
|
42
|
+
desc: "Choose <with> which dice to roll"
|
43
|
+
)
|
39
44
|
def roll(table)
|
40
|
-
|
41
|
-
|
45
|
+
if options[:help]
|
46
|
+
help(__method__)
|
47
|
+
if table
|
48
|
+
puts "\nSee the \"#{table}\" below\n\n"
|
49
|
+
@registry.render(table: table)
|
50
|
+
end
|
51
|
+
return
|
52
|
+
end
|
53
|
+
args = [table]
|
54
|
+
args << { with: options[:with] } if options.key?(:with)
|
55
|
+
$stdout.puts @registry.roll_on(*args)
|
42
56
|
end
|
43
57
|
|
44
58
|
desc "render", "Render the stored tables"
|
data/lib/rollio/table_set.rb
CHANGED
@@ -28,10 +28,14 @@ module Rollio
|
|
28
28
|
tables[key] = Table.new(table_set: self, key: key, label: label, &block)
|
29
29
|
end
|
30
30
|
|
31
|
-
def render(debug: false)
|
31
|
+
def render(table: nil, debug: false)
|
32
32
|
puts "Table Set { object_id: #{object_id} }\n" if debug
|
33
|
-
|
34
|
-
table.render
|
33
|
+
if table
|
34
|
+
tables.fetch(table).render
|
35
|
+
else
|
36
|
+
tables.sort { |a,b| a[0] <=> b[0] }.each do |key, table|
|
37
|
+
table.render
|
38
|
+
end
|
35
39
|
end
|
36
40
|
nil
|
37
41
|
end
|
data/lib/rollio/version.rb
CHANGED