RpgTools 0.3.0 → 0.3.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 +4 -4
- data/README.md +1 -1
- data/lib/rpg_tools/dice.rb +4 -4
- data/rpg_tools.gemspec +2 -2
- data/spec/dice_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76b4b5396a8ebfd678ca5ac5dbf115c3d0eeb028
|
4
|
+
data.tar.gz: dcf5233ee0231ad7b1977c4800ac857472f13150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a80e08868aee9e9ab8861b8a71c0593020923db1458e9cab1a55f63869a32b2744a013f9a31d91af467c6e9aa3f9febb0a4d94685a1127f02a9492f1aab2c4b1
|
7
|
+
data.tar.gz: cdc14519c78f42c845654783a6f2c39753b8f4572900b84daec2f4a4babddb1e4ddbc19dc99498bdff749f491e9a47427d4447f000db1bc030aa3a88fd9c2b19
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ A gem that gives you tools for your RPGs : dices, coins, cards !
|
|
6
6
|
## Usage
|
7
7
|
|
8
8
|
* <tt>RpgTools::Coin.flip</tt> returns a "heads" or "tails" string.
|
9
|
-
* <tt>RpgTools::Dice.
|
9
|
+
* <tt>RpgTools::Dice.roll(arg)</tt> returns an array of dices of your choice (arg format : "1d6", "4D10", "1d6+3" or "4D6-1" for example).
|
10
10
|
* <tt>RpgTools::Card.pick</tt> returns a card of a 52 cards deck + 2 jokers.
|
11
11
|
|
12
12
|
## Contributing
|
data/lib/rpg_tools/dice.rb
CHANGED
@@ -15,11 +15,11 @@ module RpgTools
|
|
15
15
|
return standard_roll(dices, max_value) if dice =~ /^\d+[Dd]\d+$/
|
16
16
|
|
17
17
|
# We apply bonuses/maluses properly if any
|
18
|
-
if dice =~ /^\d+
|
19
|
-
bonus = dice.gsub(/^\d+
|
18
|
+
if dice =~ /^\d+[Dd]\d+(\+)(\d+)/
|
19
|
+
bonus = dice.gsub(/^\d+[Dd]\d+(\+)/, '').to_i
|
20
20
|
roll_with_bonus(dices, max_value, bonus)
|
21
|
-
elsif dice =~ /^\d+
|
22
|
-
malus = dice.gsub(/^\d+
|
21
|
+
elsif dice =~ /^\d+[Dd]\d+(\-)(\d+)/
|
22
|
+
malus = dice.gsub(/^\d+[Dd]\d+(\-)/, '').to_i
|
23
23
|
roll_with_malus(dices, max_value, malus)
|
24
24
|
else
|
25
25
|
true
|
data/rpg_tools.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{RpgTools}
|
3
|
-
s.version = '0.3.
|
3
|
+
s.version = '0.3.1'
|
4
4
|
s.author = 'Yohan Piron'
|
5
5
|
s.email = 'yinfei84@gmail.com'
|
6
|
-
s.date = %q{
|
6
|
+
s.date = %q{2015-01-07}
|
7
7
|
s.summary = %q{RpgTools is a toolbox for tabletop games and RPGs}
|
8
8
|
s.description = 'RpgTools gives you tools for your RPGs : dices, coins, cards...'
|
9
9
|
s.homepage = 'https://github.com/Yinfei/rpg_tools.git'
|
data/spec/dice_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RpgTools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yohan Piron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|