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.
- data/COPYING +674 -0
- data/History.txt +4 -0
- data/Manifest.txt +65 -0
- data/PostInstall.txt +31 -0
- data/README.rdoc +73 -0
- data/Rakefile +24 -0
- data/bin/carps_fools +27 -0
- data/bin/register_carps_fools +35 -0
- data/features/character_sheet.feature +35 -0
- data/features/dice.feature +28 -0
- data/features/dm_interface.feature +19 -0
- data/features/launch_dm.feature +10 -0
- data/features/launch_player.feature +9 -0
- data/features/player_interface.feature +19 -0
- data/features/rules.feature +66 -0
- data/features/step_definitions/common_steps.rb +168 -0
- data/features/steps/character_sheet.rb +152 -0
- data/features/steps/dice.rb +19 -0
- data/features/steps/dm_interface.rb +21 -0
- data/features/steps/dm_mod.rb +6 -0
- data/features/steps/dm_test_mailer.rb +23 -0
- data/features/steps/general.rb +7 -0
- data/features/steps/interface.rb +10 -0
- data/features/steps/launch_dm.rb +12 -0
- data/features/steps/launch_player.rb +6 -0
- data/features/steps/player_interface.rb +45 -0
- data/features/steps/player_mod.rb +6 -0
- data/features/steps/player_test_mailer.rb +27 -0
- data/features/steps/resource.rb +5 -0
- data/features/steps/rules.rb +144 -0
- data/features/support/common.rb +29 -0
- data/features/support/env.rb +4 -0
- data/features/support/matchers.rb +11 -0
- data/lib/fools/dm/interface.rb +97 -0
- data/lib/fools/dm/launch.rb +40 -0
- data/lib/fools/dm/mod.rb +120 -0
- data/lib/fools/dm.rb +20 -0
- data/lib/fools/interface.rb +32 -0
- data/lib/fools/mod.rb +74 -0
- data/lib/fools/player/interface.rb +66 -0
- data/lib/fools/player/launch.rb +37 -0
- data/lib/fools/player/mod.rb +105 -0
- data/lib/fools/player.rb +20 -0
- data/lib/fools/rules/combat/dice.rb +41 -0
- data/lib/fools/rules/combat/rule.rb +130 -0
- data/lib/fools/rules/drink/dice.rb +43 -0
- data/lib/fools/rules/drink/rule.rb +130 -0
- data/lib/fools/rules/romance/dice.rb +62 -0
- data/lib/fools/rules/romance/rule.rb +143 -0
- data/lib/fools/rules.rb +23 -0
- data/lib/fools/sheet/alter.rb +35 -0
- data/lib/fools/sheet/schema.rb +59 -0
- data/lib/fools/sheet/semantics.rb +129 -0
- data/lib/fools/sheet.rb +20 -0
- data/lib/fools/util/error.rb +28 -0
- data/lib/fools/util.rb +18 -0
- data/lib/fools.rb +33 -0
- data/permission +16 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/tasks/readme_site.rake +28 -0
- data/test/test_fools.rb +11 -0
- data/test/test_helper.rb +3 -0
- data/website/index.html +103 -0
- metadata +213 -0
@@ -0,0 +1,152 @@
|
|
1
|
+
require "fools/sheet"
|
2
|
+
|
3
|
+
require "carps/mod"
|
4
|
+
|
5
|
+
require "yaml"
|
6
|
+
|
7
|
+
Given /^the Fools' verifier$/ do
|
8
|
+
$verifier = CARPS::Sheet::Editor.new Sheet::schema, Sheet::Semantics.new
|
9
|
+
end
|
10
|
+
|
11
|
+
When /^a valid sheet is provided$/ do
|
12
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
13
|
+
Name: Sir Bigglesly
|
14
|
+
Character Points: 37
|
15
|
+
The Readies: 6
|
16
|
+
The Old Grey Matter: 1
|
17
|
+
The Outer Crust: 5
|
18
|
+
Vim & Vigour: -2
|
19
|
+
Romantic Resistance: 2
|
20
|
+
Tolerance for Alcohol: 2
|
21
|
+
Pounds: 0
|
22
|
+
Shillings: 0
|
23
|
+
Pence: 0
|
24
|
+
Intoxication: 0
|
25
|
+
Discomfiture: 0
|
26
|
+
Luck: 0
|
27
|
+
Chances: 0
|
28
|
+
Etiquette: 1
|
29
|
+
Conscience: 0
|
30
|
+
Sports Car: flashy
|
31
|
+
Student of the Turf: no
|
32
|
+
Connections: Gentry
|
33
|
+
Gentleman's Gentleman: superior
|
34
|
+
END
|
35
|
+
end
|
36
|
+
|
37
|
+
When /^a syntactically invalid sheet is provided$/ do
|
38
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
39
|
+
Name: Mr Invalid
|
40
|
+
Character Points: 8
|
41
|
+
The Readies: 0
|
42
|
+
The Old Grey Matter: Not much!
|
43
|
+
The Outer Crust:
|
44
|
+
Vim & Vigour: 0
|
45
|
+
END
|
46
|
+
end
|
47
|
+
|
48
|
+
When /^an out of bounds sheet is provided$/ do
|
49
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
50
|
+
Name: Mr Odd
|
51
|
+
Character Points: 8
|
52
|
+
The Readies: 11
|
53
|
+
The Old Grey Matter: 0
|
54
|
+
The Outer Crust: 0
|
55
|
+
Pounds: 0
|
56
|
+
Shillings: -1
|
57
|
+
Pence: 0
|
58
|
+
Vim & Vigour: 0
|
59
|
+
Luck: 0
|
60
|
+
Intoxication: 0
|
61
|
+
Discomfiture: 0
|
62
|
+
Romantic Resistance: 0
|
63
|
+
Tolerance for Alcohol: 0
|
64
|
+
Etiquette: 0
|
65
|
+
Chances: 0
|
66
|
+
Conscience: 0
|
67
|
+
Student of the Turf: no
|
68
|
+
END
|
69
|
+
end
|
70
|
+
|
71
|
+
When /^a character sheet using more than 8 character points is provided$/ do
|
72
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
73
|
+
Name: Mr Greedy
|
74
|
+
Character Points: 8
|
75
|
+
The Readies: 2
|
76
|
+
The Old Grey Matter: 0
|
77
|
+
The Outer Crust: 0
|
78
|
+
Vim & Vigour: 2
|
79
|
+
Intoxication: 0
|
80
|
+
Discomfiture: 0
|
81
|
+
Pounds: 0
|
82
|
+
Shillings: 0
|
83
|
+
Pence: 0
|
84
|
+
Romantic Resistance: 0
|
85
|
+
Tolerance for Alcohol: 2
|
86
|
+
Luck: 2
|
87
|
+
Etiquette: 0
|
88
|
+
Chances: 0
|
89
|
+
Conscience: 0
|
90
|
+
Student of the Turf: no
|
91
|
+
END
|
92
|
+
end
|
93
|
+
|
94
|
+
When /^a character sheet using less than 8 character points is provided$/ do
|
95
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
96
|
+
Name: Mr Needy
|
97
|
+
Character Points: 8
|
98
|
+
The Readies: 0
|
99
|
+
The Old Grey Matter: 0
|
100
|
+
The Outer Crust: 0
|
101
|
+
Vim & Vigour: 2
|
102
|
+
Intoxication: 0
|
103
|
+
Discomfiture: 0
|
104
|
+
Luck: 0
|
105
|
+
Chances: 0
|
106
|
+
Conscience: 0
|
107
|
+
Pounds: 0
|
108
|
+
Shillings: 0
|
109
|
+
Pence: 0
|
110
|
+
Romantic Resistance: 0
|
111
|
+
Tolerance for Alcohol: 0
|
112
|
+
Student of the Turf: no
|
113
|
+
Etiquette: 0
|
114
|
+
END
|
115
|
+
end
|
116
|
+
|
117
|
+
When /^a character sheet using exactly 8 character points is provided$/ do
|
118
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
119
|
+
Name: Mr Balanced
|
120
|
+
Character Points: 8
|
121
|
+
The Readies: 1
|
122
|
+
The Old Grey Matter: 3
|
123
|
+
The Outer Crust: -1
|
124
|
+
Vim & Vigour: 1
|
125
|
+
Intoxication: 0
|
126
|
+
Discomfiture: 0
|
127
|
+
Pounds: 0
|
128
|
+
Shillings: 0
|
129
|
+
Pence: 0
|
130
|
+
Tolerance for Alcohol: 1
|
131
|
+
Romantic Resistance: 0
|
132
|
+
Etiquette: 0
|
133
|
+
Luck: 0
|
134
|
+
Chances: 0
|
135
|
+
Conscience: 0
|
136
|
+
Student of the Turf: no
|
137
|
+
END
|
138
|
+
end
|
139
|
+
|
140
|
+
Then /^do not accept the character sheet$/ do
|
141
|
+
valid = $verifier.valid? $sheet
|
142
|
+
if valid
|
143
|
+
raise StandardError, "Passed invalid sheet"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
Then /^accept the character sheet$/ do
|
148
|
+
valid = $verifier.valid? $sheet
|
149
|
+
unless valid
|
150
|
+
raise StandardError, "Failed valid sheet."
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "fools/rules"
|
2
|
+
|
3
|
+
include Fools::Dice
|
4
|
+
|
5
|
+
Given /^a hash of the dice rolls$/ do
|
6
|
+
$rolls = {}
|
7
|
+
$rolls["drunkenness"] = lambda {drink 0, 1, -4, 4}
|
8
|
+
$rolls["combat"] = lambda {combat 1, 1.0/3.0, 3}
|
9
|
+
$rolls["sense"] = lambda {talk_sense 0, 1, 0}
|
10
|
+
$rolls["romance"] = lambda {resist_romance 1, 5}
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^a roll is made for (.+)$/ do |roll_name|
|
14
|
+
$dice = $rolls[roll_name].call
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^show the odds$/ do
|
18
|
+
puts $dice.odds
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "fools/dm/interface"
|
2
|
+
|
3
|
+
Given /^the DM user interface$/ do
|
4
|
+
$interface = DM::Interface.new $controller
|
5
|
+
end
|
6
|
+
|
7
|
+
Then /^test all the DM user inputs$/ do
|
8
|
+
commands = []
|
9
|
+
commands.push [:spawn, "drone", "todd"]
|
10
|
+
commands.push [:spawn, "drone", "bob"]
|
11
|
+
commands.push [:spawn, "hawt", "mandy"]
|
12
|
+
commands.push [:drink, "bob", "-4", "1"]
|
13
|
+
commands.push [:drink_odds, "bob", "-5", "1"]
|
14
|
+
commands.push [:resist, "todd", "mandy"]
|
15
|
+
commands.push [:resist_odds, "todd", "mandy"]
|
16
|
+
commands.push [:sense, "bob", "mandy", "todd"]
|
17
|
+
commands.push [:sense_odds, "bob", "mandy", "todd"]
|
18
|
+
commands.push [:tussle_odds, "bob", "todd"]
|
19
|
+
commands.push [:tussle, "bob", "todd", "sabre"]
|
20
|
+
test_interface $interface, commands
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class DMTestMailer
|
2
|
+
|
3
|
+
def relay to, message
|
4
|
+
puts "Sending to #{to}: #{message}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def save mod
|
8
|
+
puts "Saving:"
|
9
|
+
puts mod.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def check type, from = nil
|
13
|
+
puts "Checking mail for #{type} from #{from}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def load
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /^a DM test mailer$/ do
|
22
|
+
$mailer = DMTestMailer.new
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "fools/player/interface"
|
2
|
+
|
3
|
+
require "carps/mod"
|
4
|
+
|
5
|
+
require "yaml"
|
6
|
+
|
7
|
+
Given /^the Player user interface$/ do
|
8
|
+
$interface = Player::Interface.new $controller
|
9
|
+
end
|
10
|
+
|
11
|
+
# What an awful hack
|
12
|
+
When /^a character sheet is provided for the player$/ do
|
13
|
+
$controller.instance_eval <<-END
|
14
|
+
@sheet = CARPS::Sheet::Character.new(YAML::load <<-NASTY
|
15
|
+
Name: Basic Drone
|
16
|
+
Character Points: 0
|
17
|
+
The Readies: 0
|
18
|
+
The Old Grey Matter: 0
|
19
|
+
The Outer Crust: 0
|
20
|
+
"Vim & Vigour": 0
|
21
|
+
Intoxication: 0
|
22
|
+
Discomfiture: 0
|
23
|
+
Pounds: 0
|
24
|
+
Shillings: 0
|
25
|
+
Pence: 0
|
26
|
+
Tolerance for Alcohol: 0
|
27
|
+
Romantic Resistance: 0
|
28
|
+
Etiquette: 0
|
29
|
+
Luck: 0
|
30
|
+
Chances: 0
|
31
|
+
Conscience: 0
|
32
|
+
Student of the Turf: no
|
33
|
+
NASTY
|
34
|
+
)
|
35
|
+
END
|
36
|
+
end
|
37
|
+
|
38
|
+
Then /^test all the Player user inputs$/ do
|
39
|
+
commands = []
|
40
|
+
commands.push [:drink, "-3", "1"]
|
41
|
+
commands.push [:resist, "6"]
|
42
|
+
commands.push [:sense, "-2", "6"]
|
43
|
+
commands.push [:tussle, "1"]
|
44
|
+
test_interface $interface, commands
|
45
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "drb"
|
2
|
+
|
3
|
+
class PlayerTestMailer
|
4
|
+
|
5
|
+
include DRbUndumped
|
6
|
+
|
7
|
+
def relay message
|
8
|
+
puts "Sending #{message}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def save mod
|
12
|
+
puts "Saving:"
|
13
|
+
puts mod.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
def check type
|
17
|
+
puts "Checking mail for #{type}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def load
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
Given /^a test player mailer$/ do
|
26
|
+
$mailer = PlayerTestMailer.new
|
27
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require "fools/rules"
|
2
|
+
require "carps/mod"
|
3
|
+
|
4
|
+
require "yaml"
|
5
|
+
|
6
|
+
Given /^a hash of the rules$/ do
|
7
|
+
$rules = {}
|
8
|
+
$rules["drunkenness"] = Rules::Drink.new
|
9
|
+
$rules["combat"] = Rules::Combat.new
|
10
|
+
$rules["romance"] = Rules::Resist.new
|
11
|
+
$rules["sense"] = Rules::Sense.new
|
12
|
+
end
|
13
|
+
|
14
|
+
When /^the rule is (.+)$/ do |rule_name|
|
15
|
+
$rule = $rules[rule_name]
|
16
|
+
end
|
17
|
+
|
18
|
+
Given /^a character sheet for an ordinary drone$/ do
|
19
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
20
|
+
Name: Ordinary McOrdin
|
21
|
+
Character Points: 0
|
22
|
+
The Readies: 0
|
23
|
+
The Old Grey Matter: 0
|
24
|
+
The Outer Crust: 0
|
25
|
+
Vim & Vigour: 0
|
26
|
+
Intoxication: 0
|
27
|
+
Discomfiture: 0
|
28
|
+
Tolerance for Alcohol: 0
|
29
|
+
Romantic Resistance: 0
|
30
|
+
Etiquette: 0
|
31
|
+
Luck: 0
|
32
|
+
Pounds: 0
|
33
|
+
Shillings: 0
|
34
|
+
Pence: 0
|
35
|
+
Chances: 0
|
36
|
+
Conscience: 0
|
37
|
+
Student of the Turf: no
|
38
|
+
END
|
39
|
+
end
|
40
|
+
|
41
|
+
Given /^a character sheet for a drone with a high tolerance for alcohol$/ do
|
42
|
+
$sheet = CARPS::Sheet::Character.new YAML.load <<-END
|
43
|
+
Name: Tolerance McTolerancy
|
44
|
+
Character Points: 0
|
45
|
+
The Readies: 0
|
46
|
+
The Old Grey Matter: 0
|
47
|
+
The Outer Crust: 0
|
48
|
+
Vim & Vigour: 0
|
49
|
+
Intoxication: 0
|
50
|
+
Discomfiture: 0
|
51
|
+
Tolerance for Alcohol: 3
|
52
|
+
Romantic Resistance: 0
|
53
|
+
Etiquette: 0
|
54
|
+
Luck: 0
|
55
|
+
Pounds: 0
|
56
|
+
Shillings: 0
|
57
|
+
Pence: 0
|
58
|
+
Chances: 0
|
59
|
+
Conscience: 0
|
60
|
+
Student of the Turf: no
|
61
|
+
END
|
62
|
+
end
|
63
|
+
|
64
|
+
Then /^display the character sheet$/ do
|
65
|
+
puts $sheet.emit
|
66
|
+
end
|
67
|
+
|
68
|
+
Then /^show the odds for the drunk rule$/ do
|
69
|
+
$rule.show_odds $sheet, -4, 4
|
70
|
+
end
|
71
|
+
|
72
|
+
Then /^apply the drunk rule$/ do
|
73
|
+
$rule.apply $sheet, -5, 4
|
74
|
+
end
|
75
|
+
|
76
|
+
Then /^show the odds for the combat rule$/ do
|
77
|
+
$rule.show_odds $sheet, $other, :fist
|
78
|
+
end
|
79
|
+
|
80
|
+
Then /^apply the combat rule$/ do
|
81
|
+
$rule.apply $sheet, $other, :fist
|
82
|
+
end
|
83
|
+
|
84
|
+
Then /^apply the romance rule$/ do
|
85
|
+
$rule.apply $sheet, $lady
|
86
|
+
end
|
87
|
+
|
88
|
+
Then /^show the odds for the romance rule$/ do
|
89
|
+
$rule.show_odds $sheet, $lady
|
90
|
+
end
|
91
|
+
|
92
|
+
Then /^apply the sense rule$/ do
|
93
|
+
$rule.apply $sheet, $lady, $other
|
94
|
+
end
|
95
|
+
|
96
|
+
Then /^show the odds for the sense rule$/ do
|
97
|
+
$rule.show_odds $sheet, $lady, $other
|
98
|
+
end
|
99
|
+
|
100
|
+
Given /^also a character sheet for a fit drone$/ do
|
101
|
+
$other = CARPS::Sheet::Character.new YAML.load <<-END
|
102
|
+
Name: Fitty McFitFit
|
103
|
+
Character Points: 0
|
104
|
+
The Readies: 0
|
105
|
+
The Old Grey Matter: 0
|
106
|
+
The Outer Crust: 0
|
107
|
+
Vim & Vigour: 2
|
108
|
+
Intoxication: 0
|
109
|
+
Discomfiture: 0
|
110
|
+
Tolerance for Alcohol: 0
|
111
|
+
Romantic Resistance: 0
|
112
|
+
Etiquette: 0
|
113
|
+
Luck: 0
|
114
|
+
Pounds: 0
|
115
|
+
Shillings: 0
|
116
|
+
Pence: 0
|
117
|
+
Chances: 0
|
118
|
+
Conscience: 0
|
119
|
+
Student of the Turf: no
|
120
|
+
END
|
121
|
+
end
|
122
|
+
|
123
|
+
Given /^a character sheet for teh hawt wimenz$/ do
|
124
|
+
$lady = CARPS::Sheet::Character.new YAML.load <<-END
|
125
|
+
Name: Hawty McHawtHawt
|
126
|
+
Character Points: 0
|
127
|
+
The Readies: 0
|
128
|
+
The Old Grey Matter: 0
|
129
|
+
The Outer Crust: 5
|
130
|
+
Vim & Vigour: 0
|
131
|
+
Intoxication: 0
|
132
|
+
Discomfiture: 0
|
133
|
+
Tolerance for Alcohol: 0
|
134
|
+
Romantic Resistance: 0
|
135
|
+
Etiquette: 0
|
136
|
+
Luck: 0
|
137
|
+
Pounds: 0
|
138
|
+
Shillings: 0
|
139
|
+
Pence: 0
|
140
|
+
Chances: 0
|
141
|
+
Conscience: 0
|
142
|
+
Student of the Turf: no
|
143
|
+
END
|
144
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CommonHelpers
|
2
|
+
def in_tmp_folder(&block)
|
3
|
+
FileUtils.chdir(@tmp_root, &block)
|
4
|
+
end
|
5
|
+
|
6
|
+
def in_project_folder(&block)
|
7
|
+
project_folder = @active_project_folder || @tmp_root
|
8
|
+
FileUtils.chdir(project_folder, &block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def in_home_folder(&block)
|
12
|
+
FileUtils.chdir(@home_path, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def force_local_lib_override(project_name = @project_name)
|
16
|
+
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
17
|
+
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
18
|
+
f << "$:.unshift('#{@lib_path}')\n"
|
19
|
+
f << rakefile
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_active_project_folder project_name
|
24
|
+
@active_project_folder = File.join(@tmp_root, project_name)
|
25
|
+
@project_name = project_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
World(CommonHelpers)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Matchers
|
2
|
+
def contain(expected)
|
3
|
+
simple_matcher("contain #{expected.inspect}") do |given, matcher|
|
4
|
+
matcher.failure_message = "expected #{given.inspect} to contain #{expected.inspect}"
|
5
|
+
matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
|
6
|
+
given.index expected
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
World(Matchers)
|
@@ -0,0 +1,97 @@
|
|
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 DM
|
25
|
+
|
26
|
+
# Interface for Fools DM
|
27
|
+
class Interface < CARPS::DM::Interface
|
28
|
+
|
29
|
+
include Fools::Interface
|
30
|
+
|
31
|
+
# Create the interface
|
32
|
+
def initialize controller
|
33
|
+
super
|
34
|
+
add_command :drink, "Apply drink to a DRONE.", "DRONE", "DRUNKENNESS", "TARGET"
|
35
|
+
add_command :drink_odds, "See the odds on how drunk a DRONE might get.", "DRONE", "DRUNKENNESS", "TARGET"
|
36
|
+
add_command :resist, "Check a DRONE's romantic resistance to the LADY.", "DRONE", "LADY"
|
37
|
+
add_command :resist_odds, "See the odds on whether or not an entity will resist romance.", "DRONE", "LADY"
|
38
|
+
add_command :sense, "A FRIEND of a SAP tried to talk him out of his love for a LADY.", "SAP", "LADY", "FRIEND"
|
39
|
+
add_command :sense_odds, "See the odds on whether talking sense will succeed.", "SAP", "LADY", "FRIEND"
|
40
|
+
add_command :tussle, "An ATTACKER attempts to overpower the DEFENDER with a WEAPON.\n#{combat_options}", "ATTACKER", "DEFENDER", "WEAPON"
|
41
|
+
add_command :tussle_odds, "See the odds on a fight when the ATTACKER assaults the DEFENDER.", "ATTACKER", "DEFENDER"
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
|
46
|
+
# Apply the drinking rule
|
47
|
+
def drink entity, quantity, target
|
48
|
+
quantity = quantity.to_i
|
49
|
+
target = target.to_i
|
50
|
+
@mod.drink entity, quantity, target
|
51
|
+
end
|
52
|
+
|
53
|
+
# See the odds on the drinking rule
|
54
|
+
def drink_odds entity, quantity, target
|
55
|
+
quantity = quantity.to_i
|
56
|
+
target = target.to_i
|
57
|
+
@mod.drink_odds entity, quantity, target
|
58
|
+
end
|
59
|
+
|
60
|
+
# Apply the romantic resistance rule
|
61
|
+
def resist drone, lady
|
62
|
+
@mod.resist drone, lady
|
63
|
+
end
|
64
|
+
|
65
|
+
# See the odds on the romantic resistance rule
|
66
|
+
def resist_odds drone, lady
|
67
|
+
@mod.resist_odds drone, lady
|
68
|
+
end
|
69
|
+
|
70
|
+
# Apply the talking sense rule
|
71
|
+
def sense sap, lady, friend
|
72
|
+
@mod.sense sap, lady, friend
|
73
|
+
end
|
74
|
+
|
75
|
+
# See the odds on talking sense
|
76
|
+
def sense_odds sap, lady, friend
|
77
|
+
@mod.sense_odds sap, lady, friend
|
78
|
+
end
|
79
|
+
|
80
|
+
# Apply the combat rule
|
81
|
+
def tussle attacker, defender, weapon
|
82
|
+
weapon = weapon.to_sym
|
83
|
+
@mod.tussle attacker, defender, weapon
|
84
|
+
end
|
85
|
+
|
86
|
+
# See the odds on the combat rule
|
87
|
+
def tussle_odds attacker, defender
|
88
|
+
# The weapon is not used for this computation.
|
89
|
+
# THIS IS NOT RIGHT
|
90
|
+
@mod.tussle_odds attacker, defender, :stick
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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"
|
19
|
+
|
20
|
+
require "carps/mod"
|
21
|
+
|
22
|
+
module Fools
|
23
|
+
|
24
|
+
module DM
|
25
|
+
|
26
|
+
# Create the mod
|
27
|
+
def DM::create_mod campaign
|
28
|
+
resource = CARPS::Resource.new "fools/#{campaign}"
|
29
|
+
Mod.new resource
|
30
|
+
end
|
31
|
+
|
32
|
+
# Launch the game
|
33
|
+
def DM::launch mod
|
34
|
+
face = Interface.new mod
|
35
|
+
face.run
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|