rpg-tools 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ Die: Models the use of a simple die (ie. D6, D10, D20, etc.)
6
6
  Throw: Takes an array of Die to be rolled and the offset to be added (ie. 2D6, 3D4+5, 2D10,3D20+2, etc.)
7
7
  CheckRoll: Using a Throw and a threshold models a check roll with one or several chances and some other settings (ie. 2D6 to get greater or equal to 10, 3D10 to get les than 15, etc.)
8
8
 
9
- These tools try to be flexible, general and powerful. Most of Die representation in other gems do the job of a Throw (a pack of Dice with a offset) or just return the result of ten rolls as single Fixum giving no information of each of the single ten rolls (which may be important if you want to have detailed info or want to give feedback to the user). With RPG Tools each object acts as it should: a Die acts as a Die, with no more functionality than a normal Die and each. Also each roll has all the information needed just if you want it. By default rolling a Throw just returns the total amount, but if you ask for a detailed roll you will get the total amount and the result of each dice of the Throw.
9
+ These tools try to be flexible, general and powerful. Most of Die representation in other gems do the job of a Throw (a pack of Dice with a offset) or just return the result of ten rolls as single Fixum giving no information of each of the single ten rolls (which may be important if you want to have detailed info or want to give feedback to the user). With RPG Tools each object acts as it should: a Die acts as a Die, with no more functionality than a normal Die. Also each roll has all the information needed just if you want it. By default rolling a Throw just returns the total amount, but if you ask for a detailed roll you will get the total amount and the result of each die of the Throw.
10
10
 
11
11
  h2. Installation
12
12
 
@@ -23,7 +23,19 @@ module Tools
23
23
  end
24
24
  return results
25
25
  end
26
-
26
+
27
+ # Adds delta to the offset value
28
+ def add_offset delta
29
+ @offset+= delta
30
+ self
31
+ end
32
+
33
+ # Subtracts delta to the offset value
34
+ def substract_offset delta
35
+ @offset-= delta
36
+ self
37
+ end
38
+
27
39
  # Returns the Trhow as a string with the format aDx,bDy,cDz+n, where a,b,c are the number of dice,
28
40
  # x,y,z are the number of sides and n the offset. Example "D6,D20,D100+8", etc.
29
41
  def to_s
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rpg-tools"
3
- s.version = "0.2.3"
3
+ s.version = "0.2.4"
4
4
  s.authors = ["Eduardo Casanova Cuesta"]
5
5
  s.summary = "RPG Tools is a compilation of helpful tools when developing a Role Playing Game (RPG). For now the gem has three classes: Die, Throw and CheckRoll. "
6
6
  s.description = "RPG Tools is a compilation of helpful tools when developing a Role Playing Game (RPG). For now the gem has three classes: Die, Throw and CheckRoll."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpg-tools
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eduardo Casanova Cuesta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-22 00:00:00 +02:00
18
+ date: 2011-08-25 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency