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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6d9919949718ff310a8dfdc0100df7c723b65674f43434e750412c52383b265
4
- data.tar.gz: 7fd4483fd44dec675c22ace6269e1e4e95313c81ad4b84d8f0508cad7b8eb2fe
3
+ metadata.gz: 18e2047afe90b85e9b68760f3786f6a9622f1f875c7a49c4afe578aa7b2bb3d8
4
+ data.tar.gz: 492ff64e298d773f3565b9f822b25cabfcd9bc7adb3206ae917ca3dcd7ccd630
5
5
  SHA512:
6
- metadata.gz: 37ee8ea172926651aa22d54479b369752685278544ca5a93a8425361ba6e98ae63daad182485e0a789058638394b3998a6bd68eaf254072b358aed0966c1c7dc
7
- data.tar.gz: 6c31a6c62645d7bfc6d93f8774ef5a864ae221e0d077fb37243e9105d561b16921040dbd64189233c502b6aa4a2a28ec92d44fdd88aae2b695405ec2bf957fff
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
 
@@ -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 do it"},
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 flounder: the GM will make a hard move"}
8
+ { "range": [10,11,12,13,14,15,16], "result": "You do it"}
9
9
  ]
10
10
  }
@@ -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
- help(__method__) and return if options[:help]
41
- $stdout.puts @registry.roll_on(table)
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"
@@ -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
- tables.sort { |a,b| a[0] <=> b[0] }.each do |key, table|
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
@@ -1,3 +1,3 @@
1
1
  module Rollio
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen