fools 0.0.4

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.
Files changed (66) hide show
  1. data/COPYING +674 -0
  2. data/History.txt +4 -0
  3. data/Manifest.txt +65 -0
  4. data/PostInstall.txt +31 -0
  5. data/README.rdoc +73 -0
  6. data/Rakefile +24 -0
  7. data/bin/carps_fools +27 -0
  8. data/bin/register_carps_fools +35 -0
  9. data/features/character_sheet.feature +35 -0
  10. data/features/dice.feature +28 -0
  11. data/features/dm_interface.feature +19 -0
  12. data/features/launch_dm.feature +10 -0
  13. data/features/launch_player.feature +9 -0
  14. data/features/player_interface.feature +19 -0
  15. data/features/rules.feature +66 -0
  16. data/features/step_definitions/common_steps.rb +168 -0
  17. data/features/steps/character_sheet.rb +152 -0
  18. data/features/steps/dice.rb +19 -0
  19. data/features/steps/dm_interface.rb +21 -0
  20. data/features/steps/dm_mod.rb +6 -0
  21. data/features/steps/dm_test_mailer.rb +23 -0
  22. data/features/steps/general.rb +7 -0
  23. data/features/steps/interface.rb +10 -0
  24. data/features/steps/launch_dm.rb +12 -0
  25. data/features/steps/launch_player.rb +6 -0
  26. data/features/steps/player_interface.rb +45 -0
  27. data/features/steps/player_mod.rb +6 -0
  28. data/features/steps/player_test_mailer.rb +27 -0
  29. data/features/steps/resource.rb +5 -0
  30. data/features/steps/rules.rb +144 -0
  31. data/features/support/common.rb +29 -0
  32. data/features/support/env.rb +4 -0
  33. data/features/support/matchers.rb +11 -0
  34. data/lib/fools/dm/interface.rb +97 -0
  35. data/lib/fools/dm/launch.rb +40 -0
  36. data/lib/fools/dm/mod.rb +120 -0
  37. data/lib/fools/dm.rb +20 -0
  38. data/lib/fools/interface.rb +32 -0
  39. data/lib/fools/mod.rb +74 -0
  40. data/lib/fools/player/interface.rb +66 -0
  41. data/lib/fools/player/launch.rb +37 -0
  42. data/lib/fools/player/mod.rb +105 -0
  43. data/lib/fools/player.rb +20 -0
  44. data/lib/fools/rules/combat/dice.rb +41 -0
  45. data/lib/fools/rules/combat/rule.rb +130 -0
  46. data/lib/fools/rules/drink/dice.rb +43 -0
  47. data/lib/fools/rules/drink/rule.rb +130 -0
  48. data/lib/fools/rules/romance/dice.rb +62 -0
  49. data/lib/fools/rules/romance/rule.rb +143 -0
  50. data/lib/fools/rules.rb +23 -0
  51. data/lib/fools/sheet/alter.rb +35 -0
  52. data/lib/fools/sheet/schema.rb +59 -0
  53. data/lib/fools/sheet/semantics.rb +129 -0
  54. data/lib/fools/sheet.rb +20 -0
  55. data/lib/fools/util/error.rb +28 -0
  56. data/lib/fools/util.rb +18 -0
  57. data/lib/fools.rb +33 -0
  58. data/permission +16 -0
  59. data/script/console +10 -0
  60. data/script/destroy +14 -0
  61. data/script/generate +14 -0
  62. data/tasks/readme_site.rake +28 -0
  63. data/test/test_fools.rb +11 -0
  64. data/test/test_helper.rb +3 -0
  65. data/website/index.html +103 -0
  66. metadata +213 -0
@@ -0,0 +1,120 @@
1
+ # This file is part of The Fools.
2
+
3
+ # The Fools is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # The Fools is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "fools/mod"
17
+ require "fools/rules"
18
+
19
+ module Fools
20
+
21
+ module DM
22
+
23
+ # An implementation of the Mod class for DMing The Fools
24
+ class Mod < CARPS::DM::Mod
25
+
26
+ include Fools::Mod
27
+
28
+ # Create the controller
29
+ def initialize resource
30
+ super
31
+ load_verifiers
32
+ end
33
+
34
+ # Apply the sense rule
35
+ def sense sap, lady, friend
36
+ with_entities sap, lady, friend do |sap_sheet, lady_sheet, friend_sheet|
37
+ apply_sense sap_sheet, lady_sheet, friend_sheet
38
+ end
39
+ end
40
+
41
+ # See the odds on talking sense
42
+ def sense_odds sap, lady, friend
43
+ with_entities sap, lady, friend do |sap_sheet, lady_sheet, friend_sheet|
44
+ see_sense_odds sap_sheet, lady_sheet, friend_sheet
45
+ end
46
+ end
47
+
48
+ # Apply the drinking rule
49
+ def drink entity, quantity, target
50
+ with_entity entity do |drone|
51
+ apply_drink drone, quantity, target
52
+ end
53
+ end
54
+
55
+ # See the drink odds
56
+ def drink_odds entity, quantity, target
57
+ with_entity entity do |drone|
58
+ see_drink_odds drone, quantity, target
59
+ end
60
+ end
61
+
62
+ # Apply the romantic resistance rule
63
+ def resist person, lady
64
+ with_entities person, lady do |drone, lady_sheet|
65
+ apply_resist drone, lady_sheet
66
+ end
67
+ end
68
+
69
+ # See the odds on romantic resistance
70
+ def resist_odds person, lady
71
+ with_entities person, lady do |drone, lady_sheet|
72
+ see_resist_odds drone, lady_sheet
73
+ end
74
+ end
75
+
76
+ # One Drone engages another in combat
77
+ def tussle attacker, defender, weapon
78
+ with_entities attacker, defender do |attacker_sheet, defender_sheet|
79
+ apply_combat attacker_sheet, defender_sheet, weapon
80
+ end
81
+ end
82
+
83
+ # See the odds of combat
84
+ def tussle_odds attacker, defender, weapon
85
+ with_entities attacker, defender do |attacker_sheet, defender_sheet|
86
+ see_combat_odds attacker_sheet, defender_sheet, weapon
87
+ end
88
+ end
89
+
90
+ private
91
+
92
+ # Apply the sense rule
93
+ def apply_sense sap, lady, friend
94
+ rule = Rules::Sense.new
95
+ rule.apply sap, lady, friend
96
+ end
97
+
98
+ # Apply combat rule
99
+ def apply_combat attacker, defender, weapon
100
+ rule = Rules::Combat.new
101
+ rule.apply attacker, defender, weapon
102
+ end
103
+
104
+ # Apply the romantic resistance rule
105
+ def apply_resist drone, lady
106
+ rule = Rules::Resist.new
107
+ rule.apply drone, lady
108
+ end
109
+
110
+ # Apply the drink rule
111
+ def apply_drink sheet, quantity, target
112
+ rule = Rules::Drink.new
113
+ rule.apply sheet, quantity, target
114
+ end
115
+
116
+ end
117
+
118
+ end
119
+
120
+ end
data/lib/fools/dm.rb ADDED
@@ -0,0 +1,20 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "fools/dm/launch"
19
+ require "fools/dm/interface"
20
+ require "fools/dm/mod"
@@ -0,0 +1,32 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module Fools
19
+
20
+ # Functionality common to Fools DM and Player interfaces
21
+ module Interface
22
+
23
+ protected
24
+
25
+ # Combat options
26
+ def combat_options
27
+ options "handbag", "fist", "stick", "crowbar", "knife", "sabre", "gun"
28
+ end
29
+
30
+ end
31
+
32
+ end
data/lib/fools/mod.rb ADDED
@@ -0,0 +1,74 @@
1
+ # This file is part of The Fools.
2
+
3
+ # The Fools is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # The Fools is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "carps/mod"
17
+
18
+ require "fools/rules"
19
+
20
+ require "fools/sheet"
21
+
22
+ module Fools
23
+
24
+ # Generic mod, base of Player and DM mods.
25
+ module Mod
26
+
27
+ # Load in the rules
28
+ include Rules
29
+
30
+ protected
31
+
32
+ # Load up the semantics and the schema
33
+ def load_verifiers
34
+ @semantics = Sheet::Semantics.new
35
+ @schema = Sheet::schema
36
+ end
37
+
38
+ # Fools schema
39
+ def schema
40
+ @schema
41
+ end
42
+
43
+ # Semantic verifier for Fools sheets
44
+ def semantic_verifier
45
+ @semantics
46
+ end
47
+
48
+ # See drink odds
49
+ def see_drink_odds sheet, quantity, target
50
+ rule = Rules::Drink.new
51
+ rule.show_odds sheet, quantity, target
52
+ end
53
+
54
+ # See the odds of resisting
55
+ def see_resist_odds drone, lady
56
+ rule = Rules::Resist.new
57
+ rule.show_odds drone, lady
58
+ end
59
+
60
+ # Find the combat odds
61
+ def see_combat_odds attacker, defender, weapon
62
+ rule = Rules::Combat.new
63
+ rule.show_odds attacker, defender, weapon
64
+ end
65
+
66
+ # See the sense odds
67
+ def see_sense_odds sap, lady, friend
68
+ rule = Rules::Sense.new
69
+ rule.show_odds sap, lady, friend
70
+ end
71
+
72
+ end
73
+
74
+ end
@@ -0,0 +1,66 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "carps/mod"
19
+
20
+ require "fools/interface"
21
+
22
+ module Fools
23
+
24
+ module Player
25
+
26
+ # Interface for Fools Player
27
+ class Interface < CARPS::Player::Interface
28
+
29
+ # Create the interface
30
+ def initialize mod
31
+ super
32
+ add_command :drink, "See the odds on how drunk you might get.", "DRUNKENNESS", "TARGET"
33
+ add_command :resist, "See your chance to resist romance, given a lady with given The Outer CRUST.", "CRUST"
34
+ add_command :sense, "See your chance to talk sense into a man with Romantic RESISTANCE, who is smitten by a lady with The Outer CRUST.", "RESISTANCE", "CRUST"
35
+ add_command :tussle, "See your chance to overpower a drone with given VIM & Vigour", "VIM"
36
+ end
37
+
38
+ protected
39
+
40
+ def drink drunkenness, target
41
+ drunkenness = drunkenness.to_i
42
+ target = target.to_i
43
+ @mod.drink drunkenness, target
44
+ end
45
+
46
+ def resist crust
47
+ crust = crust.to_i
48
+ @mod.resist crust
49
+ end
50
+
51
+ def sense resist, crust
52
+ resist = resist.to_i
53
+ crust = crust.to_i
54
+ @mod.sense resist, crust
55
+ end
56
+
57
+ def tussle vim
58
+ vim = vim.to_i
59
+ @mod.tussle vim
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+
66
+ end
@@ -0,0 +1,37 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "fools/player"
19
+
20
+ module Fools
21
+
22
+ module Player
23
+
24
+ # Create the mod
25
+ def Player::create_mod
26
+ Mod.new
27
+ end
28
+
29
+ # Launch the Player's interface
30
+ def Player::launch mod
31
+ face = Interface.new mod
32
+ face.run
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,105 @@
1
+ # This file is part of The Fools.
2
+
3
+ # The Fools is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # The Fools is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "carps/mod"
17
+
18
+ require "fools/rules"
19
+ require "fools/sheet"
20
+
21
+ module Fools
22
+
23
+ module Player
24
+
25
+ # An implementation of the Mod class for playing The Fools
26
+ class Mod < CARPS::Player::Mod
27
+
28
+ include Fools::Mod
29
+
30
+ # Create the controller
31
+ def initialize
32
+ super
33
+ load_verifiers
34
+ end
35
+
36
+ # Describe the Fools
37
+ def description
38
+ <<-END
39
+ The Fools. Copyright John Morrice 2010.
40
+
41
+ The Fools is distributed for educational purposes: it is
42
+ intended to be used by programmers, as an aid in
43
+ learning how to write mods for CARPS.
44
+
45
+ The Fools is loosely based on the rules of the Drones RPG:
46
+ http://www.granta.demon.co.uk/drones/
47
+ Copyright Ian Crowther, Sheila Thomas, Victoria Uren 1995-1996
48
+
49
+ You should familiarise yourself with the rules before
50
+ play, though note the following differences and quriks
51
+ present in this CARPS mod:
52
+
53
+ * Your character points are present on the character
54
+ sheet. These are your total character points, rather
55
+ than the points you have not yet spent available.
56
+ Hence you should NOT reduce this value when you spend
57
+ a point.
58
+ As in the Fools rules, you should expect
59
+ the Game Master to tell you how many points you have
60
+ available before the game begins.
61
+
62
+ * Two additional character attributes are added:
63
+ Intoxication and Discomfiture.
64
+ These attributes are to keep track of the transitory
65
+ nature of drunkenness and being the subject of A Sound
66
+ Drubbing, respectively.
67
+ These values range from 0 to -10. 0 indicates
68
+ sobreity or perfect health, while -10 represents a
69
+ highly debilated state.
70
+
71
+ END
72
+ end
73
+
74
+ # See the drinking odds
75
+ def drink drunkenness, target
76
+ see_drink_odds @sheet, drunkenness, target
77
+ end
78
+
79
+ # See the chance to resist romance
80
+ def resist crust
81
+ lady = CARPS::Sheet::Character.new({"The Outer Crust" => crust})
82
+ see_resist_odds @sheet, lady
83
+ end
84
+
85
+ # See the odds of winning a fight
86
+ def tussle vim
87
+ drone = CARPS::Sheet::Character.new({"Vim & Vigour" => vim})
88
+ # Weapon doesn't matter
89
+ #
90
+ # THIS IS WRONG!
91
+ see_combat_odds @sheet, drone, :stick
92
+ end
93
+
94
+ # See the chance of talking sense
95
+ def sense resist, crust
96
+ lady = CARPS::Sheet::Character.new({"The Outer Crust" => crust})
97
+ sap = CARPS::Sheet::Character.new({"Romantic Resistance" => resist})
98
+ see_sense_odds sap, lady, @sheet
99
+ end
100
+
101
+ end
102
+
103
+ end
104
+
105
+ end
@@ -0,0 +1,20 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "fools/player/launch"
19
+ require "fools/player/interface"
20
+ require "fools/player/mod"
@@ -0,0 +1,41 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module Fools
19
+
20
+ module Dice
21
+
22
+ include CARPS::Dice
23
+
24
+ # Engage in combat
25
+ #
26
+ # The first parameter is the attacker's vim
27
+ # The second is the weapon used
28
+ # The third is the defender's vim
29
+ def combat avim, awep, dvim
30
+ at = d 10
31
+ de = d 10
32
+ at + avim
33
+ de + dvim
34
+ at - de
35
+ at * awep
36
+ at
37
+ end
38
+
39
+ end
40
+
41
+ end
@@ -0,0 +1,130 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "carps/mod"
19
+ require "fools/sheet"
20
+
21
+ module Fools
22
+
23
+ module Rules
24
+
25
+ # Someone has won the combat
26
+ class CombatWin < CARPS::Action
27
+
28
+ protected
29
+
30
+ # Decrease the discomfiture of the loser
31
+ def lose sh, by
32
+ Sheet::alter sh, "Discomfiture", -by
33
+ Sheet::alter sh, "Vim & Vigour", -by
34
+ Sheet::alter sh, "The Outer Crust", -by
35
+ end
36
+
37
+ end
38
+
39
+ # The attacker won
40
+ class AttackerWins < CombatWin
41
+
42
+ def summary
43
+ "The attacker wins."
44
+ end
45
+
46
+ protected
47
+
48
+ # The attacker has won
49
+ def execute result, attacker, defender, mul
50
+ lose defender, result
51
+ end
52
+
53
+ end
54
+
55
+ # The defender won
56
+ class DefenderWins < CombatWin
57
+
58
+ def summary
59
+ "The defender wins."
60
+ end
61
+
62
+ protected
63
+
64
+ # The defender has won
65
+ def execute result, attacker, defender, mul
66
+ lose attacker, result * -1
67
+ end
68
+
69
+ end
70
+
71
+ # No one wins
72
+ class NoOneWins < CARPS::Action
73
+
74
+ def summary
75
+ "Stalemate."
76
+ end
77
+
78
+ protected
79
+
80
+ # Do nothing
81
+ def execute *forget
82
+ end
83
+
84
+ end
85
+
86
+ # Combat
87
+ class Combat < CARPS::Rule
88
+
89
+ include Fools::Dice
90
+
91
+ # Add the actions
92
+ def initialize
93
+ super
94
+ add_action :<, 0, DefenderWins
95
+ add_action :>, 0, AttackerWins
96
+ add_action :==, 0, NoOneWins
97
+ end
98
+
99
+ protected
100
+
101
+ # The combat dice
102
+ def dice attacker, defender, weapon
103
+ avim = attacker["Vim & Vigour"]
104
+ dvim = defender["Vim & Vigour"]
105
+ mul = 1.0 / 3
106
+ case weapon
107
+ when :handbag
108
+ mul = 1.0 / 5
109
+ when :fist
110
+ mul = 1.0 / 3
111
+ when :stick
112
+ mul = 1.0 / 2
113
+ when :crowbar
114
+ mul = 1.0
115
+ when :knife
116
+ mul = 3.0 / 2
117
+ when :sabre
118
+ mul = 2.0
119
+ when :gun
120
+ mul = 5.0
121
+ end
122
+ combat avim, mul, dvim
123
+ end
124
+
125
+ end
126
+
127
+ end
128
+
129
+ end
130
+
@@ -0,0 +1,43 @@
1
+ # Copyright 2010 John Morrice
2
+
3
+ # This file is part of The Fools.
4
+
5
+ # The Fools is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # The Fools is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with The Fools. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require "carps/mod"
19
+
20
+ module Fools
21
+
22
+ # Fools dice
23
+ module Dice
24
+
25
+ # How drunk will you get?
26
+ def drink vim, resistance, quantity, target
27
+ quantity += resistance
28
+ roll = d 10
29
+ roll + (vim + resistance)
30
+ roll - target
31
+ # Inspect result of roll and determine course of action
32
+ roll.is :<=, -7, quantity - 3
33
+ roll.in_range -6..-4, quantity - 2
34
+ roll.in_range -3..-1, quantity - 1
35
+ roll.in_range 1..3, quantity + 1
36
+ roll.in_range 4..6, quantity + 2
37
+ roll.is :>=, 7, quantity + 3
38
+ roll
39
+ end
40
+
41
+ end
42
+
43
+ end